Skip to content

Тоолуур

November 1, 2006

Вэбсофт Монгол ХХК-ын вэб боловсруулах программын эх кодыг та бүхэнд танилцуулж байна
function pageCounter($hel) {
 if($hel==”en”)  $data = “../count.txt”;
 else $data = “count.txt”;
    $file = fopen($data,”r+”); 
    $count = fread($file, filesize($data)); 
    fclose($file);
 if(!session_is_registered(“counter”))
    { 
  $counter=”ok”;
  session_register(“counter”);
        $file = fopen($data,”w+”); 
        $count += 1; 
        fputs($file, $count); 
        fclose($file); 
        print $count;
    } else {
        print $count;
    }
 
  }

2 Comments leave one →
  1. tume permalink
    December 25, 2007 2:13 am
  2. tume permalink
    December 25, 2007 2:15 am

    $filename = “counter.txt”;
    $c = file($filename);
    if (!$_SESSION[Count])
    {
    $_SESSION[Count]=1;
    $c[0]+=$_SESSION[Count];
    $fp = fopen($filename,”w”);
    fputs($fp,$c[0]);
    fclose($fp);
    }
    echo “Тоолуур : “.$c[0];

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: