Password Form Multiple Users
I am trying to create a basic login form in php, (i do not have access to mysql tables). The username and password are predefined in the code below as 'admin' and 'password' and they are kept in globalvars.php. I want to try and make something where i can have multiple logons with their own respective password. maybe two dimensional array?
If possible id like the user to be able to 'make an account' and select a username and password and have it added to the array. Then be able to log into my site with that name.
If thats not possible, i'd like to be able to add someones username and password into an array and then allow them to user that information.
Any help is greatly appreciated.
/* Today is October 9, 2008, 9:55 pm */
$today = date("F j, Y, g:i a"); // October 9, 2008, 9:55 pm
<table width="296" border="0" align="right">
<td width="290"><strong>System Time</strong>: <?php echo $today;?></td>
<table width="255" align="center">
<form action="<?$_SERVER['PHP_SELF']?>" method="post">
<input type="text" name="username" />
<input type="password" name="password" />
<center> <input type="submit" name="submit" value="Login" /></center>
else //otherwise, let's process this stuff
if($_POST['username'] == "$username" && $_POST['password'] == "password") //if they got it right, let's go on
session_register("mysessionvariable"); //set a variable for use later
$id = session_id(); //let's grab the session ID for those who don't have cookies
$url = "Location: index.php?sid=" . $id;
else //they got something wrong and we should tell them
<title>My Login Form</title>
<span style="color:#ff0000;">Password/Username Is Invalid</span><br />
<form action="<?$PHP_SELF?>" method="post">
Username: <input type="text" name="username" /><br />
Password: <input type="password" name="password" /><br />
<input type="submit" name="submit" value="Login" /><br />
Re: - Password form multiple users
To store multiple username & password, 2D array is a good option. But as you want the users to have the ability to create their own username & password thus there has to be a medium in which these can be stored and retrieved, since you do not want to use MySQL so you can use text files.
Every time a new user creates account then append in the text file and when someone tries to login do sequential search in the text file to authenticate and allow the user to accss members area.
Hope this helps.
LeXolution IT Services
Website Development Company