Php/lua

 

Results 1 to 2 of 2
Hi! I use a php/lua script to let my users register on my ftp server ...
  1. #1
    jolleman is offline Newbies
    Join Date
    Feb 2012
    Posts
    7
    Thanks
    1
    Thanked 1 Time in 1 Post

    Default Php/lua

    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
    Code:
    <html>
    <head>
    </head>
    
    <body>
    <?
       //Formular-Variablen abholen
       $i_days = isset($_POST["i_days"]) ? $_POST["i_days"] : 0;
    
       if ($i_days > 0) {
          //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
          // Variablen setzen
          $s_server    = 'yourserver:5466';         //Servername & Port des Adminzugangs
          $s_admin   = 'admin';                  //Account mit Administratorberechtigung
          $s_adminpwd = 'adminpassword';            //Passwort
          $s_domain    = 'yourdomain';               //Auf dem WFTPServer eingerichtete Domäne
          $s_rootdir   = '/data01/tmp_users/';         //Root Verzeichnis (darin wird jeweils ein Verzeichnis mit dem Usernamen erstellt)
          $s_group   = 'tmp_users';               //Gruppe des neuen Users (Leerlassen falls keine gewünscht)
          $s_prefix   = 'tmp_';                  //Prefix für den Usernamen
          //<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    
          $b_read = 'true';
          $b_write = 'true';
          $b_delete = 'true';
          /* Uncomment this part to have the option to set permissions
          $b_read = isset($_POST["b_read"]) ? $_POST["b_read"] : 'false';
          $b_write = isset($_POST["b_write"]) ? $_POST["b_write"] : 'false';
          $b_delete = isset($_POST["b_delete"]) ? $_POST["b_delete"] : 'false';*/
    
    
          $expire_stamp = time() + ($i_days * 24 * 60 * 60);            //Ablaufzeitpunkt setzen
          $expire_date  = date('Y-m-d H:i:s', $expire_stamp);            //Ablaufzeitpunkt setzen
          $strUrl = "ADMINURL";         //URL zusammen setzen
          $strUrlParam = "?admin=".$s_admin."&pass=".$s_adminpwd."&cmd=";   //URL zusammen setzen
          $username = $s_prefix.date('Ymd', $expire_stamp).mt_rand(0,9999);  //account name (prefix tmp_ / Ablaufdatum / 4-stellige Zufallszahl)
           $password = mt_rand();                                 //account password
           $homedir = $s_rootdir.$username;                           //home directory
    
          //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
          //LUA Script erstellen
    
          //Userverzeichnis erstellen
          $strLuaScript = "c_MkDir('".$homedir."')";
          //temporären User erstellen
    
          //                                                Parameternummern:       7           10                  15                 20                  25                  30                  35                           40                  45                        48
          $strLuaScript .= "c_AddUser('".$s_domain."','".$username."',md5('".$password."'),63,1,1, '', '', '', '', '', '', '', '', 0, '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', {{'".$s_group."'}}, '', '', '', '', '', '', '', '', '', 1,'".$expire_date."', '', '')";
    
          // User-Verzeichnis mit entsprechenden Berechtigungen setzen
          $strLuaScript .= "c_AddUserDirectory('".$s_domain."','".$username."','".$homedir."','/',true,".$b_read.",".$b_write.",".$b_write.",".$b_delete.",".$b_read.",".$b_write.",".$b_delete.",".$b_write.")";
          //<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    
    
          //LUA Script ausführen
          $strResult = file_get_contents($strUrl.$strUrlParam.rawurlencode($strLuaScript));
    
          //echo $strLuaScript;
          echo 'Username: '.$username.'<br>'.
              'Password: '.$password.'<br>'.
              'Expires: '.$expire_date.'<br><br>';
          echo '<a href='.$PHP_SELF.'>Zurueck</a>';
    
    
       }
       else {
          ?>
          <h1>Neuen tempor&auml;ren User-Account generieren</h1>
          <form method="post" action="<?=$PHP_SELF; ?>">
             <p>G&uuml;ltigkeit <select name="i_days">
                <option value="1">1 Tag</option>
                <option value="2">2 Tage</option>
                <option value="5">5 Tage</option>
                <option value="10">10 Tage</option>
                <option value="20">20 Tage</option>
                <option value="30">30 Tage</option>
             </select>
             </p>
             <!-- Uncomment this part to have the option to set permissions
             <p>
             <input type="checkbox" name="b_read" value="true"> Leseberechtigung<br>
             <input type="checkbox" name="b_write" value="true"> Schreibberechtigung<br>
             <input type="checkbox" name="b_delete" value="true"> L&ouml;schberechtigung<br>
             </p> -->
             <input type="submit" value="Los geht's">
          </form>
       <?
       }
       ?>
    
    </body>
    </html>

    I dont know php or lua very well so any help to create a expiry date extend form would be appreciated.

    Regards Joel




  2. #2
    alias_unknown is offline Newbies
    Join Date
    Dec 2012
    Posts
    40
    Thanks
    3
    Thanked 4 Times in 4 Posts

    Default Re: Php/lua

    I've never used Lua, but would need to store the expiry date for each user on a database. You could have a seperate page for the expiry form, which has a simple date picker where the user can set their expiry. When the form is posted the date is converted into something that can be stored on the table, then the script above would need to work with the expiry date set on the database table for the current user.

Similar Threads

  1. I need a PHP coder to create a PHP file for me...ASAP..quick money.
    By blackstone37 in forum Hire a Freelancer
    Replies: 2
    Last Post: 10-23-2010, 07:19 PM
  2. Replies: 4
    Last Post: 12-30-2009, 04:40 AM
  3. Replies: 2
    Last Post: 12-29-2009, 06:58 PM
  4. PHP code review... dissection for learning - PHP experts chime in plz!
    By xhanuman in forum Cloaking and Content Generators
    Replies: 1
    Last Post: 11-13-2008, 06:59 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




BlackHatWorld on Twitter BlackHatWorld on FaceBook


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103