Forum Moderators: coopster
i havent really worked with md5 before but i want to create a registration form that when you enter your username and guild it validates that info against what is in mysql (meaning that the information provided is in the same row) then allows for you to enter a password that will be saved in mysql as an md5 password.
Not sure how ecactly to begin this other than the actual form which i beleive will be a 2 part form 1st part asking for username and has a selection box pre-filled with array data and a next button, 2nd part asking for a password and a submit button posting to a sql query. also do i need to create the field in mysql for the password in any special way to accomodate the md5? also could all of this be embedded in a single script? or would it be better to do a seperate page for each?
then i want to create a login form (username, password, guild you are leader of{guild will be an array of mysql data}) and once this form is submitted i want to have it check each row for a solid match of information (username is on the same row as the inputed password and guild) then after successful login display results of "SELECT * from `table` WHERE status='Applicant' AND guild='guild from login'" with accept/deny buttons next to each result and which the accept will change the status to "Member" and the Deny will delete the record.
I know this is alot i have the basics (below) just not sure how to finish it up...
Registration Form 1:
<form id="reg1" name="reg1" method="post" action="">
<table width="100%" border="0" cellspacing="3" cellpadding="3">
<tr>
<td><div align="right">Username:</div></td>
<td><div align="left">
<input type="text" name="username" id="username" />
</div></td>
</tr>
<tr>
<td><div align="right">Guild:</div></td>
<td><div align="left">
<?
$sql = "SELECT * FROM `table` WHERE status='Member'";
$options="";
$query = mysql_query($sql);
while ($row=mysql_fetch_array($query)) {
$id=$row["gname"];
$options.="<OPTION VALUE=\"$id\">".$id;
}
?>
<select name="gname" style="width:auto" id="gname">
<?=$options?>
</select>
</div></td>
</tr>
<tr>
<td><div align="right"></div></td>
<td><div align="left"></div></td>
</tr>
<tr>
<td><div align="right"></div></td>
<td><div align="left">
<input type="button" name="next" id="next" value="Next" />
</div></td>
</tr>
</table>
</form>
Registration Form 2:
<form id="reg2" name="reg2" method="post" action="">
<table width="100%" border="0" cellspacing="3" cellpadding="3">
<tr>
<td><div align="right">Password:</div></td>
<td><div align="left">
<input type="password" name="password" id="password" />
</div></td>
</tr>
<tr>
<td><div align="right">Confirm Password:</div></td>
<td><div align="left">
<input type="password" name="password" id="password" />
</div></td>
</tr>
<tr>
<td><div align="right"></div></td>
<td><div align="left"></div></td>
</tr>
<tr>
<td><div align="right"></div></td>
<td><div align="left">
<input type="button" name="submit" id="submit" value="Submit" />
</div></td>
</tr>
</table>
</form>
Login Form:
<form id="login" name="login" method="post" action="">
<table width="100%" border="0" cellspacing="3" cellpadding="3">
<tr>
<td><div align="right">Username:</div></td>
<td><div align="left">
<input type="text" name="username" id="username" />
</div></td>
</tr>
<tr>
<td><div align="right">Password:</div></td>
<td><div align="left">
<input type="password" name="password" id="password" />
</div></td>
</tr>
<tr>
<td><div align="right">Guild:</div></td>
<td><div align="left">
<?
$sql = "SELECT * FROM `table` WHERE status='Member'";
$options="";
$query = mysql_query($sql);
while ($row=mysql_fetch_array($query)) {
$id=$row["gname"];
$options.="<OPTION VALUE=\"$id\">".$id;
}
?>
<select name="gname" style="width:auto" id="gname">
<?=$options?>
</select>
</div></td>
</tr>
<tr>
<td><div align="right"></div></td>
<td><div align="left">
<input type="button" name="submit" id="submit" value="Login" />
</div></td>
</tr>
</table>
</form>
On the login page, you could compare md5($password just supplied)==password in the database, if the same allow the login to proceed.
anyway i can get some examples as how to do this ?
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<form id="login" name="login" method="post" target="_self" action="./sql/guild_login.php">
<table width="100%" border="0" cellspacing="3" cellpadding="3">
<tr>
<td><div align="right">Username:</div></td>
<td><div align="left">
<input type="text" name="username" id="username" />
</div></td>
</tr>
<tr>
<td><div align="right">Password:</div></td>
<td><div align="left">
<input type="password" name="password" id="password" />
</div></td>
</tr>
<tr>
<td><div align="right">Guild:</div></td>
<td><div align="left">
<?php
$host="localhost";
$username="#*$!X";
$password="#*$!X";
$db_name="#*$!X";mysql_connect("$host", "$username", "$password")or die("<br />Connect-". mysql_error());
mysql_select_db("$db_name")or die("<br />Select DB-". mysql_error());
$sql = "SELECT * FROM `sun_alliance` WHERE status='Member'";
$query = mysql_query($sql);
while ($row=mysql_fetch_array($query)) {
$id=$row["gname"];
$options.="<option value='$id'>$id</option>";
}
?>
<select name="gname">
<option>Please Select</option>
<?php print($options);?>
</select>
</div></td>
</tr>
<tr>
<td><div align="right"></div></td>
<td><div align="left">
<input name="login" type="button" value="Login" />
</div></td>
</tr>
</table>
</form>
<p> <a href="http://validator.w3.org/check?uri=referer"><img
src="http://www.w3.org/Icons/valid-xhtml10"
alt="Valid XHTML 1.0 Transitional" height="31" width="88" /></a> </p>
</body>
</html>