The realization idea and core program of simulating OICQ (III.)
Last Update:2017-02-28
Source: Internet
Author: User
5 Chat message Send, read and reply program-shortalk.php
?
Require ("require.php"); Public programs that determine whether a user is legally online
?>
<title> SMS </title>
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 ">
<style type= "Text/css" >
td {FONT-SIZE:9PT}
</style>
<script language= "Javascript" >
<!--
function Docheck () {
if (document.sendmsg.replymessage.value== "") {
Alert ("Missing content: Need to enter your message content");
Document.sendmsg.replymessage.focus ();
return (false);
}
return (true);
}
function Mm_openbrwindow (theurl,winname,features) {//v2.0
window.open (Theurl,winname,features);
}
-->
</script>
<body bgcolor= "#DDDDFF" leftmargin= "0" topmargin= "0" background= "phpchat_images/cloudtile.jpg" >
?
if ($action = = "View")
{
$tmp = Mysql_fetch_array (mysql_query ("Select Sender,body,date from Forumtalk where id= $talknumber and receiver= ' $name '" ));
$msg = $tmp [' body '];
$message = Ereg_replace ("
"," \ r \ n ", $msg);
mysql_query ("Update forumtalk set readsign=1 where id= $talknumber");
$sendernickname = Mysql_fetch_row (mysql_query ("Select nickname from UserInfo where Name= '". $tmp [' sender ']. "));
?>
<table width= "border=" 0 "cellspacing=" 0 "cellpadding=" 0 "height=" "bgcolor=" f0f0f0 ">
<tr>
<TD colspan= "2" height= "bgcolor= 99cc99" align= "center" > View SMS </td>
</tr>
<tr>
<TD colspan= "2" height= "a" ><?echo date ("M-month D-Day h:i", $tmp [' Date ']). " "$sendernickname [0]?> to You [<?echo $name] Message:</td>
</tr>
<form Name=viewtalk action=shortalk.php method=post>
<input Type=hidden name=talkto value=<?echo $tmp [' Sender ']?>>
<input Type=hidden name=action value=send>
<input Type=hidden name=talknumber value=<?print ($talknumber)?>>
<TR align= "center" >
<TD colspan= "2" height= "146" valign= "Top" >
<textarea name= "TextField cols=" rows= "one" Readonly><?print ($message)?></textarea>
</td>
</tr>
<tr>
<TD colspan= "2" align= "Center" >
<input type= "Submit" Name= "toreply" value= "reply message Enter" >
<a href= "#" > Chat record </a> </td>
</tr>
</form>
</table>
<script language= "Javascript" >
Document.viewtalk.toreply.focus ();
</script>
?
}
else if ($action = = "Sendbegin")
{
$replymessage = ereg_replace ("\ r \ n", "
", $replymessage);
$replymessage = ereg_replace (">", ">", $replymessage);
$replymessage = Ereg_replace ("<", "<", $replymessage);
$replymessage = substr ($replymessage, 0,2000);
mysql_query ("INSERT INTO Forumtalk" (sender,receiver,body,date) VALUES (' $name ', ' $talkto ', ' $replymessage ', ". Date (" U " ).")");
Print ("<script language= ' JavaScript ' >window.close () </script>");
}
Else
{
?>
<table width= "border=" 0 "cellspacing=" 0 "cellpadding=" 0 "height=" "bgcolor=" f0f0f0 ">
<form name=sendmsg action=shortalk.php method=post Onsubmit=return (Docheck ());>
<input Type=hidden name=action value=sendbegin>
<TR align= "center" >
<TD colspan= "2" height= "bgcolor=" "99cc99" > Send short Message </td>
</tr>
<TR align= "center" >
<TD colspan= "2" height= "a" > Speaking object:
<select name= "Talkto" >
?
$result = mysql_query ("Select Name,nickname from UserInfo where Onlinestatus=1");
while ($msg =mysql_fetch_array ($result))
{
if ($msg [' name ']== $talkto)
echo "<option value= '". $msg [' name ']. "' selected> '. $msg [' nickname ']." </option>\n ";
Else
echo "<option value= '". $msg [' name ']. "' > ". $msg [' nickname ']." </option>\n ";
}
?>
</select>
Please be shorter than 500 characters </td>
</tr>
<TR align= "center" >
<TD colspan= "2" height= "146" valign= "Top" >
<textarea name= "Replymessage" cols= "rows=" "9" ></textarea>
</td>
</tr>
<TR align= "center" >
<TD colspan= "4" >
?
if ($talknumber!= "")
{
Print ("<input Type=button name=review value=" View the previous message alt+p ' accesskey= ' P ' > ');
}
?>
<input type= "Submit" name= "Reply" value= "Start a new Send message alt+s" accesskey= ' S ' >
<a href= "#" > Chat record </a></td>
</tr>
</form>
</table>
<script language= "Javascript" >
Document.sendmsg.replymessage.focus ();
</script>
?
}
?>
</body>