Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if(isset($_POST["login-submit"])
- {
- $servername = "localhost";
- $username = "root";
- $password = "";
- $dbname = "doos";
- $user=$_POST['username'];
- $pass=$_POST['password'];
- //creating connection
- $conn = new mysqli($servername, $username, $password, $dbname);
- // Check connection
- if ($conn->connect_error)
- die("Connection failed: " . $conn->connect_error);
- $query=mysql_query("select * from Users where Username='".$user."' and Password='".$pass."'");
- $numrows=mysql_num_rows($query);
- if($numrows!=0){
- while($rows=mysql_fetch_assoc($query))
- {
- $dbusername=$['Username'];
- $dbpassword=$['Password'];
- }
- if($user==$dbusername && $pass ==$dbpassword){
- session_start();
- $_SESSION['sess_user']=$user;
- header( "Location: ../home_page.php" );
- }
- }
- else
- echo "invalid username or password!";
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement