Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8683751
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T22:07:34+00:00 2026-06-12T22:07:34+00:00

I’m searching for script that can transfer all my data from an old website

  • 0

I’m searching for script that can transfer all my data from an old website build in phpnuke to the new one that will be build in wordpress, that includs, all users and pass, posts, etc,
Anybody how something?
Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T22:07:36+00:00Added an answer on June 12, 2026 at 10:07 pm

    with this script you can just convert postnuke articles into WordPress

    Source : http://www.csamuel.org/wp-content/uploads/2007/01/pnconvert.txt

     <?php
    
    /*
       pnconvert.php - a simple script to convert postnuke articles into WordPress
                       entries.
       Copyright 2004 Bryan Klingner (wares.b@overt.org)
    
       This program is free software; you can redistribute it and/or modify
       it under the terms of the GNU General Public License as published by
       the Free Software Foundation; either version 2 of the License, or
       (at your option) any later version.
    
       This program is distributed in the hope that it will be useful,
       but WITHOUT ANY WARRANTY; without even the implied warranty of
       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
       GNU General Public License for more details.
    
       You should have received a copy of the GNU General Public License
       along with this program; if not, write to the Free Software
       Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    */
    
        $submit = $_POST['submit'];
    
        $hostname = "localhost";
        $username = "FIXME";
        $password = "FIXME";
    
        $sourcedb = "FIXME"; // your postnuke database
        $sourcetable = "nuke_stories"; // your postnuke stories table
        $sourcecat = "nuke_topics"; // your postnuke topics table
    
        $destdb = "FIXME"; // your wordpress database
        $desttable_prefix = "FIXME"; // you word press table prefix
    
        $db_connect = @mysql_connect($hostname, $username, $password) 
                        or die("Fatal Error: ".mysql_error());
    
        mysql_select_db($sourcedb, $db_connect);
        $srcresult = mysql_query("select * from $sourcetable", $db_connect) 
                        or die("Fatal Error: ".mysql_error());
    
        $srccatresult = mysql_query("select * from $sourcecat", $db_connect)
                        or die("Fatal Error: ".mysql_error());
    
        // sanitize function stolen from wordpress source
        // used to generate the dashed titles in the URLs
        function sanitize($title) {
            $title = strtolower($title);
            $title = preg_replace('/&.+?;/', '', $title); // kill entities
            $title = preg_replace('/[^a-z0-9 _-]/', '', $title);
            $title = preg_replace('/\s+/', ' ', $title);
            $title = str_replace(' ', '-', $title);
            $title = preg_replace('|-+|', '-', $title);
            $title = trim($title, '-');
    
            return $title;
        }
    ?>
    
    <html>
    <head>
        <title>Convert postnuke stories and comments to WordPress</title>
    </head>
    <body>
    <h1>Convert postnuke stories and comments to WordPress</h1>
    <hr>
    <?php
        if($submit)
        {
            echo "<p>Converting Postnuke to WP2 databases!</p>";
        }
        else
        {
            echo "<p>This is a preview of what is going to happen,
                to actually convert you'll need to press the
                button at the very bottom of this page!</p>";
        }
    ?>
    
    <hr>
    <h2>Category Conversions</h2>
    
    <?php
        // copy over categories
        $rownum = 0;
        while ($myrow = mysql_fetch_array($srccatresult))
        {
            $mytopictext = mysql_escape_string($myrow['pn_topictext']);
            $sql = "INSERT INTO `" . $desttable_prefix . "categories`
                   (
                     `cat_ID`,
                     `cat_name`,
                     `category_nicename`,
                     `category_description`
                   )
                   VALUES
                   (
                     '$myrow[pn_topicid]',
                     '$myrow[pn_topicname]',
                     '$mytopictext',
                     '$mytopictext'
                   );";
            print $sql;
        echo "<br />";
        if ($submit && ( $myrow[pn_topicid] > 1 ) )
            {
                mysql_select_db($destdb, $db_connect);
                mysql_query($sql, $db_connect) or die("Fatal error: ".mysql_error());
            }
    
    
        }
    
    ?>
    <hr>
    <h2>Story Conversion</h2>
    <table cellpadding="2" cellspacing="3" bgcolor="#DDDDDD">
        <thead>
            <td>pn_sid</td>
            <td>pn_title</td>
            <td>pn_time</td>
            <td>pn_hometext</td>
            <td>pn_bodytext</td>
            <td>pn_topic</td>
            <td>pn_counter</td>
            <td>comments</td>
        </thead>
    <?php
        $rownum = 0; 
        while ($myrow = mysql_fetch_array($srcresult))
        {
    
            $myhometext = mysql_escape_string($myrow['pn_hometext']);
        if($myrow['pn_bodytext'])
        {
                $mybodytext = mysql_escape_string($myrow['pn_bodytext']);
            $myhometext = $myhometext.'\n<!--more-->\n'.$mybodytext;
            #$myhometext = $mybodytext;
        }
    
            $mytitle = mysql_escape_string($myrow['pn_title']);
            $myname = mysql_escape_string(sanitize($mytitle));
            $sql = "INSERT INTO `" . $desttable_prefix . "posts` 
                   ( 
                     `ID` ,
                     `post_author` ,
                     `post_date` ,
                     `post_date_gmt` ,
                     `post_content` ,
                     `post_title` ,
                     `post_name` ,
                     `post_category` ,
                     `post_excerpt` ,
                     `post_status` ,
                     `comment_status` ,
                     `ping_status` ,
                     `post_password` ,
                     `to_ping` ,
                     `pinged` ,
                     `post_modified` ,
                     `post_modified_gmt` ,
                     `post_content_filtered` ,
                     `post_parent` ) 
                   VALUES 
                   ( 
                     '$myrow[pn_sid]',
                     '1',
                     '$myrow[pn_time]',
                     '0000-00-00 00:00:00',
                     '$myhometext',
                     '$mytitle',
                     '$myname',
                     '$myrow[pn_topic]',
                     '',
                     'publish',
                     'open',
                     'open',
                     '',
                     '',
                     '',
                     '$myrow[pn_time]',
                     '0000-00-00 00:00:00',
                     '',
                     '0' );";
    
            // only really do insert if requested
            if ($submit)
            {
                mysql_select_db($destdb, $db_connect);
                mysql_query($sql, $db_connect);
    
                // now get the ID of the post we just added
                $sql = "select MAX(ID) from " . $desttable_prefix . "posts";
                $getID = mysql_query($sql, $db_connect);
                $currentID = mysql_fetch_array($getID);
                $currentID = $currentID['MAX(ID)'];
                printf("<h2>Just inserted ID %s</h2>\n", $currentID);
    
                // add post2cat map... why does he have this table?
                if ($myrow['pn_topic'] == 0)
                    $topicnum = 1;
                else
                    $topicnum = $myrow['pn_topic'];
                $sql = "insert into `" . $desttable_prefix . "post2cat` (`post_id`, `category_id`) VALUES ('$currentID', '$topicnum');";
                $result = mysql_query($sql, $db_connect) or die("Fatal error: ".mysql_error());
            }
    
            // print out source information
            if ($rownum++ % 2 == 0)
                printf("<tr bgcolor=\"#BBBBBB\">");
            else
                printf("<tr>\n");
            printf("    <td>%s</td>\n
                        <td>%s</td>\n
                        <td>%s</td>\n
                        <td>%s</td>\n
                        <td>%s</td>\n
                        <td>%s</td>\n
                        <td>%s</td>\n", 
                    $myrow["pn_sid"], 
                    $myrow["pn_title"], 
                    $myrow["pn_time"], 
            $myrow["pn_hometext"], 
            $myrow["pn_bodytext"], 
                    $myrow["pn_topic"], 
                    $myrow["pn_counter"]);
    
            // retreive all associated comments
            $mysid = $myrow["pn_sid"];
            mysql_select_db($sourcedb, $db_connect);
            $comments = mysql_query("select * from nuke_comments where pn_sid = $mysid", $db_connect);
            print "<td>";
            print "<table cellpadding=\"2\" cellspacing=\"3\" bgcolor=\"#DDDDDD\">";
            print "<thead>";
            print "    <td>pn_tid</td>";
            print "    <td>pn_sid</td>";
            print "    <td>pn_date</td>";
            print "    <td>pn_name</td>";
            print "    <td>pn_email</td>";
            print "    <td>pn_url</td>";
            print "    <td>pn_host_name</td>";
            print "    <td>pn_subject</td>";
            print "    <td>pn_comment</td>";
            print "</thead>";
    
            $comrownum = 0;
            while ($comrow = mysql_fetch_array($comments))
            {
    
                $myname = mysql_escape_string($comrow['pn_name']);
                $myemail = mysql_escape_string($comrow['pn_email']);
                $myurl = mysql_escape_string($comrow['pn_url']);
                $myIP = mysql_escape_string($comrow['pn_host_name']);
                $mycomment = mysql_escape_string($comrow['pn_comment']);
                $sql = "INSERT INTO `" . $desttable_prefix . "comments` 
                         ( 
                            `comment_ID` , 
                            `comment_post_ID` , 
                            `comment_author` , 
                            `comment_author_email` , 
                            `comment_author_url` , 
                            `comment_author_IP` , 
                            `comment_date` , 
                            `comment_date_gmt` , 
                            `comment_content` , 
                            `comment_karma` , 
                            `comment_approved` , 
                            `user_id` )
                         VALUES 
                         (
                            '',
                            '$currentID',
                            '$myname',
                            '$myemail',
                            '$myurl',
                            '$myIP',
                            '$comrow[pn_date]',
                            '0000-00-00 00:00:00',
                            '$mycomment',
                            '0',
                            '1',
                            '0'
                         );";
    
                if ($submit)
                {
                    mysql_select_db($destdb, $db_connect);
                    mysql_query($sql, $db_connect)
                        or die("Fatal Error: ".mysql_error());
                }
    
    
                if ($comrownum++ %2 == 0)
                    print "<tr bgcolor=\"#BBBBBB\">";
                else
                    print "<tr bgcolor=\"#FFFFFF\">";
                printf("    <td>%s</td>
                            <td>%s</td>
                            <td>%s</td>
                            <td>%s</td>
                            <td>%s</td>
                            <td>%s</td>
                            <td>%s</td>
                            <td>%s</td>
                            <td>%s</td></tr>\n",
                       $comrow["pn_tid"],
                       $comrow["pn_sid"],
                       $comrow["pn_date"],
                       $comrow["pn_name"],
                       $comrow["pn_email"],
                       $comrow["pn_url"],
                       $comrow["pn_host_name"],
                       $comrow["pn_subject"],
                       $comrow["pn_comment"]);
    
            }
            print "</table>\n";
            print "</td>\n";
            print "</tr>\n";
        }
    
    ?>
    </table>
    
    <hr>
    
    <h2>Updating Comment Counts</h2>
    <table><tr><th>SID</th><th>Comment count</th></tr>
    <?php
        mysql_select_db($destdb, $db_connect);
        $tidyresult = mysql_query("select * from $desttable_prefix" . "posts", $db_connect)
                        or die("Fatal Error: ".mysql_error());
    
        while ($myrow = mysql_fetch_array($tidyresult))
        {
            $mypostid=$myrow['ID'];
            $countsql="select COUNT(*) from $desttable_prefix" . "comments"
                 . " WHERE `comment_post_ID` = " . $mypostid;
            $countresult=mysql_query($countsql) or die("Fatal Error: ".mysql_error());
            $commentcount=mysql_result($countresult,0,0);
            $countsql="UPDATE `" . $desttable_prefix . "posts`
                SET `comment_count` = '" . $commentcount .
                "' WHERE `ID` = " . $mypostid . " LIMIT 1";
            if($submit)
            {
                $countresult=mysql_query($countsql) or die("Fatal Error: ".mysql_error());
            }
            if($commentcount > 0)
            {
                echo "<tr><td>$mypostid</td><td>$commentcount</tr></tr>\n";
            }
        }
    ?>
    </table>
    
    <hr>
    
    <h2>Updating Category Counts</h2>
    <table><tr><th>Category</th><th>Category count</th></tr>
    <?php
        mysql_select_db($destdb, $db_connect);
        $tidyresult = mysql_query("select * from $desttable_prefix" . "categories", $db_connect)
                        or die("Fatal Error: ".mysql_error());
    
        while ($myrow = mysql_fetch_array($tidyresult))
        {
            $mypostid=$myrow['cat_ID'];
            $countsql="select COUNT(*) from $desttable_prefix" . "post2cat"
                 . " WHERE `category_id` = " . $mypostid;
            $countresult=mysql_query($countsql) or die("Fatal Error: ".mysql_error());
            $commentcount=mysql_result($countresult,0,0);
            $countsql="UPDATE `" . $desttable_prefix . "categories`
                SET `category_count` = '" . $commentcount .
                "' WHERE `cat_ID` = " . $mypostid . " LIMIT 1";
            if($submit)
            {
              $countresult=mysql_query($countsql) or die("Fatal Error: ".mysql_error());
            }
            if($commentcount > 0)
            {
                echo "<tr><td>$mypostid</td><td>$commentcount</tr></tr>\n";
            }
        }
    ?>
    </table>
    
    <hr>
    
    <form method="post" action="<?php echo $PHP_SELF?>">
        <input type="submit" name="submit" value="Convert PN to WordPress">
    </form>
    
    
    </body>
    </html>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a text area in my form which accepts all possible characters from
Does anyone know how can I replace this 2 symbol below from the string
I have a small JavaScript validation script that validates inputs based on Regex. I
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
I used javascript for loading a picture on my website depending on which small
I have a jquery bug and I've been looking for hours now, I can't

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.