首页 >php教程 >php手册 >用php写的serv-u的web申请账号的程序,很烂,供参考,修改和删除请自己做了!这是个初稿,请多

用php写的serv-u的web申请账号的程序,很烂,供参考,修改和删除请自己做了!这是个初稿,请多

WBOY
WBOY原创
2016-06-13 10:02:401130浏览


//Sign.php
//系统适用于win2000
//power by devchina.com,http://www.2oa.net
$path="e:serv-uServUDaemon.ini";//用户文件的路径
$fabu="e:web";//总web路径
if($add)
{
$fp1=fopen($path,"r+");
$str=fread($fp1, filesize($path));
$fp=fopen($path,"a");
flock($fp,3);
$us="=".$userid;
$start=strpos($str,$us);
if($start)
    {
echo "对不起,该用户已经存在";
    }else{
$start1=strpos($str,"User1");
if($start1){
$start=$start1+6;
$end=strpos($str,"|",$start);
$firstusername=substr($str,$start,$end-$start);
$start2=strpos($str,"[USER=".$firstusername."|1]");
$usernum=count(split(" ",substr($str,$start1,$start2-$start1)));
        }else
        {
$usernum=1;
        }
$userinfo="User".$usernum."=".$userid."|1|0"." ";
$userpath=$fabu.$userid;
@mkdir($userpath,0700);
$maxsize=$size*1024;
$userp="[USER=".$userid."|1]"." ";
$userp.="Password=".$password." ";
$userp.="HomeDir=".$userpath." ";
$userp.="RelPaths=1"." ";
$userp.="DiskQuota=1|".$maxsize."|0"." ";
$userp.="MaxUsersLoginPerIP=2"." ";
$userp.="TimeOut=600"." ";
$userp.="Access1=".$userpath."|RWAMLCDP"." ";
if($start2){
$content=substr($str,$start2,strlen($str)-$start2);
$content.=$userp;
$userinfo.=$content;
    fseek($fp1,$start2,SEEK_SET);
    fputs($fp1,$userinfo);

声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn