im stuck with this code for registration,
this is my HTML code...
Code: Select all
<!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>FYPMS - Student Registration Form</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="Keywords" content="Keywords here" />
<meta name="Description" content="Description here" />
<meta name="Author" content="Joseph De Araujo" />
<meta name="Publisher" content="Interspire.com" />
<meta name="robots" content="index, follow" />
<!-- (Robot commands: All, None, Index, No Index, Follow, No Follow) -->
<meta name="revisit-after" content="30 days" />
<meta name="distribution" content="global" />
<meta name="rating" content="general" />
<meta name="Content-Language" content="english" />
<link href="style.css" rel="stylesheet" type="text/css" />
<script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
<style type="text/css">
<!--
body {
background-color: #CCFFFF;
}
.style1 {font-size: 9px}
#apDiv1 {
position:absolute;
width:165px;
height:79px;
z-index:1;
left: 494px;
top: 888px;
}
-->
</style></head>
<body>
<div align="center">
<table width="675" height="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#ECE9D8" class="maintable">
<tr>
<td height="25" class="topbg"> </td>
<td height="25" align="right" class="topbg topnav"><a href="index.html">Home</a> | <a href="#">About Us</a> | <a href="#">Contact us</a> | <a href="#">products</a> | <a href="#">services</a> </td>
</tr>
<tr>
<td height="100" colspan="2"><script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','893','height','97','title','banner','src','FYPMS BANNER','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','movie','FYPMS BANNER' ); //end AC code
</script><noscript><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="893" height="97" title="banner">
<param name="movie" value="FYPMS BANNER.swf" />
<param name="quality" value="high" />
<embed src="FYPMS BANNER.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="893" height="97"></embed>
</object></noscript></td>
</tr>
<tr>
<td width="180" height="340" valign="top">
<div class="latestnews" align="left">
<span class="latestnewscontent"><br />
</span> </div></td>
<td width="495" height="340" valign="top"><div class="maincontent" align="left">
<h1>Student Registration Form</h1>
<p> </p>
<p> </p>
<form name="form8" method="post" action="register_std.php">
<label></label>
<p>ID Number</p>
<p>
<label>
<input type="text" name="idno" id="idno" />
</label>
</p>
<p>First Name</p>
<p>
<label>
<input type="text" name="fname" id="fname" />
</label>
</p>
<p>Last Name</p>
<p>
<label>
<input type="text" name="lname" id="lname" />
</label>
</p>
<p>Student Major</p>
<p>
<label>
<select name="major" id="major">
</select>
</label>
</p>
<p>H/P Number</p>
<p>
<label>
<input type="text" name="hpno" id="hpno" />
</label>
</p>
<p>E-mail Address</p>
<p>
<label>
<input type="text" name="email" id="email" />
</label>
</p>
<p>Credit Hour Completed</p>
<p>
<label>
<input type="text" name="crhour" id="crhour" />
</label>
</p>
<p>Password <span class="style1">(Max 10)</span></p>
<p>
<label>
<input type="text" name="password" id="password" />
</label>
</p>
<p>Password Conformation <span class="style1">(Max 10)</span></p>
<p>
<label>
<input type="text" name="conpassword" id="conpassword" />
</label>
</p>
<p align="center">
<label></label>
<br />
<input type="submit" name="submit" id="button" value="Submit" />
<label>
<input type="reset" name="Reset" id="reset" value="Reset" />
</label>
</p>
<p>
<label></label>
</p>
</form>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
</div></td>
</tr>
<tr>
<td height="60" colspan="2" class="footer"><table width="675" border="0" cellspacing="0" cellpadding="10">
<tr>
<td align="left" class="footer">Copyright 2009. © FYPMS. All rights reserved</td>
<td align="right" class="footer"><a href="#" class="footer">privacy policy</a> | <a href="#" class="footer">terms of use</a> | <a href="#" class="footer">how to order</a></td>
</tr>
</table> </td>
</tr>
</table>
</div>
</body>
</html>
and this is the PHP code
Code: Select all
<?php
session_start();
include ('access.php');
if ($_POST['Submit'] == 'Register')
{
if (strlen($_POST['email']) < 5)
{
die ("Incorrect email. Please enter valid email address..");
}
if (strcmp($_POST['password'],$_POST['conpassword']) || empty($_POST['password']) )
{
//die ("Password does not match");
die("ERROR: Password does not match or empty..");
}
/*
if (strcmp(md5($_POST['user_code']),$_SESSION['ckey']))
{
die("Invalid code entered. Please enter the correct code as shown in the Image");
}
*/
$rs_duplicates = mysql_query("select std_id from users where std_email='$_POST[email]'");
$duplicates = mysql_num_rows($rs_duplicates);
if ($duplicates > 0)
{
//die ("ERROR: User account already exists.");
header("Location: register.php?msg=ERROR: User account already exists..");
exit();
}
$md5pass = md5($_POST['conpassword']);
$activ_code = rand(1000,9999);
$server = $_SERVER['HTTP_HOST'];
$host = ereg_replace('www.','',$server);
mysql_query("insert into std (std_id, std_f_nm, std_l_nm, std_major, std_hp, std_email, std_c_hour, std_pass) values('$std_id','$std_f_nm','$std_l_nm','$std_major','$std_hp','$std_email','$std_c_hour','$std_pass')") or die(mysql_error());
$message =
"Thank you for registering an account with $server. Here are the login details...\n\n
User Email: $_POST[email] \n
Password: $_POST[pass2] \n
Activation Code: $activ_code \n
____________________________________________
*** ACTIVATION LINK ***** \n
Activation Link: http://$server/activate.php?usr=$_POST[email]&code=$activ_code \n\n
_____________________________________________
Thank you. This is an automated response. PLEASE DO NOT REPLY.
";
mail($_POST['email'] , "Login Activation", $message,
"From: \"Auto-Response\" <notifications@$host>\r\n" .
"X-Mailer: PHP/" . phpversion());
unset($_SESSION['ckey']);
echo("Registration Successful! An activation code has been sent to your email address with an activation link...");
exit;
}
*/