• 31-10-2018, 13:51:48
    #1
    Selamlar ,
    ornek.txt içerisindeki veriler şöyle listeleniyor ;

    ornek.txt;

    |01.11.2018|Windows7|OK|demo@gmail.com

    * Asıl sorum ise satır sonundaki email olan satırları listeletmek istiyorum.
    yani satır sonundaki email ile $kullanici['email']; ile uyuşuyorsa ekrana yazdırmak istiyorum.


    aşağıda örnek kod mevcut

    $datamiz = file("Config/loglar.abb");
    
    foreach($datamiz AS $cekbaris)
    {
    $zerdi = explode("|", $cekbaris);
    if($zerdi[4] == $kullanici['email'])
    {
    echo $zerdi[4]; // veriler boş
    }
    }
  • 31-10-2018, 13:59:21
    #2
    Üyeliği durduruldu
    <?php
    // Get a file into an array.  In this example we'll go through HTTP to get
    // the HTML source of a URL.
    $lines = file('http://www.example.com/');
    
    // Loop through our array, show HTML source as HTML source; and line numbers too.
    foreach ($lines as $line_num => $line) {
        echo "Line #<b>{$line_num}</b> : " . htmlspecialchars($line) . "<br />n";
    }
    
    // Another example, let's get a web page into a string.  See also file_get_contents().
    $html = implode('', file('http://www.example.com/'));
    
    // Using the optional flags parameter since PHP 5
    $trimmed = file('somefile.txt', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
    ?>
    #line count -1$myFile = "4-24-11.txt";$lines = file($myFile);//file in to an arrayecho $lines[1]; //line 2
  • 31-10-2018, 19:54:45
    #3
    oxcakmak adlı üyeden alıntı: mesajı görüntüle
    <?php
    // Get a file into an array.  In this example we'll go through HTTP to get
    // the HTML source of a URL.
    $lines = file('http://www.example.com/');
    
    // Loop through our array, show HTML source as HTML source; and line numbers too.
    foreach ($lines as $line_num => $line) {
        echo "Line #<b>{$line_num}</b> : " . htmlspecialchars($line) . "<br />n";
    }
    
    // Another example, let's get a web page into a string.  See also file_get_contents().
    $html = implode('', file('http://www.example.com/'));
    
    // Using the optional flags parameter since PHP 5
    $trimmed = file('somefile.txt', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
    ?>
    #line count -1$myFile = "4-24-11.txt";$lines = file($myFile);//file in to an arrayecho $lines[1]; //line 2

    Hocam Aşağıdaki kodda ne sıkıntı olabilir? foreach içinde exit kullandığım zaman toplam sayıyı 1 olarak çıkartıyor.
    
    $lines = file("deneme.txt");
    $ttlAmount = 0;
    foreach ($lines as $line_num => $line) {
    if(preg_match_all('/('.$musteri['email'].')/', $line)) {
    
    $ttlAmount =+ $line_num;
    
    //    echo "Line #<b>{$line_num}</b> : <br />";
     if($ttlAmount>8){
    echo '<div class="alert alert-danger"> '.$ttlAmount.' Maksimum Limite Ulaşıldı...</div>';
    exit;
     }
    }
    }
  • 31-10-2018, 19:58:17
    #4
    Üyeliği durduruldu
    anydesk ile bakalım senin sorununa.
  • 01-11-2018, 06:28:23
    #5
    o kod böyle yazılmaz abicim, anydesk vs. bir işiniz de yok, fgets ile dosyayı satır satır okuyarak while döngüsü içine bir if atıp strpos ile kıyas yapacaksın, explode ıvır zıvır da lüzumsuz şeyler
  • 02-11-2018, 10:20:53
    #6
    Dracos adlı üyeden alıntı: mesajı görüntüle
    o kod böyle yazılmaz abicim, anydesk vs. bir işiniz de yok, fgets ile dosyayı satır satır okuyarak while döngüsü içine bir if atıp strpos ile kıyas yapacaksın, explode ıvır zıvır da lüzumsuz şeyler
    tesekkurler hocam. while fget ile hallettim