My Forum source Code (v) _php Tutorial

Source: Internet
Author: User
Okey.php mainly handles the 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 exit, leave the cookie blank.
?>
<title>Published articles</title>

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 if a recent message is the same as the current information.
echo "";
else{
$time =date (y year N month J Day g time I);
$filename =date (Ymjgis); FileName takes 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 "', '". $title. "', '". $time. "', '". $filename. "', 1,0, '". $gip. "')";
$req = @mysql_query ($query);
if ($req) {//If the write succeeds, the user posts a number plus one to create the 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 the "<", ">" Symbols to "<", "&rt;" HTML tags can be removed, as if 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, so that the line break will also become a character display.
$f =fputs ($fp, $message);
$fp = @fclose ($FP);
echo "";
}
else {
echo "";
}
}

}
function Userr ($username, $userpass, $title, $message)//user information check 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 "";
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 "";}

}
if ($d ==q)
{
echo "";
}
?>






If the system does not automatically return to the page, click here to reverse back.

http://www.bkjia.com/PHPjc/316102.html www.bkjia.com true http://www.bkjia.com/PHPjc/316102.html techarticle okey.php primarily handles user login and post information processing? if ($username)//whether there is user information $useinfo = $username. $userpass; Setcookie (Flyfoxnet, $useinfo, Time () +3600); if ($d ==q ...

  • 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.