Location: PHPKode > projects > PHP-Fusion: Guestbook > inf_guestbook_v4.12/files/infusions/guest_book/updates/import.php
<?php
/*-------------------------------------------------------+
| PHP-Fusion Content Management System
| Copyright © 2002 - 2008 Nick Jones
| http://www.php-fusion.co.uk/
+--------------------------------------------------------+
| Guestbook Infusion 4.06
| Author: Sebastian Schüssler (slaughter)
| Download:
| http://basti2web.de
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
require_once "../../../maincore.php";

// Check: iAUTH and $aid
if (!defined("iAUTH") || $_GET['aid'] != iAUTH) redirect("index.php");

// Includes
require_once INFUSIONS."guest_book/infusion_db.php";
require_once INFUSIONS."guest_book/includes/functions.php";

// Check: Admin Rights
if (!GB_ADMIN) redirect("index.php");

// Header
switch(UCC_PHPF_VER) {
case 6:
	require_once BASEDIR."subheader.php";
	require_once ADMIN."navigation.php";
	break;
case 7:
	require_once THEMES."templates/header.php";
	break;
default:
	redirect(INFUSIONS."guest_book/admin/error.php?id=3");
}

opentable("Import");

//-----------

$query_old = dbquery("SELECT * FROM ".DB_PREFIX."guestbook");


while($data = dbarray($query_old))  {

$query_new = dbquery("INSERT INTO ".DB_PREFIX."guestbook_entry SET gb_name='".$data['guestbook_name']."', gb_email='".$data['guestbook_email']."', gb_weburl='".$data['guestbook_weburl']."', gb_webtitle='".$data['guestbook_webtitle']."', gb_message='
".$data['guestbook_message']."', gb_show='1', gb_datestamp='".$data['guestbook_datestamp']."', gb_ip='".$data['guestbook_ip']."'");

}
$query_delete_old = dbquery("DROP TABLE ".DB_PREFIX."guestbook");

if ($query_old && $query_new && $query_delete_old) echo "<br>done!";

echo "<br><br><a href='".INFUSIONS."guest_book/admin/gb_admin.php".$aidlink."'>back</a>";


//-----------
closetable();

// Footer
switch(UCC_PHPF_VER) {
case 6:
	require_once BASEDIR."side_right.php";
	require_once BASEDIR."footer.php";
	break;
case 7:
	require_once THEMES."templates/footer.php";
	break;
default:
	redirect(INFUSIONS."guest_book/admin/error.php?id=3");
}
?>
Return current item: PHP-Fusion: Guestbook