mysql data loads once user login

This is a discussion on "mysql data loads once user login" within the PHP Forum section. This forum, and the thread "mysql data loads once user login are both part of the Program Your Website category.



 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Program Your Website > PHP Forum

Notices


Reply
 
LinkBack Thread Tools
  #1  
Old Feb 5th, 2008, 20:37
Reputable Member
Join Date: Oct 2007
Location: Liverpool UK
Age: 29
Posts: 217
Thanks: 0
Thanked 0 Times in 0 Posts
mysql data loads once user login

Am not looking for code or examples just advice!!! I desire to load a users data from a database once they successfully login to my website.

How shall i manage this?? Possibly use a cookie?? Or maybe session??

Here is the setup, a user logs in & is directed to a page that is setup to display there data from the mysql database!! Any answers or advice would be great!!!

I have managed this before with Rakuli's great help & it does work but has a few problems...

Please help!

Thanks.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old Feb 5th, 2008, 20:46
alexgeek's Avatar
Moderator

SuperMember
Join Date: Jul 2007
Location: Webforumz 24/7
Age: 15
Posts: 3,812
Blog Entries: 9
Thanks: 2
Thanked 2 Times in 2 Posts
Re: mysql data loads once user login

Sessions would be the best option.
Make sure it's secure though.
I will find a great article for you in a minute, it has tips for securing sessions.
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old Feb 5th, 2008, 20:49
Reputable Member
Join Date: Oct 2007
Location: Liverpool UK
Age: 29
Posts: 217
Thanks: 0
Thanked 0 Times in 0 Posts
Re: mysql data loads once user login

Hey Alex, how you bin???

Long time no hear mate

Thanks for the repley!!! Sessions it is then... Look forward to the article!!!

You still eating kebabs
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old Feb 5th, 2008, 20:51
masonbarge's Avatar
Highly Reputable Member
Join Date: Jan 2006
Location: Atlanta GA
Posts: 631
Thanks: 0
Thanked 0 Times in 0 Posts
Re: mysql data loads once user login

Either way works great. You can give them a choice about whether or not to set a permanent cookie and bypass the login screen.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5  
Old Feb 5th, 2008, 20:53
Reputable Member
Join Date: Oct 2007
Location: Liverpool UK
Age: 29
Posts: 217
Thanks: 0
Thanked 0 Times in 0 Posts
Re: mysql data loads once user login

Thanks mate!!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6  
Old Feb 5th, 2008, 21:01
Reputable Member
Join Date: Oct 2007
Location: Liverpool UK
Age: 29
Posts: 217
Thanks: 0
Thanked 0 Times in 0 Posts
Re: mysql data loads once user login

Recently i succesfully created my edit accounts page with file upload!!! When the user is logged in there data automatically appears in the edit account page ussing this code:

PHP: Select all

// check if session exists and assing it to a variable
if (!isset($_SESSION)) {
 
session_start();
}
// we can populate the session MM_Username because it is a unique identifier
if (isset($_SESSION['MM_Username'])) {
 
$username $_SESSION['MM_Username'];

It does not seem to work for me when on my profile page, the user data is not automatically loaded into the profile even with the session code above... Is there any specific reason for this??
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #7  
Old Feb 5th, 2008, 21:02
alexgeek's Avatar
Moderator

SuperMember
Join Date: Jul 2007
Location: Webforumz 24/7
Age: 15
Posts: 3,812
Blog Entries: 9
Thanks: 2
Thanked 2 Times in 2 Posts
Re: mysql data loads once user login

Well I can't find the exact one because I don't have time, but here's one and there's plenty of other stuff on sessions on that blog, it's pretty good!
And yes, I love a good kebab
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #8  
Old Feb 5th, 2008, 21:03
alexgeek's Avatar
Moderator

SuperMember
Join Date: Jul 2007
Location: Webforumz 24/7
Age: 15
Posts: 3,812
Blog Entries: 9
Thanks: 2
Thanked 2 Times in 2 Posts
Re: mysql data loads once user login

Quote:
Originally Posted by longstand View Post
Recently i succesfully created my edit accounts page with file upload!!! When the user is logged in there data automatically appears in the edit account page ussing this code:

PHP: Select all

// check if session exists and assing it to a variable
if (!isset($_SESSION)) {
 
session_start();
}
// we can populate the session MM_Username because it is a unique identifier
if (isset($_SESSION['MM_Username'])) {
 
$username $_SESSION['MM_Username'];

It does not seem to work for me when on my profile page, the user data is not automatically loaded into the profile even with the session code above... Is there any specific reason for this??
What do you have stored in the session?
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #9  
Old Feb 6th, 2008, 02:18
Rakuli's Avatar
SuperMember

SuperMember
Join Date: Sep 2007
Location: Australia
Age: 24
Posts: 956
Blog Entries: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Re: mysql data loads once user login

The exclamation mark has never felt so needed as in your posts Longstand!

The reason that your user data isn't loading up when you store it in the session is the way that you have the accounts.php set up. When you go to accounts.php it is expecting the query string to be something like accounts.php?id=1... it needs you to send the $_GET variable so the script can load up the passed ID.

If you are storing thne user's ID in the session, you need to attach ?id=[userIdHere] for any link you have to the profile page.

Either that, or, within the accounts.php page, have it use the stored session ID if the $_GET variable is not set.
Last Blog Entry: The wannabe juggler's quest (Oct 27th, 2007)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #10  
Old Feb 7th, 2008, 07:10
Reputable Member
Join Date: Oct 2007
Location: Liverpool UK
Age: 29
Posts: 217
Thanks: 0
Thanked 0 Times in 0 Posts
Re: mysql data loads once user login

Thanks guys!!! I will try that.. That code you done for me Rakuli worked the last time you helped, and did solve the problem but i kepy getting error messages saying i had two user login sessions set up....


So i had to try and change it.. Al try out that: ?id=[userIdHere !! And try and solve the problem!!!

Thanks for the help... Am sure i will solve the today
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
User login or anonymous? alexgeek Website Planning 6 Jan 22nd, 2008 05:51
[SOLVED] Dispaly User Data Once Logged In longstand PHP Forum 2 Nov 21st, 2007 20:16
user login security question tnikolov Starting Out 5 May 7th, 2007 17:46
User login by ASP.net redkyna ASP.NET Forum 3 Aug 9th, 2004 09:36
Filter data based on user (MSSQL) Webforumz Staff Databases 4 Sep 19th, 2003 05:48


All times are GMT. The time now is 09:59.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42