我的论坛源代码(五)
okey.php主要处理用户登录和发布的信息处理
if ($username) //是否有用户信息
$useinfo=$username."|".$userpass;
setcookie("FlyFoxNet",$useinfo,time()+3600);
if ($d==q) setcookie("FlyFoxNet"); //如果是退出的话,把COOKIE置为空
?>
include "linkfox.inc.php";
include "info.inc.php";
function postf($useinfo,$title,$message) //发帖信息处理
{
$query="select * from foxbbs order by id desc limit 1";
$row=@mysql_query($query);
$info=@mysql_fetch_array($row);
if ($useinfo[2]==$info[1]&&$title==$info[3]) //检查最近一条信息是否和当前信息一样。
echo "";
else{
$time=date(Y年n月j日G时i分);
$filename=date(YmjGis); //文件名取当前的时间
$gip=getenv("REMOTE_ADDR"); //写入信息
$query="insert into foxbbs (usename,ftbq,title,ftdate,mesname,djnum,hfnum,ip) values ('".$useinfo[0]."','".$useinfo[14]."','".$title."','".$time."','".$filename."',1,0,'".$gip."')";
$req=@mysql_query($query);
if ($req) { //如果写入成功,则给用户发帖数加一,建立内容文件
$query="select ftnum from useinfo where usename='".$useinfo[0]."'";
$req=@mysql_query($query);
$ftnum=@mysql_fetch_array($req);
$ftnum=$ftnum[0]+1;
$query="update useinfo set ftnum='$ftnum' where usename='".$useinfo[0]."'";
$req=@mysql_query($query);
$ft=$filename;
$fp=fopen($ft,"w"); //把所有的""符号转换成" $message=str_replace("",">",$message));
$message=nl2br($message); //先去除符号再变换行,免得换行符也变成字符显示出来。
$f=fputs($fp,$message);
$fp=@fclose($fp);
echo "";
}
else {
echo "";
}
}
}
function userr($username,$userpass,$title,$message) //用户信息校验函数
{
$query="select * from useinfo where usename='".$username."'";
$req=mysql_query($query);
$useinfo=mysql_fetch_array($req);
if ($useinfo[0]==$username)
{
//如果通过校检就调用信息处理函数
if ($userpass==$useinfo[1]) {postf($useinfo,$title,$message);return $useinfo;}
else {
echo "";
echo "";
}
}
else
{
echo "";
}
}
?>
$tem=$HTTP_COOKIE_VARS[FlyFoxNet];
$temp=explode("|",$tem);
$cookiem=$temp[0];
$useinfo=cuser($cookiem,$action);
if (isset($message))
{
if($username)
{
$useinfo=userr($username,$userpass,$title,$message);
}
else if($useinfo) {
userr($useinfo[0],$useinfo[1],$title,$message);
}
else {echo "

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

Dreamweaver CS6
Visual web development tools

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.