PHP - 函数内部500错误

时间:2015-10-15 01:24:47

标签: php

我在这个脚本中出现500内部错误由于某种原因我看了一下这个脚本就像一两个小时找不到函数中的问题,它不是一个mysql错误以太...

    function CreateGame($Game, $Pass, $Diff, $CharInfo, $Lad, $Desc, $Realm, $Hash, $timestamp, $Bot = 0)
    {
        $uno = false;
        include "conf.php";
        $conn = new mysqli($serverip, $username, $password, $dbname, $Port);
        if ($conn->connect_error) {
            die("Connection failed: " . encrypt($conn->connect_error);
        } 
        $game = mysqli_escape_string($conn, $Game);
        $pass = mysqli_escape_string($conn, $Pass);
        $diff = mysqli_escape_string($conn, $Diff);
        $hash = mysqli_escape_string($conn, $Hash);
        $charInfo = mysqli_escape_string($conn, $CharInfo);
        $desc = mysqli_escape_string($conn, $Desc);
        $realm = substr($Realm, 0, 1);
        $realm = mysqli_escape_string($conn, $Realm);
        $bot = mysqli_escape_string($conn, $Bot);
        $lad = mysqli_escape_string($conn, $Lad);
        $UserResult = $conn->query("SELECT * from user where hash = '$hash'");
        if (!$UserResult) 
        {
            echo encrypt("hash not found: ". $hash);
        }
        while($row = $UserResult->fetch_assoc()) 
        {
            if($uno == false)
            {
                $uno = true;
                $BanCheckQuerrt = "SELECT * from hwid where id = '".$row['HWID']."'";
                $BanCheckResult = $conn->query($BanCheckQuerrt);
                while($BanCheckRow = $BanCheckResult->fetch_assoc()) 
                {
                    if((int)$BanCheckRow['banned'] === 0)
                    {
                        $sql = "INSERT INTO games (Game, Password, Description, Difficulty, Realm, Ladder, BotGame, created, timestamp ) VALUES ('$game', '$pass', '$desc', '$diff', '$realm', 'lad', '$bot', '$timestamp', '$timestamp')";
                        if ($conn->query($sql) === TRUE) {
                            $sqli = "INSERT INTO Players (GameID, Name, timestamp) Values ('".mysqli_insert_id($conn)."', '$charInfo', '$timestamp')";
                            if ($conn->query($sqli) === TRUE) {
                                $updateUserQuerry = "UPDATE user SET playerID = '" .mysqli_insert_id($conn). "' where hash = '$hash'";
                                $conn->query($updateUserQuerry);
                                echo encrypt(mysqli_insert_id($conn));
                            } else {
                                echo "Error: " . $sqli . "\n" . encrypt($conn->error);
                            }
                        } else {
                            echo "Error: " . $sql . "\n" . encrypt($conn->error);
                        }
                    }
                    else
                        echo encrypt("Banned!");
                }
            }
        }
        $conn->close();
    }

任何可以解决这个问题的建议都是可以接受的。

0 个答案:

没有答案