1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

unexpected end at line xx

Discussion in 'PHP & Perl' started by jolleman, Dec 17, 2012.

  1. jolleman

    jolleman Newbie

    Joined:
    Feb 11, 2012
    Messages:
    7
    Likes Received:
    1
    Hi i think im going crazy with this. Ive found a perfect lua script for my wing ftp server but it doesnt work due to the error "unexpected end at line xx and im starting to get mad because i cant find anything wrong with this, no missing brackets or anything. The script is the one below this text. Any help would be appreciated. Regards Joel

    Code:
    <html>
    <head>
    </head>
    <body>
    <?php
       //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 = "admin.html";         //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>
    
     
  2. olystyle

    olystyle Regular Member

    Joined:
    Jan 6, 2012
    Messages:
    238
    Likes Received:
    103
    Hi jolleman

    wich line is it? xx doesn't help that much...

    cheers olystyle
     
  3. jazzc

    jazzc Moderator Staff Member Moderator Jr. VIP

    Joined:
    Jan 27, 2009
    Messages:
    2,468
    Likes Received:
    10,148
    Change
    Code:
    <?
     
    to

    Code:
    <?php
    
    5 lines before the end.
     
    • Thanks Thanks x 2
  4. jolleman

    jolleman Newbie

    Joined:
    Feb 11, 2012
    Messages:
    7
    Likes Received:
    1
    TY will test this when i get home. It was on line 91.


    Regards Joel
     
  5. jolleman

    jolleman Newbie

    Joined:
    Feb 11, 2012
    Messages:
    7
    Likes Received:
    1
    Thanks it worked:)
     
    • Thanks Thanks x 1