I am trying to set a page for logout from a service I use but need to kill the $_REQUESTprovided by that service so my logout and redirect works.
I have tried the following with no luck

unset ($_REQUEST['login]');
header ("Location: http://www.mysite.com/mypage.php");

There has to be some way to either delete the variable or to be rid of the entire request array.

Please help.

Recommended Answers

All 7 Replies

There was a bug in your code. Try the following:

unset ($_REQUEST['login']); //quote fixed
header ("Location: http://www.mysite.com/mypage.php");

You May Use This Code for Destroy Your Login Session and Create a logout Page. Use the Below Specified Code it's Work Greate for me:

<?php
session_start();
session_unset();

session_destroy();
// Logged out, return home.
print '<script> alert ("You Have Successfully Logged Out.");
window.top.location.href = "index.php";; </script>';
?>

You May Use This Code for Destroy Your Login Session and Create a logout Page. Use the Below Specified Code it's Work Greate for me:

Accept becraig isn't using sessions. becraig is removing the elements of the post and url variables which together form $_REQUEST.

oh!!!!!!
okay @above youare right.
i am not seeing fully or understand something wrong.
sorry for it.
but Thanx for Your comment.

I entered incorrectly when posting here but the quotes are correct in the code I am using.

I am at the point of tearing my hair out there has to be some way to do this.

ok I am able to unset the array using:

<?php
foreach ($_REQUEST as $i => $value) {
    unset($_REQUEST[$i]);}
header ("Location: http://www.mysite.com/logoutaction.php");

?>

However if I do not do the header the array clears, but when I do the header the array stays in tact ????

Can you explain your system better? Honestly, I don't see why you need to unset something in the _REQUEST array. There is probably a different way to go about what you are trying to do.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.