<?php
/**
* author : Sid Trivedi Rev :0
* A simple user login script for your website which gives
you total control of
* user access to specific area (web-pages) on your
website.
* Excellent use of associative array made the script pretty
simple.
* <<< THE BEST WAY TO INCREASE KNOWLEDGE IS TO
SHARE IT FOR FREE! >>>
* You may use and modify this script for the best
performance. If so, please
* post your modification(s) & spices, so other can also
learn and use. Also
* update this header in Credits Field.
*
* Credits :
* Rev 0 : Sid Trivedi : Basic login script.
*
*
*/
//You may modify the codes and use $_POST['FORM_FIELD_DATA']
for your web-page.
//You may find simple HTML codes for login form at the
bottom of the script.
//You may spice-up the codes with more form field validation
& security features.
//$user_name=$_POST['user_name'];
//$password=$_POST['password'];
$test_user_name = 'michelle_smith'; //for testing purpose
only
$test_password = 'msmith321'; //for testing purpose only
$user_name = $test_user_name;
$password = $test_password;
// here user_name is key and password is the value.
// website owner has to add new user manually in
$login_array
$login_array = array(
'user_name' => 'password',
'alex_duff' => 'alx321',
'xena78' => 'xena321',
'dela_pena' => 'delp321',
'shawn_1981' => 'shw81',
'michelle_smith' => 'msmith321');
ksort($login_array);
reset($login_array);
if (isset($login_array[$user_name]))
{
$pass_check = $login_array[$user_name];
if ($password === $pass_check)
{
echo "Welcome, $user_name!n<br>";
}
else
{
echo "Please try again!";
}
}
else
{
echo "Please register with us. Thanks!";
exit();
}
echo("n<br>");
echo 'Thanks to Thies C. Arntzen, Stig Bakken, Shane
Caraveo, Andi Gutmans, Rasmus Lerdorf, Sam Ruby, Sascha
Schumann, Zeev Suraski, Jim Winstead, Andrei Zmievski for
wonderful PHP!';
/*
Basic HTML code for login form for webpage is as under:
<html>
<head>
<meta http-equiv="Content-Language"
content="en-us">
<meta name="GENERATOR" content="Sid
Trivedi">
<meta http-equiv="Content-Type"
content="text/html; charset=windows-1252">
<title>my website login</title>
</head>
<body>
<p> </p>
<form method="POST" action="http://path_to/log
in.php"> <!--modify this path---->
<div align="center">
<center>
<table border="0" cellpadding="0"
cellspacing="0" style="border-collapse:
collapse" bordercolor="#111111"
width="100%" id="AutoNumber3"
align="left">
<tr>
<td width="17%"> Member ID#
:</td>
<td width="83%"><input
type="text" name="user_name"
size="20"></td>
</tr>
<tr>
<td width="17%"> Password
:</td>
<td width="83%"><input
type="password" name="password"
size="20"><input type="submit"
value="login"
name="submit"></td>
</tr>
</table>
</center>
</div>
</form>
</body>
</html>
*/
?>
----
Server IP: 69.147.83.197
Probable Submitter: 208.72.123.11
----
Manual Page -- http://www.php.net/manual/en/language.types.array.php
Edit -- https://master
.php.net/note/edit/78116
Del: integrated -- h
ttps://master.php.net/note/delete/78116/integrated
Del: useless -- http
s://master.php.net/note/delete/78116/useless
Del: bad code -- htt
ps://master.php.net/note/delete/78116/bad+code
Del: spam -- https:/
/master.php.net/note/delete/78116/spam
Del: non-english --
https://master.php.net/note/delete/78116/non-english
Del: in docs -- http
s://master.php.net/note/delete/78116/in+docs
Del: other reasons-- https://mast
er.php.net/note/delete/78116
Reject -- https://mast
er.php.net/note/reject/78116
Search -- https://
master.php.net/manage/user-notes.php
--
PHP Notes Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php
|