예제 #1
0
// HTML HEADER - BEGIN
echo("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n");
echo("<html xmlns=\"http://www.w3.org/1999/xhtml\">\n");
echo("<head>\n");
echo("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />\n");
echo("<meta name=\"author\" content=\"Icy Phoenix Team\" />\n");
echo("<title>Icy Phoenix :: UTF-8 Conversion</title>\n");
echo("</head>\n");
echo("<body>\n");
echo("<div style=\"font-family: 'Lucida Grande', 'Trebuchet MS', Verdana, Helvetica, Arial, sans-serif; font-size: 10px;\">\n");
echo("<b style=\"color: #dd2222;\">DB Conversion to UTF-8 in progress, please do not stop the browser until the whole process is finished...</b><br />\n<br />\n<br />\n");
// HTML HEADER - END
flush();

$sql = "ALTER DATABASE {$db->sql_escape($dbname)}
	CHARACTER SET utf8
	DEFAULT CHARACTER SET utf8
	COLLATE utf8_bin
	DEFAULT COLLATE utf8_bin";
$db->sql_query($sql) or die($db->sql_error());

$sql = "SHOW TABLES";
$result = $db->sql_query($sql) or die($db->sql_error());
while ($row = $db->sql_fetchrow($result))
{
	// This assignment doesn't work...
	//$table = $row[0];

	$current_item = each($row);
	$table = $current_item['value'];
예제 #2
0
if ($mode == 'restore') {
    // Drop existing Config Table
    $sql = 'DROP TABLE IF EXISTS ' . PREFIX . 'config';
    $result = $db->sql_query($sql);
    // Create Config table
    $sql = 'CREATE TABLE ' . PREFIX . 'config (
				`config_name` varchar(255) NOT NULL ,
				`config_value` text NOT NULL ,
				PRIMARY KEY (`config_name`)
				)';
    $result = $db->sql_query($sql);
    // Insert config data
    $sql = 'SELECT * FROM ' . PREFIX . 'ctracker_backup';
    $result = $db->sql_query($sql);
    while ($row = $db->sql_fetchrow($result)) {
        $sql2 = 'INSERT INTO ' . PREFIX . 'config (`config_name`, `config_value`) VALUES (\'' . $db->sql_escape($row['config_name']) . '\', \'' . $db->sql_escape($row['config_value']) . '\')';
        $result2 = $db->sql_query($sql2);
    }
    // Remove Backup Timestamp
    $sql = 'DELETE FROM ' . PREFIX . 'config WHERE config_name = \'ct_last_backup\'';
    $result = $db->sql_query($sql);
    $template->assign_block_vars('ok', array());
} else {
    if ($mode == 'psrt') {
        $sql = "UPDATE " . PREFIX . "config SET\n\t\t\t\tconfig_value = '" . $db->sql_escape($HTTP_POST_VARS['cookie_name']) . "'\n\t\t\t\tWHERE config_name = 'cookie_name'";
        $result = $db->sql_query($sql);
        $sql = "UPDATE " . PREFIX . "config SET\n\t\t\t\tconfig_value = '" . $db->sql_escape($HTTP_POST_VARS['cookie_path']) . "'\n\t\t\t\tWHERE config_name = 'cookie_path'";
        $result = $db->sql_query($sql);
        $sql = "UPDATE " . PREFIX . "config SET\n\t\t\t\tconfig_value = '" . $db->sql_escape($HTTP_POST_VARS['cookie_domain']) . "'\n\t\t\t\tWHERE config_name = 'cookie_domain'";
        $result = $db->sql_query($sql);
        $sql = "UPDATE " . PREFIX . "config SET\n\t\t\t\tconfig_value = '" . $db->sql_escape($HTTP_POST_VARS['cookie_secure']) . "'\n\t\t\t\tWHERE config_name = 'cookie_secure'";