社区(php&&mysql)一
2008-02-15 18:00:16 来源:WEB开发网核心提示:function cook_cooloff(){ global $PHP_SELF,$aid,$pgno; setcookie("OPEN_LIST",0,time()+ 31536000); Header("Location:$PHP_SELF?
function cook_cooloff(){
global $PHP_SELF,$aid,$pgno;
setcookie("OPEN_LIST",0,time()+ 31536000);
Header("Location:$PHP_SELF?aid=$aid&pgno=$pgno");
exit;
}
//===============================================================
function cook_coolon(){
global $PHP_SELF,$aid,$pgno;
setcookie("OPEN_LIST",1,time()+ 31536000);
Header("Location:$PHP_SELF?aid=$aid&pgno=$pgno");
exit;
}
function check_mail($semail)
{
$str=strchr($semail,'@');
if ($str=="") return false;
$str=strchr($semail,".");
if ($str=="") return false;
return true;
}
//================================================================
function addhitviews($sid,$rid) {
$DROOT=getenv('DOCUMENT_ROOT');
include("sql.php3");
$db=MySQL(和PHP搭配之最佳组合)_connect($sql['host'], $sql['user'] , $sql['passwd']);
if($sid==$rid) $qsql="SELECT * from bbs_subj where id='$rid'";
else $qsql="SELECT * from bbs_docs where id='$rid'";
$rs=MySQL(和PHP搭配之最佳组合)_db_query($sql['db'],$qsql);
$row=MySQL(和PHP搭配之最佳组合)_fetch_array($rs);
$views=$row['views'];
$views++;
if($sid==$rid) $qsql="UPDATE bbs_subj SET views='$views' where id='$rid'";
else $qsql="UPDATE bbs_docs SET views='$views' where id='$rid'";
MySQL(和PHP搭配之最佳组合)_db_query($sql['db'],$qsql);
}
//===============================================================
function mail_list(){
global $PHP_SELF,$HTTP_HOST,$email;
global $aid,$sid,$rid;
global $way1,$way2;
if(check_mail($email)) {
$mailtype=0; //璹綷
if(strlen($way2)) $mailtype=1;//
$DROOT=getenv('DOCUMENT_ROOT');
include("sql.php3");
$db=MySQL(和PHP搭配之最佳组合)_connect($sql['host'], $sql['user'] , $sql['passwd']);
if($mailtype==0) { //璹綷
$qsql="SELECT * from bbs_sml where sid='$sid' AND email='$email'";
$rs=MySQL(和PHP搭配之最佳组合)_db_query($sql['db'],$qsql);
if(MySQL(和PHP搭配之最佳组合)_num_rows($rs)==0) { //临⊿
$qsql="INSERT INTO bbs_sml (sid,email) values('$sid','$email')";
$rs=MySQL(和PHP搭配之最佳组合)_db_query($sql['db'],$qsql);
global $PHP_SELF,$aid,$pgno;
setcookie("OPEN_LIST",0,time()+ 31536000);
Header("Location:$PHP_SELF?aid=$aid&pgno=$pgno");
exit;
}
//===============================================================
function cook_coolon(){
global $PHP_SELF,$aid,$pgno;
setcookie("OPEN_LIST",1,time()+ 31536000);
Header("Location:$PHP_SELF?aid=$aid&pgno=$pgno");
exit;
}
function check_mail($semail)
{
$str=strchr($semail,'@');
if ($str=="") return false;
$str=strchr($semail,".");
if ($str=="") return false;
return true;
}
//================================================================
function addhitviews($sid,$rid) {
$DROOT=getenv('DOCUMENT_ROOT');
include("sql.php3");
$db=MySQL(和PHP搭配之最佳组合)_connect($sql['host'], $sql['user'] , $sql['passwd']);
if($sid==$rid) $qsql="SELECT * from bbs_subj where id='$rid'";
else $qsql="SELECT * from bbs_docs where id='$rid'";
$rs=MySQL(和PHP搭配之最佳组合)_db_query($sql['db'],$qsql);
$row=MySQL(和PHP搭配之最佳组合)_fetch_array($rs);
$views=$row['views'];
$views++;
if($sid==$rid) $qsql="UPDATE bbs_subj SET views='$views' where id='$rid'";
else $qsql="UPDATE bbs_docs SET views='$views' where id='$rid'";
MySQL(和PHP搭配之最佳组合)_db_query($sql['db'],$qsql);
}
//===============================================================
function mail_list(){
global $PHP_SELF,$HTTP_HOST,$email;
global $aid,$sid,$rid;
global $way1,$way2;
if(check_mail($email)) {
$mailtype=0; //璹綷
if(strlen($way2)) $mailtype=1;//
$DROOT=getenv('DOCUMENT_ROOT');
include("sql.php3");
$db=MySQL(和PHP搭配之最佳组合)_connect($sql['host'], $sql['user'] , $sql['passwd']);
if($mailtype==0) { //璹綷
$qsql="SELECT * from bbs_sml where sid='$sid' AND email='$email'";
$rs=MySQL(和PHP搭配之最佳组合)_db_query($sql['db'],$qsql);
if(MySQL(和PHP搭配之最佳组合)_num_rows($rs)==0) { //临⊿
$qsql="INSERT INTO bbs_sml (sid,email) values('$sid','$email')";
$rs=MySQL(和PHP搭配之最佳组合)_db_query($sql['db'],$qsql);
更多精彩
赞助商链接