- Joined
- Feb 24, 2004
- Messages
- 92
- Reaction score
- 0
im using a ftp server, and im making a automatic register script.
the php code will store the info in a users.ini file, but i have a problem with the code
the error is that it doesnt add the lines in the users.ini file, but it overwrites the existing lines, and because of that it deletes the others users. what is wrong?
<?
$dir = 'C:\\Program Files\\BPFTP Server\';
if(!$_POST){
echo '<form action='.$_SERVER['PHP_SELF'].' method=post>
<table width="300" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center" valign="middle"><strong>vShare Account Creation </strong></td>
</tr>
<tr>
<td><table width="300" border="0" cellspacing="0" cellpadding="3">
<tr>
<td>Account-Name:</td>
<td><input name=account type=text maxlength=12></td>
</tr>
<tr>
<td>Password:</td>
<td><input name=password type=password maxlength=12></td>
</tr>
<tr>
<td>Password(Again):</td>
<td><input name=confirm type=password maxlength=12></td>
</tr>
<tr>
<td>E-Mail:</td>
<td><input name=email type=text>
</td>
</tr>
</table></td>
</tr>
<tr>
<td align="center" valign="middle"><input name=submit type=submit value=Submit account></td>
</tr>
</table>
';
**
else{
$account = $_POST['account'];
$confirm = $_POST['confirm'];
$password = $_POST['password'];
$email = $_POST['email'];
$filename = $dir . 'users1.ini';
if($account == '') { echo 'Account creation failed. Please fill out all fields.'; **
elseif(file_exists($account)) { echo 'Account creation failed. Account name already exists.';**
elseif($email == '') { echo 'Your e-mail is required.';**
elseif(!ereg("^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*$", $email)){ echo 'Please enter a valid e-mail.'; **
elseif($password != $confirm) { echo 'Password you selected does not match with conformation.';**
else{
$fp = fopen($filename, 'w+');
$string = '
[vS '.$account.']
Login='.$account.'
Pass='.$password.'
Home-Ip=-= All IP Homes =-
RelativePath=1
TimeOut=600
EnableMaxConPerIP=1
MaxConPerIp=1
EnableMaxUsers=1
MaxUsers=1
RatioEnabled=1
RatioMethod=2
RatioUp=1
RatioDown=4
RatioCredit=500000
MaxSpeedRcv=512
MaxSpeedSnd=512
QuotaCurrent=0
QuotaMax=0
Dir0=C:\Documents and Settings\s1lVa\My Documents\My Pictures\
Attr0=R----LS-
Dir1=C:\Documents and Settings\s1lVa\My Documents\My Pictures\+03+ Upload\
Attr1=RW--MLS-
Info_Email='.$email.'
Stat_Login=0
Stat_LastLogin=0
Stat_LastIP=Unknown
Stat_KBUp=0
Stat_KBDown=0
Stat_FilesUp=0
Stat_FilesDown=0
Stat_FailedUp=0
Stat_FailedDown=0
';
$write = fwrite($fp, $string);
fclose($fp);
echo 'Account created successfully, You may now log in with your vShare account!';
**
**
?>
the php code will store the info in a users.ini file, but i have a problem with the code
the error is that it doesnt add the lines in the users.ini file, but it overwrites the existing lines, and because of that it deletes the others users. what is wrong?
<?
$dir = 'C:\\Program Files\\BPFTP Server\';
if(!$_POST){
echo '<form action='.$_SERVER['PHP_SELF'].' method=post>
<table width="300" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center" valign="middle"><strong>vShare Account Creation </strong></td>
</tr>
<tr>
<td><table width="300" border="0" cellspacing="0" cellpadding="3">
<tr>
<td>Account-Name:</td>
<td><input name=account type=text maxlength=12></td>
</tr>
<tr>
<td>Password:</td>
<td><input name=password type=password maxlength=12></td>
</tr>
<tr>
<td>Password(Again):</td>
<td><input name=confirm type=password maxlength=12></td>
</tr>
<tr>
<td>E-Mail:</td>
<td><input name=email type=text>
</td>
</tr>
</table></td>
</tr>
<tr>
<td align="center" valign="middle"><input name=submit type=submit value=Submit account></td>
</tr>
</table>
';
**
else{
$account = $_POST['account'];
$confirm = $_POST['confirm'];
$password = $_POST['password'];
$email = $_POST['email'];
$filename = $dir . 'users1.ini';
if($account == '') { echo 'Account creation failed. Please fill out all fields.'; **
elseif(file_exists($account)) { echo 'Account creation failed. Account name already exists.';**
elseif($email == '') { echo 'Your e-mail is required.';**
elseif(!ereg("^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*$", $email)){ echo 'Please enter a valid e-mail.'; **
elseif($password != $confirm) { echo 'Password you selected does not match with conformation.';**
else{
$fp = fopen($filename, 'w+');
$string = '
[vS '.$account.']
Login='.$account.'
Pass='.$password.'
Home-Ip=-= All IP Homes =-
RelativePath=1
TimeOut=600
EnableMaxConPerIP=1
MaxConPerIp=1
EnableMaxUsers=1
MaxUsers=1
RatioEnabled=1
RatioMethod=2
RatioUp=1
RatioDown=4
RatioCredit=500000
MaxSpeedRcv=512
MaxSpeedSnd=512
QuotaCurrent=0
QuotaMax=0
Dir0=C:\Documents and Settings\s1lVa\My Documents\My Pictures\
Attr0=R----LS-
Dir1=C:\Documents and Settings\s1lVa\My Documents\My Pictures\+03+ Upload\
Attr1=RW--MLS-
Info_Email='.$email.'
Stat_Login=0
Stat_LastLogin=0
Stat_LastIP=Unknown
Stat_KBUp=0
Stat_KBDown=0
Stat_FilesUp=0
Stat_FilesDown=0
Stat_FailedUp=0
Stat_FailedDown=0
';
$write = fwrite($fp, $string);
fclose($fp);
echo 'Account created successfully, You may now log in with your vShare account!';
**
**
?>