$_POST函数获胜';不起作用


$_POST function won't work?

我在从这里找到的页面获取文本字段时遇到了一些问题:这里把它移到这里:这里我试过$_post函数,就像我以前看到的那样,但它似乎没有传递信息!

以下是当前描述的第一页的脚本:

<?php
// Creator: Will Renfroe
// All rights Reserved
//Vote Sites and MySQL
$DBNAME="mysql";
$DBUSER="mysql";
$DBPASSWORD="mysql";
$DBHOST="mysql";
///////////////////
// SCRIPT
///////////////////
mysql_connect($DBHOST, $DBUSER, $DBPASSWORD) or die("<center>Cannot connect to MySQL</center>");
mysql_select_db($DBNAME) or die("<center>Cannot select DB</center>");
/////////
?>
<?php
    include("secure.php");
    if (getenv(HTTP_X_FORWARDED_FOR)) {
    $pipaddress = getenv(HTTP_X_FORWARDED_FOR);
    $ipaddress = getenv(REMOTE_ADDR);
} else {
    $ipaddress = getenv(REMOTE_ADDR);
}
if(isset($_POST['dovote'])){
check_inject();
    //Get user id from session
    $userid=secure($_POST["nick"]);
    $time=time();
    $query=mysql_query("SELECT nick,time FROM votesdb WHERE ip='$ipaddress'");
    $checkip=mysql_num_rows($query);
    $iprow=mysql_fetch_row($query);
    $query=mysql_query("SELECT time FROM votesdb WHERE nick='$userid'");
    $checkuser=mysql_num_rows($query);
    $userrow=mysql_fetch_row($query);
    if ($checkuser){
        //if user vote
        if ($checkip and $time>$iprow[1]){$canvote=1;}
        if (!$checkip and $time>$userrow[0]){$canvote=1;}
    }else{
        //if user never vote
        if ($checkip and $time>$iprow[1]){$canvote=1;}
        if (!$checkip){$canvote=1;}
    }
    //Do Vote
    if ($canvote){
        $newtime=time()+60*60*24;
        if ($checkuser){
            //update
            mysql_query("UPDATE votesdb SET time=$newtime, ip='$ipaddress', votes=votes+1, flags=flags+1 WHERE nick='$userid'");
        }else{
            //insert
            $query=mysql_query("INSERT INTO votesdb(nick,time,ip,votes,flags) VALUES ('$userid',$newtime,'$ipaddress',1,1)");
        }
        //Add nick to nicklist table
        $query=mysql_query("INSERT INTO nicklist(nick) VALUES ('$userid')");
        echo "<font color='red'>You can vote every 24 hours to get reward.</font>";
    }else{
        echo "<font color='green'>thank you for voting!</font>";
    }
}
?>



<style type="text/css">
.minecrafttext {
    font-family: "Volter (Goldfish)";
    font-size: 12px;
    color: #0F3;
}
.minecrafttext {
    font-family: "Volter (Goldfish)";
}
</style>
<body background="http://files.enjin.com/121395/19.gif" bgproperties="fixed"><div style="text-align: center;"> <img style="border: medium none;" alt="" title="" src="http://files.enjin.com/121395/Vote_For_Diamonds.png"><span style="color: rgb(255, 165, 0);"><br>You will get <span style="font-weight: bold; font-size: 18pt; color: rgb(255, 0, 0);">10</span></span> <img style="border: medium none; width: 37px; height: 34px;" alt="" title="" src="http://www.minecraftwiki.net/images/9/90/Diamond_%28Gem%29.png"><span style="color: rgb(255, 165, 0);">for voting on the sites below!</span><br></div><div style="text-align: center;"><span style="color: rgb(30, 144, 255); font-weight: bold;"></span><span style="color: rgb(30, 144, 255); font-weight: bold; text-decoration: underline;">Directions:</span><br>
  <br>
  <span class="minecrafttext">Vote right here: </span>
</div>
<center>
  <form target="_blank" action="http://www.minecraftservers.net/vote.php?id=1991" method="post"> 
  <p>
    <input onClick="document.getElementById('vote4').disabled=false" value="Minecraftservers.net" name="vote1" id="vote1" type="submit" />
  </p>
  <p class="minecrafttext">And here:&nbsp;</p>
</form>
<form target="_blank" action="http://www.minestatus.net/15901-freebuildxiz" method="post">
  <input onClick="document.getElementById('vote5').disabled=false" disabled="disabled" value="Minestatus" name="vote1" id="vote4" type="submit" />&nbsp;</form>
<br/>
  <form method="POST">
    <font color='lime' class="minecrafttext"><strong>Put your In-Game-Name here!</strong></font><br/>
    <input name="nick"/><br/>
<form method="POST">
<input name="dovote" type="submit" value="Receive Diamond" onClick="document.getElementById('vote5').disabled=false" id="vote5" disabled="disabled" onSubmit="return nameempty();" /> 
</form> 
<a href="http://legacyserver.info/fbxtop.php" target="http://legacyserver.info/fbxtop.php" class="minecrafttext">Click here to see the Top 10 voters!</a>
</center>
</body>
</html>

这里是第二个:

<body background="http://files.enjin.com/121395/19.gif" bgproperties="fixed"><div style="text-align: center;"><br /> <img style="border: medium none;" alt="" title="" src="http://files.enjin.com/121395/Vote_For_Diamonds.png"><br /><center><font color='cyan'>Click below to start the vote for diamonds process!</font></center><br /><br />
<form method="POST" action="VotingScriptfbxiz.php">
<input type="image" method="POST" action="VotingScriptfbxiz.php" src="http://files.enjin.com/121395/JulieGloopUI(43)45(REV2).png" alt="Submit value="POST" input name="VoteVerify" id="submitButton" />

当我试图将文本框从第一页移动到第二页,但仍然让它正确提交信息时,它不想正常工作。

此外,所描述的第一个脚本似乎有一些问题,它说你每次都投票,但它甚至不想把你添加到数据库中,我已经尝试了很多版本,当我扰乱时,它突然出现了

您的第二个脚本是错误的。您需要将其更改为:

<body background="http://files.enjin.com/121395/19.gif" bgproperties="fixed">
   <div style="text-align: center;"><br /> 
       <img style="border: medium none;" alt="" title="" src="http://files.enjin.com/121395/Vote_For_Diamonds.png"/><br />
<center><font color='cyan'>Click below to start the vote for diamonds process!</font></center><br /><br />
<form method="POST" action="VotingScriptfbxiz.php">
  <input type="image" src="http://files.enjin.com/121395/JulieGloopUI(43)45(REV2).png" alt="Submit" value="POST" /> 
  <input name="VoteVerify" id="submitButton" />
  </form>
 </div>
 <body/>

为什么要使用图像标记的操作和方法。不需要那样。此外,您不能关闭表单标签并输入type="image"标签

还可以使用验证器进行验证。

为什么不必要地使用
标记。使用样式使其正确。

希望这有帮助:)