Hello ,
In this script ive created , this is an album login script for photo albums.
If the login is sucessfull , the user is taken to the album , if unsucessful they are taken back to their profile
You can skip down thru all this code the the second javascript href: location , thats whats not working for me.
If the album login fails ( wrong password ) i want it to take them back to their profile , but instead it is taking them to my $base_url , is their any other way to make php send them back to their profile? for some reason everything i try send's them to my homepage , ive tried header , javascript href location tags , nothing works for this.
$id2 = $_GET['id']; // get's the user's id from the profile page that the albums appear on so we can use it later to take them back tto their profile.
if(isset($_POST['login'])){
// start the album login
$sql = "select id, password from $tb_albums where id = '".$_POST['album_id']."' and password = '".md5($_POST['PW'])."'";
$query = mysql_query($sql) or die(mysql_error());
if(mysql_num_rows($query)){
$_SESSION['album_'.$_POST['album_id']] = 1;
// if the login was good , register the album as session.
session_register('album_'.$_POST[album_id]);
$r = urldecode($_GET['r']);
if (!$r) { $r=urldecode($_POST['r']); }
$url = $base_url . "/" . $r;
// echo " url ".$url."a";
header("Location: $url");
exit();
// take them to the album , then exit
} else {
// if login failed , take them back to profile.
echo "<script language=\"javascript\">document.location.href='".$base_url."/acct_profile.php?acctid=$id2';</script>";
exit();
}
}
what am i doing wrong?