Hello , i have created a login script for my photo album's.
When someone visit's a user's page , if the user has locked photo album's they can view them if they have the correct password.
For some reason , this script isnt working. Even if they type the correct password , it wont let them in the album , can someone help me fix this please.
// start the login
$return_message = "";
if(isset($_POST['login'])){
$sql = "select id, password from $tb_albums where id = '".$_POST['album_id']."' and password = '".$_POST['PW']."'";
$query = mysql_query($sql) or die(mysql_error());
if(mysql_num_rows($query)){
$_SESSION['album_'.$_POST['album_id']] = 1;
session_register('album_'.$_POST[album_id]);
$r = urldecode($_GET['r']);
if (!$r) { $r=urldecode($_POST['r']); }
$url = $base_url . "/" . $r;
header("Location: $url");
exit();
} else {
$return_message = "Invalid Album Password <br><br>";
}
}
$r = urlencode($_GET['r']);