$PUREFTP_CONFIG_FILE"); $USERARRAY = array(); $raw = file($PUREFTP_CONFIG_FILE); foreach($raw AS $zeile): if(!ereg("^#",$zeile)): #skip comments // Einlesen der einzelnen Zeilen als Variable $tmp = split(" ",trim($zeile)); $var = strtoupper(trim($tmp[0])); for($n=1;$n".mysql_error()); echo '
'; if(!empty($user)) echo ''; else echo ''; echo ''; echo ''; echo ''; if(!empty($user)) { echo ''; echo ''; } else echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
Status Inactive    Active
Delete user ? Yes, i am know exactly what i am doing! (NO UNDO)
Username'.stripslashes($USERARRAY['User']).'
Username
Password
UID
GID
DIR
UL Throttle kb/s
DL Throttle kb/s
IP ACCESS
Type in * for any IP
QuotaSize in MB
Type in 0 for NO VirtualQuota
COMMENT
'; echo '
'; }#end edit elseif($action == "save") { $addnew = addslashes( get_var("addnew") ); $User = addslashes(get_var("requireduser")); $Password = addslashes(get_var("requiredpass")); $Uid = addslashes(get_var("requireduid")); $Gid = addslashes(get_var("requiredgid")); $Dir = addslashes(get_var("requireddir")); $ULThrottle = addslashes(get_var("requiredulthrottle")); $DLThrottle = addslashes(get_var("requireddlthrottle")); $QuotaSize = addslashes(get_var("requiredQuotaSize")); $comment = addslashes(get_var("comment")); $status = addslashes(get_var("status")); $delete = addslashes(get_var("delete")); $ipaccess = addslashes(get_var("requiredipaccess")); if(empty($User) || empty($Password) || empty($Uid) || empty($Gid) || empty($Dir)) DIE("Invalid or missing data entered..."); if(empty($delete)) { if($addnew == False) { $Q = DB_QUERY("UPDATE `$DB_TABLE` SET status='$status',Password='$Password',Uid='$Uid',Gid='$Gid',Dir='$Dir',ULBandwidth='$ULThrottle',DLBandwidth='$DLThrottle',comment='$comment',ipaccess='$ipaccess',QuotaSize='$QuotaSize' WHERE User LIKE '$User' LIMIT 1"); if($Q) echo "\n"; }#end if else{ $Q = DB_QUERY("INSERT INTO `$DB_TABLE` SET User='$User',status='$status',Password='$Password',Uid='$Uid',Gid='$Gid',Dir='$Dir',ULBandwidth='$ULThrottle',DLBandwidth='$DLThrottle',comment='$comment',ipaccess='$ipaccess',QuotaSize='$QuotaSize'"); if($Q) echo "\n"; }#end if }#end if elseif($User && !empty($delete)){#DELETE $Q = DB_QUERY("DELETE FROM `$DB_TABLE` WHERE User LIKE '$User' LIMIT 1"); if($Q) echo "\n"; }#end if echo "\n"; }#end else (save) ###### elseif($action == "ftpwho") { echo ''; exec($FTP_WHO." -s", $ftpresult ); $arraySize = sizeof($ftpresult); $x = 0; echo '
'; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; $x++; EndWhile; echo '
PID'; echo 'user'; echo 'min\'s'; echo 'state'; echo 'file'; echo 'IP'; echo 'current'; echo 'total'; echo '%'; echo 'bw.'; while($x < $arraySize): $ftpwho = $ftpresult[$x]; list($pid, $user, $mins, $state, $file, $host, $port,$h, $current, $total, $percent, $bandwidth ) = explode("|", $ftpwho ); $mins = round($mins / 60); if (empty($file) or !isset($file)) { ( $file = "---" ); ++$ftp_activity; } else { if(strlen($file) > 10) $file_short = substr($file,0,10); $file = "$file_short..."; }#end else $host = gethostbyname($host); echo '
' .$pid. '' .$user. '' .$mins. '' .$state. '' .$file. '' .$host. '' .$current. '' .$total. '' .$percent. '' .$bandwidth. ' kb/s
'; if(!$ftp_activity) echo 'No users currenty using the FTP.
'; echo '

'; echo '
'; }#end else (ftpwho) ###### elseif($action == "info") { ?> sOLARiZ PureFTPd Manager
Version Build
About
    Ok, whats to say about this small script ?
    Not much. The Basic version was written due the need of a simply User management for the PureFTPd Daemon. Now it's more than a simple management script.
History
    \n"; EndForEach; ?>
Thanks to
  • CrowMan for STATUS modification
  • erevo.com for detailed bug reporting
'; echo 'LOGIN'; if($viewpw) echo 'PASSWORD'; echo 'UIDGIDDIRUL/ksDL/ksQuotaIP AccessStatus '; WHILE($R=MYSQL_FETCH_ARRAY($Q)) { echo ''; echo ''.$R['User'].''; if($viewpw) echo ''.$R['Password'].''; echo ''.$R['Uid'].''; echo ''.$R['Gid'].''; echo ''.$R['Dir'].''; if($R['ULBandwidth']) echo ''.$R['ULBandwidth'].''; ELSE echo '-'; if($R['DLBandwidth']) echo ''.$R['DLBandwidth'].''; ELSE echo '-'; if($R['QuotaSize']) echo ''.$R['QuotaSize'].' MB'; ELSE echo '-'; echo ''.$R['ipaccess'].''; if($R['status'] == '0') echo 'inactive'; elseif($R['status'] == '1') echo 'active'; echo ""; echo "\n"; }#end while echo ''; ?> "; // Add User Button ECHO ""; // View Password Button echo ''; if($viewpw) echo ''; ELSE echo ''; ECHO ''; echo ''; // Status Button ECHO ""; // Update Button ECHO ""; echo "
PureFTP User Management.
v written 2002 by sOLARiZ
[Information]
 
"; ######## echo ''; }#end else // SQL Verbindung schliessen DB_CLOSE(); // Seite abschliessen PAGE_FOOTER(); // EOC <--* // Funktionen function PAGE_HEADER() { ?> PuRE FTPD - User Managemant ".mysql_error()); if(!@mysql_select_Db($MYSQLDATABASE)) DIE("Can't establish DB connection.
".mysql_error()); }#end func function DB_CLOSE() { GLOBAL $MYSQLCON; RETURN @mysql_close($MYSQLCON); }#end func function DB_QUERY($sql) { GLOBAL $MYSQLCON,$MYSQLDATABASE; $Q = @MySql_DB_query($MYSQLDATABASE,$sql,$MYSQLCON); if(@mysql_error()) DIE("MySQL Error during Query !

[$sql]
".mysql_error()); return $Q; }#end func function get_var($var){ GLOBAL $$var; GLOBAL $_POST,$_GET,$HTTP_POST_VAR,$HTTP_GET_VAR; $inhalt = $$var; # This function checks if the _GET or _POST var is set or if an old PHP version used if($_POST[$var]) RETURN $_POST[$var]; elseif($HTTP_POST_VAR[$var]) RETURN $HTTP_POST_VAR[$var]; elseif($_GET[$var]) RETURN $_GET[$var]; elseif($HTTP_GET_VAR[$var]) RETURN $HTTP_GET_VAR[$var]; elseif($inhalt) RETURN $inhalt; }#end func ?>