Jump to content

using php instead of htaccess


perficut

Recommended Posts

personally I use the header function, in a way like this:

 

<?php

if($logged_user['user_level']!='administrator')
{
header("Location: http://my-site/index.php");
}

?>

 

 

or something like that...

 

hope this helps!

 

 

Yeah...

 

OR!!!!!

 

PART 1

 

 

 

<?php

function session_admin(){

if(!isset($_SESSION['administrator'])){
if($_SERVER['REMOTE_ADDR']=="YOUR IP ADDRESS"){

$_SESSION['administrator']==$_SERVER['REMOTE_ADDR'];

}
}
}
?>

 

PART 2

 

<?php
function check_session(){


if(isset($_SESSION['administrator'])){


/*Show the content of this page*/

}
else
{

/*Knowing the session, or the webmaster is not online, we do not let outsiders enter this page*/
die("TSK TSK TSK, stop being so sneaky");

}
}
?>


IF i could get rid of this annoying problem with htaccess I would consider keeping it.

 

If the wrong login ingo is entered 3 times, it directs you to my custom 'access not granted' page. Problem is, about 1/3 the page loads, then the popup returns. Hit cancel, you might get one or two more pieces of the page to load, then the popup returns.  Keeps doing this until the page completely load (maybe 100 times).

 

This redirect page is located in my root directory, not the secured directory.

 

Any ideas?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.