0byt3m1n1
Path:
C:
/
wamp64
/
www
/
WaterCat
/
[
Home
]
File: log.php
<!doctype html> <html lang="en"> <head> <link rel="stylesheet" type="text/css" href="styles.css"> <link rel="stylesheet" type="text/css" href="nav.css"> </head> <body class="bg-white" background="assets/images/slider/s1.jpg" alt=""> <div class="topnav"> <a class="active" href="indexnew.php">Home</a> <a href="#news">News</a> <a href="contact.php">Contact</a> <a href="about.html">About</a> </div> <centre><h1>Login Form </h1> </centre> <?php $id=$_GET['id']; if(@$_POST['Empty']==true) { ?> <div class="alert-light text-danger text-center my-3"> <?php } ?> <form method="POST" action="#"> <div class="container"> <input type="hidden" name="id"> <label>User Name : </label> <input type="text" placeholder="Enter Username" name="username" required> <br> <br> <label>Password : </label> <input type="password" placeholder="Enter Password" name="password" required> <br> <br> <br> <br> <input type="submit" name="login" value="Login"> <p style="color: blue"><i>If Not registered? <a href="reg.php">signup</a></i> </p></div> </form> </body> </html> <?php $servername="localhost"; $username="root"; $password=""; $dbname="watercat"; $conn=new mysqli($servername,$username,$password,$dbname); session_start(); $_SESSION['message']="Please Enter Correct Username and Password"; if(isset($_POST['login'])) { if(empty($_POST['username']) || empty($_POST['password'])) { header("location:login.php?Empty=Please fill the form"); } else { $user=$_POST['username']; $pass= $_POST['password']; $query="select * from register where Name='$user' and Password='$pass'"; $result=mysqli_query($conn,$query); if(mysqli_fetch_assoc($result)) { $_SESSION['username']=$_POST['username']; $_SESSION['Id']=$_GET['id']; header("location:welcome.php?id=".$id); } else{ echo '<p align="center"><b><font color="red">' .$_SESSION['message'].'</font></b></p>'; unset($_SESSION['message']); } } } ?>