mario@ zrobiłem tak, ale jest jakiś błąd bo nie mozna dodac żadnych komentarzy teraz, zobacz: http://www.history.is.net.pl/?download&cat=0&appage=0
<?php
// send.php
// check if argument 'id' is there
if(empty($_GET['id']))
{
$id = 'default';
}
else
{
$id = (int)$_GET['id'];
}
// comment files location
$localization = "data/comments/";
// comment files extensions
$file_extension = ".txt";
//
// Comment content - start
//
// change HTML special chars in to properly (safe) form
// protect beware sending code via comments
$nickTestowy = preg_replace("/(\s+)/","",htmlspecialchars($_POST['nick']));
$wpisTestowy = preg_replace("/(\s+)/","",htmlspecialchars($_POST['comment']));
//
// Comment content - end
//
//
// Check - start
//
// Simple solution to don't publish empty comments
if(empty($nickTestowy))
$nick = "Anonymous";
if(empty($wpisTestowy))
die("
Zamieszczanie pustych komentarzy jest zabronione.
Kliknij Tutaj, aby wrócić do komentarzy
„); $nick = str_replace(”\r\n", " „, htmlspecialchars(trim($_POST[‘nick’]))); $comment = str_replace(”\r\n", " ", htmlspecialchars(trim($_POST[‘comment’]))); // // Check - end // // // COOKIE - start // // Simple anti-spam solution // cookie name $cookie_name = ‘comment’; // cookie value $cookie_value = ‘1’; // when cookie will expire // 60 seconds $cookie_expire = time()+60; // setcookie(name, value, expire, path, domain); // check if there is cookie now if (isset($_COOKIE[$cookie_name])) { // show information to wait before adding next comment echo "
Dodano Twój komentarz.
Kliknij Tutaj, aby wrócić do komentarzy
"; die(); } /* // update - cookie is now created when comment is sucessfully added else { // create cookie file to protect against spam setcookie($cookie_name, $cookie_value, $cookie_expire); } */ // // COOKIE - end // // // date and time of comment $date_and_time = date(„d.m.Y H:i”); // user identification $user_ip = $_SERVER[‘REMOTE_ADDR’]; $user_ua = $_SERVER[‘HTTP_USER_AGENT’]; // place between content in flat-file $PLACE = ‘|||’; // end of the line in flat-file $line_end = „\n”; // exported line to flat-file $result = $date_and_time.$PLACE.$user_ip.$PLACE.$user_ua.$PLACE.$nick.$PLACE.$comment.$line_end; // directory and name of flat-file $file = $localization.$id.$file_extension; // opening flat-file in ‘add’ mode $file_handle = fopen($file, „a”); // write ‘$result’ in to the flat-file fwrite ($file_handle, $result); // close the flat file and report result if(fclose($file_handle)) { // COOKIE // create cookie file to protect against spam setcookie($cookie_name, $cookie_value, $cookie_expire); // STATUS // show that comment was sucessfully added echo "
Dodano Twój komentarz.
Kliknij Tutaj, aby wrócić do komentarzy
"; } else { // show that there was an error while adding comment echo "
Wystąpił błąd podczas dodawania komentarza, spróbuj następnym razem.
Kliknij Tutaj, aby wrócić do komentarzy
"; } // send.php ?>[/code]