-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex1.php
More file actions
79 lines (69 loc) · 1.93 KB
/
index1.php
File metadata and controls
79 lines (69 loc) · 1.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<?php session_start();?>
<html>
<head>
<meta charset="UTF-8">
<title>Home</title>
<link rel="stylesheet" type="text/css" href="css/style.css">
</head>
<body>
<header>
<nav>
<div class="index_home">
<h2> REACTION MASTER </h2>
</div>
</nav>
</header>
<div>
<center>
<form class="home_page" action="" method= "post">
USERNAME:
<input type="text" name="username" placeholder="username">
<br>
<br>
<br>
PASSWORD:
<input type="password" name="password" placeholder="password">
<br>
<br>
<br>
<button type="submit" name="submit">LOGIN</button>
<br>
<br>
<a href="passupdate.php"> Forgot password</a>
<br>
<br>
Not a member?  <br>
<a href="login1.php"> SIGN UP</a>
</form>
</center>
</div>
</body>
</html>
<?php
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
include"db_con.php";
if(isset($_POST['submit'])){
$username=$_POST['username'];
$password=$_POST['password'];
if(empty($_POST['username'])){
echo '<script>alert("username is required")</script>';
}
if(empty($_POST['password'])){
echo '<script>alert("password is required")</script>';
}else{
$query="select * from registration where username='$username' and password='$password'";
$result= queryMysql($query);
if(mysqli_num_rows($result)==1){
$_SESSION['username'] =$username;
echo '<script>alert("logged in")</script>';
header('Location:select.php');
}
else{
echo '<script>alert("invalid credentials")</script>';
}
}}
?>