Page 0 Home Page

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

CODE

<?php

session_start();

$con = mysqli_connect("localhost", "root", "", "oas");

if (!$con) {

die("Database Not Found");

if (isset($_REQUEST["u_sub"])) {

$id = $_POST['u_id'];
$pwd = $_POST['u_ps'];

if ($id != '' && $pwd != '') {

$query = mysqli_query($con, "SELECT * FROM t_user_data WHERE s_id='" . $id . "' AND
s_pwd='" . $pwd . "'");

$query1 = mysqli_query($con, "SELECT * FROM t_user WHERE s_id='" . $id . "'");

if (mysqli_num_rows($query) > 0) {

$_SESSION['user'] = $id;

header('Location: admsnform.php');

} elseif (mysqli_num_rows($query1) > 0) {

$_SESSION['user'] = $id;

header('Location: homepageuser.php');

} else {

echo '<script>';

echo 'alert("Invalid username or password")';

echo '</script>';

} else {

echo '<script>';

echo 'alert("Enter both username and password")';

echo '</script>';

?>

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<link type="text/css" rel="stylesheet" href="css/login.css">

<link rel="stylesheet" href="bootstrap/bootstrap.min.css">


<link rel="stylesheet" href="bootstrap/bootstrap-theme.min.css">

<script src="bootstrap/jquery.min.js"></script>

<script src="bootstrap/bootstrap.min.js"></script>

<title>Login</title>

</head>

<body style="background-image:url('./images/inbg.jpg');">

<form id="index" action="index.php" method="post">

<div class="container-fluid">

<div class="row">

<div class="col-sm-12">

<img src="images/cutmmm.jpg" width="100%" style="box-shadow: 1px 5px 14px


#999999;">

</div>

</div>

<div id="divtop">

<br><br><br><br><br><br><br><br><br><br><br>

<div id="dmain">

<center><img src="./images/loginuser.png" width="120px" height="100px"></center>

<br>

<input type="text" id="u_id" name="u_id" class="form-control" style="width:300px;


margin-left: 66px;" placeholder="Enter Your User ID"><br>

<input type="password" id="u_ps" name="u_ps" class="form-control" style="width:300px;


margin-left: 66px;" placeholder="Enter Your Password"><br>

<input type="submit" id="u_sub" name="u_sub" value="Login" class="toggle btn btn-


primary" style="width:100px; margin-left: 160px;"><br>

<a href="signup.php" style="margin-left: 180px;">Sign Up</a>

</div>

</div>

</div>

</form>

</body>

</html>

You might also like