php写的serv-u的web申请账号的代码
//Sign.php
//系统适用于win2000
$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("rn",substr($str,$start1,$start2-$start1)));
}else
{
$usernum=1;
}
$userinfo="User".$usernum."=".$userid."|1|0"."rn";
$userpath=$fabu.$userid;
@mkdir($userpath,0700);
$maxsize=$size*1024;
$userp="[USER=".$userid."|1]"."rn";
$userp.="Password=".$password."rn";
$userp.="HomeDir=".$userpath."rn";
$userp.="RelPaths=1"."rn";
$userp.="DiskQuota=1|".$maxsize."|0"."rn";
$userp.="MaxUsersLoginPerIP=2"."rn";
$userp.="TimeOut=600"."rn";
$userp.="Access1=".$userpath."|RWAMLCDP"."rn";
if($start2){
$content=substr($str,$start2,strlen($str)-$start2);
$content.=$userp;
$userinfo.=$content;
fseek($fp1,$start2,SEEK_SET);
fputs($fp1,$userinfo);
}else
{
fputs($fp,$userinfo);
fputs($fp,$userp);
}
//echo $firstusername;
//echo $start;
//echo "
";
//echo $end;
}
fclose($fp);
fclose($fp1);
}
?>
下一篇: sqlserver通配符使用
推荐阅读
-
php写的serv-u的web申请账号的代码
-
用PHP写的基于Memcache的Queue实现代码_PHP
-
求教,php写正则匹配html代码的数据
-
php写法问题?该不该这样写?怎么写代码才是正确的?
-
用PHP写的基于Memcache的Queue实现代码_php技巧
-
用php写的serv-u的web申请账号的程序
-
php写的serv-u的web申请账号的代码
-
刚转学php,请大家帮小弟我写段数据库查询类的代码
-
用php写的serv-u的web申请账号的程序,很烂,供参考,修改和删除请自己做了!这是个初稿,请多_PHP教程
-
memcache 用PHP写的基于Memcache的Queue实现代码