-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
193 lines (192 loc) · 7.47 KB
/
index.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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
<html>
<head>
<title>
GYAAN
</title>
<!--Import Google Icon Font-->
<link href="http://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<!--Import materialize.css-->
<link type="text/css" rel="stylesheet" href="css/materialize.min.css" media="screen,projection"/>
<!--Let browser know website is optimized for mobile-->
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
</head>
<body class="black white-text">
<?php
if(isset($_POST["login"]))
{
$link = mysql_connect('localhost', 'root', '');
$mydb = mysql_select_db('test',$link);
$username = $_POST["username"];
$password = $_POST["password"];
$sql = "SELECT * FROM gyanuser WHERE (username= '$username' AND password='$password')";
$data = mysql_query($sql);
$count = mysql_fetch_assoc($data);
if($count!=0)
{
setcookie("username",$username, time() + (86400 * 30), "/");
header("Location: dashboard.php");
}
else
{
echo "Invalid Login";
}
}
if(isset($_POST["register"]))
{
$link = mysql_connect('localhost', 'root', '');
$mydb = mysql_select_db('test',$link);
$username = $_POST["username"];
$password = $_POST["password"];
$name = $_POST["name"];
$location = $_POST["location"];
$age = $_POST["age"];
$gender = $_POST["gender"];
$dob = $_POST["dob"];
$mobile = $_POST["mobile"];
$adhaar = $_POST["adhaar"];
$sql = "SELECT * FROM gyanuser WHERE (username= '$username')";
$data = mysql_query($sql);
$count = mysql_num_rows($data);
if($count!=0)
{
echo "username already exists!!!";
}
else
{
$result = mysql_query("INSERT INTO gyanuser VALUES ('$username','$password','$name','$location','$age','$gender','$dob','$mobile','$adhaar')");
if($result)
{
echo "Registration Successful";
}
else
{
die("Error in Registration, Sorry!!!");
}
}
}
?>
<header>
<nav style="position:fixed; z-index:+7;" class="grey">
<div class="nav-wrapper">
<a class="brand-logo center">GYAAN</a>
</div>
</nav>
<br><br><br>
<div class="row">
<div class="col s8">
<br><br><br>
<div class="slider">
<ul class="slides">
<li>
<img src="http://lorempixel.com/580/250/nature/1"> <!-- random image -->
<div class="caption center-align">
<h3>Education For All</h3>
<h5 class="light grey-text text-lighten-3"></h5>
</div>
</li>
<li>
<img src="http://lorempixel.com/580/250/nature/2"> <!-- random image -->
<div class="caption left-align">
<h3>Improve our nation, focus on education</h3>
<h5 class="light grey-text text-lighten-3"></h5>
</div>
</li>
<li>
<img src="http://lorempixel.com/580/250/nature/3"> <!-- random image -->
<div class="caption right-align">
<h3>Learn things you didn’t know, expand your horizons, help your brain grow</h3>
<h5 class="light grey-text text-lighten-3">help your brain grow.</h5>
</div>
</li>
<li>
<img src="http://lorempixel.com/580/250/nature/4"> <!-- random image -->
<div class="caption center-align">
<h3>Let our future be full of joy, educate every girl and boy!</h3>
<h5 class="light grey-text text-lighten-3">A good education is a sensation</h5>
</div>
</li>
</ul>
</div></div><br>
<span>Login</span>
<div class="col s4">
<form class="white-text" style="size:10px; padding:0px 0px 0px 0px;" action="" method="post">
Username :
<input type="text" name="username" required><br>
Password :
<input type="password" name="password" required>
<button class="btn waves-effect waves-light" type="submit" value="Login" name="login">Login
<i class="material-icons right">send</i>
</button>
</form>
<form action="" method="post">
<span class="blue-text text-darken-2">Sign Up</span>
<br>
<div class="input-field ">
<input id="first_name" type="text" class="validate" name="username" required>
<label for="first_name">Username</label>
</div><br>
<div class="input-field ">
<input id="last_name" type="password" class="validate" name="password" required>
<label for="last_name">Password</label>
</div><br>
<div class="row">
<div class="input-field ">
<input id="text" type="text" class="validate" name="name" required>
<label for="text">Name</label>
</div>
</div>
<div class="row">
<div class="input-field ">
<input id="text" type="text" class="validate" name="location" required>
<label for="text">Location</label>
</div>
</div>
<div class="row">
<div class="input-field ">
<input id="number" type="text" class="validate" name="age" required>
<label for="number">Age</label>
</div>
</div>
<div class="row">
<div class="input-field ">
<input id="date" type="date" class="validate" name="dob" required>
</div>
</div>
<p>Gender</p>
<p>
<input type="radio" id="test1" name="gender" value="M"/>
<label for="test1">Male</label>
</p>
<p>
<input type="radio" id="test2" name="gender" value="F"/>
<label for="test2">Female</label>
</p>
<div>
<input id="number" type="text" class="validate" name="mobile" required>
<label for="number">Mobile</label>
</div>
<div>
<input id="number" type="text" class="validate" name="adhaar" required>
<label for="number">Adhaar</label>
</div>
<div class="row">
<button class="btn waves-effect waves-light" type="submit" value="Register" name="register">Register
<i class="material-icons right">send</i>
</button>
</div>
</form>
</div>
</div>
</header><br>
<section>
<a>Register as Faculty</a>
</section>
<footer class="footer-fixed center grey" style="position:fixed; bottom:0px; width:100%; height:30px;">
Padho Likho Jiyo
</footer>
<!--Import jQuery before materialize.js-->
<script type="text/javascript" src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
<script type="text/javascript" src="js/materialize.js"></script>
<script src="js/init.js"></script>
</body>
</html>