You are on page 1of 7

BLUE

BELT
… OnlyKiosk Coding …
A challenge:
Can you write a program that can
record how many times a page has
been clicked/ refreshed?
Hint:
if(), file_exists(), fgets(),
$counter++
OnlyKiosk.com
1.Get started;
2.After getting started;

OnlyKiosk.com
1.If the web page has never been clicked before, the file
doesn’t need to exist;
2.After the web page has been clicked more than once, we
need to create a file to do the recording;
3.We do the ++ right after the web page has been clicked
and then echo the new recording number;

OnlyKiosk.com
OnlyKiosk.com
1. read the old value first;
2. echo old value++;
3. fopen();
4. fwrite(); // write the new
value
5. fclose();

OnlyKiosk.com
OnlyKiosk.com

You might also like