This is a discussion on "[SOLVED] Session data problem" within the PHP Forum section. This forum, and the thread "[SOLVED] Session data problem are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
[SOLVED] Session data problem
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
|||
|
[SOLVED] Session data problem
Hello all!
I have created a php page called your_account.php ! Now once the registered user logs in successfully they are transfered to the page mentioned above & there data information is automatically loaded from the database into the your_account page! Now everythink is working fine the data is loading into the page fine, the problem i have is the persons data who registered first seems to load even when anouher user logs in with a diffrent password & username! So no matter which registered user logs in, the same user data loads. The data that continuesly loads no matter who loags in is the first persons data who registered on the site! Very confusing .................................................. .................................................. ....... I have used session code found below and i have a feeling that if a seesion starts when someone logs in, the session is meant to terminate once they leave the site, i think my code is possibly incomplete, could anyone offer any advice?? Cheers.. Below is the session code:
Thanks |
|
|
|
||||
|
Re: Session data problem
Hi longstand,
The length of a session is variable based on many things. The php.ini file can determine how long the session lasts for. The defaults is that the session cookie will remain valid until the user closes their browser. Not when a user leaves your site. This allows them to go backwards and forwards during an internet "session" without having to log in again. If you want to boot the user after they leave your site you would have to put a time limit in your php code. Say, if the user hasn't been active for 10 minutes, then they are booted and not considered logged in anymore.
Last Blog Entry: The wannabe juggler's quest (Oct 27th, 2007)
|
|
|||
|
Re: Session data problem
Hello Rakuli!!!
Thanks for this, will give it a try, Take care mate, Oh yer look cool in yer christmas hat |
|
|||
|
Re: Session data problem
Hello again mate!
That code you passed me didnt work, i got the folowing errors: Parse error: syntax error, unexpected T_VARIABLE in C:\xampp\htdocs\Only4Stars\your_account.php on line 111 The error appears to be on this line: $_SESSION['last_active'] = time(); // reset the last active time Any suggestions Cheers! |
|
||||
|
Re: Session data problem
The line before that is missing a semi colon
Last Blog Entry: The wannabe juggler's quest (Oct 27th, 2007)
|
|
|||
|
Re: Session data problem
Thanks mate!!!
It appears that its not the session data thats causing the problem, i used record sets & dragged & dropped the bindings were i wanted the profile data to display on the form & it works but only by displaying the first registered users data, any other users who logs in seems to see only the the profile from the first line of my database... Am unsure whats causing the problems really, Is it becuase i dragged and dropped bindings?? Maybe my profile page needs to be hand coded without using dreamweavers in built functionality?? Or is using the bindings in the way mentioned above ok, and it really is the session data?? I just dont know?? Any ideas or advise would be cool cheers.. |
|
|||
|
Re: Session data problem
Hello everyone, i havent had much look with solving my problem, so instead of attaching a php file with a huge amount of code, i have through together some forms to help me explain my problem better:
First i created a signup registration form, and it works just fine, see code below:
Below is my working database file called dbfinal -- MySQL Administrator dump 1.4 -- -- ------------------------------------------------------ -- Server version 5.0.45-community-nt /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; -- -- Create schema dbfinal -- CREATE DATABASE IF NOT EXISTS dbfinal; USE dbfinal; -- -- Definition of table `tbl_area` -- DROP TABLE IF EXISTS `tbl_area`; CREATE TABLE `tbl_area` ( `areaid` int(10) unsigned NOT NULL auto_increment, `areaname` varchar(45) collate latin1_general_ci NOT NULL, PRIMARY KEY (`areaid`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci; -- -- Dumping data for table `tbl_area` -- /*!40000 ALTER TABLE `tbl_area` DISABLE KEYS */; /*!40000 ALTER TABLE `tbl_area` ENABLE KEYS */; -- -- Definition of table `tbl_user` -- DROP TABLE IF EXISTS `tbl_user`; CREATE TABLE `tbl_user` ( `userid` int(10) unsigned NOT NULL auto_increment, `username` varchar(45) collate latin1_general_ci NOT NULL, `useraddress` varchar(45) collate latin1_general_ci NOT NULL, `userlogin` varchar(45) collate latin1_general_ci NOT NULL, `userpassword` varchar(45) collate latin1_general_ci NOT NULL, `userarea` varchar(45) collate latin1_general_ci NOT NULL, PRIMARY KEY USING BTREE (`userid`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci; -- -- Dumping data for table `tbl_user` -- /*!40000 ALTER TABLE `tbl_user` DISABLE KEYS */; /*!40000 ALTER TABLE `tbl_user` ENABLE KEYS */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; |
|
||||
|
Re: Session data problem
What data do you need to display?
And the data is from the tbl_user table right?
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
|
|
|||
|
Re: Session data problem
The data is from the tbl_user table & i need the data from the coloumns: username, useraddress, & usercity to display in the your_account.php page once the user has logged in.
The login system works & links the user who has succesfully logged in to the your_account.php page. In the your_account.php page you will notice there is a table, the table is were i wnat the logged in users data to display.. So say like joe bloggs logs in i would like his data from the database to automatically show in the your_account.php page & dissapear once they leave the site.. Cheers Alex |
|
||||
|
Re: Session data problem
I think I know what you are getting at.
Try something like this.
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
|
|
|||
|
Re: Session data problem
I had mo luck with that mate, but thanks for trying anyway bud!!
Am still convinced it can be done using bindings, but i think maybe my rsRecords need the "were clause" adding!! Take Care fella |
|
||||
|
Re: Session data problem
Did you get an errors?
Try this one and see if you get a mysql error - it may just be SQL syntax
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
|