2011-02-18 105 views
0

我已经连续几周收到垃圾邮件。我能够通过表格在我的几页上获得一些recaptcha,但有一些不起作用。我的一些网站是用CMS完成的,其他部分是从头开始的。所以......有一个叫做sign-up.php的页面。这是最受欢迎的表单。表单结构有点奇怪。我添加的唯一东西是标签内部的php标签和recaptcha脚本。我发现这个表单发布的文件,但是当我添加google recaptcha告诉我添加的任何内容时,它会崩溃。我试着添加一些简单的行,比如include_once(recaptchalib.php),它仍然崩溃。reCaptcha打破我的代码

<div class="big_box"> 

<form name="signup" method="post" action=""> 



<div class="container_shadowl"></div> 

<div class="container"> 

<div class="h1_title">Sign Up</div> 

<p class="cntp cntmleft"> 

.... 
<div class="cntcontact"> 

    <div class="cntbox1a" style="width:285px;padding-top:35px; padding-left:120px !important"> 



      <input type="hidden" name="submit" value="submitted" /> 



      <table border="0" cellpadding="0" cellspacing="0" class="input-td"> 

      <tr> 

       <td style="width:110px;" class="ctninput">* First Name</td> 

       <td><input name="first_name" type="text" class="cntinputfield" value="<?=$values['first_name']?>" <?=$field['first_name']?> style="border:1px solid #ccc;"/></td> 

      </tr> 

      <tr> 

      <td>* Last Name</td> 

      <td><input name="last_name" type="text" class="cntinputfield" value="<?=$values['last_name']?>" <?=$field['last_name']?> style="border:1px solid #ccc;"/></td> 

      </tr> 

      <tr> 

      <td>* Company</td> 

      <td><input name="company" type="text" class="cntinputfield" value="<?=$values['company']?>" <?=$field['company']?> style="border:1px solid #ccc;"/></td> 

      </tr> 

      <tr> 

      <td>* Phone</td> 

      <td><input name="phone" type="text" class="cntinputfield" value="<?=$values['phone']?>" <?=$field['phone']?> style="border:1px solid #ccc;"/></td> 

      </tr> 

      <tr> 

       <td>* E-Mail (Username - Case Sensitive)</td> 

       <td><input name="email" type="text" class="cntinputfield" value="<?=$values['email']?>" <?=$field['email']?> style="border:1px solid #ccc;"/></td> 

      </tr> 

      <tr> 

      <td>* Password (Case Sensitive)</td> 

      <td><input name="password1" type="password" class="cntinputfield" id="password1" value="<?=$values['password1']?>" <?=$field['password1']?> style="border:1px solid #ccc;"/></td> 

      </tr> 

      <tr> 

      <td>* Confirm</td> 

      <td><input name="password2" type="password" class="cntinputfield" value="<?=$values['password2']?>" <?=$field['password2']?> style="border:1px solid #ccc;"/></td> 

      </tr> 

      <tr> 

      <td>Address</td> 

      <td><input name="address" type="text" class="cntinputfield" value="<?=$values['address']?>" <?=$field['address']?> style="border:1px solid #ccc;"/></td> 

      </tr> 

      <tr> 

      <td>City</td> 

      <td><input name="city" type="text" class="cntinputfield" value="<?=$values['city']?>" <?=$field['city']?> style="border:1px solid #ccc;"/></td> 

      </tr> 

      <tr> 

      <td>State</td> 

      <td><select name="state" class="text2" id="state" class="cntinputfield" style="border:1px solid #ccc;"> 



            <? 



            for($i=1;$i<TAMSTATES;$i++){ 



            ?> 



            <option value="<?=$CMBstateS[$i]?>" <? if(STATEDEFAULTS==$i){?> selected="selected"<? }?>> 



            <?=$CMBstateS[$i]?> 



            </option> 



            <? }?> 



           </select> 

      </td> 

      </tr> 

      <tr> 

      <td>Zip</td> 

      <td><input name="zip" type="text" class="cntinputfield" value="<?=$values['zip']?>" <?=$field['zip']?> style="border:1px solid #ccc;"/></td> 

      </tr> 

      <tr> 

      <td>How Did You Hear About Us?</td> 

      <td><input name="hear" type="text" class="cntinputfield" value="<?=$values['hear']?>" <?=$field['hear']?> style="border:1px solid #ccc;"/></td> 

      </tr> 

      <tr> 

      <td>Rep ID or Promo Code</td> 

      <td><input name="promo" type="text" class="cntinputfield" value="<?=$values['promo']?>" <?=$field['promo']?> style="border:1px solid #ccc;"/></td> 

      </tr> 



      </table> 

     <p class="cntsmall" style="display:inline">*required fields</p> 



      <div class="clear"></div> 

    </div> 

    <div class="cntbox2" style="width:400px;padding-left:0px !important"> 

    <!-- <div class="cntcol1" style="width:275px;"> 





     </div>--> 

     <div class="cntcol2" style="width:100%; padding-left:15px;"> 

      <p><span style="font-size:12px;">Message</span> 

      <br /> 

      <textarea name="message" cols="50" rows="10" class="cntinputfield cnttextarea" style="margin-top:5px;width:300px;height:75px !important; border:1px solid #ccc;" ><?=$values['message']?> 
      </textarea> 

      <br /> 

      <br /> 

      <span style="font-size:12px;font-weight:bolder;">Terms and Conditions</span> 

      <textarea readonly="readonly" name="terms" cols="50" rows="10" class="cntinputfield cnttextarea" style="margin-top:5px; width:300px; height:115px !important; border:1px solid #ccc;" ><?=$terms_conds?> 
      </textarea> 

      <br /> 

      <input type="checkbox" name="terms_agree" value="1" /> 
      <small>I agree to the Terms and Conditions</small>. 
      </p> 

       <?php 
       require_once('recaptchalib.php'); 
       $publickey = "6LelV8ESAAAAAEo6PETdSv0KvHwbIlM8394qUz0o"; 
       echo recaptcha_get_html($publickey); 
       ?> 


     <div class="clear"></div> 



      <input type="image" style="display:inline; padding-top:10px;" xonclick="document.signup.submit();" src="img/btn_cnt_send.jpg" alt="SUBMIT" /> 

    </div> 

     <div class="clear"></div> 
+0

@巨人仍然没有运气? – Alfred 2011-02-23 15:28:54

回答

0

我会建议看看EasyCaptchas,因为它是很容易(PHP记)要使用比较验证码?

该代码示例已损坏:)。查询字符串中缺少?。这是一个正确的例子:

<?php 

session_start(); 

if(isset($_POST['captcha'])) { 
    $captcha = $_POST['captcha']; 
    $uid   = $_SESSION['uid']; 
    echo file_get_contents("http://www.easycaptchas.com/check.aspx?sessionid=$uid&input=$captcha"); 
    exit(); 
} 

$uid = $_SESSION['uid'] = uniqid(); 

?> 
<form method="post"> 
    <input name="captcha" size="16"/> 
    <img id="captchaimg" src="http://www.EasyCaptchas.com/<?= $uid; ?>.captcha?" /> 
    <a href="http://www.easycaptchas.com/" onclick="document.getElementById('captchaimg').src+='rf=1';return false;" style="font-size:9px">refresh</a><br /> 
    <!-- Free Captcha provided courtesy of www.EasyCaptchas.com (please do not remove this link) --> 
    <noscript><a href="http://www.easycaptchas.com/" onclick="return false;" style="display:none">Captcha</a></noscript> 
</form> 
<script> 
    console.log(document.getElementById('captchaimg').src); 
</script> 
+0

是的,谢谢。 EasyCaptchas是一个非常简单的安装。唯一不起作用的是刷新链接。我的代码和他们网站上的测试代码完全一样。有任何想法吗? – 2011-02-18 18:20:23