i need to make a simple login script that uses session to check if the form submitted data is the same as the data in one row of the mysql table.
then i need to know how to turn that user posted data into a session.
ive already looks at thousands of php login scripts but i cant figure out how to do it.
heres my unworking script so you can see what i'm tryin to do
<?
mysql_connect("localhost","*****","****");
mysql_select_db("*****");
$result = mysql_query("select * from admins where admin = '$r_admin' and password = '$r_password'");
if(isset($_GET['admin']) && isset($_GET['password'])){
if($_GET['admin'] != $r_admin && $_GET['password'] != $r_password){
echo("$admin does not exist.");
}
else
{
$_session['admin'] = $_GET['admin'];
$_session['password'] = $_GET['password'];
echo "logged in as $admin";
}
}
?>
<form action="<? echo $PHP_SELF; ?>">
Login Form:<br/>
Admin:<input name="admin" /><br/>
Password:<input name="password" name="password" /><br/>
<input type="submit" value="Submit" />
</form>
