Jump to content

unexpected T_ENDWHILE


CaTaLinU

Recommended Posts

 

 

<?php

    //Directorul unde sa caute

    $director = /Users';

    //Un filtru pentru extensie

    $extensie = 'ini';

     

    //Logare FTP

    $server_ftp      = '93.';

    $utilizator_ftp  = '[email protected]';

    $parola_ftp      = 'x';

    $conexiune        = ftp_connect($server_ftp);

    ftp_login($conexiune,$utilizator_ftp,$parola_ftp) or die('Logarea FTP a esuat!');

    //Setam pe pasiv

    ftp_pasv($conexiune,true);

     

    //Cream lista

    $fisiere = array();

    $fisiere = raw_list('$director');

     

    //Printam rezultatele

    $i=0;

$count=count($fisiere);

    while($i <  $count);

            print ''.$fisiere[$id].'';

              $i++;

    ftp_close($conexiune);

    endwhile;

     

    //Functia raw_list

    function raw_list($folder)

    {

    Global $conexiune;

    Global $extensie;

    Global $fisiere;

    $exntesii = explode(",", $extensie);

    $list    = ftp_rawlist($conexiune, $folder);

    $anzlist  = count($list);

    $i = 0;

    while ($i < $anzlist):

    $split    = preg_split("/[\s]+/", $list[$i], 9, PREG_SPLIT_NO_EMPTY);

    $ItemName = $split[8];

    $endung  = strtolower(substr(strrchr($ItemName,"."),1));

    $path    = "$folder/$ItemName";

    if (substr($list[$i],0,1) === "d" AND substr($ItemName,0,1) != "."):

    raw_list($path);

    elseif (substr($ItemName,0,2) != "._" AND in_array($endung,$extensii)):

    array_push($files, $path);

    endif;

    $i++;

    endwhile;

    return $files;

    }

?>

 

 

 

 

Parse error: syntax error, unexpected T_ENDWHILE in xxxxxxx/vs/conturi.php on line 28

Link to comment
https://forums.phpfreaks.com/topic/256831-unexpected-t_endwhile/
Share on other sites

while should have a colon not semi colon after

<?php
  while($i <  $count):
             print ''.$fisiere[$id].''; 
              $i++; 
     ftp_close($conexiune); 
     endwhile; 
?>

not

<?php
  while($i <  $count);
?>

also

<?php $director = /Users'; ?>

should be

<?php $director = '/Users'; ?>

 

also, wrap your code in code tags (there's a button) it makes it easy to read like mine is.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.