My Forum source code (v)

Source: Internet
Author: User
Tags date current time html tags include query setcookie
Okey.php mainly deals with information processing of user login and release


?
if ($username)//whether there is user information
$useinfo = $username. "|". $userpass;
Setcookie ("Flyfoxnet", $useinfo, Time () +3600);

if ($d ==q) Setcookie ("flyfoxnet"); If you are quitting, leave the cookie blank
?>
<HTML><HEAD><TITLE> Publish Articles </TITLE>
<link href= "Js/cpcw.css" rel=stylesheet/link>
?
Include "linkfox.inc.php";
Include "info.inc.php";
function Postf ($useinfo, $title, $message)/Post information processing
{
$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])//Check that the last message is the same as the current one.
echo "<script language= ' JavaScript ' > alert (' Do not repeat the post, thank you for your cooperation! '); </script> ";
else{
$time =date (Y-year-N-month J-th G-time i);
$filename =date (Ymjgis); FileName to take the current time
$gip =getenv ("remote_addr"); Write information
$query = "INSERT into Foxbbs (USENAME,FTBQ,TITLE,FTDATE,MESNAME,DJNUM,HFNUM,IP) VALUES ('". $useinfo [0]. $useinfo [A] "', '". $title. "', '". $time "', '", $filename. "', 1,0, '". $gip. "";
$req = @mysql_query ($query);
if ($req) {//If the write succeeds, add a number of posts to the user and create a content file
$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"); Convert all "<", ">" Symbols to "<", "&rt;" HTML tags can be removed, as if there is a function can be directly removed, but I do not remember, and did not find in the reference manual, so use a stupid way.
$message =str_replace ("<", "<", Str_replace (">", ">", $message));
$message =nl2br ($message); First remove the symbol and then transform the line, lest the line break will also become a character display.
$f =fputs ($fp, $message);
$fp = @fclose ($FP);
echo "<script language= ' JavaScript ' > Alert ('". $useinfo [2]. "! Congratulations, successful posting! '); </script> ";
}
else {
echo "<script language= ' JavaScript ' > alert (' Very sorry, because of the database reason, your post failed to save!") '); </script> ";
}
}

}
function Userr ($username, $userpass, $title, $message)//user Information validation functions
{
$query = "SELECT * from Useinfo where usename= '". $username. "'";
$req =mysql_query ($query);
$useinfo =mysql_fetch_array ($req);
if ($useinfo [0]== $username)
{
Call the information processing function if you pass the school check
if ($userpass = = $useinfo [1]) {POSTF ($useinfo, $title, $message); return $useinfo;}
else {
echo "<script language= ' JavaScript ' > alert (' Incorrect password, please check! '); </script> ";
echo "<meta http-equiv= ' REFRESH ' content= ' 2; url=post.php ' > ';
}
}
Else
{
echo "<script language= ' JavaScript ' > alert (' User does not exist, please confirm registered! '); </script> ";
}
}
?>
<meta content= "text/html; charset=gb2312 "http-equiv=content-type>
<meta http-equiv= "REFRESH" content= "2; Url=foxbbs.php ">
?
$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 ' <script language= ' JavaScript ' > Alert (' You are not a legitimate user and cannot post on this forum! '); </script> ";}

}
if ($d ==q)
{
echo "<script language= ' JavaScript ' > Alert (' You have exited the login status and will return to the forum as a visitor"); </script> ";
}
?>
<br><br><br><br><br>
<div align= "center" ><a href=foxbbs.php> if the system does not automatically return to the page, click here to return .</a></div>
</body>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.