Podziekowanie za dodany komentarz


(Darom82) #1

Jak przerobic ponizszy plik tak, zeby po dodaniu komentarza nie wyskakiwalo mi osobne okno z tym tekstem: http://www.history.is.net.pl/send.php?id=00

Your comment is empty, you can not publish it 

Return to comment viewer

Tylko zeby bylo po dodaniu komentarza cos takiego jak jest tutaj: http://www.phpbbhelp.pl/archiwum/download.php?d=582Znikaja wszystkie komentarze i pojawia sie ta informacja

Dodano Twój komentarz.

Kliknij TUTAJ, aby wrócić do komentarzy

I jak klikne w link Tutaj to znow wracam do komentarzy. Jak takie cos zrobic ? Prosze o pomoc w tej sprawie.

<?php 


// XeonBloomfield - comments script

//

// send.php


// check if argument 'id' is there

if(empty($_GET['id']))

{

$id = 'default';

}

else

{

$id = $_GET['id'];

}


// comment files location

$localization = "data/comments/";

// comment files extensions

$file_extension = ".txt";


//

// Comment content - start

//


// import 'nick' and 'comment' from 'add.php' via '$_POST'

$post_nick = $_POST['nick'];

$post_comment = $_POST['comment'];


// change HTML special chars in to properly (safe) form

// protect beware sending code via comments

$temp_nick = HTMLSpecialChars($post_nick);

$temp_comment = HTMLSpecialChars($post_comment);


// change '\r\n' to '
'

$nick = str_replace("\r\n", "
", $temp_nick); 

$comment = str_replace("\r\n", "
", $temp_comment); 



//

// Comment content - end

//


//

// Check - start

//


// Simple solution to don't publish empty comments


if(empty($nick))

{

	$nick = "Anonymous";

}


if(empty($comment))

{

	echo "Your comment is empty, you can not publish it


Return to comment viewer

";

	die();

}


//

// 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 "You recently sent a comment, try in next 60 seconds


Return to comment viewer

";

	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:s");


// 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 "

Your comment was added**** Return to comment viewer **"; } else { // show that there was an error while adding comment echo " Occured an error while adding your comment, try next time****Return to comment viewer**"; } // send.php ?>