自定义身份验证失败反序列化:分析值意外遇到性格

问题描述 投票:0回答:1

我无法创建自定义身份验证!我用从000webhost的免费主机测试光子的团结多人,但我得到了统一调试以下错误:

OperationResponse 230:响应码:32755(自定义身份验证失败反序列化:意外字符遇到在解析值:U.路径“”,第0行,位置0)。

参数:{}服务器:名称服务器地址:ns.exitgames.com:5058

UnityEngine.Debug:LOGERROR(对象)

Photon.Realtime.LoadBalancingClient:DebugReturn(DEBUGLEVEL,字符串)(在资产/光子/ PhotonRealtime /代码/ LoadBalancingClient.cs:1835)

Photon.Realtime.LoadBalancingClient:OnOperationResponse(OperationResponse)(在资产/光子/ PhotonRealtime /代码/ LoadBalancingClient.cs:1909)

ExitGames.Client.Photon.PeerBase:DeserializeMessageAndCallback(StreamBuffer)(在C:/Dev/photon-sdk-dotnet/PhotonDotnet/PeerBase.cs:616)

ExitGames.Client.Photon.EnetPeer:DispatchIncomingCommands()(在C:/Dev/photon-sdk-dotnet/PhotonDotnet/EnetPeer.cs:545)

ExitGames.Client.Photon.PhotonPeer:DispatchIncomingCommands()(在C:/Dev/photon-sdk-dotnet/PhotonDotnet/PhotonPeer.cs:1473)

Photon.Pun.PhotonHandler:FixedUpdate()(在资产/光子/ PhotonUnityNetworking /代码/ PhotonHandler.cs:130)

我的统一认证码:

using Photon.Pun;
using Photon;

public class Login : MonoBehaviour {

public InputField User_Input;
public InputField Pass_Input;
public Text Error_Text;

public string username;
public string password;

public void UserName(){
    username = User_Input.text.ToString ();
}
public void UserPass(){
    password = Pass_Input.text.ToString ();
}
public void SubmitLogin(){
    PhotonNetwork.AuthValues = new AuthenticationValues ();
    PhotonNetwork.AuthValues.AuthType = CustomAuthenticationType.Custom;
    PhotonNetwork.AuthValues.AddAuthParameter ("username", username);
    PhotonNetwork.AuthValues.AddAuthParameter ("password", password);
    PhotonNetwork.ConnectUsingSettings();
}
void OnJoinedLooby(){
    Debug.Log ("We did it");
}
void OnGUI(){
    GUILayout.Label (PhotonNetwork.connectionStateDetailed.ToString ());
}
}

我的服务器端代码:

<?php
include "db.php";

$username = $_GET['username'];
$password = $_GET['password'];

$check = mysqli_query($conn , "SELECT * FROM accounts WHERE `username`='".$username."'");
$numrows = mysqli_num_rows($check);
if ($numrows == 0){
    die ("Username does not exist.");
}else{
    $password = md5($password);
        while($row = mysqli_fetch_assoc($check)){
            if ($password == $row['password']){
                $login_info = array(
                    "ResultCode" => 1,
                    "Message" => "You are connected!");

                    }else{
                    $login_info = array(
                        "ResultCode" => 2,
                        "Message" => "Wrong username or password");
                    }
            }
        }
    $json = json_encode($login_info);
echo $json;
?>

在光子面板,我把地址MYDOMAIN / auth.php,我没有把任何可选的键/值对

我不知道是什么问题,如果有谁知道

php json unity3d multiplayer photon
1个回答
1
投票

I replied on our forum。张贴了同在这里:

字母“U”是一种暗示,它可能是从“用户名不存在。”更换

die ("Username does not exist.");

$login_info = array(
                        "ResultCode" => 3,
                        "Message" => "Username does not exist."
                   );

如果问题仍然存在,使用postman并发送适当的查询字符串值的HTTP请求到服务器,看看它返回。解决这个问题。

© www.soinside.com 2019 - 2024. All rights reserved.