php - reCaptcha breaking my code -
i've been getting spam few weeks. able recaptcha on few of pages forms, there few don't work. of site done cms , other parts done scratch. so... there page called sign-up.php. page form gets hit most. form structure little odd. thing added php tag , recaptcha script inside of tag. i've found file form posts to, when add google recaptcha tells me add, crashes. i've tried adding few easy lines include_once(recaptchalib.php) , still crashes.
<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 hear 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 , 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 terms , 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>
i advise have @ easycaptchas because pretty easy(php in mind) use compared recaptcha?
that code sample broken :). ?
missing querystring. here correct example:
<?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 not remove 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>
Comments
Post a Comment