Location: PHPKode > projects > infoboard > infoboard/setup.php
<?
$iscon["pathconfig"] = "./data/_uconfig.php";
$iscon["pathconnect"] = "./data/connect.php";

if(isset($_POST["lang"])) $lang=$_POST["lang"]; else $lang="en";

if($lang == "en"){
$iscon["lang"][1]="Host";
$iscon["lang"][2]="MySQL Database Name";
$iscon["lang"][3]="UserName (MySQL Database)";
$iscon["lang"][4]="Password  (MySQL Database)";
$iscon["lang"][5]="Install  Type";
$iscon["lang"][6]="Admin UserName";
$iscon["lang"][7]="Admin Password";
$iscon["lang"][8]="Error! Connect";
$iscon["lang"][9]="Please CHMOD File 0777 ";
$iscon["lang"][10]="Success";
$iscon["lang"][11]="Database already exists";
}else{
$iscon["lang"][1]="ชื่อโฮสของคุณ";
$iscon["lang"][2]="ชื่อ MySQL ดาต้าเบส";
$iscon["lang"][3]="ชื่อ ที่มีสิทธิ์ใช้งานดาต้าเบส";
$iscon["lang"][4]="รหัสผ่าน ที่มีสิทธิ์ใช้งานดาต้าเบส";
$iscon["lang"][5]="ติดตั้งรูปแบบ";
$iscon["lang"][6]="ชื่อล็อกอิน";
$iscon["lang"][7]="รหัสผ่าน";
$iscon["lang"][8]="ดาต้าเบสไม่มีชื่อนี้ หรือยังไม่ได้สร้างไว้ <br />โปรดติดต่อผู้ให้บริการของคุณ";
$iscon["lang"][9]="ไฟล์ ไม่สามารถบันทึกได้ ";
$iscon["lang"][10]="เสร็จสิ้น";
$iscon["lang"][11]="ดาต้าเบส ถูกติดตั้งอยู่ก่อนแล้ว";
}


$iscon["base_url"]=str_replace($_SERVER["DOCUMENT_ROOT"], "", dirname($_SERVER["PHP_SELF"]))."/"; 

	function isdump(){
		 global $iscon;
		 if(isset($_POST["local"])) $local=$_POST["local"]; else $local="";
		 if(isset($_POST["db"])) $db=$_POST["db"]; else $db="";
		 if(isset($_POST["sqluser"])) $sqluser=$_POST["sqluser"]; else $sqluser="";
		 if(isset($_POST["sqlpass"])) $sqlpass=$_POST["sqlpass"]; else $sqlpass="";

		 if(isset($_POST["user"])) $user=$_POST["user"]; else $user="";
		 if(isset($_POST["pass"])) $pass=$_POST["pass"]; else $pass="";
		 if(($user) && ($pass)){
			  esetting($_POST["lang"]);
			  econnect($local, $sqluser, $sqlpass, $db);
			  $output = sqlfile($user, $pass);
			  $filename = "infoboard8.sql";
			  header("Content-type: application/octet-stream");
			  header("Content-disposition: attachment; filename=".$filename);
			  header("Pragma: no-cache");
			  header("Expires: 0");
			  echo $output;
			  exit();
		 }
	}

	function isque(){
		global $iscon;
		 if(isset($_POST["local"])) $local=$_POST["local"]; else $local="";
		 if(isset($_POST["db"])) $db=$_POST["db"]; else $db="";
		 if(isset($_POST["sqluser"])) $sqluser=$_POST["sqluser"]; else $sqluser="";
		 if(isset($_POST["sqlpass"])) $sqlpass=$_POST["sqlpass"]; else $sqlpass="";

		 if(isset($_POST["user"])) $user=$_POST["user"]; else $user="";
		 if(isset($_POST["pass"])) $pass=$_POST["pass"]; else $pass="";
		 sboby();
		 echo "<div id=\"col\">";
		 echo "<div id=\"colin\">";
			     mysql_connect($local, $sqluser, $sqlpass);
				 if(!mysql_select_db($db)){
					  mysql_error();
					  echo "<br /><br />".$iscon["lang"][8];
					  echo "<br /><br /><input type='button' name='Button' value='BACK' onClick='javascript:history.back();'>";
				 }else{
					  if($err = quesql($local, $sqluser, $sqlpass, $db, $user, $pass)){
						   echo "".$err."";
					  }else{
						  esetting($_POST["lang"]);
						  econnect($local, $sqluser, $sqlpass, $db);
						  echo $iscon["lang"][10]." Setup INFOBOARD 8+<br /><a href=\"./\">INFOBOARD 8+</a>";
					  }
					 
				 }
		 echo "</div>";
		 echo "</div>";
		 ebody();
		 exit();
	}


if(isset($_POST["action"])){
    if($_POST["action"] == "1"){
		isque();
	}elseif($_POST["action"] == "2"){
		isdump();
	}elseif($_POST["action"] == "step2"){
		sboby();
		step2_sql();
		ebody();
	}
}else{
	 sboby();
	 step1();
	 ebody();
}

	function step1(){
		global $iscon;
		 echo "
<br class=\"clear-all\" />
<br class=\"clear-all\" />
<form action=\"\" method=\"post\">
<div id=\"col\">
<div id=\"colin\">
<span class=\"stext\"><span class=\"stextnext\">STEP 1</span>&nbsp; | &nbsp;STEP 2&nbsp; | &nbsp;FINISH</span>
<div style=\"clear: both;\">&nbsp;</div>
<div style=\"clear: both;\">&nbsp;</div>
<br class=\"clear-all\" />
Language 
  <input name=\"lang\" type=\"radio\" value=\"th\" checked=\"checked\" /> Thai  
    &nbsp; 
  <input name=\"lang\" type=\"radio\" value=\"en\" /> English 
<div style=\"clear: both;\">&nbsp;</div>
<div style=\"clear: both;\">&nbsp;</div>
";

$err="";

 if (!is_writable("data")) $err.= "./data<br />";
 if (!is_writable("data/admin")) $err.= "./data/admin<br />";
 if (!is_writable("data/code")) $err.= "./data/code<br />";
 if (!is_writable("data/pic")) $err.= "./data/pic<br />";
 if (!is_writable("data/search")) $err.= "./data/search<br />";
 if (!is_writable("data/user")) $err.= "./data/user<br />";
 if (!is_writable("data/user/banner")) $err.= "./data/user/banner<br />";
 if (!is_writable("data/icon")) $err.= "./data/icon<br />";
 if (!is_writable("data/slide")) $err.= "./data/slide<br />";


if($err2 = iswritable("./data")) $err.=$err2;
if($err3 = iswritable("./data/icon")) $err.=$err3;
if($err4 = iswritable("./data/slide")) $err.=$err4;


if($err){
	 echo "<font color=\"#FF0000\">".$iscon["lang"][9]."</font><div style=\"clear: both;\">&nbsp;</div>";
	 echo "<div style=\"clear: both;\">&nbsp;</div>";
	 echo $err;
	 echo "<div style=\"clear: both;\">&nbsp;</div>";
}else{
	 echo "<input  type=\"submit\" value=\"NEXT &gt;&gt;\" /><input type=\"hidden\" name=\"action\" value=\"step2\" />";
}
echo "
  </div>
</div>
</form>
		 ";
	}

	function step2_sql(){
		global $iscon;
		 echo "
<form action=\"\" method=\"post\">
<div id=\"col\">
<div id=\"colin\">
";
if(file_exists($iscon["pathconnect"])){
	 include($iscon["pathconnect"]);
	 if(isset($iscon["isdbname"])) $dbname=$iscon["isdbname"]; else $dbname="";
	 if($dbname){
		  echo "<font color=\"#FF0000\">".$iscon["lang"][11]."</font><div style=\"clear: both;\">&nbsp;</div>";
		  return;
	 }
}

echo "
<span class=\"stext\">STEP 1&nbsp; | &nbsp;<span class=\"stextnext\">STEP 2</span>&nbsp; | &nbsp;FINISH</span>
<div style=\"clear: both;\">&nbsp;</div>
".$iscon["lang"][1]."
<br class=\"clear-all\" />
  <label>
    <input type=\"text\" name=\"local\" value=\"localhost\" />
  </label>
<br class=\"clear-all\" />
<br class=\"clear-all\" />
<div style=\"clear: both;\">&nbsp;</div>

".$iscon["lang"][2]."
<br class=\"clear-all\" />
  <label>
   <input type=\"text\" name=\"db\" value=\"\" />
  </label>
  <br class=\"clear-all\" />
  <br class=\"clear-all\" />
  <div style=\"clear: both;\">&nbsp;</div>
".$iscon["lang"][3]."
<br class=\"clear-all\" />
  <label>
   <input type=\"text\" name=\"sqluser\" value=\"\" />
  </label>
  <br class=\"clear-all\" />
  <br class=\"clear-all\" />
  <div style=\"clear: both;\">&nbsp;</div>
 ".$iscon["lang"][4]."
  <br class=\"clear-all\" />
  <label>
   <input type=\"text\" name=\"sqlpass\" value=\"\" />
  </label>

<div style=\"clear: both;\">&nbsp;</div>
<br class=\"clear-all\" />
".$iscon["lang"][5]."
<br class=\"clear-all\" />
  <input name=\"action\" type=\"radio\" value=\"1\" checked=\"checked\" /> Run SQL query 
  <input name=\"action\" type=\"radio\" value=\"2\" /> Dump File
<div style=\"clear: both;\">&nbsp;</div>


<div style=\"clear: both;\">&nbsp;</div>
<br class=\"clear-all\" />
<br class=\"clear-all\" />
<br class=\"clear-all\" />
<strong>Admin INFOBOARD 8+</strong>
<div style=\"clear: both;\">&nbsp;</div>
".$iscon["lang"][6]."
<br class=\"clear-all\" />
  <label>
   <input type=\"text\" name=\"user\" value=\"\" />
  </label>
  <br class=\"clear-all\" />
  <br class=\"clear-all\" />
  <div style=\"clear: both;\">&nbsp;</div>

  ".$iscon["lang"][7]."
  <br class=\"clear-all\" />
  <label>
   <input type=\"text\" name=\"pass\" value=\"\" />
  </label>

  <br class=\"clear-all\" />
  <br class=\"clear-all\" />
  <div style=\"clear: both;\">&nbsp;</div>
  <input  type=\"submit\" value=\"FINISH &gt;&gt;\" />
  <input type=\"hidden\" name=\"lang\" value=\"".$_POST["lang"]."\" />
  </div>
</div>
</form>
		 ";
	}



	function quesql($local, $sqluser, $sqlpass, $db, $user, $pass){
		global $iscon;
		$err="";
		mysql_connect($local, $sqluser, $sqlpass);

		if(!mysql_db_query($db, "
CREATE TABLE IF NOT EXISTS `_admin` (
  `_cid` int(10) NOT NULL auto_increment,
  `_name` varchar(100) collate utf8_unicode_ci default NULL,
  `_pass` varchar(255) collate utf8_unicode_ci default NULL,
  `_mail` varchar(50) collate utf8_unicode_ci default NULL,
  PRIMARY KEY  (`_cid`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=2 ;
		"))
		{
			$err.="error tb (_admin)<br />";
		}

		if(!mysql_db_query($db, "
CREATE TABLE IF NOT EXISTS `_block` (
  `_cid` int(10) NOT NULL auto_increment,
  `_mail` varchar(50) collate utf8_unicode_ci default NULL,
  PRIMARY KEY  (`_cid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
		"))
		{
			$err.="error tb (_block)<br />";
		}

		if(!mysql_db_query($db, "
CREATE TABLE IF NOT EXISTS `_group` (
  `_cid` int(10) NOT NULL auto_increment,
  `_name` varchar(50) collate utf8_unicode_ci NOT NULL,
  `_detail` varchar(100) collate utf8_unicode_ci default NULL,
  `_qlevel` int(1) NOT NULL default '0',
  `_alevel` int(1) NOT NULL default '0',
  `_format` int(1) NOT NULL default '0',
  `_limit` int(11) NOT NULL default '0',
  `_readlevel` int(1) NOT NULL default '1',
  `_checkq` int(1) NOT NULL default '0',
  `_checka` int(1) NOT NULL default '0',
  `_checkpic` int(1) NOT NULL default '0',
  `_uppic` int(1) NOT NULL default '0',
  PRIMARY KEY  (`_cid`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=2 ;
		"))
		{
			$err.="error tb (_group)<br />";
		}

		if(!mysql_db_query($db, "
CREATE TABLE IF NOT EXISTS `_infoboarda` (
  `_cid` int(10) NOT NULL auto_increment,
  `_qid` int(11) NOT NULL default '0',
  `_cat` int(11) NOT NULL default '1',
  `_detail` mediumtext collate utf8_unicode_ci,
  `_code` mediumtext collate utf8_unicode_ci,
  `_edit` mediumtext collate utf8_unicode_ci,
  `_name` varchar(50) collate utf8_unicode_ci NOT NULL,
  `_ip` varchar(50) collate utf8_unicode_ci default NULL,
  `_border` varchar(10) collate utf8_unicode_ci NOT NULL default 'FFFFFF',
  `_align` varchar(10) collate utf8_unicode_ci default NULL,
  `_level` int(1) NOT NULL default '0',
  `_userid` int(11) NOT NULL default '0',
  `_pic` varchar(100) collate utf8_unicode_ci default NULL,
  `_ext` varchar(4) collate utf8_unicode_ci default NULL,
  `_picformat` int(1) NOT NULL default '1',
  `_activeimg` int(1) NOT NULL default '1',
  `_active` int(1) NOT NULL default '1',
  `_time` datetime NOT NULL default '0000-00-00 00:00:00',
  PRIMARY KEY  (`_cid`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
		"))
		{
			$err.="error tb (_infoboarda)<br />";
		}

		if(!mysql_db_query($db, "
CREATE TABLE IF NOT EXISTS `_infoboardi` (
  `_cid` int(10) NOT NULL auto_increment,
  `_target` int(1) NOT NULL default '0',
  `_qid` int(11) NOT NULL default '0',
  `_aid` int(11) NOT NULL default '0',
  `_cat` int(11) NOT NULL default '1',
  `_detail` mediumtext collate utf8_unicode_ci,
  `_code` mediumtext collate utf8_unicode_ci,
  `_edit` mediumtext collate utf8_unicode_ci,
  `_name` varchar(50) collate utf8_unicode_ci NOT NULL,
  `_ip` varchar(50) collate utf8_unicode_ci default NULL,
  `_level` int(1) NOT NULL default '0',
  `_userid` int(11) NOT NULL default '0',
  `_pic` varchar(100) collate utf8_unicode_ci default NULL,
  `_ext` varchar(4) collate utf8_unicode_ci default NULL,
  `_picformat` int(1) NOT NULL default '1',
  `_activeimg` int(1) NOT NULL default '1',
  `_active` int(1) NOT NULL default '1',
  `_time` datetime NOT NULL default '0000-00-00 00:00:00',
  PRIMARY KEY  (`_cid`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
		"))
		{
			$err.="error tb (_infoboardi)<br />";
		}

		if(!mysql_db_query($db, "
CREATE TABLE IF NOT EXISTS `_infoboardq` (
  `_cid` int(10) NOT NULL auto_increment,
  `_cat` int(11) NOT NULL default '1',
  `_page` int(11) NOT NULL,
  `_topic` varchar(150) collate utf8_unicode_ci NOT NULL,
  `_detail` mediumtext collate utf8_unicode_ci,
  `_ansname` varchar(50) collate utf8_unicode_ci default NULL,
  `_anslevel` int(1) NOT NULL default '0',
  `_ansuid` int(11) NOT NULL default '0',
  `_save` int(1) NOT NULL default '0',
  `_uppage` int(11) NOT NULL default '1',
  `_code` mediumtext collate utf8_unicode_ci,
  `_edit` mediumtext collate utf8_unicode_ci,
  `_name` varchar(50) collate utf8_unicode_ci NOT NULL,
  `_read` int(11) NOT NULL default '0',
  `_reply` int(11) NOT NULL default '0',
  `_insert` int(11) NOT NULL default '0',
  `_ip` varchar(50) collate utf8_unicode_ci default NULL,
  `_border` varchar(10) collate utf8_unicode_ci NOT NULL default 'CCCCCC',
  `_align` varchar(10) collate utf8_unicode_ci default NULL,
  `_lock` int(1) NOT NULL default '0',
  `_level` int(1) NOT NULL default '0',
  `_userid` int(11) NOT NULL default '0',
  `_stick` int(1) NOT NULL default '0',
  `_vote` int(1) NOT NULL default '0',
  `_pic` varchar(100) collate utf8_unicode_ci default NULL,
  `_piccover` varchar(100) collate utf8_unicode_ci default NULL,
  `_coverformat` int(1) NOT NULL default '1',
  `_ext` varchar(4) collate utf8_unicode_ci default NULL,
  `_picformat` int(1) NOT NULL default '1',
  `_activeimg` int(1) NOT NULL default '1',
  `_active` int(1) NOT NULL default '1',
  `_time` datetime NOT NULL default '0000-00-00 00:00:00',
  `_update` datetime default '0000-00-00 00:00:00',
  PRIMARY KEY  (`_cid`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
		"))
		{
			$err.="error tb (_infoboardq)<br />";
		}

		if(!mysql_db_query($db, "
CREATE TABLE IF NOT EXISTS `_user` (
  `_cid` int(10) NOT NULL auto_increment,
  `_active` int(1) NOT NULL default '0',
  `_name` varchar(100) collate utf8_unicode_ci NOT NULL,
  `_pass` varchar(255) collate utf8_unicode_ci NOT NULL,
  `_mail` varchar(50) collate utf8_unicode_ci NOT NULL,
  `_code` varchar(200) collate utf8_unicode_ci default NULL,
  `_post` int(11) NOT NULL default '0',
  `_website` varchar(100) collate utf8_unicode_ci default NULL,
  `_banner` mediumtext collate utf8_unicode_ci,
  `_ext` varchar(4) collate utf8_unicode_ci default NULL,
  PRIMARY KEY  (`_cid`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
		"))
		{
			$err.="error tb (_user)<br />";
		}

		if(!mysql_db_query($db, "
INSERT INTO `_admin` (`_cid`, `_name`, `_pass`, `_mail`) VALUES
(1, '".$user."', '".md5($pass)."', '');
		"))
		{
			$err.="error tb (_admin) - insert<br />";
		}

		if(!mysql_db_query($db, "
INSERT INTO `_group` (`_cid`, `_name`, `_detail`, `_qlevel`, `_alevel`, `_format`, `_limit`, `_readlevel`, `_checkq`, `_checka`, `_checkpic`, `_uppic`) VALUES
(1, 'INFORMATION', '', 0, 0, 0, 0, 0, 0, 0, 0, 0);
		"))
		{
			$err.="error tb (_group) - insert<br />";
		}
		if($err) return $err;

    }



	function sqlfile($user, $pass){
		global $iscon;
			  $text = "
SET SQL_MODE=\"NO_AUTO_VALUE_ON_ZERO\";

CREATE TABLE IF NOT EXISTS `_admin` (
  `_cid` int(10) NOT NULL auto_increment,
  `_name` varchar(100) collate utf8_unicode_ci default NULL,
  `_pass` varchar(255) collate utf8_unicode_ci default NULL,
  `_mail` varchar(50) collate utf8_unicode_ci default NULL,
  PRIMARY KEY  (`_cid`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=2 ;

INSERT INTO `_admin` (`_cid`, `_name`, `_pass`, `_mail`) VALUES
(1, '".$user."', '".md5($pass)."', '');

CREATE TABLE IF NOT EXISTS `_block` (
  `_cid` int(10) NOT NULL auto_increment,
  `_mail` varchar(50) collate utf8_unicode_ci default NULL,
  PRIMARY KEY  (`_cid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

CREATE TABLE IF NOT EXISTS `_group` (
  `_cid` int(10) NOT NULL auto_increment,
  `_name` varchar(50) collate utf8_unicode_ci NOT NULL,
  `_detail` varchar(100) collate utf8_unicode_ci default NULL,
  `_qlevel` int(1) NOT NULL default '0',
  `_alevel` int(1) NOT NULL default '0',
  `_format` int(1) NOT NULL default '0',
  `_limit` int(11) NOT NULL default '0',
  `_readlevel` int(1) NOT NULL default '1',
  `_checkq` int(1) NOT NULL default '0',
  `_checka` int(1) NOT NULL default '0',
  `_checkpic` int(1) NOT NULL default '0',
  `_uppic` int(1) NOT NULL default '0',
  PRIMARY KEY  (`_cid`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=2 ;

INSERT INTO `_group` (`_cid`, `_name`, `_detail`, `_qlevel`, `_alevel`, `_format`, `_limit`, `_readlevel`, `_checkq`, `_checka`, `_checkpic`, `_uppic`) VALUES
(1, 'INFORMATION', '', 0, 0, 0, 0, 0, 0, 0, 0, 0);

CREATE TABLE IF NOT EXISTS `_infoboarda` (
  `_cid` int(10) NOT NULL auto_increment,
  `_qid` int(11) NOT NULL default '0',
  `_cat` int(11) NOT NULL default '1',
  `_detail` mediumtext collate utf8_unicode_ci,
  `_code` mediumtext collate utf8_unicode_ci,
  `_edit` mediumtext collate utf8_unicode_ci,
  `_name` varchar(50) collate utf8_unicode_ci NOT NULL,
  `_ip` varchar(50) collate utf8_unicode_ci default NULL,
  `_border` varchar(10) collate utf8_unicode_ci NOT NULL default 'FFFFFF',
  `_align` varchar(10) collate utf8_unicode_ci default NULL,
  `_level` int(1) NOT NULL default '0',
  `_userid` int(11) NOT NULL default '0',
  `_pic` varchar(100) collate utf8_unicode_ci default NULL,
  `_ext` varchar(4) collate utf8_unicode_ci default NULL,
  `_picformat` int(1) NOT NULL default '1',
  `_activeimg` int(1) NOT NULL default '1',
  `_active` int(1) NOT NULL default '1',
  `_time` datetime NOT NULL default '0000-00-00 00:00:00',
  PRIMARY KEY  (`_cid`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

CREATE TABLE IF NOT EXISTS `_infoboardi` (
  `_cid` int(10) NOT NULL auto_increment,
  `_target` int(1) NOT NULL default '0',
  `_qid` int(11) NOT NULL default '0',
  `_aid` int(11) NOT NULL default '0',
  `_cat` int(11) NOT NULL default '1',
  `_detail` mediumtext collate utf8_unicode_ci,
  `_code` mediumtext collate utf8_unicode_ci,
  `_edit` mediumtext collate utf8_unicode_ci,
  `_name` varchar(50) collate utf8_unicode_ci NOT NULL,
  `_ip` varchar(50) collate utf8_unicode_ci default NULL,
  `_level` int(1) NOT NULL default '0',
  `_userid` int(11) NOT NULL default '0',
  `_pic` varchar(100) collate utf8_unicode_ci default NULL,
  `_ext` varchar(4) collate utf8_unicode_ci default NULL,
  `_picformat` int(1) NOT NULL default '1',
  `_activeimg` int(1) NOT NULL default '1',
  `_active` int(1) NOT NULL default '1',
  `_time` datetime NOT NULL default '0000-00-00 00:00:00',
  PRIMARY KEY  (`_cid`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

CREATE TABLE IF NOT EXISTS `_infoboardq` (
  `_cid` int(10) NOT NULL auto_increment,
  `_cat` int(11) NOT NULL default '1',
  `_page` int(11) NOT NULL,
  `_topic` varchar(150) collate utf8_unicode_ci NOT NULL,
  `_detail` mediumtext collate utf8_unicode_ci,
  `_ansname` varchar(50) collate utf8_unicode_ci default NULL,
  `_anslevel` int(1) NOT NULL default '0',
  `_ansuid` int(11) NOT NULL default '0',
  `_save` int(1) NOT NULL default '0',
  `_uppage` int(11) NOT NULL default '1',
  `_code` mediumtext collate utf8_unicode_ci,
  `_edit` mediumtext collate utf8_unicode_ci,
  `_name` varchar(50) collate utf8_unicode_ci NOT NULL,
  `_read` int(11) NOT NULL default '0',
  `_reply` int(11) NOT NULL default '0',
  `_insert` int(11) NOT NULL default '0',
  `_ip` varchar(50) collate utf8_unicode_ci default NULL,
  `_border` varchar(10) collate utf8_unicode_ci NOT NULL default 'CCCCCC',
  `_align` varchar(10) collate utf8_unicode_ci default NULL,
  `_lock` int(1) NOT NULL default '0',
  `_level` int(1) NOT NULL default '0',
  `_userid` int(11) NOT NULL default '0',
  `_stick` int(1) NOT NULL default '0',
  `_vote` int(1) NOT NULL default '0',
  `_pic` varchar(100) collate utf8_unicode_ci default NULL,
  `_piccover` varchar(100) collate utf8_unicode_ci default NULL,
  `_coverformat` int(1) NOT NULL default '1',
  `_ext` varchar(4) collate utf8_unicode_ci default NULL,
  `_picformat` int(1) NOT NULL default '1',
  `_activeimg` int(1) NOT NULL default '1',
  `_active` int(1) NOT NULL default '1',
  `_time` datetime NOT NULL default '0000-00-00 00:00:00',
  `_update` datetime default '0000-00-00 00:00:00',
  PRIMARY KEY  (`_cid`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

CREATE TABLE IF NOT EXISTS `_user` (
  `_cid` int(10) NOT NULL auto_increment,
  `_active` int(1) NOT NULL default '0',
  `_name` varchar(100) collate utf8_unicode_ci NOT NULL,
  `_pass` varchar(255) collate utf8_unicode_ci NOT NULL,
  `_mail` varchar(50) collate utf8_unicode_ci NOT NULL,
  `_code` varchar(200) collate utf8_unicode_ci default NULL,
  `_post` int(11) NOT NULL default '0',
  `_website` varchar(100) collate utf8_unicode_ci default NULL,
  `_banner` mediumtext collate utf8_unicode_ci,
  `_ext` varchar(4) collate utf8_unicode_ci default NULL,
  PRIMARY KEY  (`_cid`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

			  ";
			  return $text;
		 }


	function sboby(){
		global $iscon;
		 echo "
<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">
<html xmlns=\"http://www.w3.org/1999/xhtml\">
<head>
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />
<title>Setup INFOBOARD 8+</title>
<link href=\"./_css/cover.css\" rel=\"stylesheet\" type=\"text/css\" media=\"screen\" />
</head>

<body>
<div id=\"col\">
<img src=\"_img/infoboard8.png\" width=\"294\" height=\"64\" />
</div>
		 ";
	}

	function ebody(){
		global $iscon;
		 echo "
</body>
</html>
		 ";
	}


	function esetting($lang){
		global $iscon;
		$print ="<?\n";
		$print.="\$iscon[\"website\"] = \"MySite.com\";\n";
		$print.="\$iscon[\"mailmaster\"] = \"hide@address.com\";\n";
		$print.="\$iscon[\"copyright\"] = \"Copyright © 2009 MySite.com\";\n";
		$print.="\$iscon[\"title\"] = \"INFOBOARD 8 New Species\";\n";
		$print.="\$iscon[\"fullpath\"] = \"http://".$_SERVER["HTTP_HOST"].$iscon["base_url"]."\";\n";
		$print.="\$iscon[\"keywords\"] = \"INFOBOARD\";\n";
		$print.="\$iscon[\"description\"] = \"INFOBOARD 8 New Species\";\n";
		$print.="\$iscon[\"target\"] = \"_self\";\n";
		$print.="\$iscon[\"maxsize\"] = 205000;\n";
		$print.="\$iscon[\"fileext\"] = array(\"gif\", \"jpg\", \"jpeg\", \"png\", \"swf\", \"flv\", \"zip\", \"pdf\", \"doc\", \"wmv\", \"avi\", \"mp3\");\n";
		$print.="\$iscon[\"badword\"] = array(\"fuck\", \"asshole\", \"ficken\", \"arsch\", \"porno\");\n";
		$print.="\$iscon[\"keepregister\"] = array(\"webmaster\", \"admin\", \"info\", \"master\", \"contact\");\n";
		$print.="\$iscon[\"showtopic\"] = 15;\n";
		$print.="\$iscon[\"righttopic\"] = 10;\n";
		$print.="\$iscon[\"numright\"] = 80;\n";
		$print.="\$iscon[\"showreply\"] = 5;\n";
		$print.="\$iscon[\"imgnew\"] = 1;\n";
		$print.="\$iscon[\"imghot\"] = 100;\n";
		$print.="\$iscon[\"imgcool\"] = 10;\n";
		$print.="\$iscon[\"urlmod\"] = 0;\n";
		$print.="\$iscon[\"_s\"] = \".\";\n";
		$print.="\$iscon[\"friendly\"] = false;\n";
		$print.="\$iscon[\"showlevel\"] = 1;\n";
		$print.="\$iscon[\"boardinfo\"] = 0;\n";
		$print.="\$iscon[\"showfont\"] = 0;\n";
		$print.="\$iscon[\"showInsertImage\"] = 0;\n";
		$print.="\$iscon[\"showtable\"] = 0;\n";
		$print.="\$iscon[\"showcode\"] = 0;\n";
		$print.="\$iscon[\"lockuser\"] = 0;\n";
		$print.="\$iscon[\"stamppic\"] = 0;\n";
		$print.="\$iscon[\"textstamp\"] = \"MySite.com\";\n";
		$print.="\$iscon[\"showip\"] = 0;\n";
		$print.="\$iscon[\"showlang\"] = 0;\n";
		$print.="\$iscon[\"getlang\"] = \"".$lang."\";\n";
		$print.="\$iscon[\"useronline\"] = 0;\n";
		$print.="?>\n";
		$fp=fopen($iscon["pathconfig"],"w");
		fwrite($fp ,stripslashes($print));  
		fclose($fp);
	}

	function econnect($local, $sqluser, $sqlpass, $db){
		global $iscon;
		$print ="<?\n";
		$print.="\$iscon[\"localhost\"] = \"".$local."\";\n";
		$print.="\$iscon[\"isdbname\"] = \"".$db."\";\n";
		$print.="\$iscon[\"isuser\"] = \"".$sqluser."\";\n";
		$print.="\$iscon[\"ispass\"] = \"".$sqlpass."\";\n";
		$print.="?>\n";
		
		$fp=fopen($iscon["pathconnect"],"w");
		fwrite($fp ,stripslashes($print));  
		fclose($fp);
	}

function iswritable($path) {
	 $err="";
	 $dh = opendir($path);
	 while (($file = readdir($dh)) !== false){
		   if($file != "." && $file != ".."){
			    if(is_readable($path."/".$file)){
					   if(is_dir($path."/".$file)){
						   if(!is_writable($path."/".$file)) $err.= $path."/".$file."<br />";
							iswritable($path."/".$file);
					    }else{
							if(!is_writable($path."/".$file)) $err.= $path."/".$file."<br />";
						}
				}
		   }
	 }
	 closedir($dh);
	 return $err;
}

?>
Return current item: infoboard