Forgot Password / Register
Site Statistics
Total Members: 520
Total Tutorials: 242
Newsest User: 8884244477
Todays Unique Hits: 515
1 Users 4 Guests Online

Password Protect

PHP Code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?php

$user 
"USERNAME"//Username to protected page
$pass "PASSWORD"//Password to protected page

if(!$_POST['login']) //If you didn't log in it will show the login screen
{
echo (
'<form method="POST">
    <table>
        <tr><td>Username:</td><td><input type="text" name="username"></td></tr>
        <tr><td>Password:</td><td><input type="password" name="password"></td></tr>
        <tr><td><input type="submit" name="login" value="Log In"></td></tr>
    </table>
</form>'
);

if(
$_POST['username'] == $user && $_POST['password'] == $pass//If you entered  the username/password correctly
    
{
?>
HIDDEN CONTENT HERE
<?
    
}
else 
//If you didn't enter it correctly
        
{
echo (
'Incorrect username/password!');
        }
?>
kane0ner
Author:
Views:
1926
Rating:
There are currently no comments for this tutorial.