login.php jest tam możliwość wpisania emaila oraz hasła
<!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="form1" name="form1" method="post" action="checklogin.php"> <table width="250" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="91"> email :</td> <td width="159"><label> <input type="text" name="email" id="email" /> </label></td> </tr> <tr> <td>password :</td> <td><label> <input type="password" name="password" id="password" /> </label></td> </tr> <tr> <td> </td> <td align="right"><label> <input type="submit" name="zaloguj" id="zaloguj" value="Zaloguj" /> </label></td> </tr> </table> </form> </body> </html>
checklogin.php
<?php include("db_fns.php"); $row=get_user($_POST['email'], $_POST['password']); if($row){ $_SESSION['id'] = $row['email']; $_SESSION['username'] = $row['name']; exit; } else{ } ?>
db_fns.php
index.php prosta strona która będzie serwisem dostępnym po zalogowaniu
<!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" xml:lang="pl" lang="pl"> <head> </head> <body> <form id="form1" name="form1" method="post" action=""> <table width="1085" border="0" cellspacing="0" cellpadding="0"> <tr> <input type="submit" name="wyloguj" id="wyloguj" value="wyloguj" /> </tr> </table> </form> <form id="form2" name="form2" method="post" action=""> </form> </body> </html>