php-5
02-28-2007, 02:28 AM
Hi all.
I am new to this forum, and would like to know if anyone can help me with this problem...
I am setting up a page for my friend so that it can only be accessed once, or may I say used once....
On page 1 I have the following:
<?php
session_start();
// store session data
$_SESSION['views']= "asdgh37rtcbgvsdfsrt";
header("Location: page2.php?key=gadghas656asd2f");
?>
And on page 2 I have this:
<?php
if($_SESSION['views'] =="asdgh37rtcbgvsdfsrt" & $_GET['key'] =="gadghas656asd2f"){
session_destroy();
echo "You passed!";
}else{
echo "You have accessed this page already! Go Away!";
}
?>
However, when you visit page 1, it redirects normally but shows the words "You have accessed this page already! Go Away!", but it should really show "You passed!", and then when page two is accessed again, it should only show "You have accessed this page already! Go Away!" Since the session is distroyed. So what am I doing wrong here.
// Note: //
The user never knows about page 1....
Can anyone help me!:confused: :confused:
Many Many Thanks! - This forum rocks.
I am new to this forum, and would like to know if anyone can help me with this problem...
I am setting up a page for my friend so that it can only be accessed once, or may I say used once....
On page 1 I have the following:
<?php
session_start();
// store session data
$_SESSION['views']= "asdgh37rtcbgvsdfsrt";
header("Location: page2.php?key=gadghas656asd2f");
?>
And on page 2 I have this:
<?php
if($_SESSION['views'] =="asdgh37rtcbgvsdfsrt" & $_GET['key'] =="gadghas656asd2f"){
session_destroy();
echo "You passed!";
}else{
echo "You have accessed this page already! Go Away!";
}
?>
However, when you visit page 1, it redirects normally but shows the words "You have accessed this page already! Go Away!", but it should really show "You passed!", and then when page two is accessed again, it should only show "You have accessed this page already! Go Away!" Since the session is distroyed. So what am I doing wrong here.
// Note: //
The user never knows about page 1....
Can anyone help me!:confused: :confused:
Many Many Thanks! - This forum rocks.