Jump to content

whitelist doesn't work


wesley
 Share

Recommended Posts

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.php
My 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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...