Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <form method="POST" action="loginscript.php">
- Enter Username : <input type="text" name="username"><br><br>
- Enter Password : <input type="password" name="password"><br><br>
- <input type="submit" value="Login">
- </form>
- <?php
- $username=$_POST['username'];
- $password=$_POST['password'];
- session_start();
- $con=mysqli_connect("localhost","shaun","rofl","login");
- $result=mysqli_query($con,"SELECT * FROM `logindetails` WHERE `username`='$username' && `password`='$password'");
- $count=mysqli_num_rows($result);
- if($count==1)
- {
- echo "Login success";
- $_SESSION['log']=1;
- header("refresh:2;url=home.php");
- }
- else
- {
- $message = "Incorrect user details.";
- echo "<script type='text/javascript'>alert('$message');</script>";
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement