forked from baoc75/php-payment-gateway
-
Notifications
You must be signed in to change notification settings - Fork 0
/
signup.php
121 lines (112 loc) · 3.48 KB
/
signup.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
<?php
session_start();
require 'config/dbconfig.php';
require_once 'class/class.user.php';
require_once 'class/class.error.php';
$reg_user = new USER();
$reg_error = new ErrorRep();
if($reg_user->is_logged_in()!="")
{
$reg_user->redirect('my/home.php');
}
if(isset($_POST['btn-signup']))
{
$uname = addslashes($_POST['txtuname']);
$email = addslashes($_POST['txtemail']);
$upass = addslashes($_POST['txtpass']);
$code = md5(uniqid(rand()));
if(filter_var($email,FILTER_VALIDATE_EMAIL))
{
$stmt = $reg_user->runQuery("SELECT * FROM tbl_users WHERE userEmail=:email_id");
$stmt->execute(array(":email_id"=>$email));
$row = $stmt->fetch(PDO::FETCH_ASSOC);
if($stmt->rowCount() > 0)
{
header("Location: signup.php?error=4B");
exit;
}
else
{
if($reg_user->register($uname,$email,$upass,$code))
{
$id = $reg_user->lasdID();
$key = base64_encode($id);
$id = $key;
$message = "
Hello $uname,
<br /><br />
Welcome to Coding Cage!<br/>
To complete your registration please , just click following link<br/>
<br /><br />
<a href='http://localhost/x/verify.php?id=$id&code=$code'>Click HERE to Activate :)</a>
<br /><br />
Thanks,";
$subject = "Confirm Registration";
$reg_user->send_mail($email,$message,$subject);
header("Location: signup.php?success=5B");
exit;
}
else
{
header("Location: signup.php?error=C1");
exit;
}
}
}
else
{
header("Location: signup.php?error=2C");
}
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Signup | Coding Cage</title>
<!-- Bootstrap -->
<link href="bootstrap/css/bootstrap.min.css" rel="stylesheet" media="screen">
<link href="bootstrap/css/bootstrap-responsive.min.css" rel="stylesheet" media="screen">
<link href="assets/styles.css" rel="stylesheet" media="screen">
<!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<script src="js/vendor/modernizr-2.6.2-respond-1.1.0.min.js"></script>
</head>
<body id="login">
<div class="container">
<form class="form-signin" method="post">
<?php
if(isset($_GET['error']))
{
?>
<div class='alert alert-warning'>
<button class='close' data-dismiss='alert'>×</button>
<strong><?php $reg_error->ectt($_GET['error']); ?></strong>
</div>
<?php
}
?>
<?php
if(isset($_GET['success']))
{
?>
<div class='alert alert-success'>
<button class='close' data-dismiss='success'>×</button>
<strong><?php $reg_error->ectt($_GET['success']); ?></strong>
</div>
<?php
}
?>
<h2 class="form-signin-heading">Sign Up</h2><hr />
<input type="text" class="input-block-level" placeholder="Name" name="txtuname" required />
<input type="email" class="input-block-level" placeholder="Email address" name="txtemail" required />
<input type="password" class="input-block-level" placeholder="Password" name="txtpass" required />
<hr />
<button class="btn btn-large btn-primary" type="submit" name="btn-signup">Sign Up</button>
<a href="login.php" style="float:right;" class="btn btn-large">Sign In</a>
</form>
</div> <!-- /container -->
<?php include("template/misc.php") ?>
</body>
</html>