PHPCMSÖеÄRBACȨÏÞϵͳÖ÷ÒªÓõ½ÁË4ÕÅÊý¾Ý±í£º¹ÜÀíÔ±±í£¬½ÇÉ«±í£¬²Ëµ¥±í£¬²Ëµ¥È¨ÏÞ±í¡£ÏÈÀ´¿´¿´Êý¾Ý¿âµÄÊý¾Ý±í½á¹¹£º
admin ¹ÜÀíÔ±±í
ID | ×ֶΠ| ÀàÐÍ | Null | ĬÈÏ | Ë÷Òý | ¶îÍâ | ×¢ÊÍ |
---|---|---|---|---|---|---|---|
1 | userid | mediumint(6) | unsigned | PK | auto_increment | Óû§id | |
2 | username | varchar(20) | YES | INDEX | ̞ | ||
3 | password | varchar(32) | YES | ÃÜÂë | |||
4 | roleid | smallint(5) | YES | 0 | ½ÇÉ« | ||
5 | encrypt | varchar(6) | YES | ¼ÓÃÜÒò×Ó | |||
6 | lastloginip | varchar(15) | YES | ×îºóµÇ¼ip | |||
7 | lastlogintime | int(10) unsigned | YES | 0 | ×îºóµÇ¼ʱ¼ä | ||
8 | varchar(40) | YES | |||||
9 | realname | varchar(50) | NO | ÕæʵÐÕÃû | |||
10 | card | varchar(255) | NO | Ãܱ£¿¨ |
admin_role ½ÇÉ«±í
ID | ×ֶΠ| ÀàÐÍ | Null | ĬÈÏ | Ë÷Òý | ¶îÍâ | ×¢ÊÍ |
---|---|---|---|---|---|---|---|
1 | roleid | tinyint(3) unsigned | PK | auto_increment | ½ÇÉ«id | ||
2 | rolename | varchar(50) | NO | ½ÇÉ«Ãû³Æ | |||
3 | description | text | NO | ÃèÊö | |||
4 | listorder | smallint(5) unsigned | NO | 0 | INDEX | ÅÅÐò | |
5 | disabled | tinyint(1) unsigned | NO | 0 | INDEX | ״̬£º1£¬½ûÓà |
menu ²Ëµ¥±í
ID | ×ֶΠ| ÀàÐÍ | Null | ĬÈÏ | Ë÷Òý | ¶îÍâ | ×¢ÊÍ |
---|---|---|---|---|---|---|---|
1 | id | smallint(6) unsigned | PK | auto_increment | ²Ëµ¥id | ||
2 | name | char(40) | NO | Ãû³Æ | |||
3 | parentid | smallint(6) | NO | 0 | INDEX | ¸¸id | |
4 | m | char(20) | NO | INDEX | m | ||
5 | c | char(20) | NO | INDEX | c | ||
6 | a | char(20) | NO | INDEX | a | ||
7 | data | char(100) | NO | ¸½¼þ²ÎÊý | |||
8 | listorder | smallint(6) unsigned | NO | 0 | INDEX | ÅÅÐò | |
9 | display | enum('1','0') | NO | 1 | ÊÇ·ñÏÔʾ£¬1 ÏÔʾ |
admin_role_priv ²Ëµ¥È¨ÏÞ±í
ID | ×ֶΠ| ÀàÐÍ | Null | ĬÈÏ | Ë÷Òý | ¶îÍâ | ×¢ÊÍ |
---|---|---|---|---|---|---|---|
1 | roleid | tinyint(3) unsigned | 0 | PK | ½ÇÉ«id | ||
2 | m | char(20) | NO | INDEX | m | ||
3 | c | char(20) | NO | INDEX | c | ||
4 | a | char(20) | NO | INDEX | a | ||
5 | data | char(30) | NO | ¸½¼þÊôÐÔ | |||
6 | siteid | smallint(5) unsigned | NO | 0 | INDEX | ËùÊôÕ¾µã |
ÏÂÃæÀ´¼òµ¥·ÖÎöÒ»ÏÂ4ÕűíµÄ¹Øϵ£º
1.Óû§±íÖеÄÿ¸öÓû§ÓÐÒ»¸ö½ÇÉ«×Ö¶Îroleid£¬±íÃ÷Á˸ÃÓû§ÊôÓÚÄĸö½ÇÉ«¡£
2.½ÇÉ«±íµÄÖ÷¼üΪroleid£¬ÓëÓû§±íÖеÄroleidÏà¶ÔÓ¦£¬»¹ÓнÇÉ«Ãû³Æ£¬ÃèÊöµÈ£¬±ÈÈçPHPCMSϵͳĬÈÏÓг¬¼¶¹ÜÀíÔ±¡¢×ܱࡢ·¢²¼ÈËÔ±µÈ½ÇÉ«¡£
3.¹ÜÀíԱȨÏÞ±íÖÐÖ÷¼üÒ²ÊÇroleid£¬Óë½ÇÉ«±íÖеÄÖ÷¼üroleidÏà¶ÔÓ¦£¬±íÃ÷Á˸ýÇÉ«ÓµÓеĺǫ́²Ù×÷ȨÏÞ¡£×Ö¶Îm¡¢c¡¢a·Ö±ð´ú±íµÄÊÇÄ£ÐÍ | ¿ØÖÆÆ÷ | ·½·¨£¬ÒòΪPHPCMS±¾ÉíÒ²ÊÇMVC½á¹¹£¬ËùÒÔ¸üºÃµØʹȨÏÞϵͳµÄÁ£¶Èϸ»¯µ½·½·¨ÉÏÃæ¡£
4.²Ëµ¥±íÖ÷Òª´æ·Å²Ëµ¥ÊôÐÔ£¬ÆäÖеÄm¡¢c¡¢aÓë¹ÜÀíԱȨÏÞ±íÖеÄ×Ö¶ÎÏà¶ÔÓ¦¡£
×îºóÀ´¿´¿´Óû§µÄ²Ù×÷¼°ÑéÖ¤Á÷³Ì£º
Ê×ÏÈ£¬Óû§ÔÚºǫ́µÇ¼£¬Èç¹ûµÇ¼³É¹¦£¬½«roleid£¨½ÇÉ«id£©´æÈëSESSION£¬È»ºóÌøתµ½ºǫ́Ê×Ò³£¬ÔÚPHPCMSϵͳÖУ¬Õû¸öºǫ́²Ù×÷µÄ²¿·Ö¶¼ÔÚadminÄ£¿éÖУ¬ËùÒÔ¸ÃÄ£¿éÖÐËùÓеĿØÖÆÆ÷¾ù¼Ì³Ð×ÔadminÀ࣬²¢ÇÒÔÚ¹¹Ôì·½·¨ÖÐÖ´ÐÐÁ˸¸ÀàµÄ¹¹Ôì·½·¨£¨adminµÄ¹¹Ôì·½·¨£©¡£ÄÇô£¬adminÀàµÄ¹¹Ôì·½·¨ÓÐÖ´ÐÐÁËÄÄЩ²Ù×÷ÄØ£¿
Ê×ÏÈÊǵ÷ÓÃ×ÔÉíµÄ check_admin()
À´ÅжÏÓû§ÊÇ·ñµÇ¼£¬½ô½Ó×ÅÅжÏÓû§µÄȨÏÞ£º check_priv()
check_priv() ·½·¨Ô´´úÂ룺
## ¸ñʽÂÔ΢ÐÞ¸Ä final public function check_priv() { if (ROUTE_M == 'admin' && ROUTE_C == 'index' && in_array(ROUTE_A, array('login', 'init', 'public_card'))) { return true; } if ($_SESSION['roleid'] == 1) { return true; } $siteid = param::get_cookie('siteid'); $action = ROUTE_A; $privdb = pc_base::load_model('admin_role_priv_model'); if (preg_match('/^public_/', ROUTE_A)) { return true; } if (preg_match('/^ajax_([a-z]+)_/', ROUTE_A, $_match)) { $action = $_match[1]; } $r = $privdb->get_one( array( 'm' => ROUTE_M, 'c' => ROUTE_C, 'a' => $action, 'roleid' => $_SESSION['roleid'], 'siteid' => $siteid ) ); if (!$r) { showmessage('ÄúûÓÐȨÏÞ²Ù×÷¸ÃÏî', 'blank'); } }
¸Ã·½·¨Ê×ÏÈÅжϵ±Ç°ÕýÔÚ½øÐеIJÙ×÷£¬Èç¹ûÊǵǼ»òÕß³õʼ»¯²Ù×÷£¬ÔòÍ˳ö¡£
È»ºóÅжϽÇÉ«ÊÇ·ñΪ³¬¼¶¹ÜÀíÔ±£¨³¬¼¶¹ÜÀíԱĬÈÏΪ×î¸ßȨÏÞ£©£¬Èç¹ûÊÇ£¬ÒÀ¾ÉÍ˳ö£¬»òÕßÈç¹ûµ±Ç°·½·¨Îª¹«¿ªµÄ£¨Ã»ÓÐȨÏÞÏÞÖÆ£©£¬Í¬ÑùÍ˳ö¡£
×îºó¼ÓÔØ admin_role_priv_model£¬Ò²¾ÍÊǹÜÀíԱȨÏÞÄ£ÐÍ£¬»ñÈ¡µ±Ç°Òª²Ù×÷µÄÄ£ÐÍ | ¿ØÖÆÆ÷ | ·½·¨£¬ÀûÓÃadmin_role_priv_model ÌṩµÄ·½·¨½øÐвéѯ£¬Èç¹û¿ÉÒÔ·µ»ØÊý¾Ý£¬Ôò˵Ã÷½ÇÉ«¿ÉÒÔ½øÐе±Ç°²Ù×÷£¬·´Ö®£¬µ¯³öÌáʾÐÅÏ¢£ºÄúûÓÐȨÏÞ²Ù×÷¸ÃÏȻºóÍ˳ö£¡
¶ÔÁË£¬ÍüÁ˽éÉܺǫ́²Ëµ¥µÄÉú³É¹ý³ÌÀ²£¡ÆäʵÓõ½µÄ»¹ÊÇadminÀà×ÔÉíµÄ·½·¨£ºadmin_menu()£º ²»¹ý¸Ã·½·¨ÊÇÔÚ index.tpl.phpÄ£°åÖе÷Óõģ¬Ö÷Òª½øÐеIJÙ×÷ÊÇÏÈÈ¡³ö²Ëµ¥±íÖÐËùÓв˵¥£¬È»ºóÅжϵ±Ç°½ÇÉ«£¬Èç¹ûΪ³¬¼¶¹ÜÀíÔ±£¬ÔòÖ±½Ó·µ»Ø²Ëµ¥Êý×飬·´Ö®£¬Ôò½«·ûºÏµ±Ç°½ÇɫȨÏ޵IJ˵¥Êý×é·µ»Ø¡£
ÒÔÉϾÍÊÇPHPCMSϵͳµÄȨÏ޽ṹ¼°²Ù×÷Á÷³Ì£¡
ÍƼöÐÅÏ¢
- ¡¾ÊÓƵ²¥·Å¡¿JplayerÊÓƵ²¥·ÅÆ÷µÄʹÓÃ
- memcacheÄÚ´æÔÀí
- Memcache¼¼Êõ·ÖÏí£º½éÉÜ¡¢Ê¹Óᢴ洢¡¢Ëã·¨¡¢ÓÅ»¯....
- php³£ÓÃÕýÔò±í´ïʽ
- phpÐÔÄܼà²âÄ£¿éXHProf
- ÈÃCI¿ò¼ÜÖ§³Öservice²ã
- ʹÓÃPHPÉú³É´øLOGOµÄ¸öÐÔ»¯¶þάÂëͼÏñ
- ¹ØÓÚCodeIgniterÄã¿ÉÄܲ»ÖªµÀµÄ5¸ö֪ʶµã
- Memcache ºÁÃ뼶³¬Ê±¼°ÆäËû³£¼ûÎÊÌâ»ã×Ü
- [PHP±Ê¼Ç]PHPQueryÒ»¸ö´¦ÀíDOMµÄÀûÆ÷
ÈÈÃÅÐÅÏ¢
- nohup: redirecting stderr to stdou....
- ʹÓÃlog_formatΪNginx·þÎñÆ÷ÉèÖøüÏêϸµÄÈÕÖ¾¸ñʽ
- jquery easyUI--dataGrid-Json
- [Ô´´]·ÂGoogle Reader¡¢ÐÂÀË΢²©¡¢ÌÚѶ΢²©µ....
- ÀûÓÃKeepalived+mysql¹¹½¨¸ß¿ÉÓÃMySQLË«Ö÷×Ô¶....
- Nginx+keepalivedʵÏÖ¸ºÔؾùºâºÍË«»úÈȱ¸¸ß¿ÉÓÃ
- jqueryʵÏÖÒ³Ãæ¼ÓÔؽø¶ÈÌõ
- Rolling cURL: PHP²¢·¢×î¼Ñʵ¼ù
- codeigniter ·ÓÉÖÕ¼«ÓÅ»¯(url rewrite)
- linuxÏÂÉèÖÃsshÎÞÃÜÂëµÇ¼
×î½ü¸üÐÂ
- PHP»ñÈ¡Óû§µÄÕæʵIP£¬²¢ÅжÏÊÇ·ñÄÚÍøIP
- PHP ´íÎóÈÕÖ¾ error_log
- ÀûÓÃbigpipe»úÖÆʵÏÖÒ³ÃæÄ£¿éµÄÒì²½äÖȾ chunked¼¼Êõ
- php¿ØÖÆÎļþÏÂÔØËÙ¶È
- js + php ¶ÁÈ¡¡¢²¥·ÅÊÓƵÁ÷ ¼æÈÝfirefox£¬c....
- ¡¾ÊÓƵ²¥·Å¡¿JplayerÊÓƵ²¥·ÅÆ÷µÄʹÓÃ
- UNICODE Óë UTF-8 µÄ¹Øϵ
- memcacheÄÚ´æÔÀí
- Memcache¼¼Êõ·ÖÏí£º½éÉÜ¡¢Ê¹Óᢴ洢¡¢Ëã·¨¡¢ÓÅ»¯....
- phpʹÓÃmb_detect_encoding¼ì²â×Ö·û´®±àÂë
ÆÀÂÛ