Jump to content

Need a quick fix on 1 line of code


stefsoko

Recommended Posts

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!!

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

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!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.