...

View Full Version : Substitution for .htaccess password



GO ILLINI
02-11-2006, 04:32 AM
dns.inc.php:

<?php
if (!stristr( $_SERVER['HTTP_HOST'], 'server2')) {
header('Location: http://games.game-host.org/css');
}
?>
where server2 is the computers name and http://games.game-host.org/css is the address to go to if the domain is not correct.
------------------------------------
This will only work if the client and the server are on the same network.

Purpose:
I did this because I needed a way to have an admin panel just for me. This also takes all passwords out of it. No passwords and no usernames.

How?
server2 has to be a network only dns(computer name). Then have it redirect to anything you want if its not correct.
Just include that dns.inc.php page on every page ytou want protected.

Working example:
http://games.game-host.org/css/maps_admin/
will redirect you to:
http://games.game-host.org/css/
But
http://server2/css/maps_admin/
will be the page with no change. You will not even know it is there.
http://server2/css/maps_admin

marek_mar
02-11-2006, 01:00 PM
I am afraid it might fail.

GO ILLINI
02-11-2006, 04:56 PM
weird... its worked great so far

matthijs
02-12-2006, 09:03 AM
you cannot trust any $_SERVER variable that begins with HTTP (e.g., $_SERVER["HTTP_REFERER"], $_SERVER['HTTP_HOST'])

See for example http://shiflett.org/archive/98

GO ILLINI
02-12-2006, 04:41 PM
OK, well I wont use that anymore.
I am more or less a php newbie... BUt im getting better.



ILLINI



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum