/**
* 黑夜路人简易聊天室
* 作者: heiyeluren <heiyeluren_at_163.com
* 创建: 2005-8-10 22:42
* 修改: 2005-8-11 23:25
*/
error_reporting(7);
session_start();
header("ContentType:text/html;charset=gb2312");
define("SCRIPT", $_SERVER['SCRIPT_NAME']);
define("CHAT_NOTE", "./chat.txt");
define("ONLINE_LIST", "./online.txt");
define("REF_TIME", 5);
define("CHAT_NAME", "黑夜路人聊天室");
define("AD_MSG", "今天是中国情人节, 祝大家情人节快乐!!");
//获取值
if (isset($_GET['action']) && !empty($_GET['action'])) {
$action = $_GET['action'];
}
//如果已经登陆那么直接跳到聊天界面
if (!isset($_GET['action']) && isset($_SESSION['username'])) {
header("location:".SCRIPT."?action=chat");
}
//登陆提示
if (!isset($_GET['action']))
{
if (!session_is_registered('username'))
{
echo " <p<h3 align=center[ ".CHAT_NAME." ] © 2005</h3</p
<p align=center
<form action=".SCRIPT."?action=login method=post
呢称: <input type=text size=25 maxlength=30 name=login_user
<input type=submit value=聊天
</form</p
";
exit;
}
}
//校验登陆
if ($action=='login')
{
if (isset($_POST['login_user']) && !empty($_POST['login_user'])) {
$username = $_POST['login_user'];
} else {
$username = "游客";
}
session_register('username');
save_online($username, get_client_ip());
header("location:".SCRIPT."?action=chat");
}
//开始聊天www.knowsky.com
if ($action=="chat")
{
$online_sum = get_online_sum();
echo "<head<title[ ".CHAT_NAME." ]</title</head<center<body bgcolor=#C4BFB9 style='font-size:12px;'
<div style='border:1px solid #999966; width:802px;height:450'<iframe src="http://img.jcwcn.com/attachment/portal" 猜你喜欢