Results 1 to 6 of 6

Thread: Can you explain this?

Threaded View

  1. #1

    Thread Starter
    Admodistrator |2eM!x's Avatar
    Join Date
    Jan 2005
    Posts
    3,900

    Can you explain this?

    Okay, i found this good php script:

    PHP Code:
    <?php
    $countfilename 
    "VisitorCount.txt";
    $whattoread = @fopen($countfilename"r") or die("Error opening count file");
    $contents fread($whattoreadfilesize($countfilename));
    fclose($whattoread);

    $contents = ($contents 1);

    $whattoread = @fopen($countfilename"w") or die("Error opening count file1");
    @
    fwrite($whattoread$contents) or die("Error with addition");

    fclose($whattoread);
    echo 
    $contents;
    ?>
    works like a charm..great job..what im wondering is if i can have an explanation for what it all does?

    you dont have to explain like in depth, just like $countfilename, and all those and there arguments...anything you see fit..

    thanks alot


    **edit
    im beginning to understand alot, this isnt so hard, at all!!

    heres what ive figured out in the last 5 minutes:

    Everything with a $ is a string, not a fixed variable(what i mean is, to open a file i dont have to type $whattoread =, it can be $readfile =

    $whattoread = @fopen($filename, "r") or die("Error opening count file");
    means that it should "r"ead the file, on error say ("Error opening count file")--dont really understand what die does though

    and that you can add to strings: echo $contents, " Visitors"

    other help = good
    Last edited by visualAd; May 2nd, 2005 at 06:05 PM. Reason: bizarre request :\

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width