anti spam cutenews

Status
Niet open voor verdere reacties.

marcelklip

Terugkerende gebruiker
Lid geworden
2 jan 2005
Berichten
1.010
hallo

ik heb een bestand gedownload en nu moet ik dit doen

PHP:
###############################################
1. Upload the captcha folder to your main Cutenews directory

###############################################
2. Open inc/shows.inc.php and find the first occurrence of this:

             <input type=\"hidden\" name=\"ucat\" value=\"$ucat\" />

add below:

             <input type=\"hidden\" name=\"code\" value=\"$code\" />

################################################
3. Find this:

    $time = time()+($config_date_adjust*60);

    //----------------------------------
    // Add The Comment ... Go Go GO!
    //----------------------------------

add above:

if (!PhpCaptcha::Validate($_POST['code'])) {
echo("<div style=\"text-align: center;\">Please enter the characters from the image.<br /><a href=\"javascript:history.go(-1)\">go back</a></div>");
$CN_HALT = TRUE;
     break 1;
}

################################################
4. And find this:

        </noscript>".insertSmilies('short', FALSE);

add below:

$template_form = str_replace("{captcha}","<br />Enter this code<br /><img src=\"".$config_http_script_dir."/captcha/captcha.php?width=144\" width=\"144\" alt=\"Security Image\"/><br /><input type=\"text\" size=\"10\" name=\"code\" maxlength=\"6\" /><br />",$template_form); 

################################################
5.  If you use MULTIPLE INCLUDES go to 5a (not working with comments in popup). If you use only ONE INCLUDE go to 5b (working with comments in popup).

5a. If you use MULTIPLE INCLUDES on your page open your news file (the file where you put the Cutenews include code) and add the following code at the beginning of the file above everything else (This is NOT working with COMMENTS IN POPUP):

<?php
require('./captcha/php-captcha.inc.php'); //Change the path to your needs
?>
-----------------------------------------------------------------------------------------------------

5b. If you use only ONE INCLUDE do the following steps (This is working WITH and WITHOUT COMMENTS IN POPUP):

aa) Open your news page (the file where you put the Cutenews include code) and put this at the beginning of the file above everything else:
--------------------------------
<?PHP
ob_start();
?>
---------------------------------

bb) Find your Cutenews include code and put this above:
-------------------------------------------
$pre_include = ob_get_clean();
-------------------------------------------

So it might look like this:
--------------------------------------------------
$pre_include = ob_get_clean();
$number = 10;
$category = 2;
$template = "News";
include('cutenews/show_news.php');
--------------------------------------------------

cc) Open show_news.php and find this at the beginning of the file:
----------
<?PHP
----------

add below:
----------------------------------------------------------------------------------------------------
ob_start();
require('./captcha/php-captcha.inc.php'); //Change the path to your needs
----------------------------------------------------------------------------------------------------

dd) Find this at the end of the file:
------------------------------------------------------------------------------
?>
<!-- News Powered by CuteNews: http://cutephp.com/ -->
------------------------------------------------------------------------------

add above:
-------------------------------------------------
$show_the_news = ob_get_clean();
echo $pre_include;
echo $show_the_news;
-------------------------------------------------

################################################
6. Go to Options -> Edit Templates -> Add comment form and put {captcha} where you want to show the Security Image.


van 5B snap ik er niks meer van
 
ONE INCLUDE


is include_one die doet overigens bijna het zelfde als require_once
waarbij require het meerdere keren kan kan lopen door zichzelf

risico :
require('./captcha/php-captcha.inc.php')
en in dit bestand ga je een require van je bestand waar de require van doet nog eens oproepen hierdoor gaat hij loop
require (a)==>require(b)==>require(a)
en voor dit te ondervangen gebruiken ze
require_one ;
 
Status
Niet open voor verdere reacties.
Terug
Bovenaan Onderaan