Is this login possible?

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
yosuke_
Forum Commoner
Posts: 64
Joined: Tue Apr 13, 2004 12:29 pm

Is this login possible?

Post by yosuke_ »

OK, Im making login form,I have a idea about how to login, but Im not sure if its posible!! I dont want to use cookies so this is hot it wiull work:

User will login into mysite and if username and password will be corect then hes IP will be loged in. I know its sounds stupid but listen. I will have some extra rows in my database like

Loged in and IP loged and when user will login hes IP will be added to IP loged row and in Loged in row will be added value True and it works like this!!

When someone will try to login from other computer to some users accout, if user will be loged in and Loged in row value will be True then someone will not be able to login, becase there are allready user loged in!! Another thing if user will close broser and open it again then he will be loged in because script will check for IP with what user is logged in. And when he will click logoff, the script will update information in Loged in field to false. I know it souds stupid but how can I make users login, logoff and remember users without cookies?? is there any onther login way?? please help me!! im too stipid for this!!! :cry:
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

This is the 4th time i have told you to post in the correct forum.

I won't be telling you again!

Mark
malcolmboston
DevNet Resident
Posts: 1826
Joined: Tue Nov 18, 2003 1:09 pm
Location: Middlesbrough, UK

Re: Is this login possible?

Post by malcolmboston »

yosuke_ wrote:OK, Im making login form,I have a idea about how to login, but Im not sure if its posible!! I dont want to use cookies so this is hot it wiull work:

User will login into mysite and if username and password will be corect then hes IP will be loged in. I know its sounds stupid but listen. I will have some extra rows in my database like

Loged in and IP loged and when user will login hes IP will be added to IP loged row and in Loged in row will be added value True and it works like this!!

When someone will try to login from other computer to some users accout, if user will be loged in and Loged in row value will be True then someone will not be able to login, becase there are allready user loged in!! Another thing if user will close broser and open it again then he will be loged in because script will check for IP with what user is logged in. And when he will click logoff, the script will update information in Loged in field to false. I know it souds stupid but how can I make users login, logoff and remember users without cookies?? is there any onther login way?? please help me!! im too stipid for this!!! :cry:
i asked pretty much the same question a while ago (in the correct forums)

anyway common pitfalls:
1 - what if a user doesnt click logout and closes the browser??? he wont be able to login ever again, you will need to find your own way of doing this im not writing the code out for you

[hint]

timed queries for updating records

[/hint]

its really easy.....
yosuke_
Forum Commoner
Posts: 64
Joined: Tue Apr 13, 2004 12:29 pm

Post by yosuke_ »

Well, the user wont have to login again from the same computer, if thay didnt click logoff, but the problem is this: if user will use some internet caffe and then forgets to logout there will br problems and another problem is if the forgets to logout from safee PC and goes home, he wont be able to login from hes home PC, because he didnt logout from the caffe PC! And your hint meants? Automatic logoff after some time? or it can be logoof after sesson end!! And Im soo sorry about posting this in the wrong forum! I have to post this in code snipets right? thank you!
Last edited by yosuke_ on Mon Apr 19, 2004 1:07 pm, edited 1 time in total.
malcolmboston
DevNet Resident
Posts: 1826
Joined: Tue Nov 18, 2003 1:09 pm
Location: Middlesbrough, UK

Post by malcolmboston »

no, theory and design, you have provided no code so it shouldnt be in this forum
you wrote: And your hint meants? Automatic logoff after some time? or it can be logoof after sesson end!!
try different ways like i said, im not writing it out for you, i get paid for doing that
magicrobotmonkey
Forum Regular
Posts: 888
Joined: Sun Mar 21, 2004 1:09 pm
Location: Cambridge, MA

Post by magicrobotmonkey »

Don't forget most ISPs have dynamic IP's (At least in the US) so even the home computers IP can change! That's why I don't think using the IP like this is generall a very good idea... I mean I could see its use if you are setting up something in an Intranet where different departments were subnetworked or something but out on the net it worries me...
User avatar
JAM
DevNet Resident
Posts: 2101
Joined: Fri Aug 08, 2003 6:53 pm
Location: Sweden
Contact:

Post by JAM »

The automatic logoff hint means...

Say you have a timestamp field in the database. Each time I do something on any page, this field is updated with the current timestamp (you can use time() och MySQL's NOW(), or whatever your flavour might be).

The script also does a:

Code: Select all

DELETE from TABLE where timestampfield <= NOW()-500
(needs rewriting, just pseudo code)

Hence, if I don't log off properly, the above sql query automaticly deletes all records where the timestamp is less than the current one minus 500 seconds.

So if I get home after 500 seconds, I'd be able to log in once again.

Do some searches for "useronline" in this forum and http://www.evilwalrus.com/ for more ideas.
yosuke_
Forum Commoner
Posts: 64
Joined: Tue Apr 13, 2004 12:29 pm

Post by yosuke_ »

The all progblems is with Opera Webbrowser!!! Cookie login/logoff works perfect with IE but when I try to use Opera it hase to be refreshed after logoff and dosnt work sometimes!!! Can you give me tips about how to make login/logoff without cookies?? I dont need no code snippets i just need some tips!! Im a newbie in web programming, so I dont know much about this!! thank you
User avatar
liljester
Forum Contributor
Posts: 400
Joined: Tue May 20, 2003 4:49 pm

Post by liljester »

this doesnt sound like a very good login scheme... have you tried sessions in opera?

dont get me wrong, you should log who tries to login from what ip, but its not a good way to maintain user state (logged in or not).
yosuke_
Forum Commoner
Posts: 64
Joined: Tue Apr 13, 2004 12:29 pm

Post by yosuke_ »

OK, I fill readly dumb!! I know what is global.asa in asp but I have no idea how to use sesons in PHP!!! Sorry
User avatar
liljester
Forum Contributor
Posts: 400
Joined: Tue May 20, 2003 4:49 pm

Post by liljester »

have a look at the sessions tutorial, that may be the route you want to take =)
viewtopic.php?t=6521
yosuke_
Forum Commoner
Posts: 64
Joined: Tue Apr 13, 2004 12:29 pm

Post by yosuke_ »

Thank you very much!!
Post Reply