View file guestbook/upgrade.php

File size: 3.67Kb
<?php
#-----------------------------------------------------#
#          ********* WAP-MOTORS *********             #
#             Made by   :  VANTUZ                     #
#               E-mail  :  [email protected]         #
#                 Site  :  http://pizdec.ru           #
#             WAP-Site  :  http://visavi.net          #
#                  ICQ  :  36-44-66                   #
#  Вы не имеете право вносить изменения в код скрипта #
#        для его дальнейшего распространения          #
#-----------------------------------------------------#	
include_once ("functions.php");
include_once ("files/style/index.php");

echo '<img src="files/img/guest.gif" alt=""> <b>Апгрейд скрипта</b><br><br>';	

$column = sqlite_fetch_column_types($db, "guestposts");

if (!isset($column['approved'])){ 

sqlite_exec($db, "BEGIN TRANSACTION;");
sqlite_exec($db, "CREATE TEMPORARY TABLE t1_backup(id INTEGER NOT NULL PRIMARY KEY, msg TEXT NOT NULL, name TEXT NOT NULL, ip TEXT NOT NULL, email TEXT, brow TEXT NOT NULL, date INTEGER NOT NULL, answer TEXT, approved INTEGER DEFAULT '0' NOT NULL);");

sqlite_exec($db, "INSERT INTO t1_backup SELECT id, msg, name, ip, email, brow, date, answer, '0' FROM guestposts;");
sqlite_exec($db, "DROP TABLE guestposts;");

sqlite_exec($db, "CREATE TABLE guestposts(id INTEGER NOT NULL PRIMARY KEY, msg TEXT NOT NULL, name TEXT NOT NULL, ip TEXT NOT NULL, email TEXT, brow TEXT NOT NULL, date INTEGER NOT NULL, answer TEXT, approved INTEGER DEFAULT '0' NOT NULL);");

sqlite_exec($db, "INSERT INTO guestposts SELECT * FROM t1_backup;");
sqlite_exec($db, "DROP TABLE t1_backup;");  
sqlite_exec($db, "COMMIT;");

echo '<b>Новая колонка approved успешно добавлена в таблицу guestposts!</b><br>';

} else {echo '<b>Ошибка! Колонка approved уже существует в таблице guestposts</b><br>';}


$admcolumn = sqlite_fetch_column_types($db, "guestadmin");

if (!isset($admcolumn['approval'])){ 
sqlite_exec($db, "BEGIN TRANSACTION;");
sqlite_exec($db, "CREATE TEMPORARY TABLE t1_backup(login TEXT NOT NULL, pass TEXT NOT NULL, bookpost INTEGER NOT NULL, maxpost INTEGER NOT NULL, homepage TEXT NOT NULL, copyright TEXT NOT NULL, title TEXT NOT NULL, keywords TEXT NOT NULL, description TEXT NOT NULL, logotip TEXT NOT NULL, nocache INTEGER NOT NULL, protect INTEGER NOT NULL, quick INTEGER NOT NULL, approval INTEGER NOT NULL);");
sqlite_exec($db, "INSERT INTO t1_backup SELECT login, pass, bookpost, maxpost, homepage, copyright, title, keywords, description, logotip, nocache, protect, quick, '0' FROM guestadmin;");
sqlite_exec($db, "DROP TABLE guestadmin;");

sqlite_exec($db, "CREATE TABLE guestadmin(login TEXT NOT NULL, pass TEXT NOT NULL, bookpost INTEGER NOT NULL, maxpost INTEGER NOT NULL, homepage TEXT NOT NULL, copyright TEXT NOT NULL, title TEXT NOT NULL, keywords TEXT NOT NULL, description TEXT NOT NULL, logotip TEXT NOT NULL, nocache INTEGER NOT NULL, protect INTEGER NOT NULL, quick INTEGER NOT NULL, approval INTEGER NOT NULL);");
sqlite_exec($db, "INSERT INTO guestadmin SELECT * FROM t1_backup;");
sqlite_exec($db, "DROP TABLE t1_backup;");  
sqlite_exec($db, "COMMIT;");

echo '<b>Новая колонка approval успешно добавлена в таблицу guestadmin!</b><br>';

} else {echo '<b>Ошибка! Колонка approval уже существует в таблице guestadmin</b><br>';}


sqlite_close($db);

echo '<br><img src="files/img/back.gif" alt=""> <a href="index.php?'.SID.'">В гостевую</a><br>';

include_once ("files/style/foot.php"); 
?>