Location: PHPKode > projects > Chinese Project Forum > upload/ipdata/install.php
<?
error_reporting(7);//¹æ¶¨ÏÔʾ´íÎ󱨸æµÄ·½Ê½

if (function_exists("set_time_limit")==1 and get_cfg_var("safe_mode")==0) {
  @set_time_limit(1200);//ÉèÖó¬Ê±
}
flush(); //½ûÖ¹·þÎñÆ÷»º´æ£¬Í¬²½Êä³ö³ÌÐò²úÉúµÄÄÚÈÝ
require("version.php");//°æ±¾

#Íøҳͷ²¿
function outputheader($title) {
	global $version;
	$header = "<html>
		<head>
		<title>»¶Ó­À´µ½Chinese P Forum $version µÄ°²×°³ÌÐò</title>
		<meta http-equiv=\"Content-Type\" content=\"text/html; charset=gb2312\">
		<style type=\"text/css\">
		<!--
		a:active, a:link, a:visited { color:#000099 }
		a:hover { text-decoration:none; color:#0000FF }
		table {  font-family: \"Arial\", \"Helvetica\", \"sans-serif\", \"ËÎÌå\"; font-size: 12px}
		.title {  color: #FF0000; text-decoration: underline; font-size: 13px}
		.head {  font-size: 14px; font-weight: bold}
		-->
		</style>
		</head>

		<body bgcolor=\"#CCFFCC\" text=\"#000000\" leftmargin=\"0\" topmargin=\"10\" marginwidth=\"0\" marginheight=\"0\">
		<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\" height=\"100%\">
		  <tr> 
		    <td height=\"18\"> 
		      <table width=\"75%\" border=\"0\" cellspacing=\"1\" cellpadding=\"0\" align=\"center\" bgcolor=\"#000000\">
		        <tr>
		          <td bgcolor=\"#000000\"> 
		            <table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"3\" align=\"center\">
		              <tr> 
		                <td bgcolor=\"#000099\" height=\"20\"><font face=\"ËÎÌå, Arial, Helvetica, sans-serif\" color=\"#FFFFFF\" class=\"head\">$title</font></td>
		              </tr>
		              <tr> 
		                <td bgcolor=\"#CCCCFF\" height=\"16\"></td>
		              </tr>
		            </table>
		    <table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"5\" align=\"center\">
		              <tr> 
		                <td bgcolor=\"#FFFFFF\"> ";
	echo $header;
}
#Íøҳβ²¿
$footer = "             
	          </td>
	        </tr>
	      </table></td>
	        </tr>
	      </table>
	      
	      <p align=\"center\">ÖÐÎÄ°æȨËùÓÐ&copy; 2001£­2002 <a href=\"http://www.chinaphp.com/\" target=\"_blank\">Chinaphp</a><br>
	        °æ±¾£º $version</p>
	      </td>
	  </tr>
	</table>
	</body>
	</html>";


#adodbdirĿ¼
$adodbdir="./cpfadodb";

#CPF°æ±¾Îļþ°üº¬
include ("version.php");


$tables = array(
"".$prefix."_announcements",
"".$prefix."_attachment",
"".$prefix."_avatars",
"".$prefix."_bbcode",
"".$prefix."_boards",
"".$prefix."_config",
"".$prefix."_folders",
"".$prefix."_groups",
"".$prefix."_notify",
"".$prefix."_object2board",
"".$prefix."_object2user",
"".$prefix."_pms",
"".$prefix."_pmsend",
"".$prefix."_poll",
"".$prefix."_posts",
"".$prefix."_ranks",
"".$prefix."_smilies",
"".$prefix."_style",
"".$prefix."_threads",
"".$prefix."_user_table",
"".$prefix."_useronline",
"".$prefix."_vote"
); 

#ÐèҪʹÓõĺ¯Êý
function gettemplate($template) {
        $file = file("templates/".$template.".htm");
        $template = implode("",$file);
        $template = str_replace("\"","\\\"",$template);
        return $template;
}

function dooutput($template) {
        echo $template;
}

function ifelse ($expression,$returntrue,$returnfalse) {
	if (!$expression) return $returnfalse;
	else return $returntrue;
}

function editPostdata($data) {
 $data = str_replace("'","&acute;", $data);
 $data = str_replace("\"","&quot;", $data);
 return $data;
}

#Í˳ö°²×°
if ($step==-1) {
	$title = "¸ÐлÄúʹÓÃChinese P Forum $version µÄ°²×°³ÌÐò";
	outputheader($title);
	echo "¸ÐлÄúʹÓÃChinese P Forum $version µÄ°²×°³ÌÐò¡£Èç¹ûÄúÏëÔÚÉÔºóµÄʱ¼äÄÚ°²×°±¾ÂÛ̳£¬Äú¿ÉÒÔÖØÐÂÔËÐб¾³ÌÐò¡£";
	echo $footer;
}

#»¶Ó­»­Ã濪ʼ
if (!$step) {
	$title = "»¶Ó­À´µ½Chinese P Forum $version µÄ°²×°³ÌÐò";
	outputheader($title);
	echo '        <p>ÕâÀïÊÇCPFÂÛ̳µÄ°²×°³ÌÐò£¬Ëü½«Ò»²½²½Òýµ¼Äú½øÐÐCPFÂÛ̳µÄ°²×°¡£</p>
                  <p class="title">¼ì²éϵͳÉèÖÃ</p>
                  <p>';
	$phpversion = phpversion();
	echo "	PHP °æ±¾: $phpversion ... ".ifelse($phpversion>="4.0.2", "ͨ¹ý!", "<b>ûÓÐͨ¹ý!</b>")."<br>\n";
	echo "	PHPÖÐMySQL Ö§³Ö ... ".ifelse(function_exists("mysql_connect"), "ͨ¹ý!", "<b>ûÓÐͨ¹ý!</b>")."<br>\n";
	echo "	PHPÖÐPCRE Ö§³Ö ... ".ifelse(function_exists("preg_replace"), "ͨ¹ý!", "<b>ûÓÐͨ¹ý!</b>")."<br>\n";
	echo "	magic_quotes_sybase ½ûÓà ... ".ifelse(!get_cfg_var("magic_quotes_sybase"), "ͨ¹ý!", "<b>ûÓÐͨ¹ý!</b>")."<br>\n";
	$track_vars_check = get_cfg_var("track_vars");
	if ($phpversion>="4.0.3") {
 		 $track_vars_check = 1;
	}
	echo "track_vars ÆôÓà ... ".ifelse($track_vars_check, "ͨ¹ý!", "<b>ûÓÐͨ¹ý!</b>")."<br>\n";
	$reg_globals_check = get_cfg_var("register_globals");
	if (floor($phpversion)==3) {
		$reg_globals_check = 1; // 3.0.9 ûÓÐ register_globals
	}
	echo "register_globals ÆôÓà ... ".ifelse($reg_globals_check, "ͨ¹ý!", "<b>ûÓÐͨ¹ý!</b>")."<br>\n";

	echo '</p><p class="title">½¨Òé</p><p>';
	if ($phpversion<="4.0.2") echo "ÄúµÄphp°æ±¾¹ýµÍ£¬±¾ÂÛ̳²¿·Ö¹¦ÄÜÎÞ·¨Ê¹Ó᣽¨ÒéÄú¸üÐÂphp°æ±¾¡£<br>";
	if (!function_exists("mysql_connect")) echo "ÄúµÄPHP²»Ö§³ÖMysql£¬µ±È»£¬Èç¹ûÄúµÄPHPÖ§³Ö±ðµÄÀàÐ͵ÄÊý¾Ý¿â£¬°²×°ÈÔÈ»¿ÉÒÔ¼ÌÐø¡£<br>";
	if (!function_exists("preg_replace")) echo "ÄúµÄPHP²»Ö§³ÖPCRE£¬ËùÒÔÓйØ×Ö·û´®ÑéÖ¤µÄ¹¦ÄÜ£¬ÈçEmailÓÐЧÐÔÑéÖ¤½«ÎÞ·¨ÊµÏÖ¡£½¨ÒéÄúÖØÐÂÉèÖÃϵͳ¡£<br>";
	if (get_cfg_var("magic_quotes_sybase")) echo "ÄúµÄPHPÖ§³Ömagic_quotes_sybase£¬Õâ²»ÊDZ¾ÂÛ̳ËùÐèÒªµÄ¡£½¨ÒéÖØÐÂÉèÖÃÄúµÄPHPϵͳ¡£<br>";
	if (!$reg_globals_check) echo "ÄúµÄPHP²»Ö§³Ötrack_var£¬µ«ÊÇÕâ²»»á¹ýÓÚÓ°ÏìÂÛ̳ʹÓá£<br>";
	if (($phpversion>="4.0.2") && function_exists("mysql_connect") && function_exists("preg_replace") && !get_cfg_var("magic_quotes_sybase") && $reg_globals_check)
		echo "ÄúµÄϵͳÍêÈ«·ûºÏ°²×°±¾ÂÛ̳µÄÒªÇó£¡Äú¿ÉÒÔµã»÷¡°¼ÌÐø°²×°¡±°²×°±¾ÂÛ̳¡£";
	echo "</p><p class=\"title\">ÇëÑ¡ÔñÏÂÒ»²½²Ù×÷</p><p><a href=\"$PHP_SELF?step=1\">¼ÌÐø°²×°</a> <a href=\"$PHP_SELF?step=-1\">Í˳ö°²×°</a></p>";
	echo $footer;
}

#²½Öè1£¬Ìîд±ØÒªÐÅÏ¢
if ($step==1) {
	$title = "CPF°²×°²½Öè1£ºÇëÌîд±ØÒªÐÅÏ¢";
	outputheader($title);
	$canwrite=@fopen("./config.php","a");//ÅжÏconfig.phpÊÇ·ñ¿Éд
	@fclose($canwrite);
	$canread=@fopen("./config.php","r");//ÅжÏconfig.phpÊÇ·ñ¿É¶Á
	@fclose($canread);
	$fileexists=file_exists("./config.php");//ÅжÏconfig.phpÊÇ·ñ´æÔÚ
	if ($canwrite==0 and !$fileexists) {
		// Îļþ²»´æÔÚÇÒ²»ÄÜ´´½¨ÐÂÎļþ
		echo "<p class=\"title\">´íÎó</p>";
		echo "<p>²»ÄÜÕÒµ½ config.php£¬ÇÒÎÞ·¨´´½¨ÐÂÎļþ</p>";
		echo "<p>ÇëÈ·¶¨ÉÏ´«ÁËconfig.php£¬»òÈ·±£ÉÏ´«µÄĿ¼ÓÐдȨÏÞ¡£config.phpµÄÄÚÈÝÈçÏ£º</p>";
		echo '<pre><?php
			/*ÄúµÄÊý¾Ý¿âÀàÐÍ*/
			$dbtype = "MySQL";
			/* ÄúµÄÊý¾Ý¿â·þÎñÆ÷µÄÖ÷»úÃû»òIPµØÖ·*/
			$dbhost = "localhost";
			/* µÇ¼Êý¾Ý¿â·þÎñÆ÷µÄÓû§Ãû*/
			$dbuser = "class007";
			/* µÇ¼Êý¾Ý¿â·þÎñÆ÷µÄÃÜÂë*/
			$dbpassword = "82425";
			/* ʹÓõÄÊý¾Ý¿âÃû*/
			$dbdb = "cpf";
			/* Êý¾Ý±íǰ׺*/
			$prefix = "bb1";
			/* ÊÇ·ñʹÓóÖÐøÁ¬½ÓÊý¾Ý¿â£¨0-·ñ;1-ÊÇ£©*/
			$usepconnect= 1;
			/* ¹ÜÀíÔ±µÄEmailµØÖ·*/
			$adminmail = "hide@address.com";
			'."?>".'</pre>';
		echo "<p>È·¶¨ÄúÉÏ´«ÁË config.php Îļþ£¬²¢ÇÒÔÚÎļþÊ×βµÄ\"<?\",\"?>\"Ç°ºóûÓпոñ";
		echo "<p>µ±ÄúÉÏ´«Íê±Ï config.php Îļþ£¬Çë<a href=javascript:refresh()>Ë¢ÐÂ</a>±¾Ò³";
		echo "<p class=\"title\">ÇëÑ¡ÔñÏÂÒ»²½²Ù×÷</p><p><a href=\"javascript:location.href='$PHPSELF?step=1'\">Ë¢ÐÂÖØÊÔ</a> <a href=\"javascript:history.back(1)\">»Øµ½ÉÏÒ»²½</a> <a href=\"$PHP_SELF?step=-1\">Í˳ö°²×°</a></p>";

	}
	
	if ($canwrite==0 and $fileexists) {
  		//´æÔÚ²»¿Éд
		include ("config.php");
		
		echo "<p class=\"title\">ÇëÈ·ÈÏÒÔÏÂϸ½Ú</p>";
		echo "<b>Êý¾Ý¿âÀàÐÍ£º</b> $dbtype<br>";
		echo "<b>Êý¾Ý¿â·þÎñÆ÷Ö÷»úÃû»òIPµØÖ·£º</b> $dbhost<br>";
		echo "<b>Êý¾Ý¿âÓû§Ãû£º</b> $dbuser<br>";
		echo "<b>Êý¾Ý¿âÓû§ÃÜÂ룺</b> $dbpassword<br>";
		echo "<b>Êý¾Ý¿âÃû£º</b> $dbdb <br>";
		echo "<b>Êý¾Ý±íǰ׺£º</b> $prefix<br>";
		echo "<b>ÊÇ·ñʹÓóÖÐøÁ¬½ÓÊý¾Ý¿â£º</b> ".ifelse($usepconnect,"ÊÇ","·ñ")."<br>";
		echo "<b>¹ÜÀíÔ±E-mailµØÖ·£º</b> <a href=\"mailto:$adminmail\">$adminmail</a><br>";
		echo "<p>Èç¹ûÒÔÉÏÐÅÏ¢ÕýÈ·µÄ»°Çë¼ÌÐø£¬·ñÔò£¬Çë±à¼­ÄãµÄconfig.phpÎļþ²¢Ë¢Ð£¬»ò½«config.phpµÄÊôÐÔÉèÖÃΪ666£¬Ë¢ÐÂÖØÊÔ¡£ÏÂÒ»²½½«²âÊÔÊý¾Ý¿âÊÇ·ñ¿ÉÁ¬Í¨¡£</p>";
		if ($adminmail=="hide@address.com") {
			echo "<p>¼ÌÐø֮ǰ£¬ÇëÔÚ config.php ÎļþÖиüÐÂÄãµÄ¡°¹ÜÀíÔ±E-mailµØÖ·¡±</p><p class=\"title\">ÇëÑ¡ÔñÏÂÒ»²½²Ù×÷</p><a href=\"javascript:location.href='$PHPSELF?step=1'\">ÒѾ­½«ÊôÐÔÉèÖÃΪ666»òÊÇÐÞ¸ÄÁ˹ÜÀíÔ±Email£¬Ë¢ÐÂÖØÊÔ</a> <a href=\"javascript:history.back(1)\">»Øµ½ÉÏÒ»²½</a> <a href=\"$PHP_SELF?step=-1\">Í˳ö°²×°</a></p>";
		} else {
			echo "<p class=\"title\">ÇëÑ¡ÔñÏÂÒ»²½²Ù×÷</p><p><a href=\"$PHP_SELF?step=2\">¼ÌÐø°²×°</a> <a href=\"javascript:location.href='$PHPSELF?step=1'\">ÒѾ­½«ÊôÐÔÉèÖÃΪ666£¬Ë¢ÐÂÖØÊÔ</a> <a href=\"javascript:history.back(1)\">»Øµ½ÉÏÒ»²½</a> <a href=\"$PHP_SELF?step=-1\">Í˳ö°²×°</a></p>";
		}

	}
	if ($canwrite!=0 and $fileexists) {
		//¿ÉдÇÒÎļþ´æÔÚ
		include ("config.php");
		echo "<form action=\"$PHP_SELF\" method=\"post\" name=\"form\"><input type=hidden name=step value=writeconfig>";
		echo "<p class=\"title\">ÇëÈ·ÈÏÒÔÏÂϸ½Ú£º</p>\n";
		echo "<table width=\"75%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td>";
		echo "<p><b>Êý¾Ý¿âÀàÐÍ£º</b>";
  		echo "</td><td>";
  		$dbtype = strtolower($dbtype);
		switch ($dbtype) {
			case "mysqlt":$selected[0]="selected";break;
			case "mysql":$selected[1]="selected";break;
			case "mssql":$selected[2]="selected";break;
			case "postgres":$selected[3]="selected";break;
			case "postgres7":$selected[4]="selected";break;
			case "sybase":$selected[5]="selected";break;
			case "db2":$selected[6]="selected";break;
		}
		echo "<select name=\"dbtype\">
		    <option value=\"mysqlt\" $selected[0]>MySQL 3.23 »òÒÔÉÏ°æ±¾</option>
		    <option value=\"mysql\" $selected[1]>MySQL 3.22 »òÒÔÏ°汾</option>
		    <option value=\"mssql\" $selected[2]>Microsoft SQL Server 7</option>
		    <option value=\"postgres\" $selected[3]>PostgreSQL ²»Ö§³ÖLIMIT°æ±¾</option>
		    <option value=\"postgre7\" $selected[4]>PostgreSQL 7</option>
		    <option value=\"sybase\" $selected[5]>Sybase</option>
		    <option value=\"db2\" $selected[6]>DB2</option>
		  </select>";
		echo "</td></tr>";
		echo "<tr><td><b>Êý¾Ý¿â·þÎñÆ÷Ö÷»úÃû»òIPµØÖ·£º</b></td> <td><input name=\"dbhost\" value=\"$dbhost\"></td></tr>\n";
		echo "<tr><td><b>Êý¾Ý¿âÓû§Ãû£º</b></td><td> <input name=\"dbuser\" value=\"$dbuser\"></td></tr>\n";
		echo "<tr><td><b>Êý¾Ý¿âÓû§ÃÜÂ룺</b></td><td> <input name=\"dbpassword\" value=\"$dbpassword\"></td></tr>\n";
		echo "<tr><td><b>Êý¾Ý¿âÃû£º</b> </td><td><input name=\"dbdb\" value=\"$dbdb\"></td></tr>\n";
		echo "<tr><td><b>Êý¾Ý±íǰ׺£º</b></td><td> <input name=\"prefix\" value=\"$prefix\"></td></tr>\n";
		echo "<tr><td><b>ÊÇ·ñʹÓóÖÐøÁ¬½ÓÊý¾Ý¿â£º</b></td>";
		switch ($usepconnect) {
			case 1:$checked[0]="checked";break;
			case 0:$checked[1]="checked";break;
		}
		echo "<td><input type=\"radio\" name=\"usepconnect\" value=\"1\" $checked[0]> ÊÇ&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type=\"radio\" name=\"usepconnect\" value=\"0\" $checked[1]> ·ñ</td></tr>\n";
		echo "<tr><td><b>¹ÜÀíÔ±E-mailµØÖ·£º</b> </td><td><input name=\"adminmail\" value=\"$adminmail\"></a></td></tr></table>\n";

	 	echo "<p class=\"title\">ÇëÑ¡ÔñÏÂÒ»²½²Ù×÷</p><p><a href=\"javascript:form.submit()\">¸üРconfig.php Îļþ</a>";
		if ($adminmail!="hide@address.com") {
	    	echo "&nbsp;<a href=\"$PHP_SELF?step=2\">²»×ö¸Ä¶¯¶ø¼ÌÐø</a>";
		}
		echo " <a href=\"javascript:history.back(1)\">»Øµ½ÉÏÒ»²½</a> <a href=\"$PHP_SELF?step=-1\">Í˳ö°²×°</a></p></form>\n";
	}
	echo $footer;
}

#²½Öè1¸½Êô²½Ö裺дÈëconfig.php
if ($step=="writeconfig") {
	if ($adminmail=="hide@address.com") {
		$title = "CPF°²×°²½Öè1£ºÇëÌîд±ØÒªÐÅÏ¢";
		outputheader($title);
		echo "<p class=\"title\">´íÎó</p><P>ÇëÊäÈëеĹÜÀíÔ±EmailÐÅÏäµØÖ·¡£</p>";
	    echo "<p class=\"title\">ÇëÑ¡ÔñÏÂÒ»²½²Ù×÷</p><p><a href=\"javascript:history.back(1)\">»Øµ½ÉÏÒ»²½</a> <a href=\"$PHP_SELF?step=-1\">Í˳ö°²×°</a></p>\n";
		exit;
		echo $footer;
	}
   $configfile="<"."?php
/*ÄúµÄÊý¾Ý¿âÀàÐÍ*/
\$dbtype = \"$dbtype\";
/* ÄúµÄMysql·þÎñÆ÷µÄÖ÷»úÃû»òIPµØÖ·*/
\$dbhost = \"$dbhost\";
/* µÇ¼Mysql·þÎñÆ÷µÄÓû§Ãû*/
\$dbuser = \"$dbuser\";
/* µÇ¼Mysql·þÎñÆ÷µÄÃÜÂë*/
\$dbpassword = \"$dbpassword\";
/* ʹÓõÄÊý¾Ý¿âÃû*/
\$dbdb = \"$dbdb\";
/* Êý¾Ý±íǰ׺*/
\$prefix = \"$prefix\";
/* ÊÇ·ñʹÓóÖÐøÁ¬½ÓÊý¾Ý¿â£¨0-·ñ;1-ÊÇ£©*/
\$usepconnect= $usepconnect;
/* ¹ÜÀíÔ±µÄEmailµØÖ·*/
\$adminmail = \"$adminmail\";
?".">";
	$filenum=fopen("config.php","w");
	fwrite($filenum,$configfile);
	fclose($filenum);
	header("location:$PHP_SELF?step=2");
}

#²½Öè2£º³¢ÊÔÁ¬½ÓÊý¾Ý¿â
if ($step==2) {
	include ("config.php");

	#ADODB°üº¬
	include ("$adodbdir/adodb.inc.php");
	#ADODBÊý¾Ý¿âÁ¬½Ó
	$conn=&ADONEWConnection($dbtype);
	if ($usepconnect)
		$issuccess = $conn->PConnect($dbhost,$dbuser,$dbpassword,$dbdb);
	else $issuccess = $conn->Connect($dbhost,$dbuser,$dbpassword,$dbdb);
	#ADODB Êý×éģʽ
	$ADODB_FETCH_MODE = ADODB_FETCH_BOTH;
	#ADODB Debugģʽ
	$conn->debug = false;
	
	$errno = $conn->ErrorNo();
	
	if (!$issuccess) {
		if ($errno!=0) {
			//Èç¹û³ö´í
			if ($errno == 1049) {
				//Êý¾Ý¿â²»´æÔÚ
				$title = "CPF°²×°²½Öè2£º³¢ÊÔÁ¬½ÓÊý¾Ý¿â";
				outputheader($title);
				echo "<p class=\"title\">´íÎó</p><p>ÄúÖ¸¶¨µÄÊý¾Ý¿â²»´æÔÚ¡£ÊÇ·ñÈð²×°³ÌÐò³¢ÊÔ´´½¨Ò»¸ö£¿ÒªÇóÄú±ØÐëÓµÓд´½¨Êý¾Ý¿âµÄȨÏÞ¡£</p>";
			    echo "<p class=\"title\">ÇëÑ¡ÔñÏÂÒ»²½²Ù×÷</p><p><a href=\"$PHP_SELF?step=trycreatdb\">³¢ÊÔ´´½¨</a> <a href=\"$PHP_SELF?step=1\">»Øµ½ÉÏÒ»²½</a> <a href=\"$PHP_SELF?step=-1\">Í˳ö°²×°</a></p>\n";
				echo $footer;
			} else {
				
				$title = "CPF°²×°²½Öè2£º³¢ÊÔÁ¬½ÓÊý¾Ý¿â";
				outputheader($title);
				echo "<p class=\"title\">´íÎó</p><p>ÄúµÄÊý¾Ý¿âÉèÖÃÓÐÎó¡£ÎÞ·¨ÓëÊý¾Ý¿âÖ÷»úÁ¬½Ó¡£ÇëÖØÐÂÉèÖá£</p>";
			    echo "<p class=\"title\">ÇëÑ¡ÔñÏÂÒ»²½²Ù×÷</p><p><a href=\"$PHP_SELF?step=1\">»Øµ½ÉÏÒ»²½</a> <a href=\"$PHP_SELF?step=-1\">Í˳ö°²×°</a></p>\n";
				echo $footer;
				
			}
		}
	} else {
		//Êý¾Ý¿âÁ¬½Ó³É¹¦
		$title = "CPF°²×°²½Öè2£º³¢ÊÔÁ¬½ÓÊý¾Ý¿â";
		outputheader($title);
		echo "<p class=\"title\">³¢ÊÔÁ¬½ÓÊý¾Ý¿â</p><p>Êý¾Ý¿âÁ¬½Ó³É¹¦£¬Äú¿ÉÒÔ¼ÌÐø°²×°¡£</p>";
	    echo "<p class=\"title\">ÇëÑ¡ÔñÏÂÒ»²½²Ù×÷</p><p><a href=\"$PHP_SELF?step=3\">¼ÌÐø°²×°</a> <a href=\"$PHP_SELF?step=1\">»Øµ½ÉÏÒ»²½</a> <a href=\"$PHP_SELF?step=-1\">Í˳ö°²×°</a></p>";		
		echo $footer;
	}
}

#²½Öè2¸½Êô²½Ö裺³¢ÊÔ´´½¨Êý¾Ý¿â
if ($step=="trycreatdb") {
	include ("config.php");

	#ADODB°üº¬
	include ("$adodbdir/adodb.inc.php");
	#ADODBÊý¾Ý¿âÁ¬½Ó
	$conn=&ADONEWConnection($dbtype);
	if ($usepconnect)
		$issuccess = $conn->PConnect($dbhost,$dbuser,$dbpassword);
	else $issuccess = $conn->Connect($dbhost,$dbuser,$dbpassword);
	#ADODB Êý×éģʽ
	$ADODB_FETCH_MODE = ADODB_FETCH_BOTH;
	#ADODB Debugģʽ
	$conn->debug = false;
	
	$title = "CPF°²×°²½Öè2£º³¢ÊÔÁ¬½ÓÊý¾Ý¿â";
	outputheader($title);
	echo "<p class=\"title\">½ø³Ì</p><p>ÄãÖ¸¶¨µÄÊý¾Ý¿â²»´æÔÚ£¬ÕýÔÚ³¢ÊÔ´´½¨Ëü...</p>";
	$conn->Execute("CREATE DATABASE $dbdb");
	echo "<p>³¢ÊÔÔÙ´ÎÁ¬½ÓÊý¾Ý¿â...</p>";
	if ($usepconnect)
		$issuccess = $conn->PConnect($dbhost,$dbuser,$dbpassword,$dbdb);
	else $issuccess = $conn->Connect($dbhost,$dbuser,$dbpassword,$dbdb);

	if (!$issuccess) {
			echo "<p>´´½¨Î´³É¹¦£¬ÇëÈ·±£ÄúµÄÊý¾Ý¿âºÍ·þÎñÆ÷ÅäÖÃÕýÈ·¡£</p>";
			echo "<p class=\"title\">ÇëÑ¡ÔñÏÂÒ»²½²Ù×÷</p><p><a href=\"$PHP_SELF?step=1\">·µ»ØÖØÐÂÉèÖÃ</a> <a href=\"javascript:history.back(1)\">»Øµ½ÉÏÒ»Ò³Ãæ</a> <a href=\"javascript:location.href='$PHPSELF?step=trycreatdb'\">Ë¢ÐÂÖØÊÔ</a> <a href=\"$PHP_SELF?step=-1\">Í˳ö°²×°</a></p>\n";
	} else {
			echo "<p>Êý¾Ý¿â´´½¨³É¹¦¡£Äú¿ÉÒÔ¼ÌÐø°²×°¡£</p>";
			echo "<p class=\"title\">ÇëÑ¡ÔñÏÂÒ»²½²Ù×÷</p><p><a href=\"$PHP_SELF?step=3\">¼ÌÐø°²×°</a> <a href=\"$PHP_SELF?step=2\">»Øµ½ÉÏÒ»²½</a> <a href=\"$PHP_SELF?step=-1\">Í˳ö°²×°</a></p>\n";
	}
}

#²½Öè3¿ªÊ¼£ºÑ¡ÔñÊÇȫа²×°»¹ÊÇÉý¼¶°²×°
if ($step==3) {
	$title = "CPF°²×°²½Öè3£ºÑ¡Ôñ°²×°·½Ê½";
	outputheader($title);
	echo "<form action=\"$PHP_SELF\" method=\"post\" name=\"form\">\n";
	echo "<p class=\"title\">ÇëÑ¡Ôñ°²×°·½Ê½</p><input type=\"radio\" name=\"step\" value=\"4a\" checked> ȫа²×°&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type=\"radio\" name=\"step\" value=\"4b\"> Éý¼¶°²×°";
	echo "<p class=\"title\">ÇëÑ¡ÔñÏÂÒ»²½²Ù×÷</p><p><a href=\"javascript:form.submit()\">¼ÌÐø°²×°</a> <a href=\"$PHP_SELF?step=2\">»Øµ½ÉÏÒ»²½</a> <a href=\"$PHP_SELF?step=-1\">Í˳ö°²×°</a></p></form>\n";
}

#²½Öè4a¿ªÊ¼£ºÈ«Ð°²×°
if ($step=="4a") {
	include ("config.php");

	#ADODB°üº¬
	include ("$adodbdir/adodb.inc.php");
	#ADODBÊý¾Ý¿âÁ¬½Ó
	$conn=&ADONEWConnection($dbtype);
	if ($usepconnect)
		$issuccess = $conn->PConnect($dbhost,$dbuser,$dbpassword,$dbdb);
	else $issuccess = $conn->Connect($dbhost,$dbuser,$dbpassword,$dbdb);
	#ADODB Êý×éģʽ
	$ADODB_FETCH_MODE = ADODB_FETCH_BOTH;
	#ADODB Debugģʽ
	$conn->debug = false;
	$tablecount = count($conn->MetaTables());
	if ($tablecount) {
		$title = "CPF°²×°²½Öè4£ºÈ«Ð°²×°Ç°µÄ×¼±¸";
		outputheader($title);
		echo "<p class=\"title\">Çë×¢Òâ</p><p>ÄúµÄÊý¾Ý¿â²»ÊÇ¿ÕÊý¾Ý¿â£¬Èç¹ûÄúÔø¾­°²×°¹ýCPF£¬Ñ¡Ôñ¡°¼ÌÐø°²×°¡±½«»áÇå¿Õ<b>Ô­ÓÐCPF</b>µÄÊý¾Ý¡£Èç¹ûÏ뽫Êý¾Ý¿âÖÐ<b>ËùÓÐ</b>Êý¾ÝÇå¿Õ£¬Äú¿ÉÒÔÑ¡Ôñ¡°Çå¿ÕÊý¾Ý¿â¡±¡£</p>\n";
		echo "<p class=\"title\">ÇëÑ¡ÔñÏÂÒ»²½²Ù×÷</p><p><a href=\"$PHP_SELF?step=5a\">¼ÌÐø°²×°</a> <a href=\"$PHP_SELF?step=deldb\">Çå¿ÕÊý¾Ý¿â</a> <a href=\"$PHP_SELF?step=3\">»Øµ½ÉÏÒ»²½</a> <a href=\"$PHP_SELF?step=-1\">Í˳ö°²×°</a></p></form>\n";
		echo $footer;
	} else {
		$title = "CPF°²×°²½Öè4£ºÈ«Ð°²×°Ç°µÄ×¼±¸";
		outputheader($title);
		echo "<p class=\"title\">Çë×¢Òâ</p><p>ÄúµÄÊý¾Ý¿âÊÇ¿ÕÊý¾Ý¿â£¬Äú¿ÉÒÔ¼ÌÐø°²×°¡£</p>\n";
		echo "<p class=\"title\">ÇëÑ¡ÔñÏÂÒ»²½²Ù×÷</p><p><a href=\"$PHP_SELF?step=5a\">¼ÌÐø°²×°</a> <a href=\"$PHP_SELF?step=1\">ÖØÐÂÑ¡ÔñÊý¾Ý¿â</a> <a href=\"$PHP_SELF?step=3\">»Øµ½ÉÏÒ»²½</a> <a href=\"$PHP_SELF?step=-1\">Í˳ö°²×°</a></p></form>\n";
		echo $footer;
	}
}

#²½Öè4a¸½Êô²½Ö裺Çå¿ÕÊý¾Ý¿â
if ($step=="deldb") {
	include ("config.php");

	#ADODB°üº¬
	include ("$adodbdir/adodb.inc.php");
	#ADODBÊý¾Ý¿âÁ¬½Ó
	$conn=&ADONEWConnection($dbtype);
	if ($usepconnect)
		$issuccess = $conn->PConnect($dbhost,$dbuser,$dbpassword,$dbdb);
	else $issuccess = $conn->Connect($dbhost,$dbuser,$dbpassword,$dbdb);
	#ADODB Êý×éģʽ
	$ADODB_FETCH_MODE = ADODB_FETCH_BOTH;
	#ADODB Debugģʽ
	$conn->debug = false;
	
	$tables = $conn->MetaTables();
	$tablecount = count($tables);
	for ($i = 0; $i <= $tablecount; $i++) {
		$conn->Execute("DROP TABLE $tables[$i]");
	}
	$title = "CPF°²×°²½Öè4£ºÈ«Ð°²×°Ç°µÄ×¼±¸";
	outputheader($title);
	echo "<p class=\"title\">Çë×¢Òâ</p><p>Êý¾Ý¿âÒѾ­Çå¿Õ£¬Äú¿ÉÒÔ¼ÌÐø°²×°¡£</p>\n";
	echo "<p class=\"title\">ÇëÑ¡ÔñÏÂÒ»²½²Ù×÷</p><p><a href=\"$PHP_SELF?step=5a\">¼ÌÐø°²×°</a> <a href=\"$PHP_SELF?step=1\">ÖØÐÂÑ¡ÔñÊý¾Ý¿â</a> <a href=\"$PHP_SELF?step=3\">»Øµ½ÉÏÒ»²½</a> <a href=\"$PHP_SELF?step=-1\">Í˳ö°²×°</a></p></form>\n";
	echo $footer;
}

#²½Öè5a£º¿ªÊ¼´´½¨Êý¾Ý±í
if ($step=="5a") {
	include ("config.php");
	#ADODB°üº¬
	include ("$adodbdir/adodb.inc.php");
	#ADODBÊý¾Ý¿âÁ¬½Ó
	$conn=&ADONEWConnection($dbtype);
	if ($usepconnect)
		$issuccess = $conn->PConnect($dbhost,$dbuser,$dbpassword,$dbdb);
	else $issuccess = $conn->Connect($dbhost,$dbuser,$dbpassword,$dbdb);
	#ADODB Êý×éģʽ
	$ADODB_FETCH_MODE = ADODB_FETCH_BOTH;
	#ADODB Debugģʽ
	$conn->debug = false;
	$title = "CPF°²×°²½Öè5£ºÕýÔÚ´´½¨Êý¾Ý±í";
	outputheader($title);
	echo "<p class=\"title\">½ø³Ì</p><p>";
	$conn->Execute("DROP TABLE IF EXISTS ".$prefix."_announcements");
	$conn->Execute("CREATE TABLE ".$prefix."_announcements (
		announcementid int(11) NOT NULL auto_increment,
		boardid int(11) DEFAULT '0' NOT NULL,
		userid int(11) DEFAULT '0' NOT NULL,
		starttime int(11) DEFAULT '0' NOT NULL,
		endtime int(11) DEFAULT '0' NOT NULL,
		topic varchar(70) NOT NULL,
		message text NOT NULL,
		PRIMARY KEY (announcementid)
	)");
	echo "".$prefix."_announcements ±í³É¹¦´´½¨<br>";
	
	$conn->Execute("DROP TABLE IF EXISTS ".$prefix."_attachment");
	$conn->Execute("CREATE TABLE ".$prefix."_attachment (
 		id smallint(5) NOT NULL auto_increment,
		originfilename varchar(255) NOT NULL default '',
		savefilename varchar(255) NOT NULL default '',
		postid tinyint(4) NOT NULL default '0',
		hits int(10) NOT NULL default '0',
		time timestamp(14) NOT NULL,
		PRIMARY KEY (id),
		KEY id(id)
	) TYPE=MyISAM;");
	echo "".$prefix."_attachment ±í³É¹¦´´½¨<br>";
   	
	$conn->Execute("DROP TABLE IF EXISTS ".$prefix."_avatars");
	$conn->Execute("CREATE TABLE ".$prefix."_avatars (
		id int(11) NOT NULL auto_increment,
		name varchar(250) NOT NULL,
		extension varchar(7) NOT NULL,
		groupid int(11) DEFAULT '0' NOT NULL,
		posts int(7) DEFAULT '0' NOT NULL,
		userid int(11) DEFAULT '0' NOT NULL,
		PRIMARY KEY (id)
	)");
	echo "".$prefix."_avatars ±í³É¹¦´´½¨<br>";

	$conn->Execute("DROP TABLE IF EXISTS ".$prefix."_bbcode");
	$conn->Execute("CREATE TABLE ".$prefix."_bbcode (
		id int(11) NOT NULL auto_increment,
		bbcodetag varchar(250) NOT NULL,
		bbcodereplace varchar(250) NOT NULL,
		params int(1) DEFAULT '1' NOT NULL,
		PRIMARY KEY (id)
	)");
	echo "".$prefix."_bbcode ±í³É¹¦´´½¨<br>";

	$conn->Execute("DROP TABLE IF EXISTS ".$prefix."_boards");
	$conn->Execute("CREATE TABLE ".$prefix."_boards (
		boardid int(11) NOT NULL auto_increment,
		boardparentid int(11) NOT NULL default '0',
		boardname varchar(70) NOT NULL default '',
		boardpassword varchar(25) NOT NULL default '',
		descriptiontext text NOT NULL,
		threads int(11) NOT NULL default '0',
		posts int(11) NOT NULL default '0',
		lastposttime int(11) NOT NULL default '0',
		lastpostid int(11) NOT NULL default '0',
		sort int(7) NOT NULL default '0',
		isboard int(1) NOT NULL default '0',
		invisible int(1) NOT NULL default '0',
		style_set int(11) NOT NULL default '0',
		replycanupload tinyint(1) NOT NULL default '0',
		canupload tinyint(1) NOT NULL default '0',
		maxuploadfilesize int(11) NOT NULL default '1024000',
		uploadfileextension varchar(225) NOT NULL default 'jpg,gif,zip,rar,txt',
		PRIMARY KEY (boardid)
	) TYPE=MyISAM;");
	echo "".$prefix."_boards ±í³É¹¦´´½¨<br>";

	$conn->Execute("DROP TABLE IF EXISTS ".$prefix."_config");
	$conn->Execute("CREATE TABLE ".$prefix."_config (
   	php_path varchar(200) NOT NULL,
   	master_board_name varchar(50) NOT NULL,
   	master_email varchar(70) NOT NULL,
   	html int(1) DEFAULT '0' NOT NULL,
   	smilies int(1) DEFAULT '0' NOT NULL,
   	bbcode int(1) DEFAULT '0' NOT NULL,
   	maximage int(2) DEFAULT '0' NOT NULL,
   	polls int(1) DEFAULT '0' NOT NULL,
   	image int(1) DEFAULT '0' NOT NULL,
   	image_ext text NOT NULL,
   	tproseite int(2) DEFAULT '0' NOT NULL,
   	eproseite int(2) DEFAULT '0' NOT NULL,
   	timeoffset int(3) DEFAULT '0' NOT NULL,
   	rekord int(7) DEFAULT '0' NOT NULL,
   	rekordtime int(11) DEFAULT '0' NOT NULL,
   	timeout int(2) DEFAULT '0' NOT NULL,
   	default_daysprune int(4) DEFAULT '0' NOT NULL,
   	hotthread_reply int(3) DEFAULT '0' NOT NULL,
   	hotthread_view int(5) DEFAULT '0' NOT NULL,
   	show_subboards int(1) DEFAULT '0' NOT NULL,
   	anzahl_smilies int(3) DEFAULT '0' NOT NULL,
   	cover char(1) NOT NULL,
   	badwords text NOT NULL,
   	ch_parseurl int(1) DEFAULT '0' NOT NULL,
   	ch_email int(1) DEFAULT '0' NOT NULL,
   	ch_disablesmilies int(1) DEFAULT '0' NOT NULL,
   	ch_signature int(1) DEFAULT '0' NOT NULL,
   	boardoff int(1) DEFAULT '0' NOT NULL,
   	boardoff_text text NOT NULL,
   	regdateformat varchar(30) NOT NULL,
   	shortdateformat varchar(30) NOT NULL,
   	longdateformat varchar(30) NOT NULL,
   	today varchar(30) NOT NULL,
   	timetype int(1) DEFAULT '0' NOT NULL,
   	postorder int(1) DEFAULT '0' NOT NULL,
   	register int(1) DEFAULT '0' NOT NULL,
   	act_code int(1) DEFAULT '0' NOT NULL,
   	act_permail int(1) DEFAULT '0' NOT NULL,
   	regnotify int(1) DEFAULT '0' NOT NULL,
   	multi_email int(1) DEFAULT '0' NOT NULL,
   	banname text NOT NULL,
   	banemail text NOT NULL,
   	sigsmilies int(1) DEFAULT '0' NOT NULL,
   	sigbbcode int(1) DEFAULT '0' NOT NULL,
   	sightml int(1) DEFAULT '0' NOT NULL,
   	sigimage int(1) DEFAULT '0' NOT NULL,
   	sigmaximage int(2) DEFAULT '0' NOT NULL,
   	sigimage_ext text NOT NULL,
   	siglength int(5) DEFAULT '0' NOT NULL,
   	avatars int(1) DEFAULT '0' NOT NULL,
   	avatarimage_ext text NOT NULL,
   	avatar_width int(3) DEFAULT '0' NOT NULL,
   	avatar_height int(3) DEFAULT '0' NOT NULL,
   	avatar_size int(6) DEFAULT '0' NOT NULL,
   	usertextlength int(4) DEFAULT '0' NOT NULL,
   	favboards int(2) DEFAULT '0' NOT NULL,
   	favthreads int(2) DEFAULT '0' NOT NULL,
   	pms int(1) DEFAULT '0' NOT NULL,
   	maxpms int(5) DEFAULT '0' NOT NULL,
   	maxfolder int(2) DEFAULT '0' NOT NULL,
	cpfversion varchar(30) NOT NULL default ' '
	)");
	echo "".$prefix."_config ±í³É¹¦´´½¨<br>";

	$conn->Execute("DROP TABLE IF EXISTS ".$prefix."_folders");
	$conn->Execute("CREATE TABLE ".$prefix."_folders (
   	folderid int(11) NOT NULL auto_increment,
   	userid int(11) DEFAULT '0' NOT NULL,
   	foldername varchar(100) NOT NULL,
   	PRIMARY KEY (folderid)
	)");
	echo "".$prefix."_folders ±í³É¹¦´´½¨<br>";

	$conn->Execute("DROP TABLE IF EXISTS ".$prefix."_groups");
	$conn->Execute("CREATE TABLE ".$prefix."_groups (
   	id int(11) NOT NULL auto_increment,
   	title varchar(30) NOT NULL,
   	canviewboard int(1) DEFAULT '0' NOT NULL,
   	canviewoffboard int(1) DEFAULT '0' NOT NULL,
   	canusesearch int(1) DEFAULT '0' NOT NULL,
   	canusepms int(1) DEFAULT '0' NOT NULL,
   	canstarttopic int(1) DEFAULT '0' NOT NULL,
   	canreplyowntopic int(1) DEFAULT '0' NOT NULL,
   	canreplytopic int(1) DEFAULT '0' NOT NULL,
   	caneditownpost int(1) DEFAULT '0' NOT NULL,
   	candelownpost int(1) DEFAULT '0' NOT NULL,
   	cancloseowntopic int(1) DEFAULT '0' NOT NULL,
   	candelowntopic int(1) DEFAULT '0' NOT NULL,
   	canpostpoll int(1) DEFAULT '0' NOT NULL,
   	canvotepoll int(1) DEFAULT '0' NOT NULL,
   	canuploadavatar int(1) DEFAULT '0' NOT NULL,
   	appendeditnote int(1) DEFAULT '0' NOT NULL,
   	avoidfc int(1) DEFAULT '0' NOT NULL,
   	ismod int(1) DEFAULT '0' NOT NULL,
   	issupermod int(1) DEFAULT '0' NOT NULL,
   	canuseacp int(1) DEFAULT '0' NOT NULL,
   	default_group int(1) DEFAULT '0' NOT NULL,
   	PRIMARY KEY (id)
	)");
	echo "".$prefix."_groups ±í³É¹¦´´½¨<br>";

	$conn->Execute("DROP TABLE IF EXISTS ".$prefix."_notify");
	$conn->Execute("CREATE TABLE ".$prefix."_notify (
   	threadid int(11) DEFAULT '0' NOT NULL,
  	userid int(11) DEFAULT '0' NOT NULL
	)");
	echo "".$prefix."_notify ±í³É¹¦´´½¨<br>";

	$conn->Execute("DROP TABLE IF EXISTS ".$prefix."_object2board");
	$conn->Execute("CREATE TABLE ".$prefix."_object2board (
   	boardid int(11) DEFAULT '0' NOT NULL,
   	objectid int(11) DEFAULT '0' NOT NULL,
   	mod int(1) DEFAULT '0' NOT NULL,
   	boardpermission int(1) DEFAULT '0' NOT NULL,
  	startpermission int(1) DEFAULT '0' NOT NULL,
   	replypermission int(1) DEFAULT '0' NOT NULL
	)");
	echo "".$prefix."_object2board ±í³É¹¦´´½¨<br>";

	$conn->Execute("DROP TABLE IF EXISTS ".$prefix."_object2user");
	$conn->Execute("CREATE TABLE ".$prefix."_object2user (
   	userid int(11) DEFAULT '0' NOT NULL,
   	objectid int(11) DEFAULT '0' NOT NULL,
   	favboards int(1) DEFAULT '0' NOT NULL,
   	favthreads int(1) DEFAULT '0' NOT NULL,
   	buddylist int(1) DEFAULT '0' NOT NULL,
   	ignorelist int(1) DEFAULT '0' NOT NULL,
   	pmsend int(1) DEFAULT '0' NOT NULL
	)");
	
	echo "".$prefix."_object2user ±í³É¹¦´´½¨<br>";
	$conn->Execute("DROP TABLE IF EXISTS ".$prefix."_pms");
    $conn->Execute("CREATE TABLE ".$prefix."_pms (
   	senderid int(11) DEFAULT '0' NOT NULL,
   	recipientid int(11) DEFAULT '0' NOT NULL,
   	pmid int(11) NOT NULL auto_increment,
  	folderid int(11) DEFAULT '0' NOT NULL,
   	view int(1) DEFAULT '0' NOT NULL,
   	reply int(1) DEFAULT '0' NOT NULL,
   	forward int(1) DEFAULT '0' NOT NULL,
   	sendtime int(11) DEFAULT '0' NOT NULL,
   	subject varchar(70) NOT NULL,
   	message text NOT NULL,
   	icon varchar(200) NOT NULL,
   	disable_smilies int(1) DEFAULT '0' NOT NULL,
   	signature int(1) DEFAULT '0' NOT NULL,
   	PRIMARY KEY (pmid)
	)");
	echo "".$prefix."_pms ±í³É¹¦´´½¨<br>";
	
	$conn->Execute("DROP TABLE IF EXISTS ".$prefix."_pmsend");
    $conn->Execute("CREATE TABLE ".$prefix."_pmsend (
   	userid int(11) DEFAULT '0' NOT NULL,
   	recipientid int(11) DEFAULT '0' NOT NULL,
   	pmparentid int(11) DEFAULT '0' NOT NULL,
   	pmid int(11) NOT NULL auto_increment,
   	sendtime int(11) DEFAULT '0' NOT NULL,
   	subject varchar(70) NOT NULL,
   	message text NOT NULL,
   	icon varchar(200) NOT NULL,
   	disable_smilies int(1) DEFAULT '0' NOT NULL,
   	signature int(1) DEFAULT '0' NOT NULL,
   	PRIMARY KEY (pmid)
	)");
	echo "".$prefix."_pmsend ±í³É¹¦´´½¨<br>";
	
	$conn->Execute("DROP TABLE IF EXISTS ".$prefix."_poll");
    $conn->Execute("CREATE TABLE ".$prefix."_poll (
   	id int(11) NOT NULL auto_increment,
   	threadid int(11) DEFAULT '0' NOT NULL,
   	field varchar(200) NOT NULL,
   	votes int(11) DEFAULT '0' NOT NULL,
   	PRIMARY KEY (id)
	)");
	echo "".$prefix."_poll ±í³É¹¦´´½¨<br>";
	
	$conn->Execute("DROP TABLE IF EXISTS ".$prefix."_posts");
    $conn->Execute("CREATE TABLE ".$prefix."_posts (
    boardparentid int(11) NOT NULL default '0',
    threadparentid int(11) NOT NULL default '0',
    postid int(11) NOT NULL auto_increment,
    userid int(11) NOT NULL default '0',
    posttime int(11) NOT NULL default '0',
    edittime int(11) NOT NULL default '0',
    editorid int(11) NOT NULL default '0',
    posttopic varchar(70) NOT NULL default '',
    message text NOT NULL,
    posticon varchar(200) NOT NULL default '0',
    disable_smilies int(1) NOT NULL default '0',
    signature int(1) NOT NULL default '0',
    ip varchar(15) NOT NULL default '',
    attachmentid smallint(5) NOT NULL default '0',
    PRIMARY KEY (postid)
    ) TYPE=MyISAM;");
	echo "".$prefix."_posts ±í³É¹¦´´½¨<br>";
	
	$conn->Execute("DROP TABLE IF EXISTS ".$prefix."_ranks");
    $conn->Execute("CREATE TABLE ".$prefix."_ranks (
   	id int(11) NOT NULL auto_increment,
   	groupid int(11) DEFAULT '1' NOT NULL,
   	posts int(7) DEFAULT '0' NOT NULL,
   	rank varchar(30) NOT NULL,
   	grafik varchar(250) NOT NULL,
   	mal int(2) DEFAULT '1' NOT NULL,
   	PRIMARY KEY (id)
	)");
	echo "".$prefix."_ranks ±í³É¹¦´´½¨<br>";
	
	$conn->Execute("DROP TABLE IF EXISTS ".$prefix."_smilies");
    $conn->Execute("CREATE TABLE ".$prefix."_smilies (
   	id int(11) NOT NULL auto_increment,
   	smiliespath varchar(255) NOT NULL,
   	smiliestext varchar(50) NOT NULL,
   	smiliestitle varchar(50) NOT NULL,
   	PRIMARY KEY (id)
	)");
	echo "".$prefix."_smilies ±í³É¹¦´´½¨<br>";
	
	$conn->Execute("DROP TABLE IF EXISTS ".$prefix."_style");
    $conn->Execute("CREATE TABLE ".$prefix."_style (
   	styleid int(11) NOT NULL auto_increment,
   	stylename varchar(50) NOT NULL,
   	templatefolder varchar(200) NOT NULL,
   	font varchar(100) NOT NULL,
   	fontcolor varchar(7) NOT NULL,
   	fontcolorsec varchar(7) NOT NULL,
   	fontcolorthi varchar(7) NOT NULL,
   	fontcolorfour varchar(7) NOT NULL,
   	bgcolor varchar(7) NOT NULL,
   	tablebg varchar(7) NOT NULL,
   	tablea varchar(7) NOT NULL,
   	tableb varchar(7) NOT NULL,
   	tablec varchar(7) NOT NULL,
   	tabled varchar(7) NOT NULL,
   	imageurl varchar(250) NOT NULL,
   	css text NOT NULL,
   	bgimage varchar(250) NOT NULL,
   	bgfixed int(1) DEFAULT '0' NOT NULL,
   	default_style int(1) DEFAULT '0' NOT NULL,
   	PRIMARY KEY (styleid)
	)");
	echo "".$prefix."_style ±í³É¹¦´´½¨<br>";
	
	$conn->Execute("DROP TABLE IF EXISTS ".$prefix."_threads");
    $conn->Execute("CREATE TABLE ".$prefix."_threads (
    boardparentid int(11) NOT NULL default '0',
    starttime int(11) NOT NULL default '0',
    threadid int(11) NOT NULL auto_increment,
    threadname varchar(70) NOT NULL default '',
    authorid int(11) NOT NULL default '0',
    replies int(11) NOT NULL default '0',
    views int(11) NOT NULL default '0',
    timelastreply int(11) NOT NULL default '0',
    flags int(11) NOT NULL default '0',
    topicicon varchar(200) NOT NULL default '',
    rate_points int(15) NOT NULL default '0',
    rated int(11) NOT NULL default '0',
    putoffid int(11) NOT NULL default '0',
    important int(1) NOT NULL default '0',
    pquestion varchar(250) NOT NULL default '',
    ptimeout int(11) NOT NULL default '0',
    attachmentid smallint(5) NOT NULL default '0',
	prime tinyint(1) NOT NULL default '0',
    PRIMARY KEY (threadid)
    ) TYPE=MyISAM;");
	echo "".$prefix."_threads ±í³É¹¦´´½¨<br>";
	
	$conn->Execute("DROP TABLE IF EXISTS ".$prefix."_user_table");
    $conn->Execute("CREATE TABLE ".$prefix."_user_table (
  userid int(11) NOT NULL auto_increment,
  username varchar(30) NOT NULL default '',
  userpassword varchar(50) NOT NULL default '',
  useremail varchar(150) NOT NULL default '',
  regemail varchar(150) NOT NULL default '',
  userposts int(11) NOT NULL default '0',
  groupid int(7) NOT NULL default '0',
  statusextra varchar(25) default NULL,
  regdate int(11) NOT NULL default '0',
  lastvisit int(11) NOT NULL default '0',
  lastactivity int(11) NOT NULL default '0',
  session_link int(1) NOT NULL default '1',
  signatur text NOT NULL,
  usericq varchar(30) NOT NULL default '',
  userqq varchar(30) NOT NULL default '',
  aim varchar(30) NOT NULL default '',
  yim varchar(30) NOT NULL default '',
  userhp varchar(200) NOT NULL default '',
  age_m varchar(10) NOT NULL default '',
  age_d int(2) NOT NULL default '0',
  age_y int(4) NOT NULL default '0',
  avatarid int(11) NOT NULL default '0',
  interests varchar(250) NOT NULL default '',
  location varchar(250) NOT NULL default '',
  work varchar(250) NOT NULL default '',
  gender int(1) NOT NULL default '0',
  usertext text NOT NULL,
  show_email_global int(1) NOT NULL default '0',
  mods_may_email int(1) NOT NULL default '1',
  users_may_email int(1) NOT NULL default '1',
  invisible int(1) NOT NULL default '0',
  hide_signature int(1) NOT NULL default '0',
  hide_userpic int(1) NOT NULL default '0',
  prunedays int(4) NOT NULL default '0',
  umaxposts int(2) NOT NULL default '0',
  bbcode int(1) NOT NULL default '1',
  style_set int(11) NOT NULL default '0',
  activation int(10) NOT NULL default '0',
  blocked int(1) NOT NULL default '0',
  PRIMARY KEY (userid)
) TYPE=MyISAM;");
	echo "".$prefix."_user_table ±í³É¹¦´´½¨<br>";
	
	$conn->Execute("DROP TABLE IF EXISTS ".$prefix."_useronline");
    $conn->Execute("CREATE TABLE ".$prefix."_useronline (
   	zeit int(11) DEFAULT '0' NOT NULL,
   	ip varchar(15) DEFAULT '0' NOT NULL,
   	userid int(11) DEFAULT '0' NOT NULL
	)");
	echo "".$prefix."_useronline ±í³É¹¦´´½¨<br>";
	
	$conn->Execute("DROP TABLE IF EXISTS ".$prefix."_vote");
    $conn->Execute("CREATE TABLE ".$prefix."_vote (
   	threadid int(11) DEFAULT '0' NOT NULL,
   	userid int(11) DEFAULT '0' NOT NULL
	)");
	echo "".$prefix."_vote ±í³É¹¦´´½¨</p>";

	echo "<p>ËùÓбíÒѳɹ¦´´½¨£¡ÏÂÒ»²½½«ËùÓгõʼÊý¾Ýµ¼ÈëÊý¾Ý¿â</p>";
	echo "<p class=\"title\">ÇëÑ¡ÔñÏÂÒ»²½²Ù×÷</p><p><a href=\"$PHP_SELF?step=6a\">¼ÌÐø°²×°</a> <a href=\"$PHP_SELF?step=4a\">»Øµ½ÉÏÒ»²½</a> <a href=\"$PHP_SELF?step=-1\">Í˳ö°²×°</a></p>\n";


	echo $footer;

}

#²½Öè6a£º¿ªÊ¼µ¼ÈëԭʼÊý¾Ý
if ($step=="6a") {
	include ("config.php");
	#ADODB°üº¬
	include ("$adodbdir/adodb.inc.php");
	#ADODBÊý¾Ý¿âÁ¬½Ó
	$conn=&ADONEWConnection($dbtype);
	if ($usepconnect)
		$issuccess = $conn->PConnect($dbhost,$dbuser,$dbpassword,$dbdb);
	else $issuccess = $conn->Connect($dbhost,$dbuser,$dbpassword,$dbdb);
	#ADODB Êý×éģʽ
	$ADODB_FETCH_MODE = ADODB_FETCH_BOTH;
	#ADODB Debugģʽ
	$conn->debug = false;
	$title = "CPF°²×°²½Öè6£ºÕýÔÚµ¼Èë³õʼÊý¾Ý";
	outputheader($title);
	echo "<p class=\"title\">½ø³Ì</p><p>";
	$conn->Execute("INSERT INTO ".$prefix."_bbcode VALUES ( '1', 'b', '<b>\\\\1</b>', '1');");
	$conn->Execute("INSERT INTO ".$prefix."_bbcode VALUES ( '2', 'i', '<i>\\\\1</i>', '1');");
	$conn->Execute("INSERT INTO ".$prefix."_bbcode VALUES ( '3', 'email', '<a href=\"mailto:\\\\1\">\\\\1</a>', '1');");
	$conn->Execute("INSERT INTO ".$prefix."_bbcode VALUES ( '4', 'email', '<a href=\"mailto:\\\\2\">\\\\3</a>', '2');");
	$conn->Execute("INSERT INTO ".$prefix."_bbcode VALUES ( '5', 'size', '<font size=\"\\\\2\">\\\\3</font>', '2');");
	$conn->Execute("INSERT INTO ".$prefix."_bbcode VALUES ( '6', 'quote', '<blockquote><font face=\"{font}\">ÒýÓÃ:</font><hr>\\\\1<hr></blockquote>', '1');");
	$conn->Execute("INSERT INTO ".$prefix."_bbcode VALUES ( '7', 'u', '<u>\\\\1</u>', '1');");
	$conn->Execute("INSERT INTO ".$prefix."_bbcode VALUES ( '8', 'color', '<font color=\"\\\\2\">\\\\3</font>', '2');");
	$conn->Execute("INSERT INTO ".$prefix."_bbcode VALUES ( '9', 'font', '<font face=\"\\\\2\">\\\\3</font>', '2');");
	$conn->Execute("INSERT INTO ".$prefix."_bbcode VALUES ( '10', 'align', '<div align=\"\\\\2\">\\\\3</div>', '2');");
	$conn->Execute("INSERT INTO ".$prefix."_bbcode VALUES ( '11', 'mark', '<span style=\"background-color: \\\\2\">\\\\3</span>', '2');");
	echo "".$prefix."_bbcode ±í³õʼÊý¾ÝÒÑÊäÈë<br>";
	
	$conn->Execute("INSERT INTO ".$prefix."_groups VALUES ( '1', '¹ÜÀíÔ±', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '0', '1', '1', '1', '1', '0');");
	$conn->Execute("INSERT INTO ".$prefix."_groups VALUES ( '2', '°æÖ÷', '1', '0', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '0', '0', '1', '0', '0', '0');");
	$conn->Execute("INSERT INTO ".$prefix."_groups VALUES ( '3', '»áÔ±', '1', '0', '1', '1', '1', '1', '1', '1', '0', '0', '0', '0', '1', '0', '1', '0', '0', '0', '0', '2');");
	$conn->Execute("INSERT INTO ".$prefix."_groups VALUES ( '4', '¹ý¿Í', '1', '0', '1', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '1');");
	$conn->Execute("INSERT INTO ".$prefix."_groups VALUES ( '5', '³¬¼¶°æÖ÷', '1', '0', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '0', '0', '1', '1', '0', '0');");
	echo "".$prefix."_groups ±í³õʼÊý¾ÝÒÑÊäÈë<br>";

	$conn->Execute("INSERT INTO ".$prefix."_style VALUES (1,'±ê×¼Ñùʽ','templates','Verdana, ÐÂËÎÌå, ËÎÌå, Arial, Helvetica, sans-serif','#000000','#000000','#000000','#FFF788','#FFFFFF','#000000','#9CBBD1','#FFFFFF','#AFC6DB','#DEE7EF','images/bblogo.gif','TABLE {FONT-SIZE:12px;color:#000000} BODY { SCROLLBAR-FACE-COLOR: #9CBBD1; SCROLLBAR-HIGHLIGHT-COLOR: #000000; SCROLLBAR-SHADOW-COLOR: #000000; SCROLLBAR-3DLIGHT-COLOR: #ffffff; SCROLLBAR-ARROW-COLOR: #ffffff; SCROLLBAR-TRACK-COLOR: #f5f5f5; SCROLLBAR-DARKSHADOW-COLOR: #ffffff; FONT-SIZE:12px} SELECT { FONT-FAMILY: Verdana,ËÎÌå, Arial, Helvetica, sans-serif; FONT-SIZE: 12px; background-color: #CCCCCC;border-style: solid; border-width:1} .input {font-family: Verdana,ËÎÌå, Arial, Helvetica, sans-serif; color:black; font-size:12px; background-color: #CCCCCC;border-style: solid; border-width:1; height:20} textarea {font-family: Verdana,ËÎÌå, Arial, Helvetica, sans-serif; color:black; font-size:12px; background-color: #CCCCCC;border-style: solid; border-width:1;} #bg A:link, #bg A:visited, #bg A:active { COLOR: #000000; TEXT-DECORATION: underline; } #bg A:hover { COLOR: #000000; TEXT-DECORATION: none; } #cat A:link, #cat A:visited, #cat A:active { COLOR: #000000; TEXT-DECORATION: none; } #cat A:hover { COLOR: #000000; TEXT-DECORATION: underline; } #title A:link, #title A:visited, #title A:active { COLOR: #000000; TEXT-DECORATION: none; } #title A:hover { COLOR: #000000; TEXT-DECORATION: underline; }  ','',1,1)");
	echo "".$prefix."_style ±í³õʼÊý¾ÝÒÑÊäÈë<br>";

	$conn->Execute("INSERT INTO ".$prefix."_ranks VALUES ( '1', '1', '0', '¹ÜÀíÔ±', 'images/star3.gif', '6');");
	$conn->Execute("INSERT INTO ".$prefix."_ranks VALUES ( '2', '2', '0', '°æÖ÷', 'images/star3.gif', '4');");
	$conn->Execute("INSERT INTO ".$prefix."_ranks VALUES ( '3', '3', '0', 'ÐÂÊÖÉÏ·', 'images/star.gif', '1');");
	$conn->Execute("INSERT INTO ".$prefix."_ranks VALUES ( '4', '3', '10', 'ÐÂÊÖÉÏ·Cool£¡', 'images/star.gif', '2');");
	$conn->Execute("INSERT INTO ".$prefix."_ranks VALUES ( '5', '3', '25', '»áÔ±', 'images/star.gif', '3');");
	$conn->Execute("INSERT INTO ".$prefix."_ranks VALUES ( '6', '3', '50', 'ÏÀ¿Í', 'images/star.gif', '4');");
	$conn->Execute("INSERT INTO ".$prefix."_ranks VALUES ( '7', '3', '75', 'Forum As', 'images/star.gif', '5');");
	$conn->Execute("INSERT INTO ".$prefix."_ranks VALUES ( '8', '3', '100', 'Double-As', 'images/star2.gif', '1');");
	$conn->Execute("INSERT INTO ".$prefix."_ranks VALUES ( '9', '3', '150', 'Tripel-As', 'images/star2.gif', '2');");
	$conn->Execute("INSERT INTO ".$prefix."_ranks VALUES ( '10', '3', '250', 'Routinier', 'images/star2.gif', '3');");
	$conn->Execute("INSERT INTO ".$prefix."_ranks VALUES ( '11', '3', '500', 'Viking', 'images/star2.gif', '4');");
	$conn->Execute("INSERT INTO ".$prefix."_ranks VALUES ( '12', '3', '750', 'King', 'images/star2.gif', '5');");
	$conn->Execute("INSERT INTO ".$prefix."_ranks VALUES ( '13', '3', '1000', 'Emperor', 'images/star3.gif', '1');");
	$conn->Execute("INSERT INTO ".$prefix."_ranks VALUES ( '14', '3', '1500', 'Forum Legend', 'images/star3.gif', '2');");
	$conn->Execute("INSERT INTO ".$prefix."_ranks VALUES ( '15', '3', '2000', 'Forum God', 'images/star3.gif', '3');");
	$conn->Execute("INSERT INTO ".$prefix."_ranks VALUES ( '16', '5', '0', '³¬¼¶°æÖ÷', 'images/star3.gif', '5');");
	echo "".$prefix."_ranks ±í³õʼÊý¾ÝÒÑÊäÈë<br>";

	$conn->Execute("INSERT INTO ".$prefix."_smilies VALUES ( '2', 'images/smilies/biggrin.gif', ':D', 'big grin')");
	$conn->Execute("INSERT INTO ".$prefix."_smilies VALUES ( '3', 'images/smilies/redface.gif', ':O', 'red face')");
	$conn->Execute("INSERT INTO ".$prefix."_smilies VALUES ( '4', 'images/smilies/confused.gif', '?(', 'confused')");
	$conn->Execute("INSERT INTO ".$prefix."_smilies VALUES ( '5', 'images/smilies/cool.gif', '8)', 'cool')");
	$conn->Execute("INSERT INTO ".$prefix."_smilies VALUES ( '6', 'images/smilies/crying.gif', ';(', 'sad')");
	$conn->Execute("INSERT INTO ".$prefix."_smilies VALUES ( '7', 'images/smilies/eek.gif', '8o', 'shocked')");
	$conn->Execute("INSERT INTO ".$prefix."_smilies VALUES ( '8', 'images/smilies/pleased.gif', ':]', 'gladness')");
	$conn->Execute("INSERT INTO ".$prefix."_smilies VALUES ( '9', 'images/smilies/frown.gif', ':(', 'unhappy')");
	$conn->Execute("INSERT INTO ".$prefix."_smilies VALUES ( '10', 'images/smilies/happy.gif', ':))', 'happy')");
	$conn->Execute("INSERT INTO ".$prefix."_smilies VALUES ( '11', 'images/smilies/mad.gif', 'X(', 'evil')");
	$conn->Execute("INSERT INTO ".$prefix."_smilies VALUES ( '12', 'images/smilies/smile.gif', ':)', 'smile')");
	$conn->Execute("INSERT INTO ".$prefix."_smilies VALUES ( '13', 'images/smilies/tongue.gif', ':P', 'stick out tongue')");
	$conn->Execute("INSERT INTO ".$prefix."_smilies VALUES ( '14', 'images/smilies/wink.gif', ';)', 'wink')");
	$conn->Execute("INSERT INTO ".$prefix."_smilies VALUES ( '15', 'images/smilies/rolleyes.gif', ':rolleyes:', 'roll eyes')");
	$conn->Execute("INSERT INTO ".$prefix."_smilies VALUES ( '16', 'images/smilies/baby.gif', ':baby:', 'baby')");
	$conn->Execute("INSERT INTO ".$prefix."_smilies VALUES ( '17', 'images/smilies/evil.gif', ':evil:', 'satan')");
	$conn->Execute("INSERT INTO ".$prefix."_smilies VALUES ( '18', 'images/smilies/tongue2.gif', ':tongue:', 'stick out tongue')");
	echo "".$prefix."_smilies ±í³õʼÊý¾ÝÒÑÊäÈë<br>";

	$conn->Execute("INSERT INTO ".$prefix."_avatars VALUES (1,'Image1','gif','','','');");
	$conn->Execute("INSERT INTO ".$prefix."_avatars VALUES (2,'Image2','gif','','','');");
	$conn->Execute("INSERT INTO ".$prefix."_avatars VALUES (3,'Image3','gif','','','');");
	$conn->Execute("INSERT INTO ".$prefix."_avatars VALUES (4,'Image4','gif','','','');");
	$conn->Execute("INSERT INTO ".$prefix."_avatars VALUES (5,'Image5','gif','','','');");
	$conn->Execute("INSERT INTO ".$prefix."_avatars VALUES (6,'Image6','gif','','','');");
	$conn->Execute("INSERT INTO ".$prefix."_avatars VALUES (7,'Image7','gif','','','');");
	$conn->Execute("INSERT INTO ".$prefix."_avatars VALUES (8,'Image8','gif','','','');");
	$conn->Execute("INSERT INTO ".$prefix."_avatars VALUES (9,'Image9','gif','','','');");
	$conn->Execute("INSERT INTO ".$prefix."_avatars VALUES (10,'Image10','gif','','','');");
	$conn->Execute("INSERT INTO ".$prefix."_avatars VALUES (11,'Image11','gif','','','');");
	$conn->Execute("INSERT INTO ".$prefix."_avatars VALUES (12,'Image12','gif','','','');");
	$conn->Execute("INSERT INTO ".$prefix."_avatars VALUES (13,'Image13','gif','','','');");
	$conn->Execute("INSERT INTO ".$prefix."_avatars VALUES (14,'Image14','gif','','','');");
	$conn->Execute("INSERT INTO ".$prefix."_avatars VALUES (15,'Image15','gif','','','');");
	$conn->Execute("INSERT INTO ".$prefix."_avatars VALUES (16,'Image16','gif','','','');");
	$conn->Execute("INSERT INTO ".$prefix."_avatars VALUES (17,'Image17','gif','','','');");
	$conn->Execute("INSERT INTO ".$prefix."_avatars VALUES (18,'Image18','gif','','','');");
	$conn->Execute("INSERT INTO ".$prefix."_avatars VALUES (19,'Image19','gif','','','');");
	$conn->Execute("INSERT INTO ".$prefix."_avatars VALUES (20,'Image20','gif','','','');");
	$conn->Execute("INSERT INTO ".$prefix."_avatars VALUES (21,'Image21','gif','','','');");
	$conn->Execute("INSERT INTO ".$prefix."_avatars VALUES (22,'Image22','gif','','','');");
	$conn->Execute("INSERT INTO ".$prefix."_avatars VALUES (23,'Image23','gif','','','');");
	$conn->Execute("INSERT INTO ".$prefix."_avatars VALUES (24,'Image24','gif','','','');");
	$conn->Execute("INSERT INTO ".$prefix."_avatars VALUES (25,'Image25','gif','','','');");
	$conn->Execute("INSERT INTO ".$prefix."_avatars VALUES (26,'Image26','gif','','','');");
	$conn->Execute("INSERT INTO ".$prefix."_avatars VALUES (27,'Image27','gif','','','');");
	$conn->Execute("INSERT INTO ".$prefix."_avatars VALUES (28,'Image28','gif','','','');");
	$conn->Execute("INSERT INTO ".$prefix."_avatars VALUES (29,'Image29','gif','','','');");
	$conn->Execute("INSERT INTO ".$prefix."_avatars VALUES (30,'Image30','gif','','','');");
	$conn->Execute("INSERT INTO ".$prefix."_avatars VALUES (31,'Image31','gif','','','');");
	$conn->Execute("INSERT INTO ".$prefix."_avatars VALUES (32,'Image32','gif','','','');");
	$conn->Execute("INSERT INTO ".$prefix."_avatars VALUES (33,'Image33','gif','','','');");
	$conn->Execute("INSERT INTO ".$prefix."_avatars VALUES (34,'Image34','gif','','','');");
	$conn->Execute("INSERT INTO ".$prefix."_avatars VALUES (35,'Image35','gif','','','');");
	$conn->Execute("INSERT INTO ".$prefix."_avatars VALUES (36,'Image36','gif','','','');");
	$conn->Execute("INSERT INTO ".$prefix."_avatars VALUES (37,'Image37','gif','','','');");
	$conn->Execute("INSERT INTO ".$prefix."_avatars VALUES (38,'Image38','gif','','','');");
	$conn->Execute("INSERT INTO ".$prefix."_avatars VALUES (39,'Image39','gif','','','');");
	$conn->Execute("INSERT INTO ".$prefix."_avatars VALUES (40,'Image40','gif','','','');");
	$conn->Execute("INSERT INTO ".$prefix."_avatars VALUES (41,'Image41','gif','','','');");
	$conn->Execute("INSERT INTO ".$prefix."_avatars VALUES (42,'Image42','gif','','','');");
	$conn->Execute("INSERT INTO ".$prefix."_avatars VALUES (43,'Image43','gif','','','');");
	$conn->Execute("INSERT INTO ".$prefix."_avatars VALUES (44,'Image44','gif','','','');");
	$conn->Execute("INSERT INTO ".$prefix."_avatars VALUES (45,'Image45','gif','','','');");
	$conn->Execute("INSERT INTO ".$prefix."_avatars VALUES (46,'Image46','gif','','','');");
	$conn->Execute("INSERT INTO ".$prefix."_avatars VALUES (47,'Image47','gif','','','');");
	$conn->Execute("INSERT INTO ".$prefix."_avatars VALUES (48,'Image48','gif','','','');");
	$conn->Execute("INSERT INTO ".$prefix."_avatars VALUES (49,'Image49','gif','','','');");
	$conn->Execute("INSERT INTO ".$prefix."_avatars VALUES (50,'Image50','gif','','','');");
	$conn->Execute("INSERT INTO ".$prefix."_avatars VALUES (51,'Image51','gif','','','');");
	$conn->Execute("INSERT INTO ".$prefix."_avatars VALUES (52,'Image52','gif','','','');");
	$conn->Execute("INSERT INTO ".$prefix."_avatars VALUES (53,'Image53','gif','','','');");
	$conn->Execute("INSERT INTO ".$prefix."_avatars VALUES (54,'Image54','gif','','','');");
	$conn->Execute("INSERT INTO ".$prefix."_avatars VALUES (55,'Image55','gif','','','');");
	$conn->Execute("INSERT INTO ".$prefix."_avatars VALUES (56,'Image56','gif','','','');");
	$conn->Execute("INSERT INTO ".$prefix."_avatars VALUES (57,'Image57','gif','','','');");
	$conn->Execute("INSERT INTO ".$prefix."_avatars VALUES (58,'Image58','gif','','','');");
	$conn->Execute("INSERT INTO ".$prefix."_avatars VALUES (59,'Image59','gif','','','');");
	$conn->Execute("INSERT INTO ".$prefix."_avatars VALUES (60,'Image60','gif','','','');");
	echo "".$prefix."_avatars ±í³õʼÊý¾ÝÒÑÊäÈë<br>";

	$conn->Execute("INSERT INTO ".$prefix."_config VALUES ( 'http://www.yourdomain.com/cpf', 'Chinese Piglet Forum', 'hide@address.com', '0', '1', '1', '10', '1', '1', 'gif
		jpeg
		jpg
		', '30', '20', '0', '3', '992705018', '5', '1000', '15', '150', '1', '15', '*', '{badword=goodword}', '1', '0', '0', '1', '0', '', 'YYYYÄêMMÔÂ', 'YYYY.MM.DD', 'YYYY.MM.DD, HH:II', 'YYYY.MM.DD=½ñÌì', '0', '0', '1', '0', '1', '0', '0', '', '', '1', '1', '0', '1', '1', 'gif
		jpeg
		jpg', '300', '1', 'jpg
		gif
		jpeg', '90', '90', '10000', '50', '5', '20', '1', '100', '5', '$version')");
	echo "".$prefix."_config ±í³õʼÊý¾ÝÒÑÊäÈë</p>";

	echo "<p>ËùÓбíµÄ³õʼÊý¾Ý¶¼ÒÑÊäÈë¡£ÏÂÒ»²½½«ÉèÖùÜÀíÔ±ÐÅÏ¢¡£</p>";
	echo "<p class=\"title\">ÇëÑ¡ÔñÏÂÒ»²½²Ù×÷</p><p><a href=\"$PHP_SELF?step=7a\">¼ÌÐø°²×°</a> <a href=\"$PHP_SELF?step=5a\">»Øµ½ÉÏÒ»²½</a> <a href=\"$PHP_SELF?step=-1\">Í˳ö°²×°</a></p>\n";

	echo $footer;
}

#²½Öè7a£ºÉèÖùÜÀíÔ±ÐÅÏ¢
if ($step=="7a") {
	$title = "CPF°²×°²½Öè7£ºÉèÖùÜÀíÔ±ÐÅÏ¢";
	outputheader($title);
	echo "<p class=\"title\">ÇëÊäÈë¹ÜÀíÔ±ÐÅÏ¢</p><p>";
	echo "<form name=\"form\" method=\"post\" action=\"$PHP_SELF\">
	  <table width=\"75%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
	    <tr> 
	      <td>¹ÜÀíÔ±Óû§Ãû£º</td>
	      <td> 
	        <input type=\"text\" name=\"username\">
	      </td>
	    </tr>
	    <tr> 
	      <td>¹ÜÀíÔ±ÃÜÂ룺</td>
	      <td> 
    	    <input type=\"text\" name=\"userpassword\">
	      </td>
    	</tr>
	    <tr> 
	      <td>¹ÜÀíÔ±Email£º</td>
	      <td> 
	        <input type=\"text\" name=\"useremail\">
	      </td>
	    </tr>
	  </table>
	  <input type=\"hidden\" name=\"step\" value=\"8a\">";
	echo "<p class=\"title\">ÇëÑ¡ÔñÏÂÒ»²½²Ù×÷</p><p><a href=\"javascript:form.submit();\">¼ÌÐø°²×°</a> <a href=\"$PHP_SELF?step=6a\">»Øµ½ÉÏÒ»²½</a> <a href=\"$PHP_SELF?step=-1\">Í˳ö°²×°</a></p></form>\n";
	echo $footer;
}

#²½Öè8a£ºÂÛ̳³õʼÐÅÏ¢ÉèÖÃ
if ($step=="8a") {
	include ("config.php");
	#ADODB°üº¬
	include ("$adodbdir/adodb.inc.php");
	#ADODBÊý¾Ý¿âÁ¬½Ó
	$conn=&ADONEWConnection($dbtype);
	if ($usepconnect)
		$issuccess = $conn->PConnect($dbhost,$dbuser,$dbpassword,$dbdb);
	else $issuccess = $conn->Connect($dbhost,$dbuser,$dbpassword,$dbdb);
	#ADODB Êý×éģʽ
	$ADODB_FETCH_MODE = ADODB_FETCH_BOTH;
	#ADODB Debugģʽ
	$conn->debug = false;
		
	if(!$username || !$useremail || !$userpassword) {
		$title = "CPF°²×°²½Öè7£º¹ÜÀíÔ±ÐÅÏ¢ÉèÖÃ";
		outputheader($title);
		echo "<p class=\"title\">´íÎó</p><p>";
		echo "<p>Äú±ØÐëÌîÂú¹ÜÀíÔ±ÐÅÏ¢ÉèÖõÄËùÓпոñ¡£";
		echo "<p class=\"title\">ÇëÑ¡ÔñÏÂÒ»²½²Ù×÷</p><p><a href=\"$PHP_SELF?step=7a\">·µ»ØÖØÐÂÉèÖÃ</a> <a href=\"$PHP_SELF?step=-1\">Í˳ö°²×°</a></p></form>\n";
	} else {
		$title = "CPF°²×°²½Öè8£ºÂÛ̳³õʼÐÅÏ¢ÉèÖÃ";
		outputheader($title);
		echo "<p class=\"title\">ÐÅÏ¢</p><p>";
		$time = time();
		$conn->Execute("INSERT INTO ".$prefix."_user_table (username,userpassword,useremail,regemail,groupid,regdate,lastvisit,lastactivity,activation) VALUES ('$username','".md5($userpassword)."','$useremail','$useremail','1','$time','$time','$time','1')");
		echo "<p>¹ÜÀíÔ±ÐÅÏ¢ÉèÖÃÍê±Ï¡£½ÓÏÂÀ´ÇëÉèÖÃÂÛ̳µÄ³õʼÐÅÏ¢¡£</p>";
		echo "<p class=\"title\">ÉèÖÃÂÛ̳³õʼÐÅÏ¢</p><p>";
		echo "<form name=\"form\" method=\"post\" action=\"$PHP_SELF\">
		  <table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
		    <tr> 
		      <td>ÂÛ̳±êÌ⣺</td>
		      <td> 
		        <input type=\"text\" name=\"boardname\" value=\"Chinese P Forum\" size=\"30\">
		      </td>
		    </tr>
		    <tr> 
		      <td>ÂÛ̳·¾¶£º</td>
		      <td><input type=\"text\" name=\"php_path\" value=\"http://www.yourdomain.com/cpf\" size=\"30\">
		        £¨Çë²»ÒªÔÚĩβ¼Ó¡°/¡±£©</td>
		    </tr>
		    <tr> 
		      <td>ÊÇ·ñʹÓÃÓû§¼¤»îÂ뼤»î¹¦ÄÜ£º</td>
		      <td> 
		        <input type=\"radio\" name=\"act_code\" value=\"1\">
		        ÊÇ¡ª¡ªÓû§ÐèÒªÑéÖ¤ 
		        <input type=\"radio\" name=\"act_code\" value=\"0\" checked>
		        ·ñ¡ª¡ªÓû§×Ô¶¯¼¤»î</td>
		    </tr>
		    <tr> 
		      <td>ÊÇ·ñʹÓÃEmailÑéÖ¤£º</td>
		      <td> 
		        <input type=\"radio\" name=\"act_permail\" value=\"1\">
		        ÊÇ¡ª¡ªÉÏÃæµÄÑ¡ÏîҲҪѡÊÇ 
		        <input type=\"radio\" name=\"act_permail\" value=\"0\" checked>
		        ·ñ¡ª¡ªÈç¹ûÉÏÃæÑ¡ÏîÑ¡ÊǶøÑ¡Ôñ¸ÃÏÔòÓû§ÐèÒª¹ÜÀíÔ±ÊÖ¹¤ÑéÖ¤</td>
		    </tr>
		    <tr> 
		      <td>ÊÇ·ñÔÊÐíʹÓÃÖظ´µÄEmailµØÖ·£º</td>
		      <td> 
		        <input type=\"radio\" name=\"multi_email\" value=\"1\">
		        ÊÇ 
		        <input type=\"radio\" name=\"multi_email\" value=\"0\" checked>
		        ·ñ</td>
		    </tr>
		    <tr> 
		      <td>
		        <input type=\"hidden\" name=\"step\" value=\"9a\">
		      </td>
		      <td>&nbsp;</td>
		    </tr>
		    <tr> 
		      <td colspan=\"2\">¸ü¶àÑ¡Ïî¿ÉÒÔÔÚ¹ÜÀíÃæ°åÖÐÉèÖá£ÏÂÒ»²½°²×°±ã¿ÉÍê³ÉÁË£¡</td>
		    </tr>
		  </table>";
		echo "<p class=\"title\">ÇëÑ¡ÔñÏÂÒ»²½²Ù×÷</p><p><a href=\"javascript:form.submit();\">Íê³É°²×°</a> <a href=\"$PHP_SELF?step=6a\">»Øµ½ÉÏÒ»²½</a> <a href=\"$PHP_SELF?step=-1\">Í˳ö°²×°</a></p></form>\n";
	}
	echo $footer;
}

#²½Öè9a£ºÍê³Éȫа²×°
if ($step=="9a") {
	include ("config.php");
	#ADODB°üº¬
	include ("$adodbdir/adodb.inc.php");
	#ADODBÊý¾Ý¿âÁ¬½Ó
	$conn=&ADONEWConnection($dbtype);
	if ($usepconnect)
		$issuccess = $conn->PConnect($dbhost,$dbuser,$dbpassword,$dbdb);
	else $issuccess = $conn->Connect($dbhost,$dbuser,$dbpassword,$dbdb);
	#ADODB Êý×éģʽ
	$ADODB_FETCH_MODE = ADODB_FETCH_BOTH;
	#ADODB Debugģʽ
	$conn->debug = false;
	$title = "CPF°²×°²½Öè9£ºÍê³É°²×°";
	outputheader($title);
	echo "<p class=\"title\">ÐÅÏ¢</p><p>";
	$conn->Execute("UPDATE ".$prefix."_config SET php_path = '".editPostdata($php_path)."', master_board_name = '".editPostdata($boardname)."', act_code = '$act_code', act_permail = '$act_permail', multi_email = '$multi_email'");
	echo "<p>ÂÛ̳³õʼÉèÖÃÍê³É¡£</p><p class=\"title\">°²×°Íê³É</p><p>¹§Ï²Äú£¡ÄúµÄCPFȫа²×°ÒѾ­Íê³É¡£ÏÂÃæÄúÐèÒª×öÈçÏÂÁ½¼þÊ¡£<br>Ò»¡¢ÎªÁËÂÛ̳µÄ°²È«£¬Çë<b>Îñ±Øɾ³ý${PHP_SELF}ÒÔ¼°INSTALLĿ¼</b>¡£<br>¶þ¡¢½øÈëÂÛ̳¹ÜÀíÖÐÐÄ´´½¨ÌÖÂÛ°æ²¢½øÐнøÒ»²½µÄÉèÖá£</p>";
	echo "<p class=\"title\">×îºóµÄ²Ù×÷</p><p><a href=\"admin/index.php\">½øÈëÂÛ̳¹ÜÀíÖÐÐÄ</a> <a href=\"index.php\">½øÈëÂÛ̳</a></p></form>\n";

	echo $footer;
}

#²½Öè4b£ºÉý¼¶°²×°Ç°µÄ×¼±¸¹¤×÷
if ($step=="4b") {
	include ("config.php");
	#ADODB°üº¬
	include ("$adodbdir/adodb.inc.php");
	#ADODBÊý¾Ý¿âÁ¬½Ó
	$conn=&ADONEWConnection($dbtype);
	if ($usepconnect)
		$issuccess = $conn->PConnect($dbhost,$dbuser,$dbpassword,$dbdb);
	else $issuccess = $conn->Connect($dbhost,$dbuser,$dbpassword,$dbdb);
	#ADODB Êý×éģʽ
	$ADODB_FETCH_MODE = ADODB_FETCH_BOTH;
	#ADODB Debugģʽ
	$conn->debug = false;

	$title = "CPF°²×°²½Öè4£ºÉý¼¶Ç°µÄ×¼±¸¹¤×÷";
	outputheader($title);
	echo "<p class=\"title\">×¢Òâ</p><p>ÇëÈ·±£ÄúÔø¾­°²×°¹ýCPF£¬²¢ÇÒ¸Õ²ÅÉèÖõÄÊý¾Ý¿âӦΪ¾É°æCPFËùʹÓõÄÊý¾Ý¿â¡£</p>";
	echo "<p class=\"title\">¼ì²é¾É°æCPF°æ±¾</p>";
	$config = &$conn->Execute("SELECT cpfversion FROM ".$prefix."_config");
	$errno = $conn->ErrorNo();
	$oldver = $config->fields[0];
	if ($errno==0) {
		switch ($oldver) {
			case "1.5 Alpha1": echo "ÄúµÄCPFÊÇ×îа棬ÎÞÐèÉý¼¶";break;
			case "1.5 PreAlpha": echo "ÄúµÄCPFÊÇ×îа棬ÎÞÐèÉý¼¶";break;
		}
		echo "<p class=\"title\">×îºóµÄ²Ù×÷</p><p><a href=\"admin/index.php\">½øÈëÂÛ̳¹ÜÀíÖÐÐÄ</a> <a href=\"index.php\">½øÈëÂÛ̳</a></p>\n";
	} else {
		echo "<p>ÄúʹÓõÄCPF°æ±¾½ÏÀÏ£¬ÎÞ·¨¼ì²é°æ±¾¡£ÇëÑ¡ÔñÄú¾É°æ±¾ÂÛ̳µÄ°æ±¾¡£</p><p class=\"title\">Ñ¡Ôñ¾É°æCPF°æ±¾</p>
			<form name=\"form\" method=\"post\" action=\"$PHP_SELF\">
			  <input type=\"radio\" name=\"oldver\" value=\"6\">
			  1.1 Beta2<br>
			  <input type=\"radio\" name=\"oldver\" value=\"5\">
			  1.1 Beta1<br>
			  <input type=\"radio\" name=\"oldver\" value=\"4\">
			  1.0 Beta5 ºÍ 1.0 RC1 ºÍ 1.0 RC2<br>
			  <input type=\"radio\" name=\"oldver\" value=\"3\">
			  1.0 Beta4<br>
			  <input type=\"radio\" name=\"oldver\" value=\"2\">
			  1.0 Beta3<br>
			  <input type=\"radio\" name=\"oldver\" value=\"1\">
			  1.0 Beta1 ºÍ 1.0 Beta2 
			  <input type=\"hidden\" name=\"step\" value=\"5b\">";
		echo "<p class=\"title\">ÇëÑ¡ÔñÏÂÒ»²½²Ù×÷</p><p><a href=\"javascript:form.submit();\">¼ÌÐøÉý¼¶°²×°</a> <a href=\"$PHP_SELF?step=4b\">»Øµ½ÉÏÒ»²½</a> <a href=\"$PHP_SELF?step=-1\">Í˳ö°²×°</a></p></form>\n";
	}
	echo $footer;
}

#²½Öè5b£ºÍê³ÉÉý¼¶
if ($step=="5b") {
	include ("config.php");
	#ADODB°üº¬
	include ("$adodbdir/adodb.inc.php");
	#ADODBÊý¾Ý¿âÁ¬½Ó
	$conn=&ADONEWConnection($dbtype);
	if ($usepconnect)
		$issuccess = $conn->PConnect($dbhost,$dbuser,$dbpassword,$dbdb);
	else $issuccess = $conn->Connect($dbhost,$dbuser,$dbpassword,$dbdb);
	#ADODB Êý×éģʽ
	$ADODB_FETCH_MODE = ADODB_FETCH_BOTH;
	#ADODB Debugģʽ
	$conn->debug = false;

	$title = "CPF°²×°²½Öè5£ºÍê³ÉÉý¼¶";
	outputheader($title);
	echo "<p class=\"title\">״̬</p>";
	include ("install/update".$oldver.".php");
	echo $footer;
}
?>
Return current item: Chinese Project Forum