Location: PHPKode > projects > MGB OpenSource Guestbook > install/upgrade/0691.php
<?php
	/*
	MGB 0.6.x - OpenSource PHP and MySql Guestbook
	Copyright (C) 2004 - 2011 Juergen Grueneisl - http://www.m-gb.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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
	*/

	// ======== //
	// 0691.php //
	// ======== //
	//
	// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //

$sql = array();

$sql[1] = "ALTER TABLE `".$db['prefix']."settings` 
			ADD `wrong_captcha_count` INT( 2 ) NOT NULL DEFAULT '5' AFTER `captcha_angle_2` ,
			ADD `spam_mail` VARCHAR( 255 ) NOT NULL AFTER `gravatar_position` ,
			ADD `banlist_emails` TINYINT( 1 ) NOT NULL DEFAULT '0' AFTER `spam_mail` ,
			ADD `banlist_domains` TINYINT( 1 ) NOT NULL DEFAULT '0' AFTER `banlist_emails` ,
			ADD `banlist_ips` TINYINT( 1 ) NOT NULL DEFAULT '0' AFTER `banlist_domains` ,
			ADD `banlist_log` TINYINT( 1 ) NOT NULL DEFAULT '0' AFTER `banlist_ips` ,
			ADD `timezone` VARCHAR( 255 ) NOT NULL DEFAULT 'Europe/Berlin' AFTER `h_description` ,
			ADD `captcha_length` TINYINT( 2 ) NOT NULL DEFAULT '6' AFTER `captcha_method` ,
			ADD `captcha_double_hash` TINYINT( 1 ) NOT NULL DEFAULT '1' AFTER `captcha_length` ,
			ADD `time_lock_spam_count` TINYINT( 2 ) NOT NULL DEFAULT '5' AFTER `time_lock_maxtime` ,
			ADD `blocktime` INT( 10 ) NOT NULL DEFAULT '9999999' AFTER `moderated`";
$sqldescription[1] = "- Adding new fields in settings table ...";

$sql[2] = "CREATE TABLE IF NOT EXISTS ".$db['prefix']."spam (
		  `ID` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
		  `name` VARCHAR( 255 ) NOT NULL ,
		  `ip` VARCHAR( 15 ) NOT NULL ,
		  `email` VARCHAR( 255 ) NOT NULL ,
		  `city` VARCHAR( 255 ) NOT NULL ,
		  `icq` VARCHAR( 255 ) NOT NULL ,
		  `aim` VARCHAR( 255 ) NOT NULL ,
		  `msn` VARCHAR( 255 ) NOT NULL ,
		  `hp` VARCHAR( 255 ) NOT NULL ,
		  `message` MEDIUMTEXT NOT NULL ,
		  `comment` MEDIUMTEXT NOT NULL ,
		  `user_notification` TINYINT( 1 ) NOT NULL ,
		  `user_show_email` TINYINT( 1 ) NOT NULL ,
		  `captcha` VARCHAR( 9 ) NOT NULL ,
		  `sent_captcha` VARCHAR( 9 ) NOT NULL ,
		  `counter` TINYINT( 1 ) NOT NULL ,
		  `timestamp` INT( 11 ) NOT NULL
		  )";
$sqldescription[2] = "- Creating spam table ...";

$sql[3] = "CREATE TABLE IF NOT EXISTS ".$db['prefix']."banlist_ips (
		  `ID` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
		  `banned_ip` VARCHAR( 255 ) NOT NULL ,
		  `timestamp` INT( 11 ) NOT NULL
		  )";
$sqldescription[3] = "- Creating ip banlist ...";

$sql[4] = "CREATE TABLE IF NOT EXISTS ".$db['prefix']."banlist_emails (
		  `ID` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
		  `banned_email` VARCHAR( 255 ) NOT NULL ,
		  `timestamp` INT( 11 ) NOT NULL
		  )";
$sqldescription[4] = "- Creating email banlist ...";

$sql[5] = "CREATE TABLE IF NOT EXISTS ".$db['prefix']."banlist_domains (
		  `ID` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
		  `banned_domain` VARCHAR( 255 ) NOT NULL ,
		  `timestamp` INT( 11 ) NOT NULL
		  )";
$sqldescription[5] = "- Creating domain banlist ...";

$sql[6] = "CREATE TABLE ".$db['prefix']."spam_log (
		  `ID` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
		  `ip` VARCHAR( 255 ) NOT NULL ,
		  `email` VARCHAR( 255 ) NOT NULL ,
		  `user_agent` VARCHAR( 255 ) NOT NULL ,
		  `message` MEDIUMTEXT NOT NULL ,
		  `type` INT( 2 ) NOT NULL ,
		  `site` VARCHAR( 255 ) NOT NULL ,
		  `timestamp` VARCHAR( 255 ) NOT NULL
		  )";
$sqldescription[6] = "- Creating spam log table ...";

if (isset($_POST['update_version']) AND $_POST['update_version'] == 1)
	{
	$sql[7] = "UPDATE `".$db['prefix']."settings` SET `version` = '".MGB_VERSION."'";
	$sqldescription[7] = "- Updating version number...";
	$to = 6;
	}

$to = count($sql);
?>
Return current item: MGB OpenSource Guestbook