Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $_SESSION["username"] = "$username";
- $_SESSION["user_id"] = "$user_id";
- $_SESSION["act_type"] = "$act_type";
- <?php
- session_start();
- $user = 'jane';
- $pass = '654321';
- if ( $user == $_POST[user] AND $pass == $_POST[pass] ) {
- $_SESSION[user] = $user;
- header("location: secure.php");
- }
- else {
- echo "Bad Login";
- }
- ?>
- <form name="form1" method="post" action="index.php">
- Username: <input name="user" type="text">
- <br />
- Password: <input name="pass" type="password">
- <br /><br />
- <input type="submit" name="Submit" value="Login">
- </form>
- <?php
- session_start();
- if ( !isset($_SESSION[user]) ) {
- header("location: index.php");
- }
- ?>
- Secure Page
- <?php
- session_start();
- $user = 'joe';
- $pass = '123456';
- if ( $user == $_POST[user] AND $pass == $_POST[pass] ) {
- $_SESSION[user] = $user;
- header("location: secure.php");
- }
- else {
- echo "Bad Login";
- }
- ?>
- <form name="form1" method="post" action="index.php">
- Username: <input name="user" type="text">
- <br />
- Password: <input name="pass" type="password">
- <br /><br />
- <input type="submit" name="Submit" value="Login">
- </form>
- <?php
- session_start();
- if ( !isset($_SESSION[user]) ) {
- header("location: index.php");
- }
- ?>
- Secure Page
- $_SESSION["s1_username"] = $username;
- $_SESSION["s1_user_id"] = $user_id;
- $_SESSION["s1_act_type"] = $act_type;
- $_SESSION["s2_username"] = $username;
- $_SESSION["s2_user_id"] = $user_id;
- $_SESSION["s2_act_type"] = $act_type;
- foreach($_SESSION as $key => $value)
- {
- if (strpos($key, 's1_') === 0)
- {
- unset($_SESSION[$key]);
- }
- }
- foreach($_SESSION as $key => $value)
- {
- if (strpos($key, 's2_') === 0)
- {
- unset($_SESSION[$key]);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement