Code: Select all
<?php
//include files
include("webvars.php");
if (!IsSet($_POSTї'Submit'])):
?>
<form action="<?=$PHP_SELF?>" method="post" name="TechnicianSignUp" id="TechnicianSignUp">
<table width="100%" border="0" cellspacing="4">
<tr>
<td width="20%" class="medium"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">User
Name:</font></td>
<td width="80%"><input name="username" type="text" id="username" size="15" maxlength="12">
</td>
</tr>
<tr>
<td class="medium"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Password:
</font></td>
<td><input name="password" type="password" id="password" size="10"></td>
</tr>
<tr>
<td class="medium">Confirm Password:</td>
<td><input name="confirmpassword" type="password" id="confirmpassword" size="10"></td>
</tr>
<tr>
<td class="medium"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Email:</font></td>
<td><input name="email" type="text" id="email" size="30"></td>
</tr>
<tr>
<td class="medium"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">First
Name:</font></td>
<td><input name="firstname" type="text" id="firstname" size="24"></td>
</tr>
<tr>
<td class="medium"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Last
Name:</font></td>
<td><input name="lastname" type="text" id="lastname" size="24"></td>
</tr>
<tr>
<td class="medium"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Phone
Number:</font></td>
<td><input name="phonenumber" type="text" id="phonenumber" size="10" maxlength="10"></td>
</tr>
<tr>
<td class="medium"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Location:</font></td>
<td><input name="location" type="text" id="location" size="30"></td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td colspan="2"><div align="center">
<input type="Submit" name="Submit" value="Submit">
<input type="reset" name="Reset" value="Reset">
</div></td>
</tr>
</table>
</form>
<?php
else :
// Process signup submission
mysql_connect($hostname, $user, $pass)
or die("The site database appears to be down.");
mysql_select_db("pancorp");
$usertest = $username;
$sql = "SELECT username FROM technicians WHERE username = '$usertest'";
$result = mysql_query($sql) or die(mysql_error());
if ($password != $confirmpassword) {
echo ("Your passwords must match in order to register.");
exit();
}
if (mysql_num_rows($result) != 0) {
echo "Username taken, please choose another username.";
exit();
}
else {
$sql2 = "INSERT INTO technicians (id,username,password,firstname,lastname,email,location,phonenumber)".
"VALUES ('NULL', '$username', '$password', '$firstname', '$lastname', '$email', '$location', '$phonenumber')";
$result=mysql_query($sql2) or die(); //Insert into db
// Email the new password to the person.
$message = "You have successfully registered your Technician's Account at Pancorp.com. To log in, proceed to the following address:
http://tech.pancorp.com/
Your personal login ID and password are as follows:
Username: $username
Password: $password
Feel free to login and change your password and if you have any questions or comments don't hesitate to send mail to
<ttoomey@yiinc.com>.
-Tim Toomey";
mail($email,"Your Login/Username for Pancorp.com", $message, "From: Tim Toomey <ttoomey@yiinc.com>");
}
?>
<title>Thanks for Signing Up!</title>
<h3>Registration Complete!</h3>
<p>Your username and password have been emailed to <strong>
<?=$email?>
</strong>, the email address you just provided in your registration
form. To log in, click <a href="index.php">here</a> to return to
the login page, and enter your new personal username and password.</p>
<?php
endif;
?>