Login Help

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Smackie
Forum Contributor
Posts: 302
Joined: Sat Jan 29, 2005 2:33 pm

Login Help

Post by Smackie »

Can someone help me or point me to a tutorial that can help me?

Basicly i have a login script ok and i want to make it where users can't login with the same name while they already logged on with a session if that make since..

if not basicly if a user logs in and tries either getting on a different username or there name again it will tell them they can't login..

now is this possible?

Thank you
Smackie
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Post by superdezign »

Just... Make it so that if they're logged in, the login pages displays "You are already logged in" rather than a login form.

Or... have I read your question incorrectly?
Smackie
Forum Contributor
Posts: 302
Joined: Sat Jan 29, 2005 2:33 pm

Post by Smackie »

you read my post wrong i want it so that users can't login double time..
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

No, SD got your question right then. If they are logged in, don't even give them the option of seeing the login form. And to protect yourself on the server-side, if the page loads and the user is logged, header() redirect them to another page so their is no chance that they will ever be able to see the login form or the processing page in an attempt to login twice.
Smackie
Forum Contributor
Posts: 302
Joined: Sat Jan 29, 2005 2:33 pm

Post by Smackie »

not really because i can login and then open another page up and login again with a different username i mean im using sessions and stuff but still for some reason i can login with more then 1 user name
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

That is going to be nearly impossible to enforce unless you rely on IP address, which is unreliable at best.

PS I thought you meant log in with the same username. Why would you want to keep someone from logging in with two different identities at the same time?
Smackie
Forum Contributor
Posts: 302
Joined: Sat Jan 29, 2005 2:33 pm

Post by Smackie »

Well Im creating a game and i down want them playing 2 or more chars at the same time i dont care if they have 2 or more chars just as long as they play one at a time
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Post by superdezign »

So, you mean someone like, logging in on Firefox, then logging in again on Internet Explorer or Opera? (I always put FF first :-p)

The best that you could do is create a cookie (are they cross-browser?), or program your game somewhere other than a web browser.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

Cookies are not cross browser.
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Post by superdezign »

Everah wrote:Cookies are not cross browser.
Yeah, web development is very dependent of browsers, We are at the mercy of Mozilla, Opera, and Microsoft when we program and if they don't support something, there's not much that we can do about it other than attempt to fake it.

You don't see many complex in-browser games unless they are programmed through some other medium such as Flash, Java, or Shockwave.
nyfael
Forum Commoner
Posts: 32
Joined: Thu Sep 21, 2006 2:28 am

Post by nyfael »

If you don't mind them having several characters you should make all the characters belong to one account, and then only let the account be logged into from 1 computer a time.

Trying to stop someone from being on 2 at once without them belonging to the same account is going to be very hard otherwise.

-Kerry
Post Reply