PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
Dale
Forum Contributor
Posts: 466 Joined: Fri Jun 21, 2002 5:57 pm
Location: Atherstone, Warks
Post
by Dale » Fri Aug 30, 2002 2:01 pm
OK it now works...ish.
Heres the story:
Page 1 - /install.php?step=1
Heres where you stick in your database details....
Page 2 - /install.php?step=2
Checks the MySQL settings and see's if it can connect...
Page 3 - /install.php?step=3
General Configurations... *NOTE*
Some forms graphicly hidden for testing purpose's
Page 4 - /install.php?step=4
But heres the error... it always comes up with this even when the forms on page 3 are filled in.
----------------
Sorry about my coding its not the greatest
Plz Help!
Takuma
Forum Regular
Posts: 931 Joined: Sun Aug 04, 2002 10:24 am
Location: UK
Contact:
Post
by Takuma » Fri Aug 30, 2002 3:48 pm
Could we see the code and if there is URL for the forum...
Dale
Forum Contributor
Posts: 466 Joined: Fri Jun 21, 2002 5:57 pm
Location: Atherstone, Warks
Post
by Dale » Fri Aug 30, 2002 4:20 pm
install.php
Code: Select all
<?
include("lib/functions.php");
include("lang/English.php");
$title = "Installation";
$layout = array('bgcolor'=>'#FF6800', 'text'=>'#000000', 'link'=>'#000000', 'alink'=>'#000000', 'vlink'=>'#000000', 'table_width'=>'65%', 'table_bgcolor'=>'#000000', 'tdbgcolor'=>'#FF6800', 'tdbgcolor2'=>'#FF6800', 'tdbgcolor3'=>'#FF6800', 'catbgcolor'=>'#000000');
ob_start("ob_gzhandler");
ob_implicit_flush(0);
echo <<<END_HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML>
<HEAD>
<TITLE>$title</TITLE>
END_HTML;
print_CSS($layout);
$stepnum = ($step)? $step+1:'2';
echo <<<END_HTML
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
</HEAD>
<BODY BGCOLOR="$layoutїbgcolor]" TEXT="$layoutїtext]" LINK="$layoutїlink]" ALINK="$layoutїalink]" VLINK="$layoutїvlink]">
<FORM ACTION="$PHP_SELF?step=$stepnum" METHOD="POST">
<TABLE BGCOLOR="$layoutїtable_bgcolor]" cellpadding="3" cellspacing="1" width="$layoutїtable_width]" ALIGN="center">
<TR>
<TD BGCOLOR="$layoutїtdbgcolor2]" CLASS="tdbg2">
END_HTML;
if(!$step) // Start step 1
{
if(!$mysql)
{
$mysqlїsql_host] = "localhost";
$mysqlїprefix] = "xen_";
}
echo <<<END_HTML
MySQL Host:</TD><TD BGCOLOR="$layoutїtdbgcolor2]" CLASS="tdbg2"><INPUT TYPE="text" NAME="mysqlїsql_host]" VALUE="$mysqlїsql_host]"></TD></TR><TR>
<TD BGCOLOR="$layoutїtdbgcolor2]" CLASS="tdbg2">MySQL Username:</TD><TD BGCOLOR="$layoutїtdbgcolor2]" CLASS="tdbg2"><INPUT TYPE="text" NAME="mysqlїsql_user]" VALUE="$mysqlїsql_user]"></TD></TR><TR>
<TD BGCOLOR="$layoutїtdbgcolor2]" CLASS="tdbg2">MySQL Password:</TD><TD BGCOLOR="$layoutїtdbgcolor2]" CLASS="tdbg2"><INPUT TYPE="password" NAME="mysqlїsql_password]" VALUE="$mysqlїsql_password]"></TD></TR><TR>
<TD BGCOLOR="$layoutїtdbgcolor2]" CLASS="tdbg2">MySQL Database:</TD><TD BGCOLOR="$layoutїtdbgcolor2]" CLASS="tdbg2"><INPUT TYPE="text" NAME="mysqlїsql_db]" VALUE="$mysqlїsql_db]"></TD></TR><TR>
<TD BGCOLOR="$layoutїtdbgcolor2]" CLASS="tdbg2">Prefix:</TD><TD BGCOLOR="$layoutїtdbgcolor2]" CLASS="tdbg2"><INPUT TYPE="text" NAME="mysqlїprefix]" VALUE="$mysqlїprefix]"></TD></TR><TR>
<TD BGCOLOR="$layoutїtdbgcolor2]" CLASS="tdbg2" COLSPAN="2"><INPUT TYPE="submit" VALUE="Continue" NAME="submit">
END_HTML;
}
elseif($step==2) // Step 2
{
$success = 0;
echo " Trying to connect $mysqlїsql_user]@$mysqlїsql_host]...</TD><TD BGCOLOR="$layoutїtdbgcolor3]" CLASS="tdbg3">";
$link = @mysql_connect($mysqlїsql_host],$mysqlїsql_user],$mysqlїsql_password]);
if(!$link)
{
echo "<FONT COLOR="#ff0000">Error!</FONT></TD></TR><TR>\n";
} else {
echo "<FONT COLOR="#00C000">Success!</FONT></TD></TR><TR>\n";
$success++;
}
echo " <TD BGCOLOR="$layoutїtdbgcolor2]" CLASS="tdbg2">Trying to select $mysqlїsql_db] (creating if not exists)...</TD><TD BGCOLOR="$layoutїtdbgcolor3]" CLASS="tdbg3">";
mysql_query("CREATE DATABASE IF NOT EXISTS $mysqlїsql_db]");
$db = mysql_select_db($mysqlїsql_db]);
if(!$db)
{
echo "<FONT COLOR="#ff0000">Error!</FONT></TD></TR><TR>\n";
} else {
echo "<FONT COLOR="#00C000">Success!</FONT></TD></TR><TR>\n";
$success++;
}
if($success)
{
echo " <TD BGCOLOR="$layoutїtdbgcolor2]" CLASS="tdbg2">Saving MySQL configuration...</TD><TD BGCOLOR="$layoutїtdbgcolor3]" CLASS="tdbg3">";
$fp = fopen("lib/config.php", "w");
fputs($fp, "<?\n");
foreach($mysql as $key => $val)
fputs($fp, "\${$key} = "$val";\n");
fputs($fp, "?>\n");
fclose ($fp);
echo "<FONT COLOR="#00C000">Success!</FONT></TD></TR><TR>\n";
echo " <TD BGCOLOR="$layoutїtdbgcolor2]" CLASS="tdbg2" COLSPAN="2"><INPUT TYPE="submit" VALUE="Continue"></TD>";
} else {
echo "";
}
}
elseif($step==3) // Step 3
{
echo <<<END_HTML
Forum name:</TD><TD BGCOLOR="$layoutїtdbgcolor2]" CLASS="tdbg2"><INPUT TYPE="text" NAME="settingїboardname]" SIZE="40" VALUE="$settingїboardname]"></TD></TR><TR>
<TD BGCOLOR="$layoutїtdbgcolor2]" CLASS="tdbg2">Forum URL:</TD><TD BGCOLOR="$layoutїtdbgcolor2]" CLASS="tdbg2"><INPUT TYPE="text" NAME="$settingїurl]" SIZE="40" VALUE="$settingїurl]"></TD></TR><TR>
<TD BGCOLOR="$layoutїtdbgcolor2]" CLASS="tdbg2">Language:</TD><TD BGCOLOR="$layoutїtdbgcolor2]" CLASS="tdbg2"><INPUT TYPE="text" NAME="$settingїlanguage]" SIZE="40" VALUE="$settingїlanguage]"><FONT SIZE="-2">(without the .php)</FONT></TD></TR><TR>
<TD BGCOLOR="$layoutїtdbgcolor2]" CLASS="tdbg2">Cookie name:</TD><TD BGCOLOR="$layoutїtdbgcolor2]" CLASS="tdbg2"><INPUT TYPE="text" NAME="$settingїcookiename]" SIZE="40" VALUE="$settingїcookiename]"></TD></TR><TR>
<TD BGCOLOR="$layoutїtdbgcolor2]" CLASS="tdbg2">Cookie path:</TD><TD BGCOLOR="$layoutїtdbgcolor2]" CLASS="tdbg2"><INPUT TYPE="text" NAME="$settingїcookiepath]" SIZE="40" VALUE="$settingїcookiepath]">(Set as /, if unsure)</TD></TR><TR>
<TD BGCOLOR="$layoutїtdbgcolor2]" CLASS="tdbg2">Cookie domain:</TD><TD BGCOLOR="$layoutїtdbgcolor2]" CLASS="tdbg2"><INPUT TYPE="text" NAME="$settingїcookiedomain]" SIZE="40" VALUE="$settingїcookiedomain]">(If unsure, leave empty)</TD></TR><TR>
<TD BGCOLOR="$layoutїtdbgcolor2]" CLASS="tdbg2">Admin Set Up</TD></TR><TR>
<TD BGCOLOR="$layoutїtdbgcolor2]" CLASS="tdbg2">Admin username:</TD><TD BGCOLOR="$layoutїtdbgcolor2]" CLASS="tdbg2"><INPUT TYPE="text" NAME="$settingїadmin_username]" SIZE="40" VALUE="$settingїadmin_username]"></TD></TR><TR>
<TD BGCOLOR="$layoutїtdbgcolor2]" CLASS="tdbg2">Admin password:</TD><TD BGCOLOR="$layoutїtdbgcolor2]" CLASS="tdbg2"><INPUT TYPE="password" NAME="$settingїadmin_password]" SIZE="40" VALUE="$settingїadmin_password]"></TD></TR><TR>
<TD BGCOLOR="$layoutїtdbgcolor2]" CLASS="tdbg2">Admin email:</TD><TD BGCOLOR="$layoutїtdbgcolor2]" CLASS="tdbg2"><INPUT TYPE="text" NAME="$settingїadmin_email]" SIZE="40" VALUE="$settingїadmin_email]"></TD></TR><TR>
<TD BGCOLOR="$layoutїtdbgcolor2]" CLASS="tdbg2" COLSPAN="2"><INPUT TYPE="submit" VALUE="Continue" NAME="submit">
END_HTML;
}
elseif($step==4) // Step 4
{
include("lib/config.php");
$error = 0;
$link = mysql_connect($sql_host,$sql_user,$sql_password);
$db = mysql_select_db($sql_db,$link);
echo " Creating databases...</TD><TD BGCOLOR="$layoutїtdbgcolor3]" CLASS="tdbg3">";
$file = file("xen.sql");
$from = array("{\$prefix}","\$language");
$to = array("$prefix","$settingїlanguage]");
$file = str_replace($from, $to,$file);
$time = time();
$fileї] = "INSERT INTO {$prefix}users (id, username, password, status, regdate, email) VALUES('1', '$settingїadmin_username]', '$settingїadmin_password]', '99', '$time', '$settingїadmin_email]')";
$fileї] = "INSERT INTO {$prefix}settings VALUES('boardname', '$settingїboardname]')";
$fileї] = "INSERT INTO {$prefix}settings VALUES('url', '$settingїurl]')";
$fileї] = "INSERT INTO {$prefix}settings VALUES('language', '$settingїlanguage]')";
$fileї] = "INSERT INTO {$prefix}settings VALUES('cookiename', '$settingїcookiename]')";
$fileї] = "INSERT INTO {$prefix}settings VALUES('cookiepath', '$settingїcookiepath]')";
$fileї] = "INSERT INTO {$prefix}settings VALUES('cookiedomain', '$settingїcookiedomain]')";
$fileї] = "INSERT INTO {$prefix}settings VALUES('webmaster', '$settingїadmin_email]')";
foreach($file as $sql)
{
$result = mysql_query($sql);
if(!$result)
{
$error++;
$err .= "Error $error:".mysql_error()."<BR>\n";
}
}
if($error)
{
echo "<FONT COLOR="#ff0000">Error!</FONT></TD></TR><TR><TD BGCOLOR="$layoutїtdbgcolor3]" CLASS="tdbg3" COLSPAN="2">\n $err";
} else {
echo "<FONT COLOR="#00C000">Success!</FONT></TD></TR><TR><TD BGCOLOR="$layoutїtdbgcolor3]" CLASS="tdbg3" COLSPAN="2">Installation completed.<BR>Congratulations!<BR><BR>Proceed to the <A HREF="index.php">main page</A>.\n";
}
}
echo <<<END_HTML
</TD>
</TR>
</TABLE>
</FORM>
<BR>
<DIV ALIGN="center" CLASS="copyright">
<A HREF="http://dale.piranho.com">X-en Forum</A><br>
</DIV>
</BODY>
</HTML>
END_HTML;
ob_end_flush();
?>
Sorry about the gaps.....
Dale
Forum Contributor
Posts: 466 Joined: Fri Jun 21, 2002 5:57 pm
Location: Atherstone, Warks
Post
by Dale » Fri Aug 30, 2002 11:32 pm
Anyone sussed it yet???
Dale
Forum Contributor
Posts: 466 Joined: Fri Jun 21, 2002 5:57 pm
Location: Atherstone, Warks
Post
by Dale » Wed Sep 04, 2002 12:22 pm
PLEASE!!!!!
I need this like sorted ASAP!
Takuma
Forum Regular
Posts: 931 Joined: Sun Aug 04, 2002 10:24 am
Location: UK
Contact:
Post
by Takuma » Wed Sep 04, 2002 3:50 pm
I'll do it as soon as I get my laptop back!
Dale
Forum Contributor
Posts: 466 Joined: Fri Jun 21, 2002 5:57 pm
Location: Atherstone, Warks
Post
by Dale » Wed Sep 04, 2002 4:32 pm
Thx M8!
sunderwind
Forum Newbie
Posts: 9 Joined: Thu Aug 29, 2002 4:24 am
Location: Irving, TX
Contact:
Post
by sunderwind » Wed Sep 04, 2002 8:07 pm
I see one thing that seems to be a problem throughout your code.
When using array elements with in double quotes you must enclose them in {}'s and pass the key for the array in quotes.
Example:
Code: Select all
$fileї] = "INSERT INTO {$prefix}settings VALUES('boardname', '$settingїboardname]')";
Should be:
Code: Select all
$fileї] = "INSERT INTO {$prefix}settings VALUES('boardname', '{$settingї'boardname']}')";
Regular arrays in code that use a string as the key need to be enclosed in quotes.
Code: Select all
$mysqlїsql_host] = "localhost";
Should be:
Code: Select all
$mysqlї'sql_host'] = "localhost";
Takuma
Forum Regular
Posts: 931 Joined: Sun Aug 04, 2002 10:24 am
Location: UK
Contact:
Post
by Takuma » Thu Sep 05, 2002 12:46 am
you are allowed to do this:-
Code: Select all
<?php
$mysqlїsql_host]
?>
although it's not the best idea...
Dale
Forum Contributor
Posts: 466 Joined: Fri Jun 21, 2002 5:57 pm
Location: Atherstone, Warks
Post
by Dale » Thu Sep 05, 2002 1:37 am
i know it sounds too much but could you re-do my installation file then?
Takuma
Forum Regular
Posts: 931 Joined: Sun Aug 04, 2002 10:24 am
Location: UK
Contact:
Post
by Takuma » Thu Sep 05, 2002 2:46 am
Dale
Forum Contributor
Posts: 466 Joined: Fri Jun 21, 2002 5:57 pm
Location: Atherstone, Warks
Post
by Dale » Thu Sep 05, 2002 11:17 am
I've sent it you and i've added you to MSN... my email was
dale@host.sk
Takuma
Forum Regular
Posts: 931 Joined: Sun Aug 04, 2002 10:24 am
Location: UK
Contact:
Post
by Takuma » Thu Sep 05, 2002 11:18 am
Oh cool, I'll do it now then...
Dale
Forum Contributor
Posts: 466 Joined: Fri Jun 21, 2002 5:57 pm
Location: Atherstone, Warks
Post
by Dale » Thu Sep 05, 2002 11:21 am
ok & thx
Takuma
Forum Regular
Posts: 931 Joined: Sun Aug 04, 2002 10:24 am
Location: UK
Contact:
Post
by Takuma » Thu Sep 05, 2002 11:47 am
How about this:-
Code: Select all
<?php
include("lib/functions.php");
include("lang/English.php");
$title = "Installation";
$layout = array('bgcolor'=>'#FF6800', 'text'=>'#000000', 'link'=>'#000000', 'alink'=>'#000000', 'vlink'=>'#000000', 'table_width'=>'65%', 'table_bgcolor'=>'#000000', 'tdbgcolor'=>'#FF6800', 'tdbgcolor2'=>'#FF6800', 'tdbgcolor3'=>'#FF6800', 'catbgcolor'=>'#000000');
ob_start("ob_gzhandler");
ob_implicit_flush(0);
echo "<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML>
<HEAD>
<TITLE>$title</TITLE>\n"
print_CSS($layout);
$stepnum = ($step) ? $step+1 : '2';
echo "<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
</HEAD>
<BODY BGCOLOR="{$layoutї'bgcolor']}" TEXT="{$layoutї'text']}" LINK="{$layoutї'link']}" ALINK="{}$layoutї'alink']}" VLINK="{}$layoutї'vlink']}">
<FORM ACTION="$PHP_SELF?step=$stepnum" METHOD="POST">
<TABLE BGCOLOR="{$layoutї'table_bgcolor']}" cellpadding="3" cellspacing="1" width="{$layoutї'table_width']}" ALIGN="cente">
<TR>
<TD BGCOLOR="{$layoutї'tdbgcolor2']}" CLASS="tdbg2">";
if(!$step) {
if(!$mysql) {
$mysqlїsql_host] = "localhost";
$mysqlїprefix] = "xen_";
}
echo "MySQL Host:</TD><TD BGCOLOR="{$layoutї'tdbgcolor2']}" CLASS="tdbg2"><INPUT TYPE="text" NAME="mysqlїsql_host]" VALUE="{$mysqlї'sql_host']}"></TD></TR><TR>
<TD BGCOLOR="{$layoutї'tdbgcolor2]'}" CLASS="tdbg2">MySQL Username:</TD><TD BGCOLOR="{$layoutї'tdbgcolor2']}" CLASS="tdbg2"><INPUT TYPE="text" NAME="mysqlїsql_user]" VALUE="{$mysqlї'sql_user']}"></TD></TR><TR>
<TD BGCOLOR="{$layoutї'tdbgcolor2]'}" CLASS="tdbg2">MySQL Password:</TD><TD BGCOLOR="{$layoutї'tdbgcolor2']}" CLASS="tdbg2"><INPUT TYPE="password" NAME="mysqlїsql_password]" VALUE="{$mysqlї'sql_password']}"></TD></TR><TR>
<TD BGCOLOR="{$layoutї'tdbgcolor2]'}" CLASS="tdbg2">MySQL Database:</TD><TD BGCOLOR="{$layoutї'tdbgcolor2']}" CLASS="tdbg2"><INPUT TYPE="text" NAME="mysqlїsql_db]" VALUE="{$mysqlї'sql_db']}"></TD></TR><TR>
<TD BGCOLOR="{$layoutї'tdbgcolor2]'}" CLASS="tdbg2">Prefix:</TD><TD BGCOLOR="{$layoutї'tdbgcolor2']}" CLASS="tdbg2"><INPUT TYPE="text" NAME="mysqlїprefix]" VALUE="{$mysqlї'prefix']}"></TD></TR><TR>
<TD BGCOLOR="{$layoutї'tdbgcolor2]'}" CLASS="tdbg2" COLSPAN="2"><INPUT TYPE="submit" VALUE="Continue" NAME="submit">";
} elseif( $step == 2) {
$success = 0;
echo " Trying to connect {$mysqlї'sql_user']} @ {$mysqlї'sql_host']}...</TD><TD BGCOLOR="{$layoutї'tdbgcolor3']}" CLASS="tdbg3">";
$link = @mysql_connect($mysqlї"sql_host"],$mysqlї"sql_user"],$mysqlї"sql_password"]);
if(!$link) {
echo "<FONT COLOR="#ff0000">Error!</FONT></TD></TR><TR>\n";
} else {
echo "<FONT COLOR="#00C000">Success!</FONT></TD></TR><TR>\n";
$success++;
}
echo " <TD BGCOLOR="{$layoutї'tdbgcolor2']}" CLASS="tdbg2">Trying to select {$mysqlї'sql_db']} (creating if not exists)...</TD><TD BGCOLOR="{$layoutї'tdbgcolor3']}" CLASS="tdbg3">";
mysql_query("CREATE DATABASE IF NOT EXISTS {$mysqlї'sql_db']}");
$db = mysql_select_db($mysqlї"sql_db"]);
if(!$db) {
echo "<FONT COLOR="#ff0000">Error!</FONT></TD></TR><TR>\n";
} else {
echo "<FONT COLOR="#00C000">Success!</FONT></TD></TR><TR>\n";
$success++;
}
if($success)
{
echo " <TD BGCOLOR="{$layoutї'tdbgcolor2']}" CLASS="tdbg2">Saving MySQL configuration...</TD><TD BGCOLOR="{$layoutї'tdbgcolor3']}" CLASS="tdbg3">";
$fp = fopen("lib/config.php", "w");
fputs($fp, "<?\n");
foreach($mysql as $key => $val)
fputs($fp, "\${$key} = "$val";\n");
fputs($fp, "?>\n");
fclose ($fp);
echo "<FONT COLOR="#00C000">Success!</FONT></TD></TR><TR>\n";
echo " <TD BGCOLOR="{$layoutї'tdbgcolor2']}" CLASS="tdbg2" COLSPAN="2"><INPUT TYPE="submit" VALUE="Continue"></TD>";
} else {
echo "";
}
}
elseif($step==3) // Step 3
{
echo "Forum name:</TD><TD BGCOLOR="{$layoutї'tdbgcolor2']}" CLASS="tdbg2"><INPUT TYPE="text" NAME="settingїboardname]" SIZE="40" VALUE="{$settingїboardname]}"></TD></TR><TR>
<TD BGCOLOR="{$layoutї'tdbgcolor2']}" CLASS="tdbg2">Forum URL:</TD><TD BGCOLOR="{$layoutї'tdbgcolor2']}" CLASS="tdbg2"><INPUT TYPE="text" NAME="{$settingї'url']}" SIZE="40" VALUE="{$settingї'url]'}"></TD></TR><TR>
<TD BGCOLOR="{$layoutї'tdbgcolor2']}" CLASS="tdbg2">Language:</TD><TD BGCOLOR="{$layoutї'tdbgcolor2']}" CLASS="tdbg2"><INPUT TYPE="text" NAME="{$settingї'language']}" SIZE="40" VALUE="{$settingї'language']}"><FONT SIZE="-2">(without the .php)</FONT></TD></TR><TR>
<TD BGCOLOR="{$layoutї'tdbgcolor2']}" CLASS="tdbg2">Cookie name:</TD><TD BGCOLOR="{$layoutї'tdbgcolor2']}" CLASS="tdbg2"><INPUT TYPE="text" NAME="{$settingї'cookiename']}" SIZE="40" VALUE="{$settingї'cookiename']}"></TD></TR><TR>
<TD BGCOLOR="{$layoutї'tdbgcolor2']}" CLASS="tdbg2">Cookie path:</TD><TD BGCOLOR="{$layoutї'tdbgcolor2']}" CLASS="tdbg2"><INPUT TYPE="text" NAME="{$settingї'cookiepath']}" SIZE="40" VALUE="{$settingї'cookiepath']}">(Set as /, if unsure)</TD></TR><TR>
<TD BGCOLOR="{$layoutї'tdbgcolor2']}" CLASS="tdbg2">Cookie domain:</TD><TD BGCOLOR="{$layoutї'tdbgcolor2']}" CLASS="tdbg2"><INPUT TYPE="text" NAME="{$settingї'cookiedomain']}" SIZE="40" VALUE="{$settingї'cookiedomain']}">(If unsure, leave empty)</TD></TR><TR>
<TD BGCOLOR="{$layoutї'tdbgcolor2']}" CLASS="tdbg2">Admin Set Up</TD></TR><TR>
<TD BGCOLOR="{$layoutї'tdbgcolor2']}" CLASS="tdbg2">Admin username:</TD><TD BGCOLOR="{$layoutї'tdbgcolor2']}" CLASS="tdbg2"><INPUT TYPE="text" NAME="{$settingї'admin_username']}" SIZE="40" VALUE="{$settingї'admin_username']}"></TD></TR><TR>
<TD BGCOLOR="{$layoutї'tdbgcolor2']}" CLASS="tdbg2">Admin password:</TD><TD BGCOLOR="{$layoutї'tdbgcolor2']}" CLASS="tdbg2"><INPUT TYPE="password" NAME="{$settingї'admin_password']}" SIZE="40" VALUE="{$settingї'admin_password']}"></TD></TR><TR>
<TD BGCOLOR="{$layoutї'tdbgcolor2']}" CLASS="tdbg2">Admin email:</TD><TD BGCOLOR="{$layoutї'tdbgcolor2']}" CLASS="tdbg2"><INPUT TYPE="text" NAME="{$settingї'admin_email]'}" SIZE="40" VALUE="{$settingї'admin_email']}"></TD></TR><TR>
<TD BGCOLOR="{$layoutї'tdbgcolor2']}" CLASS="tdbg2" COLSPAN="2"><INPUT TYPE="submit" VALUE="Continue" NAME="submit">";
}
elseif($step==4) // Step 4
{
include("lib/config.php");
$error = 0;
$link = mysql_connect($sql_host,$sql_user,$sql_password);
$db = mysql_select_db($sql_db,$link);
echo " Creating databases...</TD><TD BGCOLOR="{$layoutї'tdbgcolor3']}" CLASS="tdbg3">";
$file = file("xen.sql");
$from = array("{\$prefix}","\$language");
$to = array("$prefix",$settingї"language"]);
$file = str_replace($from, $to,$file);
$time = time();
$fileї] = "INSERT INTO ".$prefix."users (id, username, password, status, regdate, email) VALUES('1', '".$settingї'admin_username']."', '".$settingї'admin_password']."', '99', '$time', '".$settingї'admin_email']."')";
$fileї] = "INSERT INTO ".$prefix."settings VALUES('boardname', '".$settingї'boardname']."')";
$fileї] = "INSERT INTO ".$prefix."settings VALUES('url', '".$settingї'url']."')";
$fileї] = "INSERT INTO ".$prefix."settings VALUES('language', '".$settingї'language']."')";
$fileї] = "INSERT INTO ".$prefix."settings VALUES('cookiename', '".$settingї'cookiename']."')";
$fileї] = "INSERT INTO ".$prefix."settings VALUES('cookiepath', '".$settingї'cookiepath']."')";
$fileї] = "INSERT INTO ".$prefix."settings VALUES('cookiedomain', '".$settingї'cookiedomain']."')";
$fileї] = "INSERT INTO ".$prefix."settings VALUES('webmaster', '".$settingї'admin_email']."')";
foreach($file as $sql)
{
$result = mysql_query($sql);
if(!$result)
{
$error++;
$err .= "Error $error:".mysql_error()."<BR>\n";
}
}
if($error)
{
echo "<FONT COLOR="#ff0000">Error!</FONT></TD></TR><TR><TD BGCOLOR="{$layoutї'tdbgcolor3']}" CLASS="tdbg3" COLSPAN="2">\n $err";
} else {
echo "<FONT COLOR="#00C000">Success!</FONT></TD></TR><TR><TD BGCOLOR="{$layoutї'tdbgcolor3']}" CLASS="tdbg3" COLSPAN="2">Installation completed.<BR>Congratulations!<BR><BR>Proceed to the <A HREF="index.php">main page</A>.\n";
}
}
echo "</TD>
</TR>
</TABLE>
</FORM>
<BR>
<DIV ALIGN="center" CLASS="copyright">
<A HREF="http://dale.piranho.com">X-en Forum</A><br>
</DIV>
</BODY>
</HTML>";
ob_end_flush();
?>