cooldude832 Posted September 7, 2007 Share Posted September 7, 2007 Is there a way without code <?php session_start();?> ontop of each page to get that affect? Link to comment https://forums.phpfreaks.com/topic/68302-auto-session_start/ Share on other sites More sharing options...
teng84 Posted September 7, 2007 Share Posted September 7, 2007 nope i guess session start need to be declared on each page because it acts like a basket where the value of that session is being fetch Link to comment https://forums.phpfreaks.com/topic/68302-auto-session_start/#findComment-343415 Share on other sites More sharing options...
Liquid Fire Posted September 7, 2007 Share Posted September 7, 2007 just include it is a header or config(or any file that is including in every file. I have it in a class and i have the class created in my config file on my own framework. Link to comment https://forums.phpfreaks.com/topic/68302-auto-session_start/#findComment-343416 Share on other sites More sharing options...
teng84 Posted September 7, 2007 Share Posted September 7, 2007 just include it is a header or config(or any file that is including in every file. I have it in a class and i have the class created in my config file on my own framework. including is same as declaring session start! Link to comment https://forums.phpfreaks.com/topic/68302-auto-session_start/#findComment-343420 Share on other sites More sharing options...
cooldude832 Posted September 7, 2007 Author Share Posted September 7, 2007 Is there a way to setup in .htaccess a script to run on everypage. I know there has to be a way because my stats have to do something. Link to comment https://forums.phpfreaks.com/topic/68302-auto-session_start/#findComment-343425 Share on other sites More sharing options...
teng84 Posted September 7, 2007 Share Posted September 7, 2007 i haven't heard something like that have you tried cookie Link to comment https://forums.phpfreaks.com/topic/68302-auto-session_start/#findComment-343426 Share on other sites More sharing options...
cooldude832 Posted September 7, 2007 Author Share Posted September 7, 2007 cookies? that has nothing to do with this. Link to comment https://forums.phpfreaks.com/topic/68302-auto-session_start/#findComment-343427 Share on other sites More sharing options...
teng84 Posted September 7, 2007 Share Posted September 7, 2007 yes, but the way i know session it should always be declared hmm i dont think htaccess can do this Link to comment https://forums.phpfreaks.com/topic/68302-auto-session_start/#findComment-343429 Share on other sites More sharing options...
cooldude832 Posted September 7, 2007 Author Share Posted September 7, 2007 Then how do all my site statistics work because they track stats on each page being hit, unless apache returns that data somehow. Link to comment https://forums.phpfreaks.com/topic/68302-auto-session_start/#findComment-343431 Share on other sites More sharing options...
teng84 Posted September 7, 2007 Share Posted September 7, 2007 DB? Link to comment https://forums.phpfreaks.com/topic/68302-auto-session_start/#findComment-343432 Share on other sites More sharing options...
trq Posted September 7, 2007 Share Posted September 7, 2007 Is there a way without code <?php session_start();?> ontop of each page to get that affect? Yes. See the session.auto_start directive within your php.ini Is there a way to setup in .htaccess a script to run on everypage. .htaccess is parsed upon every request to the directory containing the .htaccess file. Then how do all my site statistics work because they track stats on each page being hit, unless apache returns that data somehow. Most stat programs query the Apache logs. Link to comment https://forums.phpfreaks.com/topic/68302-auto-session_start/#findComment-343439 Share on other sites More sharing options...
cooldude832 Posted September 7, 2007 Author Share Posted September 7, 2007 Is that an issue, if everyone who visits the site will need sessions to do anything, setting it to auto start that is. Link to comment https://forums.phpfreaks.com/topic/68302-auto-session_start/#findComment-343440 Share on other sites More sharing options...
btherl Posted September 7, 2007 Share Posted September 7, 2007 Is that an issue, if everyone who visits the site will need sessions to do anything, setting it to auto start that is. That depends on your site. If you have a lot of traffic on pages that don't use sessions, then you're probably better off starting them explicitly on those pages which do need them. Link to comment https://forums.phpfreaks.com/topic/68302-auto-session_start/#findComment-343444 Share on other sites More sharing options...
cooldude832 Posted September 7, 2007 Author Share Posted September 7, 2007 well since you can't do anything on my site, except login/register without sessions then i think auto_start will be the right move also it is anonying because there is no right way to do <?php session_start(); ?> without violating w3 compliance. Link to comment https://forums.phpfreaks.com/topic/68302-auto-session_start/#findComment-343446 Share on other sites More sharing options...
trq Posted September 7, 2007 Share Posted September 7, 2007 there is no right way to do <?php session_start(); ?> without violating w3 compliance. What on earth are you talking about? Link to comment https://forums.phpfreaks.com/topic/68302-auto-session_start/#findComment-343449 Share on other sites More sharing options...
cooldude832 Posted September 7, 2007 Author Share Posted September 7, 2007 okay if i have a doc following xhtml stricness you can't have text in the prolouge, but if the <?php session_start(); ?> is placed after the doc type decleartion it says error header already sent Link to comment https://forums.phpfreaks.com/topic/68302-auto-session_start/#findComment-343450 Share on other sites More sharing options...
trq Posted September 7, 2007 Share Posted September 7, 2007 Place it beforehand, it doesn't output anything. Link to comment https://forums.phpfreaks.com/topic/68302-auto-session_start/#findComment-343456 Share on other sites More sharing options...
cooldude832 Posted September 7, 2007 Author Share Posted September 7, 2007 so like <?php session_start(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> That technically isn't compliance because it be in the prolouge of the file or <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <?php sesion_start(); ?> //Declare some headers via <html lang="en"> or some other method ?> that does work but i have gotten header's already sent errors with this Link to comment https://forums.phpfreaks.com/topic/68302-auto-session_start/#findComment-343462 Share on other sites More sharing options...
btherl Posted September 7, 2007 Share Posted September 7, 2007 It IS in compliance, because php code is not part of the document. It's part of the php source script. Link to comment https://forums.phpfreaks.com/topic/68302-auto-session_start/#findComment-343463 Share on other sites More sharing options...
cooldude832 Posted September 7, 2007 Author Share Posted September 7, 2007 That makes sense and I'll agree, but nether less their tester still gives prolouge errors. Link to comment https://forums.phpfreaks.com/topic/68302-auto-session_start/#findComment-343464 Share on other sites More sharing options...
trq Posted September 7, 2007 Share Posted September 7, 2007 That makes sense and I'll agree, but nether less their tester still gives prolouge errors. BS. Link to comment https://forums.phpfreaks.com/topic/68302-auto-session_start/#findComment-343467 Share on other sites More sharing options...
cooldude832 Posted September 7, 2007 Author Share Posted September 7, 2007 I've gotten errors using the upload a file version not the insert a url on the validator on w3 (I assume you are familiar with it). I'm sure they address this issue in the consornoium and declare that scripting of anything preprocessor can exist pre the doc type as long as it doesn't produce any output. Link to comment https://forums.phpfreaks.com/topic/68302-auto-session_start/#findComment-343471 Share on other sites More sharing options...
trq Posted September 7, 2007 Share Posted September 7, 2007 I've gotten errors using the upload a file version The upload file version expects html, xhtml documents of pure markup. I doubt it would be expecting any php script which won't end up in the output. Link to comment https://forums.phpfreaks.com/topic/68302-auto-session_start/#findComment-343477 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.