Hello everyone,
I've been using $message to post an error if there is one however when I hit registers on the form it returns a blank page.. I'm stuck i've beenusing this method on several other pages and it works fine. Also, if I post errors through header it works but I don't want to post that way since it wont match the look of other pages.
the URL is www.ericschuppe.com/register.php
Thanks ahead of time.
I've been using $message to post an error if there is one however when I hit registers on the form it returns a blank page.. I'm stuck i've beenusing this method on several other pages and it works fine. Also, if I post errors through header it works but I don't want to post that way since it wont match the look of other pages.
the URL is www.ericschuppe.com/register.php
PHP Code:
<?php
session_start();
include ('dbc.php');
if ($_POST['Submit'] == 'Register')
{
if (strlen($_POST['full_name']) < 1)
{
$message .= '<p>Incorrect email, please enter valid email address.</p>';
}
if (strlen($_POST['email']) < 5)
{
$message .= '<p>Incorrect email, please enter valid email address.</p>';
}
if (strcmp($_POST['pass1'],$_POST['pass2']) || empty($_POST['pass1']) )
{
$messsage .= '<p>Password does not match or empty.</p>';
}
if (strlen($_POST['user_idnum']) < 4)
{
$message .= '<p>Incorrect ID number. Please enter a valid ID number.</p>';
}
if (strcmp(md5($_POST['user_code']),$_SESSION['ckey']))
{
$message .= '<p>Invalid code entered. Please enter the correct code as shown in the Image.</p>';
}
$rs_duplicates = mysql_query("SELECT id FROM users WHERE user_email='$_POST[email]'");
$duplicates = mysql_num_rows($rs_duplicates);
if ($duplicates > 0)
{
//die ("ERROR: User account already exists.");
$message .= '<p>User account already exists, Try Again.</p>';
}
$rs_duplicates_id = mysql_query("SELECT id FROM users WHERE user_idnum='$_POST[user_idnum]'");
$duplicates_id = mysql_num_rows($rs_duplicates_id);
if ($duplicates_id > 0)
{
$message .= '<p>Student ID already exists, Try Again.</p>';
exit();
}
$md5pass = md5($_POST['pass2']);
$activ_code = rand(1000,9999);
$server = $_SERVER['HTTP_HOST'];
$host = ereg_replace('www.','',$server);
mysql_query("INSERT INTO users
(`user_email`,`user_pwd`,`user_idnum`,`joined`,`activation_code`,`full_name`)
VALUES
('$_POST[email]','$md5pass','$_POST[user_idnum]',now(),'$activ_code','$_POST[full_name]')") or die(mysql_error());
unset($_SESSION['ckey']);
echo("Registration Successful! An activation code has been sent to your email address with an activation link...");
exit;
}
if (isset($message)) {
echo '<font color="red">', $message, '</font>';
}
?>
<link href="styles.css" rel="stylesheet" type="text/css">
<?php if (isset($_GET['msg'])) { echo "<div class=\"msg\"> $_GET[msg] </div>"; } ?>
<p> </p>
<table width="65%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td class="mnuheader"><strong><font size="5">Register Account</font></strong></td>
</tr>
<tr>
<td class="forumposts"><form name="form1" method="post" action="register.php" style="padding:5px;">
<p><br>
Name:
<input name="full_name" type="text" id="full_name">
</p>
<p>Email:
<input name="email" type="text" id="email">
</p>
<p>Password:
<input name="pass1" type="password" id="pass1">
Atleast 5 characters</p>
<p>Retype Password:
<input name="pass2" type="password" id="pass2">
</p>
<p>
ID Number:
<input name="user_idnum" type="text" id="user_idnum">
</p>
<p>
<input name="user_code" type="text" size="10">
<img src="pngimg.php" align="middle"> </p>
<p align="center">
<input type="submit" name="Submit" value="Register">
</p>
</form></td>
</tr>
</table>
<div align="left"></div>
</body>
</html>
Comment