· 8 years ago · Jan 15, 2018, 02:14 PM
1<?php
2include("bl_Common.php");
3 $link=dbConnect();
4
5 $name = safe($_POST['name']);
6 $password = safe($_POST['password']);
7 $kills = safe($_POST['kills']);
8 $deaths = safe($_POST['deaths']);
9 $score = safe($_POST['score']);
10 $mIP = safe($_POST['uIP']);
11 $hash = safe($_POST['hash']);
12
13
14 $real_hash = md5($name . $password . $secretKey);
15 if($real_hash == $hash)
16 {
17$check = mysql_query("SELECT * FROM MyGameDB WHERE `name`= '$name'");
18
19$numrows = mysql_num_rows($check);
20if ($numrows == 0 )
21{
22 $password = md5($password);
23 $ins = mysql_query("INSERT INTO `MyGameDB` (`name` , `password` , `uIP` ) VALUES ('".mysql_real_escape_string($name)."' , '".mysql_real_escape_string($password)."' , '".mysql_real_escape_string($mIP)."') ");
24 if ($ins){
25 die ("Done");
26 }else{
27 die ("Error: " . mysql_error());
28 }
29}
30else
31{
32 die("A user with this name already exists,\n please choose another one!");
33}
34 }else{
35 die ("Wrong hash");
36 }
37 mysql_close( $link);
38?>