View file mforum/install.php

File size: 1.26Kb
<?php
	require "inc.php";
	$db=mysql_connect($dbhost, $dbuser, $dbpass);
	$sql="CREATE DATABASE IF NOT EXISTS $dbname";
	$a=mysql_query($sql);
	mysql_select_db($dbname,$db);
	$sql="CREATE TABLE `forum` (  `pid` int(11) NOT NULL auto_increment,  `post` text,  `topic` varchar(50) default NULL,  `usid` int(11) default NULL,  `date` date default NULL,  `time` varchar(20) default NULL,  `ip` varchar(30) default NULL,  `views` int(11) default NULL,  PRIMARY KEY  (`pid`));";
	$a=mysql_query($sql);
	$sql="CREATE TABLE `replies` (  `rid` int(11) NOT NULL auto_increment,  `pid` int(11) NOT NULL,  `messg` text,  `usid` int(11) default NULL,  `date` date default NULL,  `time` varchar(20) default NULL,  `ip` varchar(30) default NULL,  PRIMARY KEY  (`rid`));";
	$a=mysql_query($sql);
	$sql="CREATE TABLE `users` (  `usid` int(11) NOT NULL auto_increment,  `name` varchar(50) NOT NULL,  `email` varchar(50) NOT NULL,  `pass` varchar(32) NOT NULL,  `avatar` varchar(20) NOT NULL,  `posts` int(11) NOT NULL,  PRIMARY KEY  (`usid`));";
	$a=mysql_query($sql);
	$pass=md5('pass');
	$sql="INSERT INTO `users` VALUES (1, 'admin', 'admin@localhost', '$pass', 'av1.gif', 0);";
	$a=mysql_query($sql);
	setcookie("usid",1);
	setcookie("pass",$pass);
	Header("Location: profile.php");
?>