1.11M Members

PHP login script under progress... Consultation needed

 
0
 

Hi! I've been trying to work on with my very own PHP login script(PHP+MySQL). Managed to get the login part work with cookies. Is there a better way to do it? I was wondering if HTML5 gives a new point of view in building a login system..

But so far I have also a problem. How can I prevent an inlogged user not to see the actual login page.(in this case login.php which contains the login form, which gives all login data to takelogin.php) I tried making a PHP script in the top of login.php: when an inlogged person hits url ..../login.php, it first checks if there is allready a cookie registered with his username. If there is, then it redirects to user home page. If there's not, login.php loads completly.

That idea didn't turn out well. Or I just couldn't figure it out in right way. So can someone consultate me with this? :)

 
0
 

Your idea should work just fine. Perhaps there was just an error in your code somewhere.

Am not quite sure what you are expecting from HTML5 to do differently.

 
0
 

Thanks for your reply, pritaeas! :) It was a good advice to look back to code i've been writing. Actually it works now! As you said idea works just fine. I did a minor mistake with marking. Instead of doing it like this

if (isset($_COOKIE['username']))

it should be written like this

if (isset($_COOKIE["username"]))

So as a statement IT SEEMS TO WORK NOW! THANKS!


For the HTML5 question, I am totaly new with it. Just read an article about it and there was something said HTML5 has an ability to store data etc... So I thougt if that could replace somehow MySQL as a storage of data.

 
0
 

Glad you got it working, but both statements should be working identical. I think you must've change something else.

 
0
 

Ouh... Then, you're probably right. I may have misspelled or something. After all, I'm happy it works now, and also about how fast you can get help from here! DaniWeb rulez! ;)

You
This article has been dead for over six months: Start a new discussion instead
Post:
Start New Discussion
View similar articles that have also been tagged: