You are on page 1of 1

<?

php
session_start();
include 'dbh.php';
$uname=$_POST['uname'];
$pass=$_POST['pass'];

$sql = "SELECT *FROM signup WHERE username='$uname' AND


password='$pass'";
$result=$conn->query($sql);
if (!$row=$result->fetch_assoc()){
header("Location:error.php");
}
else {
$_SESSION['name']=$_POST['uname'];
header("Location: home.php");

}
?><from action="login.php"method="posts">
<label><b>username</b></label>
<input type="text"name="uname" placeholder="username"><br><br>
<label><b>password</b></label>
<input type="text" name="pass" placeholder="password">
<br><br>
<button style="background-color:#6495ed;color:white;"type="submit"><b>Login</b>

</button>
</form>
if (!$row=$result->fetch_assoc()){
header("Location:error.php");
}
else {

<from action="logout.php">
<input style="width:5%;background-color:red;color:white;font-
size:20px;"type="submit" value="logout">
</form>

You might also like