1

我托管的网站是 000webhost.com

这是在控制台中的错误,

 java.net.MalformedURLException: no protocol: OxidePKz.net63.net/checkvote.php?   username=oxide
 at java.net.URL.<init>(Unknown Source)
 at java.net.URL.<init>(Unknown Source)
 at java.net.URL.<init>(Unknown Source)

这是我的检查投票页面代码

   <?php
$con = mysql_connect("mysql1.000webhost.com", "a5999082_oxidepk", "(put in right passcode)");
if (!$con) {
    die("Could not connect to database: " . mysql_error());
}
mysql_select_db("DATABASE_NAME", $con);
$username = mysql_escape_string($_GET['username']);
if (isset($_GET['username'])) {
    $result = mysql_query("SELECT * FROM `votes` where username = '$username'") or die(mysql_error());
    $row = mysql_fetch_array($result);
    if($row['username'] == $username) {
        mysql_query("DELETE FROM `votes` where username = '$username'");
        echo "true";
    } else {
        echo "false";
    }
}

我用表名 votes 做了一个我的管理员 php,这是回调页面

    $rspscoding = gethostbyname("http://www.oxidepkz.net63.net");
    if($_SERVER['REMOTE_ADDR'] == $rspscoding) {
        $con = mysql_connect("mysql1.000webhost.com", "a5999082_oxidepk", "(put in right passcode)");
        if (!$con) {
            die("Could not connect to database: " . mysql_error());
        }
        mysql_select_db("DATABASE_NAME", $con);
        $username = mysql_escape_string($_GET['username']);
        if (isset($_GET['username'])) {
            mysql_query("INSERT INTO `votes` (username) VALUES ('$username')") or die(mysql_error());  
        }
        mysql_close($con);
}
4

1 回答 1

1

一些东西;

  1. 我想知道为什么您要从 php 应用程序中获取 java 异常
  2. 接下来 gethostbyname(" http://www.oxidepkz.net63.vote.html ") 不采用 URL,它采用像“www.oxidepkz.net63.com”这样的主机名,例如根据: http://php。网络/手册/en/function.gethostbyname.php
  3. 最后,您的 URL 格式错误,因为域名后没有斜杠。“ http://www.oxidepkz.net63.vote.html ” 在任何浏览器中都不起作用 是不是被截断了?
于 2013-10-09T02:33:09.333 回答