Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- if (isset($_POST["btnsubmit"]))
- {
- $nm=$_POST["username"];
- $pwd=$_POST["password"];
- $conn = new mysqli("localhost", "root", "", "simple_login");
- // Check connection
- if ($conn->connect_error)
- {
- die("Connection failed: " . $conn->connect_error);
- }
- $sql = "select * from member where username='$nm' and password='$pwd'" ;
- $result = $conn->query($sql);
- if ($result->num_rows > 0) {
- // to add sesssion value
- $_SESSION["memid"]=$row["mem_id"];
- $_SESSION["username"]=$row["username"];
- header("location:demo2.php");
- }
- } else { echo "wrong username or password" ; }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement