questorfla Posted January 26, 2017 Share Posted January 26, 2017 In the code for a website we use, the logout sequence in class.inc.php is set to destroy the current session but leave the user on the existing URL. Below is the logout code in the class.inc.php. Everything works and the normal function would be to exit on the starting login page and wait for them to login again. I need to change the redirect to take the User to our Main page rather than staying on the URL where they logged out. I am not familiar with PHP But I think if i edited the current redirect line to send the user to the new location it should do it. If anyone could tell me where to add the 'http://www.newsite.com' address I would appreciate it. function logout() { $_SESSION["user_id"] = null; $_SESSION["user_role"] = "Visitor"; session_destroy(); redirect("$_SERVER[php_SELF]?interface=login; return true; Quote Link to comment Share on other sites More sharing options...
ginerjm Posted January 26, 2017 Share Posted January 26, 2017 This line: redirect("$_SERVER[php_SELF]?interface=login; Is not valid code. And "redirect" is not a php command. Perhaps there is a function somewhere in your code called redirect. In that case show us that as well as a corrected line above. Quote Link to comment Share on other sites More sharing options...
jperez260 Posted January 28, 2017 Share Posted January 28, 2017 (edited) Try using the "header" in your php code instead of redirect header(Location: '$_SERVER["PHP_SELF"]?interface=login'); Edited January 28, 2017 by jperez260 Quote Link to comment Share on other sites More sharing options...
Jacques1 Posted January 28, 2017 Share Posted January 28, 2017 Whatever that is, it's not valid PHP code either. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.