时间:2021-05-18
5 聊天信息的发送、阅读和回复程序 - shortalk.php
<?
require("require.php"); // 判断用户是否合法在线的公用程序
?>
<html>
<head>
<title>短信息</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("缺少内容:需要输入您的留言内容");
document.sendmsg.replymessage.focus();
return(false);
}
return (true);
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
//-->
</script>
</head>
<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="300" border="0" cellspacing="0" cellpadding="0" height="200" bgcolor="f0f0f0">
<tr>
<td colspan="2" height="20" bgcolor="99cc99" align="center">查看短信息</td>
</tr>
<tr>
<td colspan="2" height="20"><?echo date("m月d日 h:i",$tmp['date'])." ".$sendernickname[0]?> 给你[<?echo $name?>]留言:</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="40" rows="11" readonly><?print($message)?></textarea>
</td>
</tr>
<tr>
<td colspan="2" align="center">
<input type="submit" name="toreply" value="回复留言 Enter">
<a href="#" onClick="MM_openBrWindow('memberviewtalk.php?talkto=<?echo $tmp['sender']?>','viewtalk','scrollbars=yes')">聊天纪录</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="300" border="0" cellspacing="0" cellpadding="0" height="200" 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="20" bgcolor="99cc99">发送短信息</td>
</tr>
<tr align="center">
<td colspan="2" height="20">发言对象:
<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>
请短于500字符 </td>
</tr>
<tr align="center">
<td colspan="2" height="146" valign="top">
<textarea name="replymessage" cols="40" rows="9"></textarea>
</td>
</tr>
<tr align="center">
<td colspan="4">
<?
if($talknumber != "")
{
print("<input type=button name=review value='查看前一留言 Alt+P' accesskey='p' onClick='javascript:history.go(-1)'>");
}
?>
<input type="submit" name="reply" value="开始新的发送留言 Alt+S" accesskey='s'>
<a href="#" onClick="MM_openBrWindow('memberviewtalk.php?talkto=<?echo $talkto?>','viewtalk','scrollbars=yes')">聊天纪录</a></td>
</tr>
</form>
</table>
<script language="Javascript">
document.sendmsg.replymessage.focus();
</script>
<?
}
?>
</body>
</html>
声明:本页内容来源网络,仅供用户参考;我单位不保证亦不表示资料全面及准确无误,也不保证亦不表示这些资料为最新信息,如因任何原因,本网内容或者用户因倚赖本网内容造成任何损失或损害,我单位将不会负任何法律责任。如涉及版权问题,请提交至online#300.cn邮箱联系删除。
本文为大家分享了C语言实现密码程序的具体代码,供大家参考,具体内容如下题目要求编写代码实现,模拟用户登录情景,并且只能登录三次。(只允许输入三次密码,如果密码正
本文实例为大家分享了C语言实现电话簿项目的具体代码,供大家参考,具体内容如下实现思路这个程序的整体思路和实现还是很简单的,我们利用了动态分配内存的方式首先创建了
编写程序实现比萨制作。需求说明编写程序,接收用户输入的信息,选择需要制作的比萨。可供选择的比萨有:培根比萨和海鲜比萨。实现思路及关键代码1)分析培根比萨和海鲜比
前面简单地介绍了Android程序开发中AudioRecord和AudioTrack的使用,这次再结合SurfaceView实现一个Android版的手机模拟信
根据许多网友需求,特地把我站的这个模拟OICQ的在线聊天的东西献给大家!1用户必须注册登陆,在数据库userinfo里面保存如下几个字段Name不用问了,这是登