Hi, I was wondering if you could help me with this chat.php since I am not very good at php.
I've this chat script that i put in my website but when I use the script to post link for example: http://www.deltascripts.com/, it just turn into a normal text but not a link. I want to be able to turn into a link when you post it.
I include here the script:
cht.php
<?
include "admin/inc.php";
$limit=30;
?>
<meta http-equiv="Refresh" content="15">
<?
echo "<table cellspacing='0' cellpadding='0' width=\"100%\">";
$date_format="%m/%d/%Y %H:%i:%s";
$sql_str = "select * , DATE_FORMAT(chat_time, '$date_format') as chat_time from chat order by chat_time desc limit $limit";
$res_2 = mysql_query($sql_str);
while ($row=mysql_fetch_array($res_2))
{
if (strlen($row["chat_name"])<=20)
{
$chat_name = $row["chat_name"];
}
else
{
$chat_name = substr($row["chat_name"],0,17)."...";
}
$chat_mes = $row["chat_mes"];
$chat_time = $row["chat_time"];
$chat_ip = $row["chat_ip"];
echo "<tr><td><font color='#808080' style='font-size: 8pt; font-family: Arial'>$chat_time : $chat_ip</font></td></tr>";
echo "<tr><td><font color='#000000' style='font-size: 8pt; font-family: Arial'><b>$chat_name:</b></font> <font color='#000080' style='font-size: 8pt; font-family: Arial'>$chat_mes</font></td></tr>";
}
echo "</table>";
?>
=============================
and chat_form.php
<?
include "admin/inc.php";
function chC_get_ip()
{
foreach( array( 'HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_REMOTECLIENT_IP' ) as $var_name )
{
if( isset( $SERVER[$var_name] ) && !empty( $SERVER[$var_name] ) )
{
if( is_int( strpos( $SERVER[$var_name], ', ' ) ) )
{
$array = explode( ', ', $SERVER[$var_name] );
foreach( $array as $value )
{
if( chC_valid_ip( trim( $value ) ) == TRUE )
{
return trim( $value );
}
}
}
elseif( chC_valid_ip( $SERVER[$var_name] ) == TRUE )
{
return $SERVER[$var_name];
}
}
}
return $SERVER['REMOTE_ADDR'];
}
if (!empty($REQUEST["chat_button"]))
{
$chat_name=htmlspecialchars($REQUEST["chat_name"]);
$chat_mes=htmlspecialchars($REQUEST["chat_mes"]);
$chat_ip=chC_get_ip();
$sql_insert = "insert into chat (chat_name,chat_mes,chat_ip,chat_time) values ('$chat_name','$chat_mes', '$chat_ip', NOW())";
$result = mysql_query($sql_insert);
$sql_insert = "delete from chat where chat_time <= DATE_ADD(NOW(), INTERVAL -15 DAY)";
$result = mysql_query($sql_insert);
}
?>
<link rel="stylesheet" href="style.css" type="text/css" />
<table><tr>
<td align='left'>
<form action='chat_form.php' method='post'>
Nama: </td><td><input name='chat_name' type='text' size='20' maxlength='20' class="txt" value='<? echo $_REQUEST["chat_name"]; ?>'></td></tr>
<tr>
<td align='left'>
Message: </td><td><input name='chat_mes' type='text' size='35' maxlength='100' class="txt"> <input name='chat_button' class='txt' type='submit' value='Chat'></tr></td>
</form>
</table>
I hope you can help me. thank you.