Hi, now that my site is populated i cant just quickly sneak a peak at the session or post like i used to with live customers on the site.
So im wanting to learn how to print_r to a file rather than to the browser, that way i can troubleshoot without interferring with members visits.
If i cant get this working right i will come back and let you all know whats up, but i dont want to just come here first, i want to figure it out or try like heck to figure out the issue im having with the session.
More later if i hit a dead end.
Hope i can learn how to do a file rather than a browser display so i can start on this troubleshooting, thanks.
...but that would add up to a lot of files in a short amount of time if it's a popular site. On the other hand, overwriting would have you missing out on a lot of data as each hit would wipe the previous data.
i cant just quickly sneak a peak at the session or post like i used to with live customers on the site.
durangod... yes you can. As always, php can do almost anything.. including storing session data to a database instead of a file. That then means you can (in your admin panel) pull out session data and make adjustments to it / see whats in it.
Run this in phpmyadmins SQL page:
CREATE TABLE `sessions` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`session` varchar(42) NOT NULL,
`data` text NOT NULL,
`created` int(11) NOT NULL,
`modified` int(10) unsigned NOT NULL DEFAULT '0',
`closed` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=260 DEFAULT CHARSET=utf8
Now, here is sessions.class.php:
// the following prevents unexpected effects when using objects as save handlers
Now here is the way to handle a session in a script:
include('sessions.class.php'); //Note you need mysql connection for this
You're a smart guy, you'll see how to modify the table to link it to your users accounts. Then once thats done you can simply use your admin pages to inspect / change the session data and put it back into the database using serialize and unserialize functions.
Of course if you really want... you can always use code to open each users session file on the disk instead... but that really is a bit more complex.
Very nice tango thanks so much, above and beyond the call of duty, thanks for that. And thanks for the compliment i am proud of some of the things i have done and things i have overcome but then again i have those days where i feel like a third grader trying to figure out how to use a calculater lol...
Such as my current issue as to why if using sessions which is suppose to be a superglobal and should be available anywhere in the script. Then why when i do
$_SESSION['AdminArea'] = 'online';
does it not show up when i look at $_SESSION, its driven me nuts lol... but ill figure it out eventually, hopefully before all my hair is gone lol