1

所以我有这个 api 脚本,人们将拥有 HWID,当他们打开程序时,它必须将他们的信息添加到他们的帐户中,但是当有多个用户使用相同的 HWID 时,它会搞砸并且不会添加他们的信息到帐户,这是我正在使用的代码:

$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 * FROM $table WHERE cpukey = '$cpukey'";
    $result=mysql_query($sql);
    $count=mysql_num_rows($result);
    if($count == 1){
        $result = mysql_query("SELECT * FROM $table") or die(mysql_error()); 
        while($row = mysql_fetch_array( $result )) {
        $time = time();
        if ($row['ip'] = '-' and $row['pcname'] = '-'){
            mysql_query("UPDATE $table SET pcname = '$pcname'
            WHERE cpukey = '$cpukey' AND pcname = '-'");
            mysql_query("UPDATE $table SET ip = '$ip'
            WHERE cpukey = '$cpukey' AND pcname = '$pcname'");
            if ( $row['expire'] > $time) {
                $str1 = "NOT EXPIRED";
            }else{
                $str1 = "EXPIRED";
                mysql_query("UPDATE $table SET expired = 'Yes'
                WHERE cpukey = '$cpukey' AND pcname = '$pcname'");
                mysql_query("UPDATE $table SET banned = '1'
                WHERE cpukey = '$cpukey' AND pcname = '$pcname'");
            }
            echo $str1;
        } else {
            mysql_query("UPDATE $table SET pcname = '$pcname'
            WHERE cpukey = '$cpukey' AND pcname = '$pcname'");
            mysql_query("UPDATE $table SET ip = '$ip'
            WHERE cpukey = '$cpukey' AND pcname = '$pcname'");
            if ( $row['expire'] > $time) {
                $str1 = "NOT EXPIRED";
            }else{
                $str1 = "EXPIRED";
                mysql_query("UPDATE $table SET expired = 'Yes'
                WHERE cpukey = '$cpukey' AND pcname = '$pcname'");
                mysql_query("UPDATE $table SET banned = '1'
                WHERE cpukey = '$cpukey' AND 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 * FROM $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;

现在,如果尚未输入用户信息,我希望代码添加用户的信息,女巫他们的信息将是“-”,然后当他们打开程序时,它会将他们的信息更改为其他内容......换句话说让它在人们可以拥有相同 HWID 并且不会给出任何错误的地方......

4

1 回答 1

0

这是你的问题:

if ($row['ip'] = '-' and $row['pcname'] = '-'){

它应该是

if ($row['ip'] == '-' and $row['pcname'] == '-'){
于 2013-09-04T00:07:57.877 回答