Page 1 of 1
session management
Posted: Tue Feb 17, 2004 3:51 pm
by outsider
how can check if user & password, and then if password is true how can i pass username into a new page?
like this:
username: outsider
password: admin
welcome outsider,
....
....
....
or /* if pass is not true */
wrong password,
...
...
...
Posted: Tue Feb 17, 2004 3:59 pm
by d3ad1ysp0rk
Code: Select all
<?php
session_start();
$username = $_POST['username'];
$password = $_POST['password'];
if($username="outsider" && $password=="admin"){
$_SESSION['username'] = $username;
$_SESSION['password'] = $password;
echo "Welcome " . $username;
}
else {
echo "Incorrect Username/Password combination.";
}
?>
Posted: Tue Feb 17, 2004 4:12 pm
by outsider
thank you, that worked well
Posted: Tue Feb 17, 2004 4:13 pm
by dethron
Nice explainations always work well
Good Luck outsider, we want to see you more here

Posted: Tue Feb 17, 2004 10:34 pm
by d3ad1ysp0rk
outsider if you check here again, please change this line:
Code: Select all
if($username="outsider" && $password=="admin"){
to this:
Code: Select all
if($username=="outsider" && $password=="admin"){
I forgot 1 equals sign. It's no big deal since it's only the username (and what good is a username without a password?) but if you were to make it dynamic, it would check the results against the password for 'outsider'.