SuperSpacecadet Posted October 28, 2009 Share Posted October 28, 2009 Ok where do i start? Probably by telling you I have very little working knowledge of PHP and that I have been working on this problem for 3 days and have had no luck! Here we go: I have a rate and review script on my site, I am trying to put in a anti spam code. I have tried 5 diffrent scripts including "recaptcha" and always have the same problem. Even if the code entered is wrong it allows you to hit the submit button. It's like the "submit button" and the anti spam picture are not connected in any way. No matter what they enter it allows them to post. I have no idea what to do but I have concluded that im missing something in the starting form field, I just dont know what. I have an anti spam script running right now and i have the same problem. Take a look at the link below and feel free to post and play with it all you like. I have also pasted the form code below. Thank you in advance. http://www.localkaraokeshows.com/countries/canada/mb/bars/fraserwoodhotel/fraserwoodhotelrate.php <form method='post'> <table width='90%' border='1' cellspacing='0' bordercolor=#3a4f6c bgcolor=#f5f9fd> <tr><b><font size=1> <td bgcolor=#c2cfdf><b>Add a Review</b></td></tr> <tr><td><table border='0'cellspacing='0' align=middle bgcolor=#f5f9fd> <tr><td><font size=1> Name: <BR></font></b></td><td><input type='text' maxlength="50" name='name' size=20 style="font-weight:10"></td><td>Rating: <select name=rate><option value="">Select<option value="10">10 (Good)<option value="9">9<option value="8">8<option value="7">7<option value="6">6<option value="5">5<option value="4">4<option value="3">3<option value="2">2<option value="1">1 (Bad)</select></td></tr></table><table> <tr valign='top'><td></td><td align=middle> <?php smile(); ?></td><tr><td><font size=1> Comment:<BR></b></td> <td><textarea cols='35' rows='3' name='comment' onkeydown=textCounter(this.form.comment,this.form.descriptionleft,400); onkeyup=textCounter(this.form.comment,this.form.descriptionleft,400);></textarea><br>Characters Left <INPUT maxLength=3 name=descriptionleft readOnly size=3 tabIndex=400 value=400 style='BORDER-RIGHT: 0px; BORDER-TOP:0px;BORDER-LEFT:0px; BORDER-BOTTOM:0px;BACKGROUND-COLOR: #f5f9fd;'></td></tr> <tr><td></td><td> <img src="antispam.php"><br> <input name="anti_spam_code"><br> <input type="submit" value="Add Review" style="background:#f5f9fd;border-width:1;Border-color:#3a4f6c;" /> <?php @session_start(); // start session if not started yet if ($_SESSION['AntiSpamImage'] != $_REQUEST['anti_spam_code']) { // set antispam string to something random, in order to avoid reusing it once again $_SESSION['AntiSpamImage'] = rand(1,9999999); // here you add code to let user know incorrect code entered } else { // set antispam string to something random, in order to avoid reusing it once again $_SESSION['AntiSpamImage'] = rand(1,9999999); exit; // everything is fine, proceed with processing feedback/comment/etc. } ?> </td></tr> </table> </table> </form> Quote Link to comment Share on other sites More sharing options...
MadTechie Posted October 28, 2009 Share Posted October 28, 2009 Maybe read the comment // here you add code to let user know incorrect code entered maybe add header("Location: fraserwoodhotelrate.php"); exit(); instead of leaving it blank Quote Link to comment Share on other sites More sharing options...
SuperSpacecadet Posted October 28, 2009 Author Share Posted October 28, 2009 This is what i get... Warning: Cannot modify header information - headers already sent by (output started at /home/content/y/i/p/yippydoo/html/karaoke/countries/canada/mb/bars/fraserwoodhotel/fraserwoodhotelrate.php:13) in /home/content/y/i/p/yippydoo/html/karaoke/countries/canada/mb/bars/fraserwoodhotel/review.php on line 205 Quote Link to comment Share on other sites More sharing options...
abazoskib Posted October 29, 2009 Share Posted October 29, 2009 move your PHP block to the top of your document Quote Link to comment Share on other sites More sharing options...
SuperSpacecadet Posted October 29, 2009 Author Share Posted October 29, 2009 I tried it at the very top of the page before the HTML tag. I tried it inside the head, and i tried it right after the head tag at the beginning of the html. same error. except now the form is completly gone lol. Next idea? Quote Link to comment Share on other sites More sharing options...
MadTechie Posted October 29, 2009 Share Posted October 29, 2009 It has to be at the VERY top, with nothing before it. Quote Link to comment Share on other sites More sharing options...
SuperSpacecadet Posted October 29, 2009 Author Share Posted October 29, 2009 I placed the code at the very top before everything else, same error. Is it possible I have it in the wrong document? does it go in the same doc as the one with the code to make it display? If so, I'm open to ideas, if not which doc should it be in? Thanks Quote Link to comment Share on other sites More sharing options...
MadTechie Posted October 29, 2009 Share Posted October 29, 2009 See attached i have zipped 3 files a font, antispam.php and 274670.php open 274670.php and test [attachment deleted by admin] Quote Link to comment Share on other sites More sharing options...
SuperSpacecadet Posted October 29, 2009 Author Share Posted October 29, 2009 Now I get this: Fatal error: Call to undefined function: smile() in /home/content/y/i/p/yippydoo/html/karaoke/countries/canada/mb/bars/fraserwoodhotel/274670.php on line 33 Take A look: http://www.localkaraokeshows.com/countries/canada/mb/bars/fraserwoodhotel/274670.php Quote Link to comment Share on other sites More sharing options...
SuperSpacecadet Posted October 29, 2009 Author Share Posted October 29, 2009 Sorry about the above post, took me a bit to realize it was just a part of the code and not an html page. Thats what i get for coping and pasting without reading. I added your code into the proper places in the original page and now im getting: Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/content/y/i/p/yippydoo/html/karaoke/countries/canada/mb/bars/fraserwoodhotel/fraserwoodhotelrate.php:13) in /home/content/y/i/p/yippydoo/html/karaoke/countries/canada/mb/bars/fraserwoodhotel/review.php on line 2 Here is the link again if you need it. Thanks http://www.localkaraokeshows.com/countries/canada/mb/bars/fraserwoodhotel/fraserwoodhotelrate.php Quote Link to comment Share on other sites More sharing options...
MadTechie Posted October 29, 2009 Share Posted October 29, 2009 Can you just add the file 274670.php, without any changes (just for testing) Quote Link to comment Share on other sites More sharing options...
dgoosens Posted October 29, 2009 Share Posted October 29, 2009 if you put the script at the top of the file, with nothing above it, it is quite possible that you are working in UTF-8 with BOM. The BOM causes this kind of errors. When working with PHP you should work in UTF-8 without BOM. (...) in PHP, if output buffering is disabled, it has the subtle effect of causing the page to start being sent to the browser, preventing custom headers from being specified by the PHP script. The UTF-8 representation of the BOM is the byte sequence EF BB BF, which appears as the ISO-8859-1 characters  in most text editors and web browsers not prepared to handle UTF-8. http://en.wikipedia.org/wiki/Byte-order_mark Quote Link to comment Share on other sites More sharing options...
SuperSpacecadet Posted October 29, 2009 Author Share Posted October 29, 2009 "Can you just add the file 274670.php, without any changes (just for testing)" Here you go, http://www.localkaraokeshows.com/countries/canada/mb/bars/fraserwoodhotel/274670.php Can someone please tell me in simple terms what the post above means? I don't understand the aberviations. Quote Link to comment Share on other sites More sharing options...
MadTechie Posted October 29, 2009 Share Posted October 29, 2009 Okay the smile(); function isn't working comment out the line //smile(); Quote Link to comment Share on other sites More sharing options...
SuperSpacecadet Posted October 30, 2009 Author Share Posted October 30, 2009 Interesting, so now the test page you gave me appears to be working, however when I past the code into my rate and review page i get this again. And it still allows the entry if the code is wrong? Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/content/y/i/p/yippydoo/html/karaoke/countries/canada/mb/bars/fraserwoodhotel/fraserwoodhotelrate.php:13) in /home/content/y/i/p/yippydoo/html/karaoke/countries/canada/mb/bars/fraserwoodhotel/review.php on line 2 Quote Link to comment Share on other sites More sharing options...
MadTechie Posted October 30, 2009 Share Posted October 30, 2009 is it possible to attach fraserwoodhotelrate.php or PM me it (as a file) ? Quote Link to comment Share on other sites More sharing options...
SuperSpacecadet Posted November 1, 2009 Author Share Posted November 1, 2009 I will get that to you ASAP, Does anyone know how to attach a file to a pm in here? I tried and dont see a button for it. I don't suppose anyone has a diffrent Rate and Review script with anti bot that would be easier to use than this one? I'm not attached in any way to this one, as a matter of fact I dont really like it but it's the only one i found that didnt want a fortune to buy it. Quote Link to comment Share on other sites More sharing options...
MadTechie Posted November 1, 2009 Share Posted November 1, 2009 Your on 9 posts, you need 10+ Quote Link to comment Share on other sites More sharing options...
SuperSpacecadet Posted November 1, 2009 Author Share Posted November 1, 2009 is it possible to attach fraserwoodhotelrate.php or PM me it (as a file) ? Ok got it thanks, I'm posting these files publicly in a zip file so anyone can take a look if they want. One again, thank you everyone for helping me out especially Madtechie. At the moment I still have the same problem as stated in the first post. oops uploaded it twice lol [attachment deleted by admin] Quote Link to comment Share on other sites More sharing options...
MadTechie Posted November 1, 2009 Share Posted November 1, 2009 Okay the reason for the error is this While the code is at the top of the file, its not before any output.. as your calling the file like this <center> <?php include "review.php"; ?> </center> So anything that if outputted before the include is still output.. thus causing the error. if you move <?php session_start(); // start session if not started yet $ERROR = ""; if(isset($_REQUEST['anti_spam_code'])) { if ($_SESSION['AntiSpamImage'] != $_REQUEST['anti_spam_code']) { // set antispam string to something random, in order to avoid reusing it once again $_SESSION['AntiSpamImage'] = rand(1,9999999); $ERROR = "WRONG CODE"; }else { // set antispam string to something random, in order to avoid reusing it once again $_SESSION['AntiSpamImage'] = rand(1,9999999); // everything is fine, proceed with processing feedback/comment/etc. //PROCESS POST /* SQL stuff for adding new comment etc */ header("Location: fraserwoodhotelrate.php"); //jump to new page exit(); } } ?> from review.php to the TOP of fraserwoodhotelrate.php if should be fine Quote Link to comment Share on other sites More sharing options...
SuperSpacecadet Posted November 1, 2009 Author Share Posted November 1, 2009 I tried that and it does get rid of th error but it still allows a post if the entry is wrong. It's like the anti bot and rate and review are not connected. give me 5 min and take a look I will make those changes right now. then visit the web page and enter a review and the wrong code and see what I mean. Changes are done Thanks Jeremy http://www.localkaraokeshows.com/countries/canada/mb/bars/fraserwoodhotel/fraserwoodhotelrate.php Quote Link to comment Share on other sites More sharing options...
MadTechie Posted November 1, 2009 Share Posted November 1, 2009 Your right its not linked.. no offence but the code really needs to be re-written, I have got it working, but I still think it need re-doing, as theirs tons of issues, and it would be probably quicker to start over.. (no offence intended, as i believe you picked this up from another site) See zip attached [attachment deleted by admin] Quote Link to comment Share on other sites More sharing options...
SuperSpacecadet Posted November 2, 2009 Author Share Posted November 2, 2009 Your right its not linked.. no offence but the code really needs to be re-written, I have got it working, but I still think it need re-doing, as theirs tons of issues, and it would be probably quicker to start over.. (no offence intended, as i believe you picked this up from another site) See zip attached No offence taken my friend since the script it's self looks crappy. I really wanted a nicer looking one but there are hardly any Rate and REview scripts out there that they dont want a fortune for. Thanks for all the help I'll make the changes right now. Do you happen to know of any other rate and review scripts that are better than this one? Quote Link to comment Share on other sites More sharing options...
SuperSpacecadet Posted November 2, 2009 Author Share Posted November 2, 2009 It works perfectly, Thank you so much. Can you tell me what I was doing wrong for future refrence please? Why was the submit button and the antispam script not connected? Take Care Jeremy Quote Link to comment Share on other sites More sharing options...
MadTechie Posted November 2, 2009 Share Posted November 2, 2009 I removed the redirect and added the error check to this line if (strlen($name)>=1 && strlen($comment)>=1 && strlen($rate)>=1 && $stats[4]!=$ip && empty($ERROR)){ as it validated the comment and rate but you also needed it to fail if the captcha was invalid note: && empty($ERROR) So now when the captcha is invalid, the error gets set $ERROR = "WRONG CODE"; then will fail on the write to file check Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.