· 8 years ago · Jun 09, 2017, 12:22 AM
1<!DOCTYPE html>
2<html lang="en">
3 <head>
4 <meta charset="utf-8">
5 <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
6 <meta name="description" content="">
7 <meta name="keywords" content="">
8
9 <title>Payment.ly | Sell digital goods online.</title>
10
11 <!-- Styles -->
12 <link href="assets/css/core.min.css" rel="stylesheet">
13 <link href="assets/css/thesaas.min.css" rel="stylesheet">
14 <link href="assets/css/style.css" rel="stylesheet">
15
16 <!-- Favicons -->
17 <link rel="apple-touch-icon" href="assets/img/apple-touch-icon.png">
18 <link rel="icon" href="assets/img/favicon.png">
19 <script src='https://www.google.com/recaptcha/api.js'></script>
20 </head>
21
22 <body class="mh-fullscreen bg-img center-vh p-20" style="background-image: url(assets/img/bg-girl.jpg);">
23
24
25
26
27 <div class="card card-shadowed p-50 w-400 mb-0" style="max-width: 100%">
28 <h5 class="text-uppercase text-center">Register</h5>
29 <br><br>
30
31 <form action="register.php" method = "POST" class="form-type-material">
32 <div class="form-group">
33 <input type="text" name="username" class="form-control" placeholder="Username">
34 </div>
35
36 <div class="form-group">
37 <input type="string" name="email" class="form-control" placeholder="Email address">
38 </div>
39
40 <div class="form-group">
41 <input type="password" name="password" class="form-control" placeholder="Password">
42 </div>
43
44 <div class="form-group">
45 <input type="password" name="passwordcheck" class="form-control" placeholder="Password (confirm)">
46 </div>
47 <div class="g-recaptcha" data-sitekey="6LdfmyQUAAAAAKfWbKCPxXkDhBmqQXU8lwu0PaQ_"></div>
48
49 <div class="form-group">
50 <label class="custom-control custom-checkbox">
51 <input type="checkbox" class="custom-control-input">
52 <span class="custom-control-indicator"></span>
53 <span class="custom-control-description">I agree to all <a class="text-primary" href="#">terms</a></span>
54 </label>
55 </div>
56
57 <br>
58 <button class="btn btn-bold btn-block btn-primary" type="submit">Register</button>
59 </form>
60
61 <hr class="w-30">
62
63 <p class="text-center text-muted fs-13 mt-20">Already have an account? <a href="page-login.html">Sign in</a></p>
64 </div>
65
66
67
68
69 <!-- Scripts -->
70 <script src="assets/js/core.min.js"></script>
71 <script src="assets/js/thesaas.min.js"></script>
72 <script src="assets/js/script.js"></script>
73
74 </body>
75</html>
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90<!--<html>
91 <head>
92<style>
93body
94 {
95
96 font-family: Helvetica;
97 background-color: black;
98 color: white;
99
100 }
101</style>
102<script src='https://www.google.com/recaptcha/api.js'></script>
103</head>
104<body>
105
106
107<form action="register.php" method ="POST">
108
109<b>Insert Username </b><input type="text" name="username"><br>
110<b>Insert Password </b><input type="password" name="password"><br>
111<b>Insert e-mail</b><input type= "string" name = "email"><br>
112<div class="g-recaptcha" data-sitekey="6LdfmyQUAAAAAKfWbKCPxXkDhBmqQXU8lwu0PaQ_"></div>
113<input type="submit">
114</form>
115
116</body>
117</html>
118-->
119
120<?php
121
122$email;$username;$captcha;
123 if(isset($_POST['email'])){
124 $email=$_POST['email'];
125 }if(isset($_POST['username'])){
126 $email=$_POST['username'];
127 }if(isset($_POST['password'])){
128 $password=$_POST['password'];
129 }if(isset($_POST['g-recaptcha-response'])){
130 $captcha=$_POST['g-recaptcha-response'];
131 }
132 if(!$captcha){
133 //echo '<h2>Please check the captcha form.</h2>';
134 exit;
135 }
136 $secretKey = "6LdfmyQUAAAAAMXA2h5X0Ysm0C0d4q4SMxgszEsJ";
137 $ip = $_SERVER['REMOTE_ADDR'];
138 $response=file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=".$secretKey."&response=".$captcha."&remoteip=".$ip);
139 $responseKeys = json_decode($response,true);
140 if(intval($responseKeys["success"]) !== 1) {
141 echo '<p>Please check the captcha form.</p>';
142 } else {
143
144
145
146if( isset($_POST['username']) and isset($_POST['password']))
147{
148$username = $_POST['username'];
149$password = $_POST['password'];
150$passwordcheck = $_POST['passwordcheck'];
151$hashedpassword = password_hash($password, PASSWORD_DEFAULT);
152$email = $_POST['email'];
153
154if(empty($_POST['username']) or empty($_POST['email']) or empty($_POST['password']))
155 {
156 echo "Please fill out all of the information";
157 }
158 else
159 {
160
161if (!filter_var($email, FILTER_VALIDATE_EMAIL)){
162 echo "Invalid Email";
163}
164else{
165
166 if(strlen($password) < 6)
167 {
168 echo "password must be at least 6 characters long";
169 }
170 else
171 {
172
173 if (!preg_match("#[0-9]+#", $password))
174 {
175 echo "Password must include at least one number!";
176 }
177 else
178 {
179
180
181if($password !== $passwordcheck)
182{
183 echo "Make sure both passwords are the same";
184}
185 else
186 {
187
188
189
190$accounts = mysqli_connect("localhost" , "root" , "ROMASISGAY!")
191or die(mysql_error());
192
193mysqli_select_db($accounts , "accounts");
194
195$userinfo = "SELECT * FROM users WHERE Username = '$username'";
196
197$results = mysqli_query($accounts , $userinfo);
198if(mysqli_num_rows($results) !== 0)
199 {
200 echo "Username taken, try again";
201 }
202 else
203 {
204
205$checkemail = "SELECT * FROM users WHERE Email = '$email'";
206
207$emailresults = mysqli_query($accounts , $checkemail);
208 if(mysqli_num_rows($emailresults) !== 0)
209 {
210 echo "Email is already in use";
211 }
212 else
213 {
214 $sql = "
215INSERT INTO users(Username, Password, Email) VALUES('$username' , '$hashedpassword' , '$email')
216";
217
218mysqli_query($accounts, $sql) or die("Error: ".mysql_error());
219
220header("location: http://payment.ly/login.php");
221die();
222}
223}
224}
225}
226}
227}
228}
229 }
230 }
231?>