Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if(isset($_POST['login']))
- {
- @$username=$_POST['username'];
- @$password=$_POST['password'];
- $query = "SELECT * from users where username='$username' and password='$password' ";
- //echo $query;
- $query_run = mysqli_query($con,$query);
- //echo mysql_num_rows($query_run);
- if($query_run)
- {
- if(mysqli_num_rows($query_run)>0)
- {
- $row = mysqli_fetch_array($query_run,MYSQLI_ASSOC);
- $_SESSION['username'] = $username;
- $_SESSION['password'] = $password;
- $_SESSION['userid'] = $userid;
- header( "Location: profile.php");
- }
- else
- {
- echo '<script type="text/javascript">alert("No such User exists or username and password do not match. Invalid Credentials")</script>';
- }
- }
- else
- {
- echo '<script type="text/javascript">alert("Database Error")</script>';
- }
- }
- else
- {
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement