Location: PHPKode > projects > WH Community > wh_community/setup/install.php
<?php

    define('CONFIG_CHECK', 1);
    define('MYSQL_CHECK', 1);

	if(file_exists('../framework/mysql.php') == TRUE)
        include_once('../framework/config.php');
        include_once('../framework/mysql.php');

		if($language == "de") {
			require('../language/de.php');

		}elseif ($language == "en") {
			require('../language/en.php');

    }else{

	echo '<p class="false">' . $lang['config_not_found'] . '!</p><br>';
	exit;
	}

?>
<!DOCTYPE html>
<html>

<head>
    <title><?php echo $title; ?></title>

    <meta charset="ISO-8859-1" />

    <link href="../css/design.css" rel="stylesheet" />
    <link href="../images/favicon.ico" rel="shortcut icon" />

    <!--[if IE]>
    <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
</head>

<body>

<div id="main">

<div id="wrapper">

<div id="header_wrapper">
    <div class="header">
        <div class="header_left"><img src="../images/logo.png" alt="Logo"></div>
        <div class="header_right"><span class="news_blue">Forum - Installation</span><br>
		<span class="datetime"><strong>(<?php echo $lang['step']; ?> 1/2)</strong></span></div>
    </div>
</div>

<div class="clear"></div>

<div id="content_wrapper">
    <div class="content">

		<?php

		$sql = 'DROP TABLE IF EXISTS users';
		mysql_query($sql);
		$sql = 'CREATE TABLE `users` ('
			 . '`user_id` INT(8) NOT NULL AUTO_INCREMENT,'
			 . '`user_name` VARCHAR(30) NOT NULL,'
			 . '`user_pass` VARCHAR(255) NOT NULL,'
			 . '`user_email` VARCHAR(255) NOT NULL,'
			 . '`user_date` DATETIME NOT NULL,'
			 . '`user_level` INT(8) NOT NULL,'
			 . '`user_hash` VARCHAR(32) NOT NULL,'
			 . '`user_active` INT(1) NOT NULL DEFAULT "0",'
			 . '`user_status` DATETIME NOT NULL,'
			 . '`user_visits` BIGINT(11) NOT NULL,'
			 . '`user_showmail` TINYINT(1) NULL,'
			 . '`user_homepage` VARCHAR(70) NOT NULL,'
			 . '`user_icq` VARCHAR(70) NOT NULL,'
			 . '`user_live` VARCHAR(70) NOT NULL,'
			 . '`user_skype` VARCHAR(70) NOT NULL,'
			 . '`user_facebook` VARCHAR(70) NOT NULL,'
			 . '`user_twitter` VARCHAR(70) NOT NULL,'
			 . '`user_about` VARCHAR(500) NOT NULL,'
			 . '`user_sex` VARCHAR(70) NOT NULL,'
			 . '`user_bday` DATE NOT NULL,'
			 . '`user_signature` VARCHAR(100) NOT NULL,'
			 . '`user_avatar` VARCHAR(100) NOT NULL DEFAULT "images/avatars/default.png",'
			 . 'UNIQUE INDEX user_name_unique (`user_name`),'
			 . 'PRIMARY KEY (`user_id`)'
			 . ') ENGINE=MYISAM';
		if(mysql_query($sql))
		echo '<p class="right">' . $lang['table'] . ' <u>users</u> ' . $lang['successfully_created'] . '</p>';
		else{
		echo '<p class="false">' . $lang['table'] . ' <u>users</u> ' . $lang['couldnot_created'] . '</p>';
		echo '<p><strong>' . $lang['error'] . ':</strong> ' . mysql_error() . '</p>';
		die();
		}

		$sql = 'DROP TABLE IF EXISTS categories';
		mysql_query($sql);
		$sql = 'CREATE TABLE `categories` ('
			 . '`cat_id` INT(8) NOT NULL AUTO_INCREMENT,'
			 . '`cat_name` VARCHAR(255) NOT NULL,'
			 . '`cat_description` VARCHAR(255) NOT NULL,'
			 . 'UNIQUE INDEX cat_name_unique (`cat_name`),'
			 . 'PRIMARY KEY (`cat_id`)'
			 . ') ENGINE=MYISAM';
		if(mysql_query($sql))
		echo '<p class="right">' . $lang['table'] . ' <u>categories</u> ' . $lang['successfully_created'] . '</p>';
		else{
		echo '<p class="false">' . $lang['table'] . ' <u>categories</u> ' . $lang['couldnot_created'] . '</p>';
		echo '<p><strong>' . $lang['error'] . ':</strong> ' . mysql_error() . '</p>';
		die();
		}

		$sql = 'DROP TABLE IF EXISTS topics';
		mysql_query($sql);
		$sql = 'CREATE TABLE `topics` ('
			 . '`topic_id` INT(8) NOT NULL AUTO_INCREMENT,'
			 . '`topic_subject` VARCHAR(255) NOT NULL,'
			 . '`topic_date` DATETIME NOT NULL,'
			 . '`topic_cat` INT(8) NOT NULL,'
			 . '`topic_by` INT(8) NOT NULL,'
			 . '`topic_views` BIGINT(11) NOT NULL,'
			 . 'PRIMARY KEY (`topic_id`)'
			 . ') ENGINE=MYISAM';
		if(mysql_query($sql))
		echo '<p class="right">' . $lang['table'] . ' <u>topics</u> ' . $lang['successfully_created'] . '</p>';
		else{
		echo '<p class="false">' . $lang['table'] . ' <u>topics</u> ' . $lang['couldnot_created'] . '</p>';
		echo '<p><strong>' . $lang['error'] . ':</strong> ' . mysql_error() . '</p>';
		die();
		}

		$sql = 'DROP TABLE IF EXISTS posts';
		mysql_query($sql);
		$sql = 'CREATE TABLE `posts` ('
			 . '`post_id` INT(8) NOT NULL AUTO_INCREMENT,'
			 . '`post_content` TEXT NOT NULL,'
			 . '`post_date` DATETIME NOT NULL,'
			 . '`post_topic` INT(8) NOT NULL,'
			 . '`post_by`INT(8) NOT NULL,'
			 . 'PRIMARY KEY (`post_id`)'
			 . ') ENGINE=MYISAM';
		if(mysql_query($sql))
		echo '<p class="right">' . $lang['table'] . ' <u>posts</u> ' . $lang['successfully_created'] . '</p>';
		else{
		echo '<p class="false">' . $lang['table'] . ' <u>posts</u> ' . $lang['couldnot_created'] . '</p>';
		echo '<p><strong>' . $lang['error'] . ':</strong> ' . mysql_error() . '</p>';
		die();
		}

		$sql = 'DROP TABLE IF EXISTS messages';
		mysql_query($sql);
		$sql = 'CREATE TABLE `messages` ('
			 . '`pm_id` BIGINT(20) NOT NULL,'
			 . '`pm_id2` INT(11) NOT NULL,'
			 . '`title` VARCHAR(256) NOT NULL,'
			 . '`user1` BIGINT(20) NOT NULL,'
			 . '`user2` BIGINT(20) NOT NULL,'
			 . '`message` TEXT NOT NULL,'
			 . '`timestamp` INT(11) NOT NULL,'
			 . '`user1read` VARCHAR(3) NOT NULL,'
			 . '`user2read` VARCHAR(3) NOT NULL'
			 . ') ENGINE=MYISAM';
		if(mysql_query($sql))
		echo '<p class="right">' . $lang['table'] . ' <u>messages</u> ' . $lang['successfully_created'] . '</p>';
		else{
		echo '<p class="false">' . $lang['table'] . ' <u>messages</u> ' . $lang['couldnot_created'] . '</p>';
		echo '<p><strong>' . $lang['error'] . ':</strong> ' . mysql_error() . '</p>';
		die();
		}

		$sql = 'DROP TABLE IF EXISTS notice';
		mysql_query($sql);
		$sql = 'CREATE TABLE `notice` ('
			 . '`id` INT(11),'
			 . '`notice` TEXT NOT NULL,'
			 . 'PRIMARY KEY (`id`)'
			 . ') ENGINE=MYISAM';
		if(mysql_query($sql))
		echo '<p class="right">' . $lang['table'] . ' <u>notice</u> ' . $lang['successfully_created'] . '</p>';
		else{
		echo '<p class="false">' . $lang['table'] . ' <u>notice</u> ' . $lang['couldnot_created'] . '</p>';
		echo '<p><strong>' . $lang['error'] . ':</strong> ' . mysql_error() . '</p>';
		die();
		}

		$sql = 'INSERT INTO `notice` (`id`, `notice`) VALUES ( 1, "" )';
		if(mysql_query($sql))
		echo '<p class="right">Startwert <u>notice</u> erfolgreich eingetragen</p>';
		else{
		echo '<p class="false">Startwert <u>notice</u> konnte nicht eingetragen werden</p>';
		echo '<p><strong>' . $lang['error'] . ':</strong> ' . mysql_error() . '</p>';
		die();
		}

		$sql = 'DROP TABLE IF EXISTS counter';
		mysql_query($sql);
		$sql = 'CREATE TABLE `counter` ('
			 . '`id` BIGINT(20) NOT NULL AUTO_INCREMENT,'
			 . '`ip` VARCHAR(15) NOT NULL DEFAULT "",'
			 . '`timed` VARCHAR(11) NOT NULL DEFAULT "",'
			 . 'PRIMARY KEY (`id`)'
			 . ') ENGINE=MYISAM';
		if(mysql_query($sql))
		echo '<p class="right">' . $lang['table'] . ' <u>counter</u> ' . $lang['successfully_created'] . '</p>';
		else{
		echo '<p class="false">' . $lang['table'] . ' <u>counter</u> ' . $lang['couldnot_created'] . '</p>';
		echo '<p><strong>' . $lang['error'] . ':</strong> ' . mysql_error() . '</p>';
		die();
		}

		$sql = 'DROP TABLE IF EXISTS online';
		mysql_query($sql);
		$sql = 'CREATE TABLE `online` ('
			 . '`session_ip` VARCHAR(15),'
			 . '`session_timed` DATETIME'
			 . ') ENGINE=MYISAM';
		if(mysql_query($sql))
		echo '<p class="right">' . $lang['table'] . ' <u>online</u> ' . $lang['successfully_created'] . '</p>';
		else{
		echo '<p class="false">' . $lang['table'] . ' <u>online</u> ' . $lang['couldnot_created'] . '</p>';
		echo '<p><strong>' . $lang['error'] . ':</strong> ' . mysql_error() . '</p>';
		die();
		}

		$sql = 'DROP TABLE IF EXISTS news';
		mysql_query($sql);
		$sql = 'CREATE TABLE `news` ('
			 . '`id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,'
			 . '`title` VARCHAR(100) NOT NULL,'
			 . '`author` VARCHAR(50) NOT NULL,'
			 . '`text` TEXT NOT NULL,'
			 . '`date` TIMESTAMP NOT NULL,'
			 . '`imageurl` VARCHAR(255) NOT NULL,'
			 . '`check` INT(11) NOT NULL DEFAULT "1",'
			 . 'PRIMARY KEY (`id`)'
			 . ') ENGINE=MYISAM';
		if(mysql_query($sql))
		echo '<p class="right">' . $lang['table'] . ' <u>news</u> ' . $lang['successfully_created'] . '</p>';
		else{
		echo '<p class="false">' . $lang['table'] . ' <u>news</u> ' . $lang['couldnot_created'] . '</p>';
		echo '<p><strong>' . $lang['error'] . ':</strong> ' . mysql_error() . '</p>';
		die();
		}

		$sql = 'DROP TABLE IF EXISTS badwords';
		mysql_query($sql);
		$sql = 'CREATE TABLE `badwords` ('
			 . '`id` TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT,'
			 . '`word` VARCHAR(100) NOT NULL,'
			 . 'PRIMARY KEY (`id`),'
			 . 'KEY id (`id`)'
			 . ') ENGINE=MYISAM';
		if(mysql_query($sql))
		echo '<p class="right">' . $lang['table'] . ' <u>badwords</u> ' . $lang['successfully_created'] . '</p>';
		else{
		echo '<p class="false">' . $lang['table'] . ' <u>badwords</u> ' . $lang['couldnot_created'] . '</p>';
		echo '<p><strong>' . $lang['error'] . ':</strong> ' . mysql_error() . '</p>';
		die();
		}

		$sql = 'DROP TABLE IF EXISTS iplock';
		mysql_query($sql);
		$sql = 'CREATE TABLE `iplock` ('
			 . '`register` VARCHAR (15),'
			 . '`time` INT(11) NOT NULL DEFAULT "0"'
			 . ') ENGINE=MYISAM';
		if(mysql_query($sql))
		echo '<p class="right">' . $lang['table'] . ' <u>iplock</u> ' . $lang['successfully_created'] . '</p>';
		else{
		echo '<p class="false">' . $lang['table'] . ' <u>iplock</u> ' . $lang['couldnot_created'] . '</p>';
		echo '<p><strong>' . $lang['error'] . ':</strong> ' . mysql_error() . '</p>';
		die();
		}

		$sql = 'DROP TABLE IF EXISTS blog';
		mysql_query($sql);
		$sql = 'CREATE TABLE `blog` ('
			 . '`blog_id` INT(11) NOT NULL AUTO_INCREMENT,'
			 . '`title` VARCHAR(70) NOT NULL,'
			 . '`author` VARCHAR(50) NOT NULL,'
			 . '`post` TEXT NOT NULL,'
			 . '`date` DATETIME NOT NULL,'
			 . 'PRIMARY KEY (`blog_id`)'
			 . ') ENGINE=MYISAM';
		if(mysql_query($sql))
		echo '<p class="right">' . $lang['table'] . ' <u>blog</u> ' . $lang['successfully_created'] . '</p>';
		else{
		echo '<p class="false">' . $lang['table'] . ' <u>blog</u> ' . $lang['couldnot_created'] . '</p>';
		echo '<p><strong>' . $lang['error'] . ':</strong> ' . mysql_error() . '</p>';
		die();
		}

		$sql = 'DROP TABLE IF EXISTS comments';
		mysql_query($sql);
		$sql = 'CREATE TABLE `comments` ('
			 . '`blog_id` INT(11) NOT NULL AUTO_INCREMENT,'
			 . '`blog_id2` INT(11) NOT NULL,'
			 . '`title` VARCHAR(70) NOT NULL,'
			 . '`author` VARCHAR(50) NOT NULL,'
			 . '`comment` TEXT NOT NULL,'
			 . '`date` DATETIME NOT NULL,'
			 . 'PRIMARY KEY (`blog_id`)'
			 . ') ENGINE=MYISAM';
		if(mysql_query($sql))
		echo '<p class="right">' . $lang['table'] . ' <u>comments</u> ' . $lang['successfully_created'] . '</p>';
		else{
		echo '<p class="false">' . $lang['table'] . ' <u>comments</u> ' . $lang['couldnot_created'] . '</p>';
		echo '<p><strong>' . $lang['error'] . ':</strong> ' . mysql_error() . '</p>';
		die();
		}

		$sql = 'DROP TABLE IF EXISTS discussions';
		mysql_query($sql);
		$sql = 'CREATE TABLE `discussions` ('
			 . '`disc_id` INT(11) NOT NULL AUTO_INCREMENT,'
			 . '`subject` VARCHAR(255) NOT NULL,'
			 . '`discussion` TEXT NOT NULL,'
			 . '`author` VARCHAR(70) NOT NULL,'
			 . '`email` VARCHAR(70) NOT NULL,'
			 . '`views` BIGINT(11) NOT NULL,'
			 . '`date` DATETIME NOT NULL,'
			 . 'PRIMARY KEY (`disc_id`)'
			 . ') ENGINE=MYISAM';
		if(mysql_query($sql))
		echo '<p class="right">' . $lang['table'] . ' <u>discussions</u> ' . $lang['successfully_created'] . '</p>';
		else{
		echo '<p class="false">' . $lang['table'] . ' <u>discussions</u> ' . $lang['couldnot_created'] . '</p>';
		echo '<p><strong>' . $lang['error'] . ':</strong> ' . mysql_error() . '</p>';
		die();
		}

		$sql = 'DROP TABLE IF EXISTS opinions';
		mysql_query($sql);
		$sql = 'CREATE TABLE `opinions` ('
			 . '`op_id` INT(11) NOT NULL AUTO_INCREMENT,'
			 . '`op_id2` INT(11) NOT NULL,'
			 . '`opinion` TEXT NOT NULL,'
			 . '`op_author` VARCHAR(70) NOT NULL,'
			 . '`op_email` VARCHAR(70) NOT NULL,'
			 . '`date` DATETIME NOT NULL,'
			 . 'PRIMARY KEY (`op_id`)'
			 . ') ENGINE=MYISAM';
		if(mysql_query($sql))
		echo '<p class="right">' . $lang['table'] . ' <u>opinions</u> ' . $lang['successfully_created'] . '</p>';
		else{
		echo '<p class="false">' . $lang['table'] . ' <u>opinions</u> ' . $lang['couldnot_created'] . '</p>';
		echo '<p><strong>' . $lang['error'] . ':</strong> ' . mysql_error() . '</p>';
		die();
		}

		$sql = 'DROP TABLE IF EXISTS guestbook';
		mysql_query($sql);
		$sql = 'CREATE TABLE `guestbook` ('
			 . '`gb_id` INT(11) NOT NULL AUTO_INCREMENT,'
			 . '`gb_id2` INT(11) NOT NULL,'
			 . '`name` VARCHAR(30) NOT NULL,'
			 . '`email` VARCHAR(40) NOT NULL,'
			 . '`url` VARCHAR(255) NOT NULL,'
			 . '`post` TEXT NOT NULL,'
			 . '`date` DATETIME NOT NULL,'
			 . 'PRIMARY KEY (`gb_id`)'
			 . ') ENGINE=MYISAM';
		if(mysql_query($sql))
		echo '<p class="right">' . $lang['table'] . ' <u>guestbook</u> ' . $lang['successfully_created'] . '</p>';
		else{
		echo '<p class="false">' . $lang['table'] . ' <u>guestbook</u> ' . $lang['couldnot_created'] . '</p>';
		echo '<p><strong>' . $lang['error'] . ':</strong> ' . mysql_error() . '</p>';
		die();
		}

		$sql = 'DROP TABLE IF EXISTS messagebox';
		mysql_query($sql);
		$sql = 'CREATE TABLE `messagebox` ('
			 . '`msg_id` INT(11) NOT NULL AUTO_INCREMENT,'
			 . '`msg_id2` INT(11) NOT NULL,'
			 . '`message` VARCHAR(140) DEFAULT NULL,'
			 . '`date` DATETIME NOT NULL,'
			 . 'PRIMARY KEY (`msg_id`)'
			 . ') ENGINE=MYISAM';
		if(mysql_query($sql))
		echo '<p class="right">' . $lang['table'] . ' <u>messagebox</u> ' . $lang['successfully_created'] . '</p>';
		else{
		echo '<p class="false">' . $lang['table'] . ' <u>messagebox</u> ' . $lang['couldnot_created'] . '</p>';
		echo '<p><strong>' . $lang['error'] . ':</strong> ' . mysql_error() . '</p>';
		die();
		}

		$sql = 'DROP TABLE IF EXISTS todo';
		mysql_query($sql);
		$sql = 'CREATE TABLE `todo` ('
			 . '`do_id` INT(11) NOT NULL AUTO_INCREMENT,'
			 . '`do_id2` INT(11) NOT NULL,'
			 . '`task` VARCHAR(255) NOT NULL,'
			 . '`priority` INT(1) NOT NULL DEFAULT "3",'
			 . '`success` ENUM("0","1") NOT NULL DEFAULT "0",'
			 . 'PRIMARY KEY (`do_id`)'
			 . ') ENGINE=MYISAM';
		if(mysql_query($sql))
		echo '<p class="right">' . $lang['table'] . ' <u>todo</u> ' . $lang['successfully_created'] . '</p>';
		else{
		echo '<p class="false">' . $lang['table'] . ' <u>todo</u> ' . $lang['couldnot_created'] . '</p>';
		echo '<p><strong>' . $lang['error'] . ':</strong> ' . mysql_error() . '</p>';
		die();
		}

		$sql = 'DROP TABLE IF EXISTS address';
		mysql_query($sql);
		$sql = 'CREATE TABLE `address` ('
			 . '`add_id` INT(11) NOT NULL AUTO_INCREMENT,'
			 . '`add_id2` INT(11) NOT NULL,'
			 . '`name` VARCHAR(80) NOT NULL,'
			 . '`email` VARCHAR(100) NOT NULL,'
			 . '`phone` VARCHAR(50) NOT NULL,'
			 . '`address` VARCHAR(120) NOT NULL,'
			 . 'PRIMARY KEY (`add_id`)'
			 . ') ENGINE=MYISAM';
		if(mysql_query($sql))
		echo '<p class="right">' . $lang['table'] . ' <u>address</u> ' . $lang['successfully_created'] . '</p>';
		else{
		echo '<p class="false">' . $lang['table'] . ' <u>address</u> ' . $lang['couldnot_created'] . '</p>';
		echo '<p><strong>' . $lang['error'] . ':</strong> ' . mysql_error() . '</p>';
		die();
		}

		echo '<br>';
		echo '<p class="blue">' . $lang['success_install'] . '</p>';
		echo '<p>' . $lang['create_admin_acc'] . '! [ <a href="admin.php">' . $lang['go_on'] . '</a> ]</p>';

        echo '<div class="spacer_div">&nbsp;</div>';

		?>

    </div>
</div>

</div>

</div>

</body>
</html>
Return current item: WH Community