Система за коментари как?

mizarck

Registered
Form.html

Код:
<html> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251"> 
</head> 
<body> 

<FORM action=send.php method=post > 
<b> 

Име:<br> 
<INPUT name=ime><br> 
eMail :<br> 
<INPUT name=mail><br> 

Коментар?<BR> 
<TEXTAREA name=mes rows=5 cols=30> 
</TEXTAREA > 
<br> 
<INPUT type=submit value="Send "> 
</body> 
</html>

send.php

Код:
<head> 
<meta http-equiv="Content-Type" 
content="text/html; charset=windows-1251"> 
</head> 
<body> 


<?php 
$ime=$HTTP_POST_VARS['ime']; 
$mes=$HTTP_POST_VARS['mes']; 
$mail=$HTTP_POST_VARS['mail']; 
$ip = getenv("REMOTE_ADDR"); 
$date = date('H:i , jS F '); 

function filled_out($form_vars) 
{ 

foreach ($form_vars as $key => $value) 
{ 
if (!isset($key) || ($value == '')) 
return false; 
} 
return true; 
} 
function valid_email($address) 
{ 

if (ereg('^[a-zA-Z0-9_\.\-]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$', $address)) 
return true; 
else 
return false; 
} 

if(!filled_out($HTTP_POST_VARS)) 
{ 
echo " <b><center> <font color=#ff0000> Не сте попълнили всички полета. "; 
exit; 
} 


$mes=str_replace("<",'',$mes); 
$mes=str_replace(">",'',$mes); 
$mes=nl2br($mes); 
$ime=str_replace("<",'',$ime); 
$ime=str_replace(">",'',$ime); 


if (file_exists("comment.html")) 

{ 

$table = 
' 
<tr> 
<td > 
<b> <font color="#eaeaea"> '.$date.'</b> 
</td> 

<td width="100"> 
<a href="http://'.$ip.'"> 
<b><font color="#FF0000">'.$ip.'</a> 
</td></b> 


<td > 
<b> <font color="#5053FD"> '.$mes.'</b> 
</td> 

<td width="30"> 
<b> <font color="#00C400"> '.$mail.'</b> 
</td> 


<td width="30"> 
<b> <font color="#ff0000"> '.$ime.'</b> 
</td> 


</tr> 
'; 
} 
else 
{ 


$table = 

' 

<head> 
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251"> 
</head> 
<body bgcolor="#000000"> 
<table border="1"> 
<tr> 
<td > <b> 
<font color="#eaeaea"> Дата</b> 
</td> 

<td width="100"><font color="#ff0000"><b> 
IP-address </td></b> 


<td > 
<b> <font color="#5053FD"> Коментар</b> 
</td> 


<td width="30"> 
<b> <font color="#00C400"> eMail</b> 
</td> 


<td width="30"> 
<b> <font color="#ff0000">Име</b> 
</td> 


</tr> 
<tr> 
<td > 
<b> <font color="#eaeaea"> '.$date.'</b> 
</td> 
<td width="100"> 
<a href="http://'.$ip.'"> <b><font color="#FF0000">'.$ip.'</a></td></b> 


<td > 
<b> <font color="#5053FD"> '.$mes.'</b> 
</td> 

<td width="30"> 
<b> <font color="#00C400"> '.$mail.'</b> 
</td> 


<td width="30"> 
<b> <font color="#ff0000"> '.$ime.'</b> 
</td> 


</tr> 
'; 
} 

$fp = fopen ("comment.html" ,"a"); 

fwrite($fp, $table ); 
fclose($fp); 



?> 

Вашия коментар е изпратен. 
</body> 
</html>
 

MitakaDan

Registered
Код:
if (file_exists(" comment.html"))
Код:
$fp = fopen (" comment.html" ,"a");

Новак съм тия работи и не разбирам тоя фаил липсва ли или ???
А моята цел е на една и съща страница да е формата за попълвяане и коментарите.Някой ще ми помогне ли ??? :wink:
 

Горе