stefsoko Posted January 13, 2011 Share Posted January 13, 2011 How do I remove the captcha check on this line and keep it valid? if ($author && $message && ($capatcha == 6 || controlPosts::isAdmin())) I tried if ($author && $message && (controlPosts::isAdmin())) but the script wont post like this? Quote Link to comment https://forums.phpfreaks.com/topic/224315-need-a-quick-fix-on-1-line-of-code/ Share on other sites More sharing options...
stefsoko Posted January 13, 2011 Author Share Posted January 13, 2011 here is the entire function if need.. function getPosts() { global $users; global $author; global $message; global $nameMaxChars; global $messageMaxChars; if ($author && $message && ($capatcha == 6 || controlPosts::isAdmin())) { if (strlen($author) <= $nameMaxChars && strlen($message) <= $messageMaxChars) { if ((!controlPosts::isAdmin() && !in_array($author, array_keys($users))) || (controlPosts::isAdmin() && $author == controlPosts::adminName())) { $this->inputPost($author, $message); header('Location: ./'); } } } } } It is currently just checking for a set number as a captcha before posting content. I want to remove this captcha number check, and cannot seem to do so without breaking the script. thanks in advance!! Quote Link to comment https://forums.phpfreaks.com/topic/224315-need-a-quick-fix-on-1-line-of-code/#findComment-1158913 Share on other sites More sharing options...
denno020 Posted January 13, 2011 Share Posted January 13, 2011 I can't get the script to break on my end, but maybe I need your set up to be able to call it right? Anyway, do you understand what the if statement is saying? Simply removing $capatcha == 6 || should do the trick. But make sure you get rid of the brackets too, as they're no longer needed. So your code would be like this: if ($author && $message && controlPosts::isAdmin()) Without being able to replicate the error on my end, I won't really be able to help. Have you got anything I need to be able to try and run your script? Denno Quote Link to comment https://forums.phpfreaks.com/topic/224315-need-a-quick-fix-on-1-line-of-code/#findComment-1158920 Share on other sites More sharing options...
stefsoko Posted January 13, 2011 Author Share Posted January 13, 2011 that doesnt create any errors, but the script then will not post the message? i will PM you denno Quote Link to comment https://forums.phpfreaks.com/topic/224315-need-a-quick-fix-on-1-line-of-code/#findComment-1158936 Share on other sites More sharing options...
stefsoko Posted January 13, 2011 Author Share Posted January 13, 2011 I would like someone to add a functional CAPTCHA to my small 2 page script, if you are interested I posted here: http://www.phpfreaks.com/forums/php-freelancing/need-someone-to-add-captcha-to-form/ I will pay via PayPal immediately after seeing a working example, and you can send the code afterwards! Please reply or PM. Thanks so much! Quote Link to comment https://forums.phpfreaks.com/topic/224315-need-a-quick-fix-on-1-line-of-code/#findComment-1158944 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.