Empire CMS top deduction point mechanism_PHP tutorial

WBOY
Release: 2016-07-13 10:33:24
Original
1064 people have browsed it

First add int field top in desired system model, radio buttons 0, 1 (0 is no, 1 is yes). There are two main modifications to e/class/qinfofun.php, one for adding and one for editing.

Find esetcookie("lastaddinfotime", time(), time()+3600*24) in the file; go to //-------------modify below

Replace all with:

	//置顶扣分
	$t=$empire->fetch1("select top from {$dbtbpre}ecms_".$tbname." where userid='$muserid' and id='$id' and classid='$classid' limit 1");
	if($t[top])
	{
   		$w=$empire->fetch1("select userfen from {$dbtbpre}enewsmember where userid='$muserid'");
     	if($w[userfen]>=10)
      	{
       		$sql3=$empire->query("update {$dbtbpre}enewsmember set userfen=userfen-10 where userid='$muserid'");
          	printerror("AddQinfoSuccess",$reurl,1);
      	}
     	else
       	{
        	$sql4=$empire->query("update {$dbtbpre}ecms_".$tbname." set top=0 where userid='$muserid' and id='$id' and classid='$classid' limit 1");
       		printerror("jifenbugou",$reurl,1);
      	}
	}                
   	else
	{
		printerror("AddQinfoSuccess",$reurl,1);
	}
}
else
{
	printerror("DbError","history.go(-1)",1);
}
}
Copy after login

Found

if($sql)
{
	$reurl=DoingReturnUrl("ListInfo.php?mid=$mid",$add['ecmsfrom']);
 	if($add['editgotoinfourl']&&$infor['checked'])//返回内容页
	{
    	if($cr['showdt']==1)
   		{
         	$reurl=$public_r[newsurl]."e/action/ShowInfo/?classid=$classid&id=$id";
     	}
 		elseif($cr['showdt']==2)
      	{
          	$reurl=$public_r[newsurl]."e/action/ShowInfo.php?classid=$classid&id=$id";
       	}
     	else
   		{
          	$reurl=$titleurl;
    	}
	}
Copy after login

Between it and //---------------Delete replace with:

//置顶扣分
	$t=$empire->fetch1("select top from {$dbtbpre}ecms_".$tbname." where userid='$muserid' and id='$id' and classid='$classid' limit 1");
	if($t[top])
	{
		$w=$empire->fetch1("select userfen from {$dbtbpre}enewsmember where userid='$muserid'");
    	if($w[userfen]>=10)
     	{
         	$sql3=$empire->query("update {$dbtbpre}enewsmember set userfen=userfen-10 where userid='$muserid'");
          	printerror("EditQinfoSuccess",$reurl,1);
   		}
    	else
       	{
       		$sql4=$empire->query("update {$dbtbpre}ecms_".$tbname." set top=0 where userid='$muserid' and id='$id' and classid='$classid' limit 1");
       		printerror("jifenbugou",$reurl,1);
    	}
  	}
 	else{printerror("EditQinfoSuccess",$reurl,1);}        
	}
	else
	{printerror("DbError","history.go(-1)",1);}
}
Copy after login

Note that the 10 points in the above section are set by yourself, and jifenbuzhu can add the prompts he needs in e/data/language/gb/pub/q_message.php.

This field is added mainly to avoid conflicts with the boss’s firsttitle and to avoid the trouble caused by future upgrades. If a member has insufficient points, it will prompt that the points are insufficient, but the information can still be submitted but cannot be pinned to the top.

Call method in list template:

[e:loop={"select * from phome_ecms_house where top=1 and checked=1 and classid='$GLOBALS[navclassid]'  limit 3",3,24,0}]
<tr onmouseout="this.style.backgroundColor='#ffffff'" onmouseover="this.style.backgroundColor='#F1F5FC'">
        <td><?=$bqr[myarea]?></td>
        <td class="tx"><font color="red">[置顶]</font>
<a href="<?=$bqsr[titleurl]?>" title="<?=$bqr[title]?>" target="_blank"><?=$bqr[xiangxidizhi]?></a></td>
        <td><?=$bqr[shi]?>室<?=$bqr[ting]?>厅</td>
        <td><?=$bqr[size]?><span class="m">㎡</span></td>
        <td><?=$bqr[money]?></td>
        <td align="right"><?=date('Y-m-d',$bqr[newstime])?></td>
    </tr>
[/e:loop]
Copy after login

//The 01.23 daily update function adds the expiration time field date. After expiration, the top function is invalid. Add and (unix_timestamp(youxiaoqi)-UNIX_TIMESTAMP(NOW()))>0

to the above list template sql.

For reference only.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/752499.htmlTechArticleFirst add int field top in the required system model, radio button 0, 1 (0 is no, 1 is yes). There are two main modifications to e/class/qinfofun.php, one for adding and one for editing. In the file...
Related labels:
source:php.cn
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!