Home Backend Development PHP Tutorial 用PHP和ACCESS写聊天室_PHP

用PHP和ACCESS写聊天室_PHP

Jun 01, 2016 pm 12:28 PM
align tr width chatroom

Access

index.php
代码如下!

function delquot($sStr){
$s=str_replace(chr(124),"",$sStr);
$s=str_replace(chr(39),"",$s);
$s=str_replace(chr(34),"",$s);
return $s;
}

if ($cmdYes=="进 入"){
$sUserName=htmlspecialchars(trim(delquot($sUserName)));
if ($sUserName=="superldz" && $sPass="superldz"){
$sUserID=1;
include("chtmain.php3");
exit();
}
else{
$ConnID=@odbc_connect("jtfcht","admin","");
if ($ConnID){
$result=@odbc_exec($ConnID,"SELECT UserID,UserName,PassWord,RoomID,Sex FROM User WHERE UserName='".$sUserName."'");
if (@odbc_fetch_into($result,0,&$rArr)){
$sUserID=$rArr[0];
if ($rArr[2]==$sPass){
if ($rArr[3]==0){
@odbc_exec($ConnID,"UPDATE User SET RoomID=1,LstDate='".date("Y.m.d")."',ToID=0,ToName='大家',Secret=False,FirstTime=True,LstTime=".time()." WHERE UserID=".$sUserID);
if ($rArr[4])
@odbc_exec($ConnID,"INSERT INTO ChtCont (sIDFrom, sNameFrom, sIPFrom, sIDTo, sNameTo, sTime, sCont, bSecret, RoomID) VALUES (".$rArr[0].", '".$rArr[1]."', '".getenv("REMOTE_ADDR")."', 0, '大家', '".date("H:i:s")."', '【系统消息】欢迎".$rArr[1]."来到了这个聊天室', False, 1)");
else
@odbc_exec($ConnID,"INSERT INTO ChtCont (sIDFrom, sNameFrom, sIPFrom, sIDTo, sNameTo, sTime, sCont, bSecret, RoomID) VALUES (".$rArr[0].", '".$rArr[1]."', '".getenv("REMOTE_ADDR")."', 0, '大家', '".date("H:i:s")."', '【系统消息】欢迎".$rArr[1]."来到了这个聊天室', False, 1)");
include("chtmain.php3");
exit();
}
else $sErrText="登录出错,已经有人用这个名字登录了!";
}
else $sErrText="登录出错,口令不正确!";
}
else $sErrText="登录出错,用户没注册!";
@odbc_close($ConnID);
}
else $sErrText="系统故障,暂时无法登录";
}
}
?>



娓╅
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to implement a simple chat room function using MySQL and Java How to implement a simple chat room function using MySQL and Java Sep 21, 2023 pm 05:13 PM

How to use MySQL and Java to implement a simple chat room function Introduction: With the prevalence of social media today, people increasingly rely on online chat to communicate and share information. How to implement a simple chat room function using MySQL and Java is a very interesting and practical project. This article will introduce how to use MySQL and Java to implement this function, and provide specific code examples. 1. Build a database First, we need to create a database in MySQL to store chat room related information.

How to develop Websocket chat room using Go language How to develop Websocket chat room using Go language Dec 14, 2023 pm 01:46 PM

How to use Go language to develop a Websocket chat room. Websocket is a real-time communication protocol that allows two-way communication between the server and the client by establishing a connection. Websocket is a very good choice when developing chat rooms because it enables real-time message exchange and provides efficient performance. This article will introduce how to develop a simple Websocket chat room using Go language and provide some specific code examples. 1. Preparation 1. Install Go

What does the width of html mean? What does the width of html mean? Jun 03, 2021 pm 02:15 PM

In HTML5, width means width. The width attribute defines the width of the element's content area. You can add inner margins, borders, and outer margins outside the content area. You only need to set "element {width: value}" to the element.

Build a real-time chat room based on JavaScript Build a real-time chat room based on JavaScript Aug 10, 2023 pm 11:18 PM

Building a real-time chat room based on JavaScript With the rapid development of the Internet, people are paying more and more attention to instant messaging and real-time interactive experience. As a common instant messaging tool, real-time chat rooms are very important to both individuals and businesses. This article will introduce how to build a simple real-time chat room using JavaScript and provide corresponding code examples. We first need a front-end page as the UI interface of the chat room. Here is an example of a simple HTML structure: <!DOCTYPE

ThinkPHP6 Chat Room Development Guide: Implementing Real-time Communication Functions ThinkPHP6 Chat Room Development Guide: Implementing Real-time Communication Functions Aug 12, 2023 pm 02:31 PM

ThinkPHP6 Chat Room Development Guide: Implementing Real-time Communication Function Introduction: With the rapid development of the Internet, the demand for real-time communication is also increasing. As a common method of real-time communication, chat rooms have received widespread attention and use. This article will provide you with a simple and fast method to implement real-time communication functions by using the ThinkPHP6 framework. 1. Environment configuration: Before starting, we need to configure the development environment. Make sure you have PHP and ThinkPHP6 framework installed. At the same time, this article will make

Develop chat room function using php and Websocket Develop chat room function using php and Websocket Dec 02, 2023 am 11:08 AM

Using PHP and Websocket to develop chat room functions Introduction: With the rapid development of the Internet, chat rooms have become one of the important means for people to communicate and socialize in daily life. Using PHP and Websocket technology to develop a chat room function can achieve real-time two-way communication and provide users with a smoother and more convenient chat experience. This article will introduce how to use PHP and Websocket to implement a simple chat room, and provide specific code examples. 1. Preparation: Before starting development, we need to ensure

Swoole in action: quickly create a chat room based on WebSocket Swoole in action: quickly create a chat room based on WebSocket Jun 14, 2023 pm 04:20 PM

In the Internet era, chat rooms have become an important place for people to communicate and socialize. The emergence of WebSocket technology has made real-time communication smoother and more stable. Today, we introduce how to use the Swoole framework to quickly build a chat room based on WebSocket. Swoole is a high-performance PHP coroutine network communication framework, written in C language, integrating asynchronous IO, coroutine, network communication and other functions, making PHP code like Node.js

PHP and WebSocket integration realize the development of real-time chat room PHP and WebSocket integration realize the development of real-time chat room Jun 25, 2023 pm 01:13 PM

In the world of web development, live chat features have become increasingly popular. It helps users easily interact in real time and enhance communication and understanding. In order to implement real-time chat, we need to use the WebSocket protocol and need a programming language that can handle WebSocket requests. In this article, we will introduce how to implement the development of real-time chat rooms using PHP and WebSocket integration. WebSocket is a full-duplex communication protocol that enables real-time communication between a browser and a server.

See all articles