this_end_up
11-27-2007, 07:20 PM
Hello,
I would like to combine a few different PHP scripts to create one solution...maybe you guys can help.
I want to start out with a counter script, to count the visits on a single page. Now, instead of "echoing/displaying" a number, I would like it to echo/display a snippet of text based on the number/visitor...
I already have a code to count the visits...it is a "write to" a text file.
But what I want to do is to use the "$fgets" to read the last character/number in the text file. If that number is a five (5) or a zero (0), then I would like to display/echo a message, if it isn't either a 5 or 0, then I would like to display/echo a different message.
So for example: If a visitor lands on the page, and the counter senses that he is visitor number 235, then it will display a message like "great for visiting", but when the next person lands on the page, and is number 236, then a message that will be diplayed will be "thank you."
I have all of the code, such as the counter and the if/then, but I am having trouble with reading the last number/character of the text file. Because the text file will always expand, from single digit for number 1-9 up to say 5 digits for the 10,000 - 99,999, how can I create a script to read the last digit...
Thanks.
I would like to combine a few different PHP scripts to create one solution...maybe you guys can help.
I want to start out with a counter script, to count the visits on a single page. Now, instead of "echoing/displaying" a number, I would like it to echo/display a snippet of text based on the number/visitor...
I already have a code to count the visits...it is a "write to" a text file.
But what I want to do is to use the "$fgets" to read the last character/number in the text file. If that number is a five (5) or a zero (0), then I would like to display/echo a message, if it isn't either a 5 or 0, then I would like to display/echo a different message.
So for example: If a visitor lands on the page, and the counter senses that he is visitor number 235, then it will display a message like "great for visiting", but when the next person lands on the page, and is number 236, then a message that will be diplayed will be "thank you."
I have all of the code, such as the counter and the if/then, but I am having trouble with reading the last number/character of the text file. Because the text file will always expand, from single digit for number 1-9 up to say 5 digits for the 10,000 - 99,999, how can I create a script to read the last digit...
Thanks.