Hi there. I am trying to modify a simple login script. I have two files. The first one is login.html shown below:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Login Page</title>
</head>
<body>
<form method="post" action="process.php">
<h2>Login Page</h2>
<br />
<br />
User Name:
<br />
<input type="text" name="username" size="16" />
<br />
<br />
Password:
<br />
<input type="password" name="password" size="16" />
<br />
<br />
<br />
<br />
<input type="submit" value="submit" />
</form>
</body>
</html>
The second page is process.php
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
<?php
$passwords = array("bill" =>"apple", "charles" =>"potato", "david" =>"orange");
if ($password == $passwords[$username])
{
setcookie("username", $username, time()+1200);
echo "<h2>Access granted.</h2>";
}
else
{
setcookie("username", "", time()-1200);
echo "<h2>Invalid user name or password: access denied.</h2>";
}
?>
</body>
</html>
However rather than have the usernames and passwords stored in the array inside the process.php file i would like them to be stored in a csv file. I have looked at the tutorial on the sitepoint website however the example shown works with a mysql database. I want the data stored in a csv file. Can anyone point me in the right direction regarding this or provide me with some links to examples like this??
Thanks, Jen