Single-Page PHP Login System
Posted: Sat May 28, 2005 2:55 pm
After deciding its been a while since I\'ve done anything like this, I spent around 30 mins just coding something which I know a lot of people need when starting out..
The following is a simple\'ish login system (using PHP and cookies), which all fits inside a single page, the only things which need configuring are the $pass variable (clearly marked within the script) and the content which you would like to restrict.
For example:
I have a script with the following content that I would like to protect.
[code]<html>
<head>
<title>Restricted Page</title>
</head>
<body>
phone number: 0793424423435<br />
address: 13 rhfeu road, roertherfh<br /><br />
personal information, not to be disclosed!
</body>
</html>[/code]
the above could be any sensetive information which should only be accessed by certain individuals.. if we used this script to protect the above information, we would be presented with something resembling the following:
[url=\"http://ner0.killagraphix.com/php/dev/loginexample.php\"]
/click.gif\' class=\'bbc_emoticon\' alt=\'(click)\' /> [/url]
[url=\"http://ner0.killagraphix.com/php/dev/loginexample.phps\"]source code[/url]
[b]Password:[/b] t3st
the Script will set a cookie for 1hr after a successful login attempt, so the user can continue accessing the page without logging in again for up to an hour after the initial login.
the source file can be found [url=\"http://ner0.killagraphix.com/php/dev/login.phps\"][b]HERE[/b][/url]
The following is a simple\'ish login system (using PHP and cookies), which all fits inside a single page, the only things which need configuring are the $pass variable (clearly marked within the script) and the content which you would like to restrict.
For example:
I have a script with the following content that I would like to protect.
[code]<html>
<head>
<title>Restricted Page</title>
</head>
<body>
phone number: 0793424423435<br />
address: 13 rhfeu road, roertherfh<br /><br />
personal information, not to be disclosed!
</body>
</html>[/code]
the above could be any sensetive information which should only be accessed by certain individuals.. if we used this script to protect the above information, we would be presented with something resembling the following:
[url=\"http://ner0.killagraphix.com/php/dev/loginexample.php\"]
[url=\"http://ner0.killagraphix.com/php/dev/loginexample.phps\"]source code[/url]
[b]Password:[/b] t3st
the Script will set a cookie for 1hr after a successful login attempt, so the user can continue accessing the page without logging in again for up to an hour after the initial login.
the source file can be found [url=\"http://ner0.killagraphix.com/php/dev/login.phps\"][b]HERE[/b][/url]