forked from rishigarg94/-ABHIMANYU
-
Notifications
You must be signed in to change notification settings - Fork 0
/
registration.php
58 lines (54 loc) · 2.13 KB
/
registration.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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Registration</title>
<link rel="stylesheet" href="styleloginnew.css" />
</head>
<body>
<?php
require('db.php');
if (isset($_REQUEST['username'])){
$username = stripslashes($_REQUEST['username']);
$username = mysqli_real_escape_string($con,$username);
$email = stripslashes($_REQUEST['email']);
$email = mysqli_real_escape_string($con,$email);
$password = stripslashes($_REQUEST['password']);
$password = mysqli_real_escape_string($con,$password);
$trn_date = date("Y-m-d H:i:s");
$branch = stripslashes($_REQUEST['branch']);
$branch = mysqli_real_escape_string($con,$branch);
$regis = stripslashes($_REQUEST['regis']);
$regis = mysqli_real_escape_string($con,$regis);
$years = stripslashes($_REQUEST['years']);
$years = mysqli_real_escape_string($con,$years);
$query = "INSERT into `users` (username, password, email, trn_date, branch, regis, years)
VALUES ('$username', '".md5($password)."', '$email', '$trn_date', '$branch', '$regis', '$years')";
$result = mysqli_query($con,$query);
if($result){
$_SESSION['branch'] = $branch;
$_SESSION['regis'] = $regis;
$_SESSION['years'] = $years;
echo "<div class='box'>
<h3>You are registered successfully.</h3>
<br/>Click here to <a href='login.php'>Login</a></div>";
}
}else{
?>
<div class="form">
<form name="registration" action="" method="post" class="box">
<h1>Registration</h1>
<input type="text" name="username" placeholder="Username" required />
<input type="text" name="email" placeholder="Email" required />
<input type="text" name="branch" placeholder="Branch" required />
<input type="text" name="regis" placeholder="Registration no." required />
<input type="text" name="years" placeholder="Year(1/2/3/4)" required />
<input type="password" name="password" placeholder="Password" required />
<input type="submit" name="submit" value="Register" />
<p style="color:white";>Already Registered? <a href='login.php' style="color: #3498db";>Login</a></p>
<p style="color:white";> <a href='index.html' style="color: #3498db";>Back To Homepage</a></p>
</form>
</div>
<?php } ?>
</body>
</html>