-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathregistration.php
128 lines (119 loc) · 6.95 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
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
<?php
include('includes/connection.php');
?>
<!doctype html>
<html class="no-js" lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>Become A Learner</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="apple-touch-icon" href="apple-touch-icon.png">
<!-- Place favicon.ico in the root directory -->
<link href="css/jquery.bxslider.css" rel="stylesheet">
<link href="css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="css/font-awesome.min.css">
<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" href="css/responsive.css">
<link href='https://fonts.googleapis.com/css?family=Lora:400,400italic,700,700italic' rel='stylesheet' type='text/css'>
<script src="js/vendor/modernizr-2.8.3.min.js"></script>
</head>
<body>
<!--[if lt IE 8]>
<p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
<![endif]-->
<section class="login_area">
<div class="container">
<div class="row">
<div class="col-md-12">
<div class="logo">
<img src="images/logo.png" alt="E-learning">
</div>
<div class="login_form">
<h2 style="text-align:center;margin:20px 0;">Become A Learner</h2>
<form name="form" id="form" class="form-horizontal" enctype="multipart/form-data" method="POST">
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-leaf"></i></span>
<input id="fname" type="text" class="form-control" name="fname" placeholder="First Name">
</div>
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-fire"></i></span>
<input id="lname" type="text" class="form-control" name="lname" placeholder="Last Name">
</div>
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-envelope"></i></span>
<input id="uemail" type="email" class="form-control" name="uemail" placeholder="User Email">
</div>
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-user"></i></span>
<input id="user" type="text" class="form-control" name="user" placeholder="User">
</div>
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-key"></i></span>
<input id="password" type="password" class="form-control" name="password" placeholder="Password">
</div>
<div class="form-group">
<!-- Button -->
<div class="col-sm-12 controls">
<input type="submit" value="Submit" class="btn btn-primary pull-right" name="register"/>
</div>
</div>
<p style="color:#fff;font-size:16px;">Already an Instructor?? Login <strong><a href="http://localhost/e-learning/login.php">Here</a></strong> </p>
</form>
<p style="margin:20px 0;color:#222;text-align:center;font-size:18px;">Go back to the <strong><a href="http://localhost/e-learning/">Site</a></strong> </p>
</div>
</div>
</div>
</div>
</section>
<?php
if(isset($_POST['register'])){
$fname = mysqli_real_escape_string ($con,$_POST['fname']);
$lname = mysqli_real_escape_string ($con,$_POST['lname']);
$uemail = $_POST['uemail'];
$user = mysqli_real_escape_string ($con,$_POST['user']);
$pass = md5($_POST['password']);
if($fname == '' OR $lname == '' OR $uemail == '' OR $user == '' OR $pass == '' ){
echo "<script>alert('Please Fill All The Fields')</script>";
exit();
}
else{
$email_check = "select * from learners where luser_email='$uemail'";
$username_check = "select * from learners where luser_name='$user'";
$run_email = mysqli_query($con,$email_check);
$run_username = mysqli_query($con,$username_check);
if(mysqli_num_rows( $run_email ) > 0 ){
echo "<script>alert('$uemail Already Exist!!');</script>";
}
elseif(mysqli_num_rows( $run_username ) > 0 ){
echo "<script>alert('Username $user Already Exist!!');</script>";
}else{
$insert_user = "insert into learners (luser_fname,luser_lname,luser_email,luser_name,luser_pass) values('$fname','$lname','$uemail','$user','$pass')";
$run_reg = mysqli_query($con,$insert_user);
if($run_reg){
echo "<script>alert('Registration Successfully!!Please Login!!')</script>";
echo "<script>window.open('login.php','_self');</script>";
}
}
}
}
?>
<script src="https://code.jquery.com/jquery-1.12.0.min.js"></script>
<script>window.jQuery || document.write('<script src="js/vendor/jquery-1.12.0.min.js"><\/script>')</script>
<script src="js/jquery.bxslider.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/plugins.js"></script>
<script src="js/main.js"></script>
<!-- Google Analytics: change UA-XXXXX-X to be your site's ID. -->
<script>
(function(b,o,i,l,e,r){b.GoogleAnalyticsObject=l;b[l]||(b[l]=
function(){(b[l].q=b[l].q||[]).push(arguments)});b[l].l=+new Date;
e=o.createElement(i);r=o.getElementsByTagName(i)[0];
e.src='https://www.google-analytics.com/analytics.js';
r.parentNode.insertBefore(e,r)}(window,document,'script','ga'));
ga('create','UA-XXXXX-X','auto');ga('send','pageview');
</script>
</body>
</html>