PHP kodu sorunları

0 Cevap

Nedir bu kod ile yanlış herkes görebilir, tüm dosya izinlerini doğru ama çalıştırıldığında ben sadece hiç hata ile boş bir ekran olsun. I yorumları kutusu ve yorumun verileri kaydetmek için kod eklendi önce çalışıyordu, ama yanlış herhangi bir şey bulamıyorum?

Arka plan: Bu tür izlemek ve takip edilmiştir kaç kez saymak için PHP kodu ile bu web sitesine gidin (? Domain.com t = Q8YH) gibi onları saklanan bir http adresi ile QR kodları.

<?php

error_reporting(E_ALL);
ini_set('display_errors', true);

$tag = $_GET["t"];

$file = "tags/" . $tag . ".txt";

if (file_exists($file)) {

    echo "<p>You found tag: <b>" . $tag . "</b></p>";

    $f1 = fopen($file, 'r');
    $number = fread($f1, 10);
    fclose($f1);

        if (isset($_COOKIE[$tag])) {

        } else {

            $f2 = fopen($file, 'w') or die("ERROR: Can't open file");
            $newnumber = $number + 1;
            fwrite($f2, $newnumber);
            fclose($f2);
            setcookie($tag, "TAG", time()+3);

            $logfile = "tags/logs/" . date("Y.m.d");
            $time = time();
            $f3 = fopen($logfile, 'w') or die("ERROR: Can't open file");
            fwrite($f3, "\nTag: " . $tag . " Time: " . $time);
            fclose($f3);

        }

    echo "<p>This TAG has been found <b>" . $number . "</b> times before you.</p>";

        if ($number == 0) {
            echo "<p>You are the first to find this TAG!</p>";

                if(!$_POST) {
                echo "no post";
                } else {

                    $comment = $_POST["comment"];

                    $commentfile = "tags/comments/" . $tag . ".txt";
                    $f4 = fopen($commentfile, 'w') or die("ERROR: Can't open file");
                    fwrite($f4, $comment . "\n\n\n\n");
                    fclose($f4);

                    echo "<br><br>First to find comment";
                    echo "<br><form action="index.php" method="post">Comment:<textarea type="text" name="comment" lenght="50" ROWS="10" COLS="50"></TEXTAREA><br><input type="submit" /></form>";

                }

        } else {

            $filecomment = "tags/comments/" . $tag . ".txt";

                if (file_exists($filecomment)) {

                    $f5 = fopen($filecomment, 'r');
                    $commentread = fread($f5, 10);
                    fclose($f5);

                    echo "<br><br>";
                    echo "First to Tag comment: " . $commentread;
        }

}

}

?>

0 Cevap