php多用户怎么储存数据 php支持多进程吗( 二 )


fclose($fp);
return true;
} else {
exit("File: $filename write error.");
return false;
}
}
?
adminconfig.php 后台权限配置文件,以一个数组形式保存
. 代码如下:
?
$menus = array(
'news' = array(
'caption'='资讯管理',
'icon'='admin/icon_15.gif',
'sub' = array(
'newsaddtype' = array('caption' = '分类增加', 'url' = 'news/addtype.php'),
'newstypemange' = array('caption' = '分类管理', 'url' = 'news/typemange.php'),
'newsnewsend' = array('caption' = '发布资讯', 'url' = 'news/newsend.php'),
'newsnewmange' = array('caption' = '资讯管理', 'url' = 'news/newmange.php'),
'newscomments' = array('caption' = '评论管理', 'url' = 'news/comments.php'),
),
),
'ask' = array(
'caption'='问卷调查',
'icon'='admin/icon_15.gif',
'sub' = array(
'voteadmin_subject_add' = array('caption' = '添加投票主题', 'url' = 'vote/admin_subject_add.php'),
'voteadmin_subject' = array('caption' = '管理投票主题', 'url' = 'vote/admin_subject.php'),
'voteadmin_title_add' = array('caption' = '添加投票问题', 'url' = 'vote/admin_title_add.php'),
【php多用户怎么储存数据 php支持多进程吗】'voteadmin_title' = array('caption' = '管理投票问题', 'url' = 'vote/admin_title.php'),
'voteadmin_question_add' = array('caption' = '添加投票答案', 'url' = 'vote/admin_question_add.php'),
'voteadmin_question' = array('caption' = '管理投票答案', 'url' = 'vote/admin_question.php'),
'voteadmin_system' = array('caption' = '投票初始配置', 'url' = 'vote/admin_system.php')
),
),
'ads' = array(
'caption'='广告管理',
'icon'='admin/icon_15.gif',
'sub' = array(
'ada' = array('caption' = '增加广告', 'url' = 'ada.php'),
'adm' = array('caption' = '广告管理', 'url' = 'adm.php'),
'flashadd' = array('caption' = '焦点图广告增加', 'url' = 'flashadd.php'),
'flashad' = array('caption' = '焦点图广告管理', 'url' = 'flashad.php')
),
),
'mange' = array(
'caption'='系统管理员',
'icon'='admin/icon_15.gif',
'sub' = array(
'adminuser' = array('caption' = '管理员添加', 'url' = 'adminuser.php'),
'modpass' = array('caption' = '密码修改', 'url' = 'modpass.php')
),
),
);
?
left.php文件很简单就是根据用户登录后ID读出权限
. 代码如下:
?
$userid = $_SESSION['adminid'];
include("op/admincofig.php");
include("op//".$userid.".php");
foreach($bb as $key=$submenu)
{
echo "trtd bgcolor="#D879A7" style="line-height:22px;text-align:center;color:#ffffff;" nr font color="#EA6A8D" face="Webdings"/fontb".$menus[$key]['caption']."/bbr //td/tr nr tr td bgcolor="F5E8F1"";
foreach($submenu as $subkey=$menuitem)
{
$tmparr = explode("|",$menuitem);
echo "font color="#EA6A8D" face="Webdings"4/fonta href='".$tmparr[1]."' target="mainframe"".$tmparr[0]."/abr nr";
}
echo "/td/tr nr ";
}
op.php这个文件就是要调用我们的adminconfig.php文件,然后利用fun.php文件中函数把提供过来的数据保存成数组如图
点击保存我们调用了opsava.php 文件,代码如下
. 代码如下:
?
include("op/fun.php");
if( $_POST )
{
$sarray = $_POST ;
cache_write($userid,'bb',$sarray);//写入缓存
echo "scriptalert('编辑保存成功!');location='op.php?userid=".$userid."';/script";
}
?
保存成功后文件内容如
. 代码如下:
?php
$bb=Array
(
'member' = Array
(
'user_search' = '会员升级管理|user_search.php'
),
'membercy' = Array
(
'cyuser_search' = '会员升级管理|cyuser_search.php',

推荐阅读