<?
// Sign. php
// The system is applicable to win2000
$ Path = "e :\\ serv-u \ ServUDaemon. ini"; // path of the User File
$ Fabu = "e: \ web \"; // total web path
If ($ add)
{
$ Fp1 = fopen ($ path, "r + ");
$ Str = fread ($ fp1, filesize ($ path ));
$ Fp = fopen ($ path, "");
Flock ($ fp, 3 );
$ Us = "=". $ userid;
$ Start = strpos ($ str, $ us );
If ($ start)
{
Echo "sorry, this user already exists ";
} 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. = "time out = 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">
Account: <input type = "text" NAME = "userid" size = 10 maxlength = 20> <br> password:
<Input type = "password" name = "password" size = 10 maxlength = 20> <br> space size: <input type = "text" NAME = "size" size = 4 maxlength = 4> M <br> <input type = "submit" name = "add" value = "add User ">
</FORM>