witajcie, skierowano mnie na to forum - podobno zawsze dacie radę

mam problem z skryptem który można pobrać z
http://www.phpcaptcha.org Jest tam instrukcja (
http://www.phpcaptcha.org/?page_id=8) jak ten skrypt połączyć ze swoją stroną. Używam CutePHP i jest to dla mnie za skomplikowane aby samodzielnie zrobić. Oczywiście z formularzem sobie poradziłem ale mam problem z drugą częścią, która sprawdza przepisane znaki. Bądźcie wyrozumiali - jestem "przedszkolakiem". Będę wdzięczny za pomoc.
Oto część kodu CutePHP gdzie odbywa się zapisywanie komentarza (plik inc/shows.inc.php):
<?PHP
include_once("$cutepath/langdate.php");
do{ // Used if we want to display some error to the user and halt the rest of the script
$user_query = cute_query_string
($QUERY_STRING, array( "comm_start_from","start_from", "archive", "subaction", "id", "ucat")); $user_post_query = cute_query_string
($QUERY_STRING, array( "comm_start_from", "start_from", "archive", "subaction", "id", "ucat"), "post");
//##############################
// Add Comment
//##############################
if($allow_add_comment){
$id = (int) $id; // Yes it's stupid how I didn't thought about this :/
//----------------------------------
// Check the lenght of comment, include name + mail
//----------------------------------
echo"<div style=\"text-align: center;\">Twoja nazwa jest za długa!</div>"; $CN_HALT = TRUE;
break 1;
}
echo"<div style=\"text-align: center;\">Twój e-mail jest za długi!</div>"; $CN_HALT = TRUE;
break 1;
}
if( strlen($comments) > $config_comment_max_long and
$config_comment_max_long != "" and
$config_comment_max_long != "0"){ echo"<div style=\"text-align: center;\">Twój komentarz jest za długi</div>"; $CN_HALT = TRUE;
break 1;
}
//----------------------------------
// Add The Comment ... Go Go GO!
//----------------------------------
$old_comments = file("$comm_file"); $new_comments = fopen("$comm_file", "w"); @flock ($new_comments,2
); $found = FALSE;
foreach($old_comments as $old_comments_line)
{
$old_comments_arr = explode("|>|", $old_comments_line); if($old_comments_arr[0] == $id)
{
$old_comments_arr[1
] = trim($old_comments_arr[1
]); fwrite($new_comments, "$old_comments_arr[0]|>|$old_comments_arr[1]$time|$name|$mail|$ip|$comments||\n"); $found = TRUE;
}else{
fwrite($new_comments, $old_comments_line); //if we do not have the news ID in the comments.txt we are not doing anything (see comment below) (must make sure the news ID is valid)
}
}
if(!$found){
/* // do not add comment if News ID is not found \\ fwrite($new_comments, "$id|>|$time|$name|$mail|$ip|$comments||\n");*/
echo("<div style=\"text-align: center;\">CuteNews nie dodał twojego komentarza, gdyż wyst?pił problem z baz? danych.<br /><a href=\"java script:history.go(-1)\">powrót</a></div>"); $CN_HALT = TRUE;
break 1;
}
@flock ($new_comments,3
);
//----------------------------------
// Sign this comment in the Flood Protection
//----------------------------------
if($config_flood_time != "0" and $config_flood_time != "" ){
$flood_file = fopen("$cutepath/data/flood.db.php", "a"); }
//----------------------------------
// Notify for New Comment ?
//----------------------------------
if($config_notify_comment == "yes" and $config_notify_status == "active"){
send_mail("$config_notify_email", "CuteNews - Dodano Nowy Komentarz", "Został dodany nowy komentarz przez $name:\n--------------------------$comments");
}
echo "<script type=\"text/javascript\">window.location=\"$PHP_SELF?subaction=showfull&id=$id&ucat=$ucat&archive=$archive&start_from=$start_from&$user_query\";</script>"; }
Dzięki!
Ten post edytował marian33_32 25.09.2009, 17:17:56