Hi!
I use a php/lua script to let my users register on my ftp server and this script includes a set expiry date. And now i wanna create a form that lets users extend their expiry date by x days.
Here is the registration script
I dont know php or lua very well so any help to create a expiry date extend form would be appreciated.
Regards Joel
I use a php/lua script to let my users register on my ftp server and this script includes a set expiry date. And now i wanna create a form that lets users extend their expiry date by x days.
Here is the registration script
Code:
[COLOR=#2E8B57][FONT=Monaco]<html>[/FONT][/COLOR]
[COLOR=#2E8B57][FONT=Monaco]<head>[/FONT][/COLOR]
[COLOR=#2E8B57][FONT=Monaco]</head>[/FONT][/COLOR]
[COLOR=#2E8B57][FONT=Monaco]<body>[/FONT][/COLOR]
[COLOR=#2E8B57][FONT=Monaco]<?[/FONT][/COLOR]
[COLOR=#2E8B57][FONT=Monaco] //Formular-Variablen abholen[/FONT][/COLOR]
[COLOR=#2E8B57][FONT=Monaco] $i_days = isset($_POST["i_days"]) ? $_POST["i_days"] : 0;[/FONT][/COLOR]
[COLOR=#2E8B57][FONT=Monaco] if ($i_days > 0) {[/FONT][/COLOR]
[COLOR=#2E8B57][FONT=Monaco] //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>[/FONT][/COLOR]
[COLOR=#2E8B57][FONT=Monaco] // Variablen setzen[/FONT][/COLOR]
[COLOR=#2E8B57][FONT=Monaco] $s_server = 'yourserver:5466'; //Servername & Port des Adminzugangs[/FONT][/COLOR]
[COLOR=#2E8B57][FONT=Monaco] $s_admin = 'admin'; //Account mit Administratorberechtigung[/FONT][/COLOR]
[COLOR=#2E8B57][FONT=Monaco] $s_adminpwd = 'adminpassword'; //Passwort[/FONT][/COLOR]
[COLOR=#2E8B57][FONT=Monaco] $s_domain = 'yourdomain'; //Auf dem WFTPServer eingerichtete Domne[/FONT][/COLOR]
[COLOR=#2E8B57][FONT=Monaco] $s_rootdir = '/data01/tmp_users/'; //Root Verzeichnis (darin wird jeweils ein Verzeichnis mit dem Usernamen erstellt)[/FONT][/COLOR]
[COLOR=#2E8B57][FONT=Monaco] $s_group = 'tmp_users'; //Gruppe des neuen Users (Leerlassen falls keine gewnscht)[/FONT][/COLOR]
[COLOR=#2E8B57][FONT=Monaco] $s_prefix = 'tmp_'; //Prefix fr den Usernamen[/FONT][/COLOR]
[COLOR=#2E8B57][FONT=Monaco] //<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<[/FONT][/COLOR]
[COLOR=#2E8B57][FONT=Monaco] $b_read = 'true';[/FONT][/COLOR]
[COLOR=#2E8B57][FONT=Monaco] $b_write = 'true';[/FONT][/COLOR]
[COLOR=#2E8B57][FONT=Monaco] $b_delete = 'true';[/FONT][/COLOR]
[COLOR=#2E8B57][FONT=Monaco] /* Uncomment this part to have the option to set permissions[/FONT][/COLOR]
[COLOR=#2E8B57][FONT=Monaco] $b_read = isset($_POST["b_read"]) ? $_POST["b_read"] : 'false';[/FONT][/COLOR]
[COLOR=#2E8B57][FONT=Monaco] $b_write = isset($_POST["b_write"]) ? $_POST["b_write"] : 'false';[/FONT][/COLOR]
[COLOR=#2E8B57][FONT=Monaco] $b_delete = isset($_POST["b_delete"]) ? $_POST["b_delete"] : 'false';*/[/FONT][/COLOR]
[COLOR=#2E8B57][FONT=Monaco] $expire_stamp = time() + ($i_days * 24 * 60 * 60); //Ablaufzeitpunkt setzen[/FONT][/COLOR]
[COLOR=#2E8B57][FONT=Monaco] $expire_date = date('Y-m-d H:i:s', $expire_stamp); //Ablaufzeitpunkt setzen[/FONT][/COLOR]
[COLOR=#2E8B57][FONT=Monaco] $strUrl = "ADMINURL"; //URL zusammen setzen[/FONT][/COLOR]
[COLOR=#2E8B57][FONT=Monaco] $strUrlParam = "?admin=".$s_admin."&pass=".$s_adminpwd."&cmd="; //URL zusammen setzen[/FONT][/COLOR]
[COLOR=#2E8B57][FONT=Monaco] $username = $s_prefix.date('Ymd', $expire_stamp).mt_rand(0,9999); //account name (prefix tmp_ / Ablaufdatum / 4-stellige Zufallszahl)[/FONT][/COLOR]
[COLOR=#2E8B57][FONT=Monaco] $password = mt_rand(); //account password[/FONT][/COLOR]
[COLOR=#2E8B57][FONT=Monaco] $homedir = $s_rootdir.$username; //home directory[/FONT][/COLOR]
[COLOR=#2E8B57][FONT=Monaco] //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>[/FONT][/COLOR]
[COLOR=#2E8B57][FONT=Monaco] //LUA Script erstellen[/FONT][/COLOR]
[COLOR=#2E8B57][FONT=Monaco] //Userverzeichnis erstellen[/FONT][/COLOR]
[COLOR=#2E8B57][FONT=Monaco] $strLuaScript = "c_MkDir('".$homedir."')";[/FONT][/COLOR]
[COLOR=#2E8B57][FONT=Monaco] //temporren User erstellen[/FONT][/COLOR]
[COLOR=#2E8B57][FONT=Monaco] // Parameternummern: 7 10 15 20 25 30 35 40 45 48[/FONT][/COLOR]
[COLOR=#2E8B57][FONT=Monaco] $strLuaScript .= "c_AddUser('".$s_domain."','".$username."',md5('".$password."'),63,1,1, '', '', '', '', '', '', '', '', 0, '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', {{'".$s_group."'}}, '', '', '', '', '', '', '', '', '', 1,'".$expire_date."', '', '')";[/FONT][/COLOR]
[COLOR=#2E8B57][FONT=Monaco] // User-Verzeichnis mit entsprechenden Berechtigungen setzen[/FONT][/COLOR]
[COLOR=#2E8B57][FONT=Monaco] $strLuaScript .= "c_AddUserDirectory('".$s_domain."','".$username."','".$homedir."','/',true,".$b_read.",".$b_write.",".$b_write.",".$b_delete.",".$b_read.",".$b_write.",".$b_delete.",".$b_write.")";[/FONT][/COLOR]
[COLOR=#2E8B57][FONT=Monaco] //<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<[/FONT][/COLOR]
[COLOR=#2E8B57][FONT=Monaco] //LUA Script ausfhren[/FONT][/COLOR]
[COLOR=#2E8B57][FONT=Monaco] $strResult = file_get_contents($strUrl.$strUrlParam.rawurlencode($strLuaScript));[/FONT][/COLOR]
[COLOR=#2E8B57][FONT=Monaco] //echo $strLuaScript;[/FONT][/COLOR]
[COLOR=#2E8B57][FONT=Monaco] echo 'Username: '.$username.'<br>'.[/FONT][/COLOR]
[COLOR=#2E8B57][FONT=Monaco] 'Password: '.$password.'<br>'.[/FONT][/COLOR]
[COLOR=#2E8B57][FONT=Monaco] 'Expires: '.$expire_date.'<br><br>';[/FONT][/COLOR]
[COLOR=#2E8B57][FONT=Monaco] echo '<a href='.$PHP_SELF.'>Zurueck</a>';[/FONT][/COLOR]
[COLOR=#2E8B57][FONT=Monaco] }[/FONT][/COLOR]
[COLOR=#2E8B57][FONT=Monaco] else {[/FONT][/COLOR]
[COLOR=#2E8B57][FONT=Monaco] ?>[/FONT][/COLOR]
[COLOR=#2E8B57][FONT=Monaco] <h1>Neuen temporären User-Account generieren</h1>[/FONT][/COLOR]
[COLOR=#2E8B57][FONT=Monaco] <form method="post" action="<?=$PHP_SELF; ?>">[/FONT][/COLOR]
[COLOR=#2E8B57][FONT=Monaco] <p>Gültigkeit <select name="i_days">[/FONT][/COLOR]
[COLOR=#2E8B57][FONT=Monaco] <option value="1">1 Tag</option>[/FONT][/COLOR]
[COLOR=#2E8B57][FONT=Monaco] <option value="2">2 Tage</option>[/FONT][/COLOR]
[COLOR=#2E8B57][FONT=Monaco] <option value="5">5 Tage</option>[/FONT][/COLOR]
[COLOR=#2E8B57][FONT=Monaco] <option value="10">10 Tage</option>[/FONT][/COLOR]
[COLOR=#2E8B57][FONT=Monaco] <option value="20">20 Tage</option>[/FONT][/COLOR]
[COLOR=#2E8B57][FONT=Monaco] <option value="30">30 Tage</option>[/FONT][/COLOR]
[COLOR=#2E8B57][FONT=Monaco] </select>[/FONT][/COLOR]
[COLOR=#2E8B57][FONT=Monaco] </p>[/FONT][/COLOR]
[COLOR=#2E8B57][FONT=Monaco] <!-- Uncomment this part to have the option to set permissions[/FONT][/COLOR]
[COLOR=#2E8B57][FONT=Monaco] <p>[/FONT][/COLOR]
[COLOR=#2E8B57][FONT=Monaco] <input type="checkbox" name="b_read" value="true"> Leseberechtigung<br>[/FONT][/COLOR]
[COLOR=#2E8B57][FONT=Monaco] <input type="checkbox" name="b_write" value="true"> Schreibberechtigung<br>[/FONT][/COLOR]
[COLOR=#2E8B57][FONT=Monaco] <input type="checkbox" name="b_delete" value="true"> Löschberechtigung<br>[/FONT][/COLOR]
[COLOR=#2E8B57][FONT=Monaco] </p> -->[/FONT][/COLOR]
[COLOR=#2E8B57][FONT=Monaco] <input type="submit" value="Los geht's">[/FONT][/COLOR]
[COLOR=#2E8B57][FONT=Monaco] </form>[/FONT][/COLOR]
[COLOR=#2E8B57][FONT=Monaco] <?[/FONT][/COLOR]
[COLOR=#2E8B57][FONT=Monaco] }[/FONT][/COLOR]
[COLOR=#2E8B57][FONT=Monaco] ?>[/FONT][/COLOR]
[COLOR=#2E8B57][FONT=Monaco]</body>[/FONT][/COLOR]
[COLOR=#2E8B57][FONT=Monaco]</html>[/FONT][/COLOR]
I dont know php or lua very well so any help to create a expiry date extend form would be appreciated.
Regards Joel