· 9 years ago · Jan 29, 2017, 07:14 PM
1<?php
2 $db = mysql_connect('localhost', 'username', 'password') or die ('Could not connect: ' . mysql_error());
3 echo ('Database connection complete');
4 mysql_select_db('databasename') or die ('Could not select database');
5
6 $email = mysql_real_escape_string($_GET['email'], $db);
7 $username = mysql_real_escape_string($_GET['username'], $db);
8 $password = mysql_real_escape_string($_GET['password'], $db);
9 $hash = $_GET['hash'];
10
11 $secretKey = 'secretkey';
12
13 $real_hash = md5($email . $username . $password . $secretKey);
14 if ($real_hash == $hash)
15 {
16 $query = "INSERT INTO users (username, password, creationdate, email) values ('$username', '$password', NOW(), '$email');";
17 $result = mysql_query($query) or die('Query failed: ' . mysql_error());
18 }
19?>