The realization idea and core procedure of simulating OICQ (iii) turn--suggest to join the essence area

Source: Internet
Author: User
Tags date echo date join require return sendmsg window
Program | Essence article Source: PHP Century Net
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>
&LT;TD colspan= "2" height= "bgcolor= 99cc99" align= "center" > View SMS </td>
</tr>
<tr>
&LT;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)?>>
&LT;TR align= "center" >
&LT;TD colspan= "2" height= "146" valign= "Top" >
<textarea name= "TextField cols=" rows= "one" Readonly><?print ($message)?></textarea>
</td>
</tr>
<tr>
&LT;TD colspan= "2" align= "Center" >
<input type= "Submit" Name= "toreply" value= "reply message Enter" >
<a href= "#" onclick= "Mm_openbrwindow (' Memberviewtalk.php?talkto=<?echo $tmp [' sender ']?> '], ' viewtalk ', ' Scrollbars=yes ') "> 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>
&LT;TR align= "center" >
&LT;TD colspan= "2" height= "bgcolor=" "99cc99" > Send short Message </td>
</tr>
&LT;TR align= "center" >
&LT;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>
&LT;TR align= "center" >
&LT;TD colspan= "2" height= "146" valign= "Top" >
<textarea name= "Replymessage" cols= "rows=" "9" ></textarea>
</td>
</tr>
&LT;TR align= "center" >
&LT;TD colspan= "4" >
?
if ($talknumber!= "")
{
Print ("<input Type=button name=review value=" View previous message alt+p ' accesskey= ' P ') "> Chat record </a></td>
</tr>
</form>
</table>
<script language= "Javascript" >
Document.sendmsg.replymessage.focus ();
</script>
?
}
?>
</body>


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.