/    Sign up×
Community /Pin to ProfileBookmark

Hey everybody,
I need help! I have a chat on my website, wich is very simple and, you can choose the name you want. Now, I don’t wan’t people hanging around and calling themselves “Admin”, or “Moderator”… So I had an idea: I would need a script, that creates a random number/name, that would look something like this:

[QUOTE]

visitor01, visitor015…

[/QUOTE]

Now, thats easy and I know how to do that, but I want it so that:
Ex: If the Ip adress is 000.00.00.00 , then the visitor name is visitor24 AND CREATES A COOKIE or something so that then on, that ip adress will be called visitor24.
I think it would also be usefull if the script wrote the names (visitor00…) in a file and would check if the random name doesn’t allready exist so trhat two people aren’t called the same.
I hope someonecan help me,

Thanks
Fire Cat

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@ssystemsOct 25.2009 — if you want a unique name server wide based on IP I would rather store it in a database instead. Easier to track uniqueness that way than cookie.

Get the IP address

CHeck if it exist in the db already

- if it exist use the existing username / or name or whatever you call it

- if it doesn't exist assign a unique name (based on what rule you want it to be) and save IP and name
×

Success!

Help @Fire_Cat spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.29,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...