- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
function checkUserPermission($module,$act){
#return true;
$this->temp=array();
$this->temp['_result']=0;
$this->temp['_uid']=explode('::',$_COOKIE['site_hash']);
$this->temp['_uid']=$this->temp['_uid'][0];
$this->temp['_gid']=$this->getUserSecurityAccess($this->temp['_uid']);
$this->temp['_conn_id']=mysql_connect('host','user','passwd');
mysql_select_db('database');
$this->temp['_q1']=mysql_query('SELECT perms'
.'FROM `secure_groups`'
.'WHERE id='.$this->temp['_gid']);
$this->temp['_access_stamp']=mysql_fetch_assoc($this->temp['_q1']);
$this->temp['_access_stamp']=$this->temp['_access_stamp']['perms'];
$this->temp['_access_stamp']=explode(';',$this->temp['_access_stamp']);
$this->temp['_access_stamp']=array_slice($this->temp['_access_stamp'],0,-1);
foreach($this->temp['_access_stamp'] as $this->temp['v']){
$this->temp['_mod_access']=explode(':',$this->temp['v']);
$this->temp['_mod_indefier']=$this->temp['_mod_access'][0];
if($this->temp['_mod_indefier']==$module){
$this->temp['_perms']=explode(',',$this->temp['_mod_access'][1]);
switch($act){
case 'r':
$this->temp['_result']=($this->temp['_perms'][0]==1)? 1:0;
break;
case 'w':
$this->temp['_result']=($this->temp['_perms'][1]==1)? 1:0;
break;
}
break;
}
}
mysql_close($conn_id);
return $this->temp['_result'];
}
Комментарии (0) RSS
Добавить комментарий