Hi everybody,
I already post a thread like this but that was in mysql.
Here i have a problem with all the code,,
Now the question arises are these:
IC number and Access Code are alredy given to users.
1: I want that when user enters the details like Ic number,access code,Full name,email,hp,u sername etc. The script 1st check that is their any IC number and access code exist in the table, if have than store the
others values to the table like email,username, hp etc to that row of table.
if no error msg showed.
2: Where i edit the script to give right results.Is there any thing wrong in the sql query.
Plz help me if any body have idea..
Thanks...
I already post a thread like this but that was in mysql.
Here i have a problem with all the code,,
Code:
<?php // signup.php
include("common.php");
include("db.php");
if (!isset($_POST['submitok'])):
// Display the user signup form
?>
<!DOCTYPE html PUBLIC "-//W3C/DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title> Access Code Generator Form </title>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1
</head><link href="style.css" rel="stylesheet" type="text/css">
<body bgcolor="slate"><center>
<h3> <font color="#FFFFFF" face="verdana"><u>Registration Form For New Users</u><p>Please Fill The Form Below Carefully
</font>
</h3></body>
<form name="reg" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<table align="center" border="0" cellpadding="0" cellspacing="5">
<hr color="blue" />
<tr>
<td align="right">
<p><font color="#FFFFFF" face="verdana">IC Number :</font></p>
</td>
<td>
<input name="icnumber" type="text" maxlength="100" size="25" />
<font color="orangered" size="+1"><tt><b>*</b></tt></font>
</td>
</tr>
<tr>
<td align="right">
<p><font color="#FFFFFF" face="verdana">Access Code :</font></p>
</td>
<td>
<input name="acccode" type="text" maxlength="100" size="25" />
<font color="orangered" size="+1"><tt><b>*</b></tt></font>
</td>
</tr>
<tr>
<td align="right">
<p><font color="#FFFFFF" face="verdana">Username :</font></p>
</td>
<td>
<input name="username" type="text" maxlength="100" size="25" />
<font color="orangered" size="+1"><tt><b>*</b></tt></font><td align="left">Enter a valid user name.</td>
</td>
</tr>
<tr>
<td align="right">
<p><font color="#FFFFFF" face="verdana">Full Name :</font></p>
</td>
<td>
<input name="fullname" type="text" maxlength="100" size="25" />
<font color="orangered" size="+1"><tt><b>*</b></tt></font>
</td>
</tr>
<tr>
<td align="right">
<p><font color="#FFFFFF" face="verdana">Email :</font></p>
</td>
<td>
<input name="email" type="text" maxlength="100" size="25" />
<font color="orangered" size="+1"><tt><b>*</b></tt></font><td>Email must be valid for password retreival.</td>
</td>
</tr>
<tr>
<td align="right">
<p><font color="#FFFFFF" face="verdana">Hand Phone :</font></p>
</td>
<td>
<input name="hp" type="text" maxlength="100" size="25" />
<font color="orangered" size="+1"><tt><b>*</b></tt></font>
</td>
</tr>
<tr><td>
<font face="verdana" color="orangered" size="+1"><tt><b>*</b></tt></font>
<u><font face="arial" size="2" color="#FFFFFF">indicates a required field</u></font>
</td>
</tr>
<tr>
<td align="right" colspan="3">
<hr color="blue" />
<input type="reset" value="Reset" />
<input type="submit" name="submitok" value="Register" />
</td>
</tr>
</table>
</form>
</body>
</html>
<?php
else:
// Process signup submission
dbConnect('db');
if ($_POST['icnumber']=='' or $_POST['acccode']=='' or $_POST['username']==''or $_POST['fullname']==''
or $_POST['email']=='' or $_POST['hp']=='') {
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 * FROM m_users WHERE icnumber = '$_POST[icnumber]' AND acccode = '$_POST[acccode]'";
$result = mysql_query($sql);
if (!$result==0) {
error('A database error occurred in processing your '.
'submission.\\nIf this error persists, please '.
'contact you@example.com.');
}
if (mysql_result($result) < 1) {
error('Your entered Ic number and Access code does not match\\n'.
'to the database data. Please try agian.');
}
$newpass = substr(md5(time()),0,6);
$sql = "INSERT INTO m_users where icnumber = '$_POST[icnumber]' SET
password = PASSWORD('$newpass'),
email = '$_POST[email]',
h/p = '$_POST[hp]',
username = '$_POST[username]',
fullname = '$_POST[fullname]'";
if (!mysql_query($sql))
error('A database error occurred in processing your '.
'submission.\\nIf this error persists, please '.
'contact admin@straight-a.com.my .\\n' . mysql_error());
// Email the new password to the person.
$message = "G'Day!
Your personal account for the Straight-a program
has been created! To log in, proceed to the
following address:
http://www.straight-a.com.my/
Your personal login ID and password are as
follows:
username: $_POST[username]
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
<admin@straight-a.com.my>.
-Arif
Webmaster
";
mail($_POST['email'],"Your Password for the Straight-a Program",
$message, "From:Arif <admin@straight-a.com.my>");
?>
<!DOCTYPE html PUBLIC "-//W3C/DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title> Registration Complete </title>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1" />
</head>
<body>
<p><strong>User registration successful!</strong></p>
<p>Your userid and password have been emailed to
<strong><?=$_POST['email']?></strong>, the email address
you provided in your registration form. To log in,
go to your email and click the link provided in your email.</p>
</body>
</html>
<?php
endif;
?>
IC number and Access Code are alredy given to users.
1: I want that when user enters the details like Ic number,access code,Full name,email,hp,u sername etc. The script 1st check that is their any IC number and access code exist in the table, if have than store the
others values to the table like email,username, hp etc to that row of table.
if no error msg showed.
2: Where i edit the script to give right results.Is there any thing wrong in the sql query.
Plz help me if any body have idea..
Thanks...
Comment