模拟OICQ的实现思路和核心程序(三)

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="#" >聊天纪录</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' >");
}
?>
<input type="submit" name="reply" value="开始新的发送留言 Alt+S" accesskey='s'>
<a href="#" >聊天纪录</a></td>
</tr>
</form>
</table>
<script language="Javascript">
document.sendmsg.replymessage.focus();
</script>
<?
}
?>
</body>
</html> 

时间: 2024-08-30 22:57:53

模拟OICQ的实现思路和核心程序(三)的相关文章

模拟 OICQ 的实现思路和核心程序(三) 转 --建议加入精华区

程序|精华 文章来源:php世纪网5 聊天信息的发送.阅读和回复程序 - shortalk.php <?require("require.php"); // 判断用户是否合法在线的公用程序?><html><head><title>短信息</title><meta http-equiv="Content-Type" content="text/html; charset=gb2312"

模拟OICQ的实现思路和核心程序(三)_php基础

5 聊天信息的发送.阅读和回复程序 - shortalk.php <?require("require.php"); // 判断用户是否合法在线的公用程序?><html><head><title>短信息</title><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><style ty

模拟 OICQ 的实现思路和核心程序(一) 转 --建议加入精华区

程序|精华 文章来源:PHP 世纪网根据许多网友需求,特地把我站的这个模拟 OICQ 的在线聊天的东西献给大家! 1 用户必须注册登陆,在数据库 userinfo 里面保存如下几个字段Name 不用问了,这是登陆用的用户名,必须唯一Password 登陆密码NickName 用户昵称,也就是显示的名字Face 存放着用户头像的编号,比如 01,代表 /images/face/01.gif 头像文件OnlineStatus 用户是否在线的标志,在用户登陆的时候设置为 1CurrentDate 用户

模拟OICQ的实现思路和核心程序(一)

根据许多网友需求,特地把我站的这个模拟 OICQ 的在线聊天的东西献给大家! 1 用户必须注册登陆,在数据库 userinfo 里面保存如下几个字段Name 不用问了,这是登陆用的用户名,必须唯一Password 登陆密码NickName 用户昵称,也就是显示的名字Face 存放着用户头像的编号,比如 01,代表 /images/face/01.gif 头像文件OnlineStatus 用户是否在线的标志,在用户登陆的时候设置为 1CurrentDate 用户最后访问/更新的时间,用于判断用户是

模拟OICQ的实现思路和核心程序(一)_php基础

根据许多网友需求,特地把我站的这个模拟 OICQ 的在线聊天的东西献给大家! 1 用户必须注册登陆,在数据库 userinfo 里面保存如下几个字段Name 不用问了,这是登陆用的用户名,必须唯一Password 登陆密码NickName 用户昵称,也就是显示的名字Face 存放着用户头像的编号,比如 01,代表 /images/face/01.gif 头像文件OnlineStatus 用户是否在线的标志,在用户登陆的时候设置为 1CurrentDate 用户最后访问/更新的时间,用于判断用户是

模拟 OICQ 的实现思路和核心程序(二) 转 --建议加入精华区

程序|精华 文章来源;PHP 世纪网  3 在线用户的信息扫描和更新在网页中使用内置框架来调用扫描和更新程序,这行也能在网页源代码里面看到!<iframe name=flush src="userflush.php" width="0" height="0" frameborder="0" scrolling="NO" marginwidth="0" marginheight=&q

模拟OICQ的实现思路和核心程序(二)

3 在线用户的信息扫描和更新在网页中使用内置框架来调用扫描和更新程序,这行也能在网页源代码里面看到!<iframe name=flush src="userflush.php" width="0" height="0" frameborder="0" scrolling="NO" marginwidth="0" marginheight="0" hspace=&

iOS简易蓝牙对战五子棋游戏设计思路之一——核心蓝牙通讯类的设计

iOS简易蓝牙对战五子棋游戏设计思路之一--核心蓝牙通讯类的设计 一.引言     本系列博客将系统的介绍一款蓝牙对战五子棋的开发思路与过程,其中的核心部分有两个,一部分是蓝牙通讯中对战双方信息交互框架的设计与开发,一部分是五子棋游戏中棋盘逻辑与胜负判定的算法实现.本篇博客将介绍游戏中蓝牙通讯类的设计思路 二.设计通讯类的核心想法    在前篇的一篇博客中,我们有详细的介绍iOS中蓝牙4.0技术的应用与系统框架CoorBluetooth.framework中提供的编程接口的用法.博客地址如下,如

在线测试-C#开发在线模拟考试,求思路

问题描述 C#开发在线模拟考试,求思路 如图,求思路!!! 已设计好数据库表(试题表(试题ID,标题,描述,答案,分值,题型,车型,科目,章节):试题选项表(ID,试题ID,选项名称,描述..))