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,
...
...
...
session management
Moderator: General Moderators
-
d3ad1ysp0rk
- Forum Donator
- Posts: 1661
- Joined: Mon Oct 20, 2003 8:31 pm
- Location: Maine, USA
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.";
}
?>-
d3ad1ysp0rk
- Forum Donator
- Posts: 1661
- Joined: Mon Oct 20, 2003 8:31 pm
- Location: Maine, USA
outsider if you check here again, please change this line:
to this:
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'.
Code: Select all
if($username="outsider" && $password=="admin"){Code: Select all
if($username=="outsider" && $password=="admin"){