-
Notifications
You must be signed in to change notification settings - Fork 0
/
login.php
124 lines (94 loc) · 3.04 KB
/
login.php
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
<?php
$login=0;
$invalid=0;
if($_SERVER['REQUEST_METHOD']=='POST'){
include 'connect1.php';
$username = $_POST['username'];
$mailid = $_POST['email'];
$password = $_POST['password'];
$mobile = $_POST['num'];
$country = $_POST['country'];
$state = $_POST['state'];
$pincode = $_POST['pin'];
$image = $_POST['image'];
$sql = "select * from `Registration1` where username='$username' and password='$password'";
$result = mysqli_query($conn,$sql);
if($result){
$num = mysqli_num_rows($result);
if($num>0){
$row=mysqli_fetch_assoc($result);
echo "login successfull";
$login=1;
session_start();
$_SESSION['username']=$username;
$_SESSION['password']=$password;
$_SESSION['email']=$row['email'];
$_SESSION['mobile']=$row['mobile'];
$_SESSION['country']=$row['country'];
$_SESSION['state']=$row['state'];
$_SESSION['pincode']=$row['pincode'];
$_SESSION['image']=$_SESSION['image'];
header('location:home2.php');
}else{
echo "invalid login credentials!";
$invalid=1;
}
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="css/bootstrap.min.css">
<script src="js/bootstrap.bundle.min.js"></script>
<link href="style.css" rel="stylesheet">
<title>Farmer Login</title>
<!-- <style>
*{
margin: 0;
padding: 0;
box-sizing: border-box;
}
body{
justify-content: center;
align-items: center;
height: 100vh;
}
select{
cursor: pointer;
width: 300px;
height: 40px;
border-radius: 15px;
background-color: rgb(250, 250, 250);
box-shadow: 2px 4px 8px #c5c5c5;
border: darkslategray;
outline: dimgrey;
margin-top: 30px;
}
</style> -->
</head>
<body >
<h1 style="text-align: center;"><u>Farmer Login page</u></h1>
<div class="container-fluid mt-5">
<form action="/crud/project_S/login.php" method="POST">
<br>
<div class="form-group">
<label for="username">Username</label>
<input type="tel" class="form-control" id="username" name="username" required>
</div>
<br>
<div class="form-group">
<label for="password">Password:</label>
<input type="password" class="form-control" id="password" name="password" required>
</div>
<br>
<div>
<button type="submit" class="btn btn-primary w-100">Login</button>
</div>
</form>
</div>
</body>
</html>