· 8 years ago · Sep 15, 2017, 08:10 PM
1<?php
2
3 $db = mysql_connect('localhost', 'root', 'Onlyforme1') or die('Could not connect: ' . mysql_error());
4
5 // Strings must be escaped to prevent SQL injection attack.
6 $username = mysql_real_escape_string($_GET['username'], $db);
7 $password = mysql_real_escape_string($_GET['password'], $db);
8 $hash = $_GET['hash'];
9 $secretKey="pigsfeet";
10 $real_hash = md5($username . $password . $secretKey);
11 if($real_hash == $hash) {
12 if (mysql_query("CREATE DATABASE $username",$db)){
13 echo "Database created";
14 mysql_select_db('username') or die('Could not select database');
15 mysql_close($db);
16 echo "Account created!";
17 }
18 else{
19 echo "Account Creation failed." . mysql_error();
20 }
21 }
22
23
24?>