Dynadot .com transfer sale, only $10.12 with coupon code DYNA12, available while supplies last, ends October 31, 2026.

[Resolved] How to limit access to admin file?

Namecheap AuctionsNamecheap Auctions
Namecheap AuctionsNamecheap Auctions
SpaceshipSpaceship
Watch

ApeXX

VIP Member
Impact
101
How to limit access to admin file?

I'm looking for some sort of code, script or technique, that limits complete access to my admin.php file without a password.

The admin.php file is the backend to one of my sites and does have a secure login before allowing access to website controls, however I would like to add another security measure.

Basically I'm looking for something like cPanel's directory password lock, except for a single file so that it cannot be read, open, or run without a password.

+Rep for all who assist me! :tu:
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
PHP:
<?

$password = md5("yourpassword");

if ($_POST['pass']) {
$pass = md5($_POST['pass']);
setcookie("password", $pass, time()+3600);
}

if ($_COOKIE["password"]) {
if ($_COOKIE["password"] !== $password) { exit; }
} else {
echo "
<form method=\"POST\" action=\"admin.php\">
<input type=\"text\" name=\"pass\" size=\"20\">
<input type=\"submit\" value=\"Submit\">
</form>
";
}

?>
 
1
•••
I just realized the admin page is encoded with Ioncube... Will the above code still work inserted in an Ioncube encoded page?
 
0
•••
1
•••
0
•••
DomainEasy: flexible LTO options. Close more domain deals with financing.

We're social

Escrow.com
Spaceship
Escrowly
CryptoExchange.com
Domain Recover
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back