I am running the following signup script for users to be able to log in:
<?php // signup.php
include("common.php"
include("db.php"
if(!isset($submitok)):
// Display the user signup form
?>
<html>
<head><title>New User Registration</title></head>
<body>
<h3>New User Registration Form</h3>
<p><font color=orangered size=+1><TT><B>*</B></TT></font>
indicates a required field</p>
<form method=post action="<?=$PHP_SELF?>">
<table border=0 cellpadding=0 cellspacing=5>
<tr>
<td align=right>
<p>User ID</p>
</td>
<td>
<input name=newid type=text maxlength=100 size=25>
<font color=orangered size=+1><TT><B>*</B></TT></font>
</td>
</tr>
<tr>
<td align=right>
<p>Full Name</p>
</td>
<td>
<input name=newname type=text maxlength=100 size=25>
<font color=orangered size=+1><TT><B>*</B></TT></font>
</td>
</tr>
<tr>
<td align=right>
<p>E-Mail Address</p>
</td>
<td>
<input name=newemail type=text maxlength=100 size=25>
<font color=orangered size=+1><TT><B>*</B></TT></font>
</td>
</tr>
<tr valign=top>
<td align=right>
<p>Other Notes</p>
</td>
<td>
<textarea wrap name=newnotes rows=5 cols=30></textarea>
</td>
</tr>
<tr>
<td align=right colspan=2>
<input type=reset value="Reset Form">
<input type=submit name="submitok" value="Submit">
</td>
</tr>
</table>
</form>
</body>
</html>
<?php
else:
// Process signup submission
dbConnect('');
if ($newid=="" or $newname=="" or $newemail=="" {
error("One or more required fields were left blank.\\n".
"Please fill them in and try again."
}
// Check for existing user with the new id
$sql = "SELECT COUNT(*) FROM user WHERE userid = '$newid'";
$result = mysql_query($sql);
if (!$result) {
error("A database error occurred in processing your ".
"submission.\\nIf this error persists, please ".
"contact me@keyitskills.co.uk"
}
if (mysql_result($result,0,0)>0) {
error("A user already exists with your chosen userid.\\n".
"Please try another."
}
$newpass = substr(md5(time()),0,6);
$sql = "INSERT INTO user SET
userid = '$newid',
password = PASSWORD('$newpass'),
fullname = '$newname',
email = '$newemail',
notes = '$newnotes'";
if (!mysql_query($sql))
error("A database error occurred in processing your ".
"submission.\\nIf this error persists, please ".
"contact me@keyitskills.co.uk"
// Email the new password to the person.
$message = "G'Day!
Your personal account for the Project Web Site
has been created! To log in, proceed to the
following address:
Your personal login ID and password are as
follows:
userid: $newid
password: $newpass
You aren't stuck with this password! Your can
change it at any time after you have logged in.
If you have any problems, feel free to contact me at
<me@keyitskills.co.uk>.
Project Webmaster
";
mail($newemail,"Your Password for the Project Website",
$message, "From: me <me@keyitskills.co.uk>"
?>
<html>
<head><title> Registration Complete </title></head>
<body>
<p><strong>User registration successful!</strong></p>
<p>Your userid and password have been emailed to
<strong><?=$newemail?></strong>, the email address
you just provided in your registration form. To log in,
click <a href="signup.php">here</a> to return to the login
page, and enter your new personal userid and password.</p>
</body>
</html>
<?php
endif;
?>
However, When I bring up the page and enter data the form just refreshes and enters no data into the database.
I have tried using the $_POST array but this will not even display the form - it just echos one of the custom error messages and keeps looping.
Any suggestions on where I am going wrong would be much appreciated. Thankyou in advance for your help . . .
Skootz ;o)
<?php // signup.php
include("common.php"
include("db.php"
if(!isset($submitok)):
// Display the user signup form
?>
<html>
<head><title>New User Registration</title></head>
<body>
<h3>New User Registration Form</h3>
<p><font color=orangered size=+1><TT><B>*</B></TT></font>
indicates a required field</p>
<form method=post action="<?=$PHP_SELF?>">
<table border=0 cellpadding=0 cellspacing=5>
<tr>
<td align=right>
<p>User ID</p>
</td>
<td>
<input name=newid type=text maxlength=100 size=25>
<font color=orangered size=+1><TT><B>*</B></TT></font>
</td>
</tr>
<tr>
<td align=right>
<p>Full Name</p>
</td>
<td>
<input name=newname type=text maxlength=100 size=25>
<font color=orangered size=+1><TT><B>*</B></TT></font>
</td>
</tr>
<tr>
<td align=right>
<p>E-Mail Address</p>
</td>
<td>
<input name=newemail type=text maxlength=100 size=25>
<font color=orangered size=+1><TT><B>*</B></TT></font>
</td>
</tr>
<tr valign=top>
<td align=right>
<p>Other Notes</p>
</td>
<td>
<textarea wrap name=newnotes rows=5 cols=30></textarea>
</td>
</tr>
<tr>
<td align=right colspan=2>
<input type=reset value="Reset Form">
<input type=submit name="submitok" value="Submit">
</td>
</tr>
</table>
</form>
</body>
</html>
<?php
else:
// Process signup submission
dbConnect('');
if ($newid=="" or $newname=="" or $newemail=="" {
error("One or more required fields were left blank.\\n".
"Please fill them in and try again."
}
// Check for existing user with the new id
$sql = "SELECT COUNT(*) FROM user WHERE userid = '$newid'";
$result = mysql_query($sql);
if (!$result) {
error("A database error occurred in processing your ".
"submission.\\nIf this error persists, please ".
"contact me@keyitskills.co.uk"
}
if (mysql_result($result,0,0)>0) {
error("A user already exists with your chosen userid.\\n".
"Please try another."
}
$newpass = substr(md5(time()),0,6);
$sql = "INSERT INTO user SET
userid = '$newid',
password = PASSWORD('$newpass'),
fullname = '$newname',
email = '$newemail',
notes = '$newnotes'";
if (!mysql_query($sql))
error("A database error occurred in processing your ".
"submission.\\nIf this error persists, please ".
"contact me@keyitskills.co.uk"
// Email the new password to the person.
$message = "G'Day!
Your personal account for the Project Web Site
has been created! To log in, proceed to the
following address:
Your personal login ID and password are as
follows:
userid: $newid
password: $newpass
You aren't stuck with this password! Your can
change it at any time after you have logged in.
If you have any problems, feel free to contact me at
<me@keyitskills.co.uk>.
Project Webmaster
";
mail($newemail,"Your Password for the Project Website",
$message, "From: me <me@keyitskills.co.uk>"
?>
<html>
<head><title> Registration Complete </title></head>
<body>
<p><strong>User registration successful!</strong></p>
<p>Your userid and password have been emailed to
<strong><?=$newemail?></strong>, the email address
you just provided in your registration form. To log in,
click <a href="signup.php">here</a> to return to the login
page, and enter your new personal userid and password.</p>
</body>
</html>
<?php
endif;
?>
However, When I bring up the page and enter data the form just refreshes and enters no data into the database.
I have tried using the $_POST array but this will not even display the form - it just echos one of the custom error messages and keeps looping.
Any suggestions on where I am going wrong would be much appreciated. Thankyou in advance for your help . . .
Skootz ;o)