小编Spi*_*git的帖子

无法使用php webservice连接unity和mysql

我正在使用来自Server Side Highscores Tutorial页面的脚本.我稍微编辑了它,但它不起作用.该值未保存,我在php页面中不断收到此消息:

注意:未定义的索引:第6行的C:\ xampp\htdocs\unitypb\saveVerant.php中的名称

注意:未定义的索引:第7行的C:\ xampp\htdocs\unitypb\saveVerant.php中的值

注意:未定义的索引:第8行的C:\ xampp\htdocs\unitypb\saveVerant.php中的哈希

这是php代码

<?php 
        $db = mysql_connect('localhost', 'root', '') or die('Could not connect: ' . mysql_error()); 
        mysql_select_db('unitypb') or die('Could not select database');

        // Strings must be escaped to prevent SQL injection attack. 
        $name = mysql_real_escape_string($_GET['name'], $db); 
        $score = mysql_real_escape_string($_GET['score'], $db); 
        $hash = $_GET['hash']; 

        $secretKey="mySecretKey"; # Change this value to match the value stored in the client javascript below 

        $real_hash = md5($name . $score . $secretKey); 
        if($real_hash == $hash) { 
            // Send variables …
Run Code Online (Sandbox Code Playgroud)

php mysql database unity-game-engine

6
推荐指数
1
解决办法
495
查看次数

标签 统计

database ×1

mysql ×1

php ×1

unity-game-engine ×1