Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- include "db_connect.php";
- ?>
- <html>
- <body>
- <h3>Login form:</h3>
- <form action='index.php' method='POST'>
- User:
- <input type="text" name="user">
- Pass:
- <input type="password" name="pass">
- <br><br>
- <input type="submit" value="Login">
- </form>
- </body>
- </html>
- <?php
- session_start();
- $_SESSION['user'] = $_POST['user'];
- $_SESSION["pass"] = $_POST['pass'];
- $session_user = $_SESSION['user'];
- $session_pass = $_SESSION['pass'];
- ?>
- <html>
- <head>
- </head>
- <body>
- </body>
- </html>
- <?php
- include "../db_connect.php";
- $sql = "SELECT * FROM user WHERE (user = '$session_user' && password = '$session_pass')";
- $result = $conn->query($sql);
- if ($result->num_rows > 0) {
- // output data of each row
- while($row = $result->fetch_assoc()) {
- include "index_detail.php";
- }
- } else {
- echo "There was an error logging in.";
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement