Ikonki systemu windows nie wyswietlaja sie


(Darom82) #1

Czy ktos moze wie jak na mojej stronce: http://www.history.is.net.pl/?download&cat=2&appage=0

Poprawic kod pliku tak, zeby obok ikonki przegladarki wyswietlala sie tez ikonka systemu windows po dodaniu komentarza ?

Bo nie moge sobie z tym poradzic i bardzo prosze o pomoc w tej sprawie.

show.php

<?php


// show.php


// check if argument 'id' is there

if(!isset($_GET['appage']))

{

$id = 'default';

}

else

{

$id = $_GET['cat'].$_GET['appage'];

}


// comment files location

$localization = "data/comments/";

// comment files extensions

$file_extension = ".txt";


// check if file exist, if no create

if (!file_exists($localization.$id.$file_extension))

{

   file_put_contents($localization.$id.$file_extension, '');

   chmod($localization.$id.$file_extension, 0777);

}


// load file to array

$file = file($localization.$id.$file_extension);

// reverse array order

$file = array_reverse($file);


// count number of comments

$number_of_comments = count($file);



?>




<?php


// 


echo "Komentarze ($number_of_comments)

";


// check if there is any comment

if($number_of_comments == 0)

{

   echo "

Brak komentarzy

"; } else { // variable counting loop moves $loop_counter = 1; // loop for each line in file foreach($file as $key => $value) { // load line of file in to '$data' array $data = explode('|||', $value); // load array fields in to variables $comment_data = $data[0]; // $comment_ip = $data[1]; $comment_ua = $data[2]; $comment_nick = $data[3]; $comment_content = $data[4]; // check if it is last loop move if($loop_counter < $number_of_comments) { // echo "
"; echo "
"; } else { echo "
"; } // // show comment // echo "~$comment_nick ($comment_data) napisał:User Agent: \"$comment_ua\"

$comment_content

"; // add '1' to loop counter variable $loop_counter = $loop_counter + 1; } } ? ?php include('./add.php'); // // show.php ?
send.php

Zamieszczanie pustych komentarzy jest zabronione.

Kliknij Tutaj, aby wrócić do komentarzy

"); $nick = (empty($nickTestowy))? "Anonymous" : str_replace("\r\n", " ", htmlspecialchars(trim($_POST['nick']))) ; $comment = str_replace("\r\n", " ", htmlspecialchars(trim($_POST['comment']))); // // Check - end // // // COOKIE - start // // Simple anti-spam solution // cookie name $cookie_name = 'comment'; // cookie value $cookie_value = '1'; // when cookie will expire // 60 seconds $cookie_expire = time()+60; // setcookie(name, value, expire, path, domain); // check if there is cookie now if (isset($_COOKIE[$cookie_name])) { // show information to wait before adding next comment echo "

Dodano Twój komentarz.

Kliknij Tutaj, aby wrócić do komentarzy

"; die(); } $date_and_time = date("d.m.Y H:i"); // user identification $user_ip = $_SERVER['REMOTE_ADDR']; list($useragent,$ua_name,$ua_version,$user_os,$ua_pattern)=array_values(getBrowser()); // place between content in flat-file $PLACE = '|||'; // end of the line in flat-file $line_end = "\n"; // exported line to flat-file $result = $date_and_time.$PLACE.$user_ip.$PLACE.$ua_name.$PLACE.$nick.$PLACE.$comment.$line_end; // directory and name of flat-file $file = $localization.$id.$file_extension; // opening flat-file in 'add' mode $file_handle = fopen($file, "a"); // write '$result' in to the flat-file fwrite ($file_handle, $result); // close the flat file and report result if(fclose($file_handle)) { // COOKIE // create cookie file to protect against spam setcookie($cookie_name, $cookie_value, $cookie_expire); // STATUS // show that comment was sucessfully added echo "

Dodano Twój komentarz.

Kliknij Tutaj, aby wrócić do komentarzy

"; } else { // show that there was an error while adding comment echo "

Wystąpił błąd podczas dodawania komentarza, spróbuj następnym razem.

Kliknij Tutaj, aby wrócić do komentarzy

"; } // send.php ?

?php

function getBrowser()

{

    $u_agent = $_SERVER['HTTP_USER_AGENT'];

    $bname = 'Unknown';

    $platform = 'Unknown';

    $version= "";


    //First get the platform?

    if (preg_match('/linux/i', $u_agent)) {

        $platform = 'linux';

    }

    elseif (preg_match('/macintosh|mac os x/i', $u_agent)) {

        $platform = 'mac';

    }

    elseif (preg_match('/windows|win32/i', $u_agent)) {

        $platform = 'windows';

    }


    // Next get the name of the useragent yes seperately and for good reason

    if(preg_match('/MSIE/i',$u_agent) !preg_match('/Opera/i',$u_agent))

    {

        $bname = 'Internet Explorer';

        $ub = "MSIE";

    }

    elseif(preg_match('/Firefox/i',$u_agent))

    {

        $bname = 'Mozilla Firefox';

        $ub = "Firefox";

    }

    elseif(preg_match('/Chrome/i',$u_agent))

    {

        $bname = 'Google Chrome';

        $ub = "Chrome";

    }

    elseif(preg_match('/Safari/i',$u_agent))

    {

        $bname = 'Apple Safari';

        $ub = "Safari";

    }

    elseif(preg_match('/Opera/i',$u_agent))

    {

        $bname = 'Opera';

        $ub = "Opera";

    }

    elseif(preg_match('/Netscape/i',$u_agent))

    {

        $bname = 'Netscape';

        $ub = "Netscape";

    }


    // finally get the correct version number

    $known = array('Version', $ub, 'other');

    $pattern = '#(?' . join('|', $known) .

    ')[/]+(?[0-9.|a-zA-Z.]*)#';

    if (!preg_match_all($pattern, $u_agent, $matches)) {

        // we have no matching number just continue

    }


    // see how many we have

    $i = count($matches['browser']);

    if ($i != 1) {

        //we will have two since we are not using 'other' argument yet

        //see if version is before or after the name

        if (strripos($u_agent,"Version") strripos($u_agent,$ub)){

            $version= $matches['version'][0];

        }

        else {

            $version= $matches['version'][1];

        }

    }

    else {

        $version= $matches['version'][0];

    }


    // check if we have a number

    if ($version==null || $version=="") {$version="?";}


    return array(

        'userAgent' = $u_agent,

        'name' = $bname,

        'version' = $version,

        'platform' = $platform,

        'pattern' = $pattern

    );

}


// send.php


// check if argument 'id' is there

if(empty($_GET['id']))

{

$id = 'default';

}

else

{

$id = $_GET['id'];

}


// comment files location

$localization = "data/comments/";

// comment files extensions

$file_extension = ".txt";


//

// Comment content - start

//


// change HTML special chars in to properly (safe) form

// protect beware sending code via comments

$nickTestowy = preg_replace("/(\s+)/","",htmlspecialchars($_POST['nick']));

$wpisTestowy = preg_replace("/(\s+)/","",htmlspecialchars($_POST['comment']));


//

// Comment content - end

//


//

// Check - start

//


// Simple solution to don't publish empty comments


if(empty($wpisTestowy))

   die("

(Grzesie K) #2

W send.php zmień:

$result = $date_and_time.$PLACE.$user_ip.$PLACE.$ua_name.$PLACE.$nick.$PLACE.$comment.$line_end

na:

$result = $date_and_time.$PLACE.$user_ip.$PLACE.$ua_name.$PLACE.$user_os.$PLACE.$nick.$PLACE.$comment.$line_end

a w show.php

$data = explode('|||', $value);


      // load array fields in to variables

      $comment_data = $data[0];

      // $comment_ip = $data[1];

      $comment_ua = $data[2];

      $comment_nick = $data[3];   

      $comment_content = $data[4];

na

$data = explode('|||', $value);

list( $comment_data, $comment_ip,$comment_ua,$comment_os,$comment_nick,$comment_content)=$data;

oraz

echo "~$comment_nick ($comment_data) napisał:

User Agent:

$comment_content

";[/code]


(Darom82) #3

Grzesie1k nie działa coś bo podczas dodania komentarza wyrzuca błąd:

Parse error: syntax error, unexpected T_VARIABLE in /home/users/history/public_html/send.php on line 190

W gruncie rzeczy komentarz nie zostaje dodany wogole :frowning: Pozatym przy komentarzu ktory juz jest tutaj: http://www.history.is.net.pl/?download&cat=2&appage=0Chyba tak nie powinno byc :frowning: Tam gdzie pisze "testowy_nick" powinna byc ikonka systemu windows z informacja o systemie. A tam gdzie pisze "testowy_komentarz" powinno pisac: testowy_nick W tym polu jasno niebieskim powinno pisac: "trestowy komentarz" Wiec nie działa mi to :frowning: Mozesz mi jakos pomoc w tym ? send.php

<?php

function getBrowser()

{

    $u_agent = $_SERVER['HTTP_USER_AGENT'];

    $bname = 'Unknown';

    $platform = 'Unknown';

    $version= "";


    //First get the platform?

    if (preg_match('/linux/i', $u_agent)) {

        $platform = 'linux';

    }

    elseif (preg_match('/macintosh|mac os x/i', $u_agent)) {

        $platform = 'mac';

    }

    elseif (preg_match('/windows|win32/i', $u_agent)) {

        $platform = 'windows';

    }


    // Next get the name of the useragent yes seperately and for good reason

    if(preg_match('/MSIE/i',$u_agent) && !preg_match('/Opera/i',$u_agent))

    {

        $bname = 'Internet Explorer';

        $ub = "MSIE";

    }

    elseif(preg_match('/Firefox/i',$u_agent))

    {

        $bname = 'Mozilla Firefox';

        $ub = "Firefox";

    }

    elseif(preg_match('/Chrome/i',$u_agent))

    {

        $bname = 'Google Chrome';

        $ub = "Chrome";

    }

    elseif(preg_match('/Safari/i',$u_agent))

    {

        $bname = 'Apple Safari';

        $ub = "Safari";

    }

    elseif(preg_match('/Opera/i',$u_agent))

    {

        $bname = 'Opera';

        $ub = "Opera";

    }

    elseif(preg_match('/Netscape/i',$u_agent))

    {

        $bname = 'Netscape';

        $ub = "Netscape";

    }


    // finally get the correct version number

    $known = array('Version', $ub, 'other');

    $pattern = '#(?' . join('|', $known) .

    ')[/]+(?[0-9.|a-zA-Z.]*)#';

    if (!preg_match_all($pattern, $u_agent, $matches)) {

        // we have no matching number just continue

    }


    // see how many we have

    $i = count($matches['browser']);

    if ($i != 1) {

        //we will have two since we are not using 'other' argument yet

        //see if version is before or after the name

        if (strripos($u_agent,"Version") < strripos($u_agent,$ub)){

            $version= $matches['version'][0];

        }

        else {

            $version= $matches['version'][1];

        }

    }

    else {

        $version= $matches['version'][0];

    }


    // check if we have a number

    if ($version==null || $version=="") {$version="?";}


    return array(

        'userAgent' => $u_agent,

        'name' => $bname,

        'version' => $version,

        'platform' => $platform,

        'pattern' => $pattern

    );

}


// send.php


// check if argument 'id' is there

if(empty($_GET['id']))

{

$id = 'default';

}

else

{

$id = $_GET['id'];

}


// comment files location

$localization = "data/comments/";

// comment files extensions

$file_extension = ".txt";


//

// Comment content - start

//


// change HTML special chars in to properly (safe) form

// protect beware sending code via comments

$nickTestowy = preg_replace("/(\s+)/","",htmlspecialchars($_POST['nick']));

$wpisTestowy = preg_replace("/(\s+)/","",htmlspecialchars($_POST['comment']));


//

// Comment content - end

//


//

// Check - start

//


// Simple solution to don't publish empty comments


if(empty($wpisTestowy))

   die("

Zamieszczanie pustych komentarzy jest zabronione.

Kliknij Tutaj, aby wrócić do komentarzy

"); $nick = (empty($nickTestowy))? "Anonymous" : str_replace("\r\n", " ", htmlspecialchars(trim($_POST['nick']))) ; $comment = str_replace("\r\n", " ", htmlspecialchars(trim($_POST['comment']))); // // Check - end // // // COOKIE - start // // Simple anti-spam solution // cookie name $cookie_name = 'comment'; // cookie value $cookie_value = '1'; // when cookie will expire // 60 seconds $cookie_expire = time()+60; // setcookie(name, value, expire, path, domain); // check if there is cookie now if (isset($_COOKIE[$cookie_name])) { // show information to wait before adding next comment echo "

Dodano Twój komentarz.

Kliknij Tutaj, aby wrócić do komentarzy

"; die(); } $date_and_time = date("d.m.Y H:i"); // user identification $user_ip = $_SERVER['REMOTE_ADDR']; list($useragent,$ua_name,$ua_version,$user_os,$ua_pattern)=array_values(getBrowser()); // place between content in flat-file $PLACE = '|||'; // end of the line in flat-file $line_end = "\n"; // exported line to flat-file $result = $date_and_time.$PLACE.$user_ip.$PLACE.$ua_name.$PLACE.$user_os.$PLACE.$nick.$PLACE.$comment.$line_end // directory and name of flat-file $file = $localization.$id.$file_extension; // opening flat-file in 'add' mode $file_handle = fopen($file, "a"); // write '$result' in to the flat-file fwrite ($file_handle, $result); // close the flat file and report result if(fclose($file_handle)) { // COOKIE // create cookie file to protect against spam setcookie($cookie_name, $cookie_value, $cookie_expire); // STATUS // show that comment was sucessfully added echo "

Dodano Twój komentarz.

Kliknij Tutaj, aby wrócić do komentarzy

"; } else { // show that there was an error while adding comment echo "

Wystąpił błąd podczas dodawania komentarza, spróbuj następnym razem.

Kliknij Tutaj, aby wrócić do komentarzy

"; } // send.php ?>[/code] [b]show.php[/b]
[code]<?php // show.php // check if argument 'id' is there if(!isset($_GET['appage'])) { $id = 'default'; } else { $id = $_GET['cat'].$_GET['appage']; } // comment files location $localization = "data/comments/"; // comment files extensions $file_extension = ".txt"; // check if file exist, if no create if (!file_exists($localization.$id.$file_extension)) { file_put_contents($localization.$id.$file_extension, ''); chmod($localization.$id.$file_extension, 0777); } // load file to array $file = file($localization.$id.$file_extension); // reverse array order $file = array_reverse($file); // count number of comments $number_of_comments = count($file); ?> <?php // echo "Komentarze ($number_of_comments) "; // check if there is any comment if($number_of_comments == 0) { echo "

Brak komentarzy

"; } else { // variable counting loop moves $loop_counter = 1; // loop for each line in file foreach($file as $key => $value) { // load line of file in to '$data' array $data = explode('|||', $value); list( $comment_data, $comment_ip,$comment_ua,$comment_os,$comment_nick,$comment_content)=$data; // check if it is last loop move if($loop_counter < $number_of_comments) { // echo "
"; echo "
"; } else { echo "
"; } // // show comment // echo "~$comment_nick ($comment_data) napisał:User Agent: \"$comment_ua\"

$comment_content

"; // add '1' to loop counter variable $loop_counter = $loop_counter + 1; } } ? ?php include('./add.php'); // // show.php ?