</td></tr>
</table>
</form>
</html>
/* That was the login page
Next is some code you can put into a different file (named 'login_check.inc' or something)
that you include() on each page you want protected on your site.
It uses the cookie from the first script to verify user has already been there.
*/
// if the cookie doesn't exsist means the user hasn't been verified by the login page so send them back to the login page.
if(!$candle_login)
header("Location: ./login.php");
if($phpcoders) { // if the cookie does exsist
mysql_connect() or die ("Whoops"); //connect to db
$user = explode(" ","$phpcoders"); //explode cookie value (which is the '$username $password (note seperated by space)) and store values in $user. Check
manual for more info
on explode()
$sql = "select * from login where username='$user[0]'"; //sql statment that uses the username from the cookie.
$r = mysql_db_query("register",$sql); //execute sql
if(!mysql_num_rows($r)) { // if there are no rows, means no matches for that username
header("Location: ./login.php"); // so go back to the login page
}
$chkusr = mysql_fetch_array($r); //if we got passed the last part, then get the username/password set that match that username
if(unserialize($user[1]) != $chkusr[1]) //if the password from cookie (notice we have to unserialize it) doesn't match the one from the database
header("Location: ./login.php"); // go back to the login page
} // if it did match then continue on to page and this ends up doing nothing :)
?>
Privacy Policy
|
Link to Us
|
Links
|