为什么我得到java.net.MalformedURLException:没有协议?

时间:2013-10-09 02:13:51

标签: java php html mysql

我主持的网站是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";
    }
}

我用表名投票制作了我的admin 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);
}

1 个答案:

答案 0 :(得分:1)

一些事情;

  1. 我很想知道你为什么要从php应用程序中获取java异常
  2. 下一个gethostbyname(“http://www.oxidepkz.net63.vote.html”)不带URL,例如根据:http://php.net/manual/en/function.gethostbyname.php
  3. 需要“www.oxidepkz.net63.com”等主机名
  4. 最后,您的网址格式错误,因为域名后面没有结尾的斜杠。 “http://www.oxidepkz.net63.vote.html”无法在任何浏览器中使用 它可能会被截断吗?