wesley Posted January 18, 2016 Share Posted January 18, 2016 Hello,I have a whitelist of pages, but it doesn't work.If you visit a page (write.php) that is not on the white list, the browser isn't going to index.php. But this is not the intention.I have five pages: products.php, contact.php, information.php, login.php and write.phpMy whitelist is: <?php session_start(); $whitelist = array("/folder/products.php", "/folder/contact.php", "/folder/information.php", "/folder/login.php"); $ip = $_SERVER['SCRIPT_NAME']; //var_dump($ip); if (in_array($ip, $whitelist)) { //echo "You can access the whitelist page!"; } else { session_destroy (); header("Location: index.php");die(); } ?> My question is: how can I make the whitelist when you visit a page, that is not on the whitelist, that the browser go to index.php?can someone help me?thanks in advance. Link to comment Share on other sites More sharing options...
justsomeguy Posted January 18, 2016 Share Posted January 18, 2016 Code that like will generally work, so if it's not working then you should verify what you're comparing to make sure that it actually is or is not in the list. Link to comment Share on other sites More sharing options...
dsonesuk Posted January 18, 2016 Share Posted January 18, 2016 How is this code instered and where is this code placed? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now