<?php
//=====================================
// LINKER Category Engine
//=====================================
// Filename : step2.php
// Path : install directory
// last update : 2002/09/01
// Desc : Install step2
//=====================================
isset($_POST) ? extract($_POST) : extract($HTTP_POST_VARS) ;
isset($_SERVER) ? extract($_SERVER) : extract($HTTP_SERVER_VARS) ;
//=====================================
// Check submit data
//=====================================
if (!$db_host) $errcode .= "<li>Fill DB HOST field</li>\n";
if (!$db_name) $errcode .= "<li>Fill DB NAME field</li>\n";
if (!$db_user) $errcode .= "<li>Fill DB USER field</li>\n";
if (!$db_pass) $errcode .= "<li>Fill DB PASS field</li>\n";
if (!$db_type) $errcode .= "<li>Fill DB TYPE field</li>\n";
if (!$tb_name) $errcode .= "<li>Fill TABLE NAME field</li>\n";
$default_server = "http://". $HTTP_HOST . str_replace("/install/step2.php","",$SCRIPT_NAME);
if (file_exists("../function/{$db_type}.php")) {
include "../function/{$db_type}.php";
}
include ("../function/base_info.php");
$db = new DB_Sql($db_host,$db_user,$db_pass,$db_name);
$db->DBconnect();
if (!$db->Connect) $errcode .= "<li>Cannot connect Database</li>\n";
if (!$db->ReSelect) $errcode .= "<li>Incorrct or non exist db name</li>\n";
//=====================================
// Error Code
//=====================================
if ($errcode) {
$table_content = <<<EOF
<table align="center" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td height="25" colspan="2" bgcolor="#E0E0E0" align="center"> <font size="2" color=red><b>ERROR !!</b></font></td>
</tr>
<tr>
<td height=100><font size=2><b><ul>$errcode</ul></b></td>
</tr>
<tr>
<td height="30" colspan="2" bgcolor="#E0E0E0" valign="bottom" align="center"><font size=2>
<input type="button" value=" << BACK " style="background-color:rgb(255,255,223);" onClick="history.back()"></font></td>
</tr>
</table>
EOF;
}
//=====================================
// Step2 output
//=====================================
else {
// Language Select
$handle = opendir("../lang");
while ($dirname = readdir($handle)){
if ($dirname <> "." && $dirname <> ".." && is_dir("../lang/$dirname")) {
$full_path = "lang/" . $dirname;
if ($full_path == $Slang)
$lang_op .= "<option value='$full_path' selected>" . ucfirst($dirname) . "</option>\n";
else
$lang_op .= "<option value='$full_path'>" . ucwords($dirname) . "</option>\n";
}
}
closedir($handle);
$table_content = <<<EOF
<table align="center" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td height="25" colspan="2" bgcolor="#E0E0E0" align="center"> <font size="2"><b>Fill other things</b></font></td>
</tr>
<tr><td colspan=2 height=1 bgcolor=gray><img src="image/x1.gif"></td></tr>
<tr>
<td width="168" height="25" bgcolor="#F6F6F6" align="center"><font size=2 color="black"> Admin ID</font></td>
<td width="309" bgcolor="#F6F6F6"> <input type="text" name="admin_id"></td>
</tr>
<tr><td colspan=2 height=1 bgcolor=gray><img src="image/x1.gif"></td></tr>
<tr>
<td width="168" height="25" bgcolor="#F6F6F6" align="center"><font size=2 color="black"> Admin Pass</font></td>
<td width="309" bgcolor="#F6F6F6"> <input type="password" name="admin_pass"></td>
</tr>
<tr><td colspan=2 height=1 bgcolor=gray><img src="image/x1.gif"></td></tr>
<tr>
<td width="168" height="25" bgcolor="#F6F6F6" align="center"><font size=2 color="black"> Admin Email</font></td>
<td width="309" bgcolor="#F6F6F6"> <input type="text" name="admin_email"></td>
</tr>
<tr><td colspan=2 height=1 bgcolor=gray><img src="image/x1.gif"></td></tr>
<tr>
<td width="168" height="25" bgcolor="#F6F6F6" align="center"><font size=2 color="black"> Linker URL</font></td>
<td width="309" bgcolor="#F6F6F6"> <input type="text" name="site_path" value="$default_server" size=20 style="widths:250px" value="http://"></td>
</tr>
<tr><td colspan=2 height=1 bgcolor=gray><img src="image/x1.gif"></td></tr>
<tr>
<td width="168" height="25" bgcolor="#F6F6F6" align="center"><font size=2 color="black"> Language</font></td>
<td width="309" bgcolor="#F6F6F6"> <font size=2><select name="language">$lang_op
</select></font></td>
</tr>
<tr><td colspan=2 height=1 bgcolor=gray><img src="image/x1.gif"></td></tr>
<tr>
<td height="30" colspan="2" bgcolor="#E0E0E0" valign="bottom" align="center"> <font size=2><input type="reset" value=" Reset" style="background-color:rgb(226,226,226);">
<input type="submit" value=" Next >>" style="background-color:rgb(255,255,223);"></font></td>
</tr>
</table>
EOF;
}
print <<<EOF
<html>
<head>
<title>LINKER INSTALL</title>
</head>
<body bgcolor="#F6F6F6" leftmargin="0" marginwidth="0" topmargin="0" marginheight="0">
<form action="step3.php" method="post">
<input type="hidden" name="db_host" value="$db_host">
<input type="hidden" name="db_user" value="$db_user">
<input type="hidden" name="db_pass" value="$db_pass">
<input type="hidden" name="db_name" value="$db_name">
<input type="hidden" name="tb_name" value="$tb_name">
<input type="hidden" name="db_type" value="$db_type">
<table border="0" cellpadding="0" cellspacing="0" width="100%" height="100%">
<tr>
<td height="75" bgcolor="#E0E0E0" align="center"><img src="image/title.gif" border="0"></td>
</tr>
<tr>
<td bgcolor="black"><font color="white" size=2 face="Arial"><b> INSTALL >> STEP 2</b></font></td>
</tr>
<tr>
<td bgcolor="#F6F6F6" valign=top>
<br><br><br><br>
<table width="500" cellspacing="0" cellpadding="0" border="0" align=center>
<tr>
<td align="left" valign=top width="11"><img src="image/ul.gif" width="11" height="11" border="0"></td>
<td bgcolor="#E0E0E0" width=100%><img src="image/x1.gif"></td>
<td align="right" valign=top width="11"><img src="image/ur.gif" width="11" height="11" border="0"></td>
</tr>
<tr>
<td bgcolor="#E0E0E0" width="11"><img src="image/x1.gif"></td>
<td bgcolor="#E0E0E0">
<!-- Start content -->
$table_content
</td>
<td bgcolor="#E0E0E0" width="11"><img src="image/x1.gif"></td>
</tr>
<tr>
<td align="left" valign=bottom width="11"><img src="image/dl.gif" width="11" height="11" border="0"><img src="image/x1.gif"></td>
<td bgcolor="#E0E0E0"><img src="image/x1.gif"></td>
<td align="right" valign=bottom width="11"><img src="image/dr.gif" width="11" height="11" border="0"><img src="image/x1.gif"></td>
</tr>
</table>
</td></tr></table>
</form>
</body></html>
EOF;
?>