Hello all,
I need help with my php code.
I have a code that when some writes www.domain.com/1.php?name="variable"
The variable is saved into a plain text name.txt
Now i need some help to count the duplicate entries for the name.txt and do something. I tried to find some information but i couldn't find anything.
Example :
The name.txt has this information
line 1 - name1
line 2 - name2
line 3 - name1
line 4 - name3
Now when the php code search the name.txt for the "variable" if it doesn't find it then write the "variable" to name.txt and echo something
if the "variable" is already 1 time then echo something and write the "variable" again to name.txt
if the "variable" is already 2 times in the name.txt then echo something and write the "variable" again in name.txt
if the "variable" is already 3 times then echo something and write the "variable" again in name.txt
if the "variable" is more than 3 times then echo something and dont write anything to name.txt
Anyone can help ?
Thank you.