Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- include './../config.php'
- //Login code
- if (isset($_POST['submit'])) {
- $user = $_POST['user'];
- $pwd = $_POST['pwd'];
- if ($user == "MyUsername" && $pwd == "abc123") {
- $_SESSION["user"] = $username;
- } else {
- echo "Login incorrect. Please try again";
- }
- }
- // If the user is not logged in, show the login form
- if (!isset($_SESSION["user"])) {
- ?>
- <form action="" method="POST">
- User: <input type="text" name="user" /><br />
- Pass: <input type="password" name="pwd" />
- <input type="submit" name="submit" style="display:none;"/>
- </form>
- <?php
- } else {
- // If the IS logged in. Show the table
- ?>
- <table style="width:100%">
- <tr>
- <th>Firstname</th>
- <th>Lastname</th>
- <th>Age</th>
- </tr>
- <tr>
- <td>Jill</td>
- <td>Smith</td>
- <td>50</td>
- </tr>
- <tr>
- <td>Eve</td>
- <td>Jackson</td>
- <td>94</td>
- </tr>
- </table>
- <?php
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement