Jump to content


2 problems with my PHP user system


1 reply to this topic

#1 Tubby

    Young Padawan

  • Members
  • Pip
  • 24 posts

Posted 19 July 2005 - 11:06 AM

Hey

I only have moderate PHP knowledge, so I'm not sure if these problems are common/ easy to solve etc.

1. I have a sessions problem, in that when I put the $user variable in my code, it works when they're redirected to my home page. So It'll say "thanks for logging in johnsmith". But as soon as they go on any other page on my site, it goes wrong and says "thanks for logging in 1119125401|3|ellen|eb399bcaca686f8609137153307eecf1|Ellen|ellen's email address here|0|0||1119180517||". 'Ellen' being the first user in the database. I have the session start at the top of every page, and any help would be appreciated.

2. I had the code a long time ago to make it so when a user selected a check box, it would keep them logged in if they closed their window or computer down. I no longer have the code for some reason, and was wondering if someone could give it to me. I'm fairly sure it was one line of coding that fit into here somewhere:

"$username = htmlspecialchars($_POST['username']);
$password = htmlspecialchars($_POST['password']);
$check = mysql_query("SELECT * FROM members WHERE username='$username' AND password='$password'");"

I've named the checkbox remember, so I think it starts with $remember =, but I'm not sure.


I know you'll need to see some page codes, so just ask when/ if they're needed. Thanks in advance

#2 rc69

    PHP Master PD

  • P2L Staff
  • PipPipPipPip
  • 3,827 posts
  • Gender:Male
  • Location:Here
  • Interests:Web Development

Posted 19 July 2005 - 12:12 PM

honestly, i've never heard of that error. It could be a problem with the way you're carring the session_id over to the next page. But that wouldn't explain why "ellen" would come up (unless you're using a database to carry the session).

For the remember thing, search php.net for set_cookie, and then show us the code for how you're carring the id over.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users