为减轻服务器压力,希望在易优模板的会员登录判断处使用js代码来实现。以下代码可以实现易优cms模板使用JS判断会员登录状态,可大幅度降低服务器压力:
01 | <script type = "text/javascript" > |
02 | function layerLogin(gourl) { |
04 | if (0 < ey_getCookie( 'users_id' )) { |
16 | function ey_getCookie(c_name) |
20 | return getCookie(c_name); |
24 | function getCookie(c_name) |
28 | if (document.cookie.length>0) |
32 | c_start = document.cookie.indexOf(c_name + "=" ) |
38 | c_start=c_start + c_name.length+1 |
40 | c_end=document.cookie.indexOf( ";" ,c_start) |
42 | if (c_end==-1) c_end=document.cookie.length |
44 | return unescape(document.cookie.substring(c_start,c_end)) |
|
发表评论
评论列表(0条)