XF 1.4 Adding Captcha to my webpage

liv4spd

Member
I have a webpage inside Xenforo to conduct searches with a SQL database. It works very well, except that occasionally I got requests from crawlers that are trying to steal my database. So now I am thinking to add a Captcha to stop the crawlers.

Below is the code I am trying to add to my webpage:
<tr>
<td><input type="text" name="verif_box" size="4" maxlength="4"/></td>
<td><img src="verificationimage.php?<?php echo rand(0,9999);?>" width="60" height="24" align="absbottom" /></td>
</tr>


Then all I need to do is to use the below to wrap my PHP code.
$VERIF_BOX = @$_GET['verif_box'];
if(md5($VERIF_BOX).'a4xn' == @$_COOKIE['tntcon']){
}


Unfortunately, now I am getting an error as below:
Callback OBD_Search::getResults is invalid (Method Not Static).

Anyone has any clue? Thank you!

Below is the code for my search webpage:
<xen:callback class="OBD_Search" method="getResults"></xen:callback>
<form action="/pages/searchOBD/" method="get">
<table>
<tr>
<td>
<input type="text" name="search" value="P0123" maxlength="5" style="width: 200px; height:30px; padding-bottom:2px; border-color:#FF9; background-color:#9FF; color:#777; text-align:center; font-size: 30px;" />
</td>
<td>
<input type="submit" name="submit" value="Search" style="width:85px; margin-left:5px; text-align:center; vertical-align:middle; height:30px; color:#06C; font-size:20px; font-weight:bold;" />
</td>
</tr>
</table>
</form>
 
Last edited:
The error is telling you what's wrong the OBD_Search::getResults() method that you wrote is being called statically, but it's not defined statically. You need to change that method to be static.
 
Thank you so much! I changed the "public function" to "public static function" and now it is working like a charm.

That said, I still can not get the Captcha image values to be sent to the webpage from my "veriticationimage.php", so that my users can read its values and input them to the input box.

Alternatively, may I use the Xenforo built-in Captcha mechanisms (questions I created) on my page? If so, how do I do that? Thank you.
 
Top Bottom