php - Multiple User Registration MYSQL -
so have api script , people going have hwid , has add information account when open program, when there multiple user same hwid screws , doesn't add info account, here's code i'm using:
$cpukey = mysql_escape_string($_get['cpukey']); $ip = mysql_escape_string($_get['ip']); $pcname = mysql_escape_string($_get['pcname']); $con = mysql_connect($host,$username,$password); mysql_select_db("$db_name", $con); $sql="select * $table cpukey = '$cpukey'"; $result=mysql_query($sql); $count=mysql_num_rows($result); if($count == 1){ $result = mysql_query("select * $table") or die(mysql_error()); while($row = mysql_fetch_array( $result )) { $time = time(); if ($row['ip'] = '-' , $row['pcname'] = '-'){ mysql_query("update $table set pcname = '$pcname' cpukey = '$cpukey' , pcname = '-'"); mysql_query("update $table set ip = '$ip' cpukey = '$cpukey' , pcname = '$pcname'"); if ( $row['expire'] > $time) { $str1 = "not expired"; }else{ $str1 = "expired"; mysql_query("update $table set expired = 'yes' cpukey = '$cpukey' , pcname = '$pcname'"); mysql_query("update $table set banned = '1' cpukey = '$cpukey' , pcname = '$pcname'"); } echo $str1; } else { mysql_query("update $table set pcname = '$pcname' cpukey = '$cpukey' , pcname = '$pcname'"); mysql_query("update $table set ip = '$ip' cpukey = '$cpukey' , pcname = '$pcname'"); if ( $row['expire'] > $time) { $str1 = "not expired"; }else{ $str1 = "expired"; mysql_query("update $table set expired = 'yes' cpukey = '$cpukey' , pcname = '$pcname'"); mysql_query("update $table set banned = '1' cpukey = '$cpukey' , pcname = '$pcname'"); } echo $str1; } } } mysql_close($con); mysql_connect($host, $username, $password) or die(mysql_error()); mysql_select_db($db_name) or die(mysql_error()); $result = mysql_query("select * $table") or die(mysql_error()); while($row = mysql_fetch_array( $result )) { if ( $cpukey == $row['cpukey'] ) { if ( $row['banned'] == 0) { $str = "not banned"; break; }else{ $str = "banned";} break; } else { $str = "don't exist";} } echo $str;
now want code add users' info if info hasn't been entered yet, witch info "-" , when open program change info else... in other words make people can have same hwid , won't give errors...
here problem:
if ($row['ip'] = '-' , $row['pcname'] = '-'){
it should be
if ($row['ip'] == '-' , $row['pcname'] == '-'){
Comments
Post a Comment