Location: PHPKode > scripts > WH Social > wh_social/setup/sql.php
<?php

$sql = 'DROP TABLE IF EXISTS members'; mysql_query($sql);
$sql = 'CREATE TABLE `members` ('
. '`id` INT(11) NOT NULL AUTO_INCREMENT,'
. '`name` VARCHAR(30) NOT NULL,'
. '`password` VARCHAR(255) NOT NULL,'
. '`email` VARCHAR(255) NOT NULL,'
. '`date` DATETIME NOT NULL,'
. '`level` INT(11) NOT NULL,'
. '`hash` VARCHAR(32) NOT NULL,'
. '`active` INT(1) NOT NULL DEFAULT "0",'
. '`status` DATETIME NOT NULL,'
. '`visits` BIGINT(11) NOT NULL,'
. '`showmail` TINYINT(1) NULL,'
. '`sex` VARCHAR(70) NOT NULL,'
. '`birthday` DATE NOT NULL,'
. '`friends` TEXT NOT NULL,'
. '`avatar` VARCHAR(100) NOT NULL DEFAULT "uploads/avatars/default.png",'
. 'UNIQUE INDEX email_unique (`email`),'
. 'PRIMARY KEY (`id`)'
. ') ENGINE=MYISAM';

if(mysql_query($sql)) {

echo '<p class="success">' . $lang['setup_the_table'] . ' <em>members</em> ' . $lang['setup_seccussfully_crated'] . '</p>';

}else{

$errors[] = 'members';
}

$sql = 'DROP TABLE IF EXISTS profiles'; mysql_query($sql);
$sql = 'CREATE TABLE `profiles` ('
. '`id` INT(11) NOT NULL,'
. '`homepage` VARCHAR(80) NOT NULL,'
. '`icq` VARCHAR(80) NOT NULL,'
. '`live` VARCHAR(80) NOT NULL,'
. '`skype` VARCHAR(80) NOT NULL,'
. '`facebook` VARCHAR(80) NOT NULL,'
. '`twitter` VARCHAR(80) NOT NULL,'
. '`google` VARCHAR(80) NOT NULL,'
. '`about` VARCHAR(500) NOT NULL,'
. '`signature` VARCHAR(100) NOT NULL,'
. 'PRIMARY KEY (`id`)'
. ') ENGINE=MYISAM';

if(mysql_query($sql)) {

echo '<p class="success">' . $lang['setup_the_table'] . ' <em>profiles</em> ' . $lang['setup_seccussfully_crated'] . '</p>';

}else{

$errors[] = 'profiles';
}

$sql = 'DROP TABLE IF EXISTS messages'; mysql_query($sql);
$sql = 'CREATE TABLE `messages` ('
. '`msg` INT(11) NOT NULL,'
. '`assign` INT(11) NOT NULL,'
. '`title` VARCHAR(255) NOT NULL,'
. '`user1` BIGINT(20) NOT NULL,'
. '`user2` BIGINT(20) NOT NULL,'
. '`content` TEXT NOT NULL,'
. '`date` DATETIME NOT NULL,'
. '`user1read` VARCHAR(3) NOT NULL,'
. '`user2read` VARCHAR(3) NOT NULL'
. ') ENGINE=MYISAM';

if(mysql_query($sql)) {

echo '<p class="success">' . $lang['setup_the_table'] . ' <em>messages</em> ' . $lang['setup_seccussfully_crated'] . '</p>';

}else{

$errors[] = 'messages';
}

$sql = 'DROP TABLE IF EXISTS requests'; mysql_query($sql);
$sql = 'CREATE TABLE `requests` ('
. '`id` INT(11) NOT NULL AUTO_INCREMENT,'
. '`sender` INT(11) NOT NULL,'
. '`recipient` INT(11) NOT NULL,'
. 'PRIMARY KEY (`id`)'
. ') ENGINE=MYISAM';

if(mysql_query($sql)) {

echo '<p class="success">' . $lang['setup_the_table'] . ' <em>requests</em> ' . $lang['setup_seccussfully_crated'] . '</p>';

}else{

$errors[] = 'requests';
}

$sql = 'DROP TABLE IF EXISTS counter'; mysql_query($sql);
$sql = 'CREATE TABLE `counter` ('
. '`id` BIGINT(30) NOT NULL AUTO_INCREMENT,'
. '`ip` VARCHAR(15) NOT NULL DEFAULT "",'
. '`browser` VARCHAR(255) NOT NULL DEFAULT "",'
. '`host` VARCHAR(255) NOT NULL DEFAULT "",'
. '`time` VARCHAR(15) NOT NULL DEFAULT "",'
. '`date` DATE NOT NULL,'
. 'PRIMARY KEY (`id`)'
. ') ENGINE=MYISAM';

if(mysql_query($sql)) {

echo '<p class="success">' . $lang['setup_the_table'] . ' <em>counter</em> ' . $lang['setup_seccussfully_crated'] . '</p>';

}else{

$errors[] = 'counter';
}

$sql = 'DROP TABLE IF EXISTS topics'; mysql_query($sql);
$sql = 'CREATE TABLE `topics` ('
. '`id` INT(11) NOT NULL AUTO_INCREMENT,'
. '`subject` VARCHAR(255) NOT NULL,'
. '`views` BIGINT(11) NOT NULL,'
. '`date` DATETIME NOT NULL,'
. '`author` INT(11) NOT NULL,'
. 'PRIMARY KEY (`id`)'
. ') ENGINE=MYISAM';

if(mysql_query($sql)) {

echo '<p class="success">' . $lang['setup_the_table'] . ' <em>topics</em> ' . $lang['setup_seccussfully_crated'] . '</p>';

}else{

$errors[] = 'topics';
}

$sql = 'DROP TABLE IF EXISTS discussions'; mysql_query($sql);
$sql = 'CREATE TABLE `discussions` ('
. '`id` INT(11) NOT NULL AUTO_INCREMENT,'
. '`content` TEXT NOT NULL,'
. '`topic` INT(11) NOT NULL,'
. '`date` DATETIME NOT NULL,'
. '`author` INT(11) NOT NULL,'
. 'PRIMARY KEY (`id`)'
. ') ENGINE=MYISAM';

if(mysql_query($sql)) {

echo '<p class="success">' . $lang['setup_the_table'] . ' <em>discussions</em> ' . $lang['setup_seccussfully_crated'] . '</p>';

}else{

$errors[] = 'discussions';
}

$sql = 'DROP TABLE IF EXISTS photos'; mysql_query($sql);
$sql = 'CREATE TABLE `photos` ('
. '`id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,'
. '`id2` INT(11) NOT NULL,'
. '`title` VARCHAR(255) DEFAULT "",'
. '`tag` VARCHAR(255) DEFAULT "",'
. '`description` TEXT NOT NULL,'
. '`date` DATETIME NOT NULL,'
. 'PRIMARY KEY (`id`)'
. ') ENGINE=MYISAM';

if(mysql_query($sql)) {

echo '<p class="success">' . $lang['setup_the_table'] . ' <em>photos</em> ' . $lang['setup_seccussfully_crated'] . '</p>';

}else{

$errors[] = 'photos';
}

$sql = 'DROP TABLE IF EXISTS comments'; mysql_query($sql);
$sql = 'CREATE TABLE `comments` ('
. '`id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,'
. '`id2` INT(11) NOT NULL,'
. '`author` INT(11) NOT NULL,'
. '`comment` TEXT NOT NULL,'
. '`date` DATETIME NOT NULL,'
. 'PRIMARY KEY (`id`)'
. ') ENGINE=MYISAM';

if(mysql_query($sql)) {

echo '<p class="success">' . $lang['setup_the_table'] . ' <em>comments</em> ' . $lang['setup_seccussfully_crated'] . '</p>';

}else{

$errors[] = 'comments';
}

$sql = 'DROP TABLE IF EXISTS news'; mysql_query($sql);
$sql = 'CREATE TABLE `news` ('
. '`id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,'
. '`title` VARCHAR(255) NOT NULL,'
. '`author` VARCHAR(50) NOT NULL,'
. '`text` TEXT NOT NULL,'
. '`date` DATETIME NOT NULL,'
. '`check` INT(11) NOT NULL DEFAULT "1",'
. 'PRIMARY KEY (`id`)'
. ') ENGINE=MYISAM';

if(mysql_query($sql)) {

echo '<p class="success">' . $lang['setup_the_table'] . ' <em>news</em> ' . $lang['setup_seccussfully_crated'] . '</p>';

}else{

$errors[] = 'news';
}

$sql = 'DROP TABLE IF EXISTS events'; mysql_query($sql);
$sql = 'CREATE TABLE `events` ('
. '`id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,'
. '`title` VARCHAR(255) NOT NULL DEFAULT "",'
. '`content` TEXT NOT NULL,'
. '`date` DATETIME NOT NULL,'
. 'PRIMARY KEY (`id`)'
. ') ENGINE=MYISAM';

if(mysql_query($sql)) {

echo '<p class="success">' . $lang['setup_the_table'] . ' <em>events</em> ' . $lang['setup_seccussfully_crated'] . '</p>';

}else{

$errors[] = 'events';
}

$sql = 'DROP TABLE IF EXISTS pinboard'; mysql_query($sql);
$sql = 'CREATE TABLE `pinboard` ('
. '`id` INT(11) NOT NULL AUTO_INCREMENT,'
. '`id2` INT(11) NOT NULL,'
. '`post` TEXT NOT NULL,'
. '`date` DATETIME NOT NULL,'
. 'PRIMARY KEY (`id`)'
. ') ENGINE=MYISAM';

if(mysql_query($sql)) {

echo '<p class="success">' . $lang['setup_the_table'] . ' <em>pinboard</em> ' . $lang['setup_seccussfully_crated'] . '</p>';

}else{

$errors[] = 'pinboard';
}

$sql = 'DROP TABLE IF EXISTS guestbook'; mysql_query($sql);
$sql = 'CREATE TABLE `guestbook` ('
. '`id` INT(11) NOT NULL AUTO_INCREMENT,'
. '`id2` INT(11) NOT NULL,'
. '`name` VARCHAR(35) NOT NULL,'
. '`email` VARCHAR(45) NOT NULL,'
. '`url` VARCHAR(255) NOT NULL,'
. '`post` TEXT NOT NULL,'
. '`date` DATETIME NOT NULL,'
. 'PRIMARY KEY (`id`)'
. ') ENGINE=MYISAM';

if(mysql_query($sql)) {

echo '<p class="success">' . $lang['setup_the_table'] . ' <em>guestbook</em> ' . $lang['setup_seccussfully_crated'] . '</p>';

}else{

$errors[] = 'guestbook';
}

$sql = 'DROP TABLE IF EXISTS addresses'; mysql_query($sql);
$sql = 'CREATE TABLE `addresses` ('
. '`id` INT(11) NOT NULL AUTO_INCREMENT,'
. '`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 (`id`)'
. ') ENGINE=MYISAM';

if(mysql_query($sql)) {

echo '<p class="success">' . $lang['setup_the_table'] . ' <em>addresses</em> ' . $lang['setup_seccussfully_crated'] . '</p>';

}else{

$errors[] = 'addresses';
}

$sql = 'DROP TABLE IF EXISTS todo'; mysql_query($sql);
$sql = 'CREATE TABLE `todo` ('
. '`do` INT(11) NOT NULL AUTO_INCREMENT,'
. '`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`)'
. ') ENGINE=MYISAM';

if(mysql_query($sql)) {

echo '<p class="success">' . $lang['setup_the_table'] . ' <em>todo</em> ' . $lang['setup_seccussfully_crated'] . '</p>';

}else{

$errors[] = 'todo';
}

$sql = 'DROP TABLE IF EXISTS online'; mysql_query($sql);
$sql = 'CREATE TABLE `online` ('
. '`id` INT(11) NOT NULL,'
. '`ip` VARCHAR(15),'
. '`timed` DATETIME'
. ') ENGINE=MYISAM';

if(mysql_query($sql)) {

echo '<p class="success">' . $lang['setup_the_table'] . ' <em>online</em> ' . $lang['setup_seccussfully_crated'] . '</p>';

}else{

$errors[] = 'online';
}

$sql = 'DROP TABLE IF EXISTS attempts'; mysql_query($sql);
$sql = 'CREATE TABLE `attempts` ('
. '`ip` VARCHAR(20) NOT NULL,'
. '`attempts` INT NOT NULL,'
. '`lasttry` DATETIME NOT NULL,'
. 'PRIMARY KEY (`ip`)'
. ') ENGINE=MYISAM';

if(mysql_query($sql)) {

echo '<p class="success">' . $lang['setup_the_table'] . ' <em>attempts</em> ' . $lang['setup_seccussfully_crated'] . '</p>';

}else{

$errors[] = 'attempts';
}

$sql = 'DROP TABLE IF EXISTS badwords'; mysql_query($sql);
$sql = 'CREATE TABLE `badwords` ('
. '`id` INT(11) NOT NULL AUTO_INCREMENT,'
. '`word` VARCHAR(100) NOT NULL,'
. 'PRIMARY KEY (`id`)'
. ') ENGINE=MYISAM';

if(mysql_query($sql)) {

echo '<p class="success">' . $lang['setup_the_table'] . ' <em>badwords</em> ' . $lang['setup_seccussfully_crated'] . '</p>';

}else{

$errors[] = 'badwords';
}

$sql = 'DROP TABLE IF EXISTS appointments'; mysql_query($sql);
$sql = 'CREATE TABLE `appointments` ('
. '`do` INT(11) NOT NULL AUTO_INCREMENT,'
. '`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`)'
. ') ENGINE=MYISAM';

if(mysql_query($sql)) {

echo '<p class="success">' . $lang['setup_the_table'] . ' <em>appointments</em> ' . $lang['setup_seccussfully_crated'] . '</p>';

}else{

$errors[] = 'appointments';
}

$sql = 'DROP TABLE IF EXISTS maintenance'; mysql_query($sql);
$sql = 'CREATE TABLE `maintenance` ('
. '`id` INT(11) NOT NULL AUTO_INCREMENT,'
. '`status` TINYINT(1) NULL,'
. 'PRIMARY KEY (`id`)'
. ') ENGINE=MYISAM';

if(mysql_query($sql)) {

echo '<p class="success">' . $lang['setup_the_table'] . ' <em>maintenance</em> ' . $lang['setup_seccussfully_crated'] . '</p>';

}else{

$errors[] = 'maintenance';
}

$sql = 'INSERT INTO `maintenance` (`id`, `status`) VALUES (1, "0")'; mysql_query($sql);

?>
Return current item: WH Social