PHP simple login help
Posted: Tue Mar 21, 2006 1:10 am
Hey there,
Well, I want to make a simple login page (where differnt usernames go to differnt URL's), where the login details are just in a php page,, since I will only ever have 4 user names and 4 passwords, I don't require an SQL database.
I got this login form
Now I assume I just create in the validate.php page a statment of sorts which can redirect each login to a differnt url
I've really only ever programed basic java, so I have no idea about the php syntax,, I got some info from around the place and came up with this (its 100% wrong I know, but this is what I got,, )
variable names I think are incorrect in the validation form
I would very my appreciate it if someone told me what I put in that validation page, since I have no idea. for example sake (to make me understand easier),, lets say the specific user name "bob" and password "milk" redirect to, "www.google.com"
Thanx in Advanced,
Regards,
Chris
Well, I want to make a simple login page (where differnt usernames go to differnt URL's), where the login details are just in a php page,, since I will only ever have 4 user names and 4 passwords, I don't require an SQL database.
I got this login form
Code: Select all
<html>
<head>
<title>login.html</title>
</head>
<body>
<form name="login" method="post" action="validate.php">
username:<input type="text" name="user_name"><br>
password:<input type="password" name="password"><br>
<input type="submit" value="submit">
</form>
</body>
</html>I've really only ever programed basic java, so I have no idea about the php syntax,, I got some info from around the place and came up with this (its 100% wrong I know, but this is what I got,, )
Code: Select all
<?php
if($password == $_POST['pass'] && $user_name == $_POST['user']){
header('Location: page.php?user=\'.' $user_name );
}
{
else{
$error = '1';
}I would very my appreciate it if someone told me what I put in that validation page, since I have no idea. for example sake (to make me understand easier),, lets say the specific user name "bob" and password "milk" redirect to, "www.google.com"
Thanx in Advanced,
Regards,
Chris