2016-04-03 63 views
-1

我有一个页面,更新user_points表其呼叫 pointsxxl50updateforposts.php 是自动更新他们自己的用户分 我喜欢闻其提交的留言,提供50点提交后,这可能像因为我有尝试提交却又无可奈何 这是我喜欢做这样的事情去一些页面提交后

<td><input type="submit" name="submit" id="submit" value="Submit Post" onclick="window.location.href='http://bitcoinrotator.publiadds.org.pt/login-registration/pointsxxl50updateforposts.php'"> 
    </td> 

,这是我的代码对使用reCAPTCHA选项 该网页,我喜欢留在验证码和提交后进入该页面

http://bitcoinrotator.publiadds.org.pt/login-registration/pointsxxl50updateforposts.php 

<?php 
 
include("db.php"); 
 
    
 
$select=mysql_query("select * from commenttable"); 
 
while($row=mysql_fetch_array($select)) 
 
{ 
 
\t echo "<div id='sty'>"; 
 
\t echo "<img src='files/fav icon.png'"."' width='50px' height='50px' align='left' />"; 
 
\t echo "<div id='nameid'>".$row['name']."</div>"; 
 
\t echo "<div id='msgid'>".$row['message']."</div>"; 
 
\t echo "</div><br />"; 
 
} 
 
?> 
 
<!DOCTYPE HTML> 
 
<html> 
 
<head> 
 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 
 
<title>Comment system using php and mysql</title> 
 
<center><br><br><form> 
 
<input type="button" value="Back" onclick="window.location.href='http://bitcoinrotator.publiadds.org.pt/login-registration/home.php'" /> 
 
</form></center> 
 

 

 
<script type="text/javascript"> 
 
function validation() 
 
{ 
 
\t var nam=document.comment.namename.value; 
 
\t var nam1=document.getElementById('tnameid'); 
 
\t if(nam=="") 
 
\t { 
 
\t \t document.comment.namename.focus(); 
 
\t \t nam1.style.borderColor="#f00"; 
 
\t \t return false; 
 
\t } 
 
\t var nam1=document.getElementById('tnameid'); 
 
\t nam1.style.borderColor=""; 
 
\t var jo=document.comment.job.value; 
 
\t var jo1=document.getElementById('tjobid'); 
 
\t if(jo=="") 
 
\t { 
 
\t \t document.comment.job.focus(); 
 
\t \t jo1.style.borderColor="#f00"; 
 
\t \t return false; 
 
\t } 
 
\t var jo1=document.getElementById('tjobid'); 
 
\t jo1.style.borderColor=""; 
 
\t var mess=document.comment.message.value; 
 
\t var mess1=document.getElementById('tmessageid'); 
 
\t if(mess=="") 
 
\t { 
 
\t \t document.comment.message.focus(); 
 
\t \t mess1.style.borderColor="#f00"; 
 
\t \t return false; 
 
\t } 
 
} 
 
</script> 
 
</head> 
 

 
<body> 
 
<body bgcolor="#ffffff"> 
 
<center><form name="comment" method="post" action="comment.php" onSubmit="return validation()"> 
 

 
    
 
<table width="500" border="0" cellspacing="3" cellpadding="3" style="margin:auto;"> 
 
    <tr> 
 
    <td align="right" id="one">Name :<span style="color:#F00;">*</span></td> 
 
    <td><input type="text" name="namename" id="tnameid"></td> 
 
    </tr> 
 
    <tr> 
 
    <td align="right" id="one">Work :<span style="color:#F00;">*</span></td> 
 
    <td><input type="text" name="job" id="tjobid"></td> 
 
    </tr> 
 
    <tr> 
 
    <td align="right" id="one"></td> 
 
    <td><textarea name="message" id="tmessageid"></textarea></td> 
 
    </tr> 
 
    <tr> 
 
    <td align="right" id="one"></td></center> 
 
<?php 
 
require_once('recaptchalib.php'); 
 
      // Get a key from https://www.google.com/recaptcha/admin/create 
 
$publickey = "6LfFYRwTAAAAAKjhq4QOgfYXZP6aZ6OSJhNBPglV 
 
"; 
 
$privatekey = "6LfFYRwTAAAAAIqSCCYHobymWT98Jwooh9EwinjE"; 
 
# the response from reCAPTCHA 
 
$resp = null; 
 
# the error code from reCAPTCHA, if any 
 
$error = null; 
 

 
echo recaptcha_get_html($publickey, $error); 
 
?> 
 
    <td><input type="submit" name="submit" id="submit" value="Submit Post"> 
 
    </td> 
 
</tr> 
 
</table> 
 
</form></center> 
 

 
</body> 
 
</html>

回答

0

嗯,我只是解决了重定向问题提交

验证码有效的响应后后

if ($resp->is_valid) { 
 
       if(isset($_POST['submit'])) 
 
\t \t \t \t \t { 
 
\t \t \t \t \t \t $name=$_POST['namename']; 
 
\t \t \t \t \t \t $job=$_POST['job']; 
 
\t \t \t \t \t \t $message=$_POST['message']; 
 
\t \t \t \t \t \t $insert=mysql_query("insert into commenttable(name,job,message)values('$name','$job','$message')")or die(mysql_error()); 
 
\t \t \t \t \t \t echo "You posted a comment"; 
 
\t \t \t \t \t \t header("Location: mylink");