Sorry, it's me again,
I get a blank page when I click on "Register" on login.php
The code for register.php generated is as follows:
<?php
ini_set("display_errors","1");
ini_set("display_startup_errors","1");
session_start();
set_magic_quotes_runtime(0);
session_unset();
include("include/dbcommon.php");
include("include/dbconnection.php");
$cEmailField = "email";
$registered=false;
$onload=' ';
$strMessage="";
$strUsername="";
$strPassword="";
$strEmail="";
if(@$_POST["btnSubmit"] == "Register")
{
$conn=db_connect();
$rstemp=db_query("select from ".AddTableWrappers($cLoginTable)." where 1=0",$conn);
$fields="";
$values="";
$ind=1;
$userdata = array()
$userinfo[$ind] = refine(@$_POST["userinfo".$ind]);
$userdata["username"]=$userinfo[$ind];
if(NeedQuotes(db_fieldtype($rstemp,"username")))
$dbval="'".db_addslashes($userinfo[$ind])."'";
else
$dbval=(0+$userinfo[$ind]);
if(strlen($fields))
{
$fields.=",".AddFieldWrappers("username");
$values.=",".$dbval;
}
else
{
$fields.=AddFieldWrappers("username");
$values.=$dbval;
}
if("username"==$cUserNameField)
{
$strUsername = $userinfo[$ind];
$dbstrUsername = $dbval;
}
if("username"==$cEmailField)
{
$strEmail = $userinfo[$ind];
$dbstrEmail = $dbval;
}
if("username"==$cPasswordField)
$strPassword = $userinfo[$ind];
$ind++;
$userinfo[$ind] = refine(@$_POST["userinfo".$ind]);
$userdata["password"]=$userinfo[$ind];
if(NeedQuotes(db_fieldtype($rstemp,"password")))
$dbval="'".db_addslashes($userinfo[$ind])."'";
else
$dbval=(0+$userinfo[$ind]);
if(strlen($fields))
{
$fields.=",".AddFieldWrappers("password");
$values.=",".$dbval;
}
else
{
$fields.=AddFieldWrappers("password");
$values.=$dbval;
}
if("password"==$cUserNameField)
{
$strUsername = $userinfo[$ind];
$dbstrUsername = $dbval;
}
if("password"==$cEmailField)
{
$strEmail = $userinfo[$ind];
$dbstrEmail = $dbval;
}
if("password"==$cPasswordField)
$strPassword = $userinfo[$ind];
$ind++;
$userinfo[$ind] = refine(@$_POST["userinfo".$ind]);
$userdata["email"]=$userinfo[$ind];
if(NeedQuotes(db_fieldtype($rstemp,"email")))
$dbval="'".db_addslashes($userinfo[$ind])."'";
else
$dbval=(0+$userinfo[$ind]);
if(strlen($fields))
{
$fields.=",".AddFieldWrappers("email");
$values.=",".$dbval;
}
else
{
$fields.=AddFieldWrappers("email");
$values.=$dbval;
}
if("email"==$cUserNameField)
{
$strUsername = $userinfo[$ind];
$dbstrUsername = $dbval;
}
if("email"==$cEmailField)
{
$strEmail = $userinfo[$ind];
$dbstrEmail = $dbval;
}
if("email"==$cPasswordField)
$strPassword = $userinfo[$ind];
$ind++;
$retval=true;
if(function_exists("BeforeRegister"))
$retval = BeforeRegister($userdata);
$strMessage="";
// check if entered username already exists
if(!strlen($strUsername))
$strMessage="Username can not be empty.";
else
{
$strSQL="select count() from ".AddTableWrappers($cLoginTable)." where ".AddFieldWrappers($cUserNameField)."=".$dbstrUsername;
$rs=db_query($strSQL,$conn);
$data=db_fetch_numarray($rs);
if($data[0]>0)
$strMessage="Username"." <i>".$strUsername."</i> "."already exists. Choose another username.";
}
// check if entered email already exists
if(!strlen($strEmail))
$strMessage="Please enter valid email address.";
else
{
$strSQL="select count(*) from ".AddTableWrappers($cLoginTable)." where ".AddFieldWrappers($cEmailField)."=".$dbstrEmail;
$rs=db_query($strSQL,$conn);
$data=db_fetch_numarray($rs);
if($data[0]>0)
{
if($strMessage)
$strMessage.="
";
$strMessage.="Email"." <i>".$strEmail."</i> "."already registered. If you forgot your username or password use the password reminder form.";
}
}
if(!$strMessage && $retval)
{
$strSQL="insert into ".AddTableWrappers($cLoginTable)." (".$fields.") values (".$values.")";
db_exec($strSQL,$conn);
if(function_exists("AfterSuccessfulRegistration"))
AfterSuccessfulRegistration();
// send email to user
$message="You have registered as user at http://".$_SERVER["SERVER_NAME"].$_SERVER["SCRIPT_NAME"]."\r\n"'>http://".$_SERVER["SERVER_NAME"].$_SERVER["SCRIPT_NAME"]."\r\n";
$ind=1;
$label = "Username";
$message.=$label.": ".$userinfo[$ind++]."\r\n";
$label = "Password";
$message.=$label.": ".$userinfo[$ind++]."\r\n";
$label = "Email";
$message.=$label.": ".$userinfo[$ind++]."\r\n";
mail($strEmail,"Notification on registering",$message);
// send letter to admin
$message="User registered at http://".$_SERVER["SERVER_NAME"].$_SERVER["SCRIPT_NAME"]."\r\n"'>http://".$_SERVER["SERVER_NAME"].$_SERVER["SCRIPT_NAME"]."\r\n";
$ind=1;
$label = "Username";
$message.=$label.": ".$userinfo[$ind++]."\r\n";
$label = "Password";
$message.=$label.": ".$userinfo[$ind++]."\r\n";
$label = "Email";
$message.=$label.": ".$userinfo[$ind++]."\r\n";
mail("alan@aws-services.com","Notification on registering",$message);
$registered=true;
$onload="";
}
else
if(function_exists("AfterUnsuccessfulRegistration"))
AfterUnsuccessfulRegistration();
}
if(function_exists("RegisterOnLoad"))
RegisterOnLoad();
?>
<html>
<head>
<title>Register</title>
<link REL="stylesheet" href="include/style.css" type="text/css">
</head>
<script language = JavaScript>
function OnKeyDown()
{
e = window.event;
if (e.keyCode == 13)
{
e.cancel = true;
document.forms[0].submit();
}
}
</script>
<body bgcolor=white <?php echo $onload;?> text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" link="#0066cc">
<?php
if(file_exists("include/supertop.php"))
include("include/supertop.php");
?>
<table width="100%" border="0" cellspacing="0" cellpadding="0" height="99%">
<tr>
<td valign="center" align="middle">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td> </td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td bgcolor="#ffffff" valign="top" align="right">
<table width="300" border="0" cellspacing="4" cellpadding="4" align="center">
<tr>
<td> </td>
</tr>
</table>
<table width="300" border="0" cellspacing="1" cellpadding="4" align="center" bgcolor="#cccccc">
<tr>
<td align=middle class=blackshade>
<b><font size=+1>Register</font></b></td>
</tr>
<tr>
<td valign="top" class=shade>
<DIV align=center>
<table width="200" border=0 align="center" class=shade>
<tbody>
<tr height=10><td colspan=2> </td></tr>
<?php if(!$registered) {?>
<form method="POST" action="register.php" id=form1 name=form1>
<?php $ind=1;?>
<!--username-->
<tr>
<td align=right width="50%">
<div align="left"><?php echo "Username"; ?>:</div>
</td>
<td width="50%">
<input type=text name="userinfo<?php echo $ind;?>" value="<?php if(isset($userinfo[$ind])) echo htmlspecialchars($userinfo[$ind]);?>" >
</td>
<?php $ind++; ?>
</tr>
<!--password-->
<tr>
<td align=right width="50%">
<div align="left">Password:</div>
</td>
<td width="50%">
<input type=password id="password" name=userinfo<?php echo $ind;?> value="<?php if(isset($userinfo[$ind])) echo htmlspecialchars($userinfo[$ind]);?>">
</td>
</tr>
<tr>
<td align=right width="50%">
<div align="left">Re-enter password:</div>
</td>
<td width="50%">
<input type=password id="password1" name=password1 value="<?php if(isset($userinfo[$ind])) echo htmlspecialchars($userinfo[$ind]);?>">
</td>
<?php $ind++; ?>
</tr>
<!--email-->
<tr>
<td align=right width="50%">
<div align="left"><?php echo "Email"; ?>:</div>
</td>
<td width="50%">
<input type=text name="userinfo<?php echo $ind;?>" value="<?php if(isset($userinfo[$ind])) echo htmlspecialchars($userinfo[$ind]);?>" >
</td>
<?php $ind++; ?>
</tr>
<tr>
<td colspan=2 align=middle>
<input type=hidden name=btnSubmit value="Register">
<input type=submit value="Submit" class=buttonM onclick="java script: if(document.getElementById('password').value!=document.getElementById('password1').value) {alert('Passwords do not match. Re-enter password');document.getElementById('password1').value='';return false;} return true;">
</td>
</tr>
<tr>
<td colspan=2 align=middle>
<a href="login.php">Back to login page</a>
</td>
</tr>
<tr height=20>
<td align=center colspan=2>
<font color=red><?php echo $strMessage;?></font>
</td></tr>
<?php } else {?>
<form method="POST" action="login.php" id=form1 name=form1>
<input type="Hidden" name=username value="<?php echo htmlspecialchars($strUsername);?>">
<input type="Hidden" name=password value="<?php echo htmlspecialchars($strPassword);?>">
<tr>
<td colspan=2 align=middle>
Registration successful!
<a href="login.php" onclick="form1.submit(); return false;">Proceed to login page</a>
</td>
</tr>
<?php } ?>
</tbody>
</table></DIV>
</td>
</tr>
</table>
</form>
<p> </p></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
<?php
if(file_exists("include/superbottom.php"))
include("include/superbottom.php");
?>
</body>
</html>
<?php
// refine value passed by POST or GET method
function refine($str)
{
$ret=$str;
if(get_magic_quotes_gpc())
$ret=stripslashes($str);
return html_special_decode($ret);
}
function html_special_decode($str)
{
$ret=$str;
$ret=str_replace(">",">",$ret);
$ret=str_replace("<","<",$ret);
$ret=str_replace(""","\"",$ret);
$ret=str_replace("'","'",$ret);
$ret=str_replace("&","&",$ret);
return $ret;
}
?>
Anybody got any ideas?