Newbee here
I wounder if it possibel to change text in tabel.
If a user arrives to my site I want to display "hello friend!"
second time I want to dispay "A friend in need is a friend in deed"
or something.
How do I do this ?
Dynamic change of contens
Moderator: General Moderators
-
thegreatone2176
- Forum Contributor
- Posts: 102
- Joined: Sun Jul 11, 2004 1:27 pm
- IceMetalPunk
- Forum Commoner
- Posts: 71
- Joined: Thu Jul 07, 2005 11:45 am
Dale, what if the user clears his cookies? Then every time he clears his cookies, he will get the same 1st visit message. The best way is to write a PHP file that writes a text file on the server. In this file have something like this:
Of course, the IPs would be real IPs of the people that have logged in. When someone registers, add their IP to the list with a 0 after it. When they visit the site, read the text file. Explode it at every line break (\n for linux, \r\n (the are is supposed to be the lower-case letter)), then split those at the -. Go through the array and find the IP that matches the user's. Then go to the index 1 of that array index, and get the number. If it's 0, echo the 1st-time visitor message and change it to 1. Otherwise, echo the normal message.
-IMP

Code: Select all
127.0.0.1-0
157.0.0.1-1
147.0.0.1-0
197.0.0.1-1-IMP
- IceMetalPunk
- Forum Commoner
- Posts: 71
- Joined: Thu Jul 07, 2005 11:45 am
Whatismyip is often hailed as some miraculous thing.. its over-rated. It does *not* see my home computer's ip address, which goes through a gateway machine. It does *not* see my work computer ip address, which goes through a proxy.IceMetalPunk wrote:That I'm not sure about... I think it might, though.... after all, most routers have proxies for protection, yet whatismyip.com uses PHP to get the correct IP address, and that works.
-IMP![]()
It only sees what the proxies LET it see, and if the user is using a gateway, or coming from a work address, it wont get the right IP.
I've said it before, and I'll say it hundreds of times again.. IP != user. Never has, never will. Its completely unreliable.
Not to mention, a TEXT file?? google or aol hits and that text file will grow to megs of text, and be unparse-able in any reasonable amount of time. Thats what databases are built for.