程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 網頁編程 >> PHP編程 >> 關於PHP編程 >> 用php寫的serv-u的web申請賬號的程序

用php寫的serv-u的web申請賬號的程序

編輯:關於PHP編程

<?
//Sign.php
//系統適用於win2000
$path="e:\\serv-u\\ServUDaemon.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("\r\n",substr($str,$start1,$start2-$start1)));
        }else
        {
$usernum=1;
        }
$userinfo="User".$usernum."=".$userid."|1|0"."\r\n";
$userpath=$fabu.$userid;
@mkdir($userpath,0700);
$maxsize=$size*1024;
$userp="[USER=".$userid."|1]"."\r\n";
$userp.="Password=".$password."\r\n";
$userp.="HomeDir=".$userpath."\r\n";
$userp.="RelPaths=1"."\r\n";
$userp.="DiskQuota=1|".$maxsize."|0"."\r\n";
$userp.="MaxUsersLoginPerIP=2"."\r\n";
$userp.="TimeOut=600"."\r\n";
$userp.="Access1=".$userpath."|RWAMLCDP"."\r\n";

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 "<br>";
//echo $end;


            }
fclose($fp);
fclose($fp1);
}
?>



<FORM METHOD=POST ACTION="sign.php">
賬號:<INPUT TYPE="text" NAME="userid" size=10 maxlength=20 ><br>密碼:
<INPUT TYPE="password" name="password" size=10 maxlength=20 ><br>空間大小:<INPUT TYPE="text" NAME="size" size=4 maxlength=4> M<br><INPUT TYPE="submit" name="add" value="增加用戶">
</FORM>

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved