Go Back   Webmaster Malaysia Forum » Website Design & Development » Website Programming

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 23-11-2005, 11:57 PM
New kid on the block
 
Join Date: Jun 2005
Location: Perak
Posts: 7
Rep Power: 0
lovandrea6884 is on a distinguished road
Chat script help

Hai,
Saya ada chat script ni yang saya letak di http://www.macam2ada.com/iklan/testchat.php . Masalahnya bila saya cuba taip link je, hanya kuar text biasa sahaja tapi bukan link. Jadi nak tahula macamane nak jadikan boleh link setiap kali submit. Tak tahula nak buat camne, dah try remove htmlspecialcharacter dah, tapi same jek. Tolong erk, pleaseeee....
Berikut saya sertakan script tersebut:

Bahagian form:
Quote:
<?
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">&nbsp;<input name='chat_button' class='txt' type='submit' value='Chat'></tr></td>
</form>
</table>
Nie bahagian chatting
Quote:
<?
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>";
?>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
IM chat tansks Mamak Stall 1 28-08-2006 10:27 PM
Chat can win prize? kuraku Websites Review and Suggestion 1 24-02-2004 06:04 PM
Chat can win prize? kuraku Websites Review and Suggestion 0 24-02-2004 12:41 PM
tlg!! php coding tuk bt chat aarkus Website Programming 0 22-05-2003 04:57 PM
chat servers sunshinerocke Website Design 2 19-04-2003 12:47 AM



All times are GMT +8. The time now is 06:34 PM. Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.1.0 vBulletin skin by ForumMonkeys.com.


WebmasterMalaysia.com is Proudly Hosted by Exabytes Semi Dedicated Server.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59