[PHP] Re: session problem
I don't normally have problem with using session functions on the Win2000 Server using IIS 5. It work pretty well. You may will want to narrow down the problem and find out if it is a session problem only or if it is something else. I don't use some of the IIS patches like the IIS Lockdown as an example because some of those patches prevent hte PHP function from working. IIS is so filled with holes that I had to use hte firewall. "Supra" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hi, > > I got serious problem I need to solve a.s.a.p. > Well, I've developed a database application with PHP and MySql, I used > sessions. > While developing I used my own computer as a web server - Windows 2000 Pro, > IIS 5, PHP 4.2.3 via ISAPI. And all my code was tested successfully while my > computer is the server and the client. Now after moving the sources to the > server (Windows 2000 Advanced Server) and exporting the MySql database to > the server, the application fail. While debugging I got to a firm conclusion > that the sessions doesn't work well. I copied the php.ini to the system root > on the server and it still doesn't work. > > Please advice me what to do in order to make the application work on the > server. > > Thanks I advance, > > Supra > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Session problem
> I am using session_start() and > session_register("variablename") . The when I click on > the back button from the browser it shows me the > following error: "Warning: Page has Expired The page > you requested was created using information you > submitted in a form. This page is no longer available. > As a security precaution, Internet Explorer does not > automatically resubmit your information for you. To > resubmit your information and view this Web page, > click the Refresh button. " That has nothing to do with your sessions. It has to do something with forms in HTML. If you use the POST method for forms, then the page will expire if you don't resubmit the values. You can also read that in the text. You cannot change this behaviour, because your browser does this for you. To force the browser to resubmit the values, you have to push the Refresh button. You won't get this behaviour if the form is submitted with the GET method, because the variables are then part of the URL (and thus automatically submitted if you push the back button) HTH Erwin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Session problem
All you have to do is to call session_name("EmailSess"); session_start(); in rest of pages. BTW: You don't really need to call session_name() "Manisha" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I am facing so many problems - first file lock and now for session - I > still could not understand how to get the session value in another page. I > am very new to PHP. I tried many many ways to get it > > Actually I want to store ID in a session and want to get back this ID in > rest pages. Can you give me one by one step to do it. > > > First page - > > session_name("EmailSess"); > session_start(); > $ID = "1"; > session_register("ID"); > > > - > > How to get back this ID in another pages ? > > Please help, I am stuck > > Manisha > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: session problem?
I have the same problem... I thought it was for a different reason... If you got a solution please email me !!! "Bob" <[EMAIL PROTECTED]> escribió en el mensaje [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > 1.php?2.php > session_start(); session_start(); > .. .. > $_SESSION['a'] =$a;echo $_SESSION['a']; > $_SESSION['b'] =$b; echo $_SESSION['b']; > header("location: 2.php"); > > there is an warning: undefined index a ,b. > > > after change > > 1.php 2.php > session_start(); session_start(); > .. .. > $_SESSION['a'] =$a;echo $_SESSION['a']; > $_SESSION['b'] =$b; echo $_SESSION['b']; > go on > > it works well? > why? > > > thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Session problem
> Warning: Cannot send session cache limiter - headers already sent > (output started at /path/to/my/little/session.inc:9) in > /path/to/my/little/session.inc on line 10 this means that there is output before session_start() was called. look at your include files, and make sure that there is no whitespace before the first at the end. "Torkil Johnsen" <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I get this errormessage when trying to make my logon work: > > Warning: Cannot send session cache limiter - headers already sent > (output started at /path/to/my/little/session.inc:9) in > /path/to/my/little/session.inc on line 10 > > line 10 contains: session_start(); > > > It does however seem like I am "logged in", becase at the bottom of my page, > my logout button is appearing. (which it is only supposed to do if > "session_is_registered(session_id)" > > When clickign the logout button I get this message: > Warning: Trying to destroy uninitialized session in > /path/to/my/little/session.inc on line 37 > > Where line 37 says:session_destroy(); > > Anyone...? > Anyone have any links to any really good php session examples? I have read > quite a few of them now... > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Session Problem
Register the variable whether it exists or not. \n"; ?> -- WARNING [EMAIL PROTECTED] address is an endangered species -- Use [EMAIL PROTECTED] Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm - Original Message - From: Lawrence Sheed <[EMAIL PROTECTED]> Newsgroups: php.general To: <[EMAIL PROTECTED]> Sent: Thursday, August 23, 2001 9:41 PM Subject: Session Problem > I can't get session variables to work > > I know this has been done to death in the past, but I've looked on php.net, > and google for a solution, have tried the suggestions, and seem to fix it. > > My php session settings are as follows: > > Name Local Global settings > session.auto_start Off Off > session.cache_expire 180 180 > session.cache_limiter nocache nocache > session.cookie_domain no value no value > session.cookie_lifetime 0 0 > session.cookie_path / / > session.entropy_file no value no value > session.entropy_length 0 0 > session.gc_maxlifetime 1440 1440 > session.gc_probability 1 1 > session.name PHPSESSID PHPSESSID > session.referer_check no value no value > session.save_handler files files > session.save_path /tmp /tmp > session.serialize_handler php php > session.use_cookies On On > > The code I'm using to test is as follows: > > session_start(); > > echo "COUNT{$count}"; > if (!isset($count)) { > echo "registering session"; > session_register($count); > $count=1; > } > else { > $count++; > echo $count; > } > ?> > > The output is as follows: > > COUNTregistering session > > Refreshing shows the same output > > My /tmp directory exists and has the following permissions. > drwxrwxrwt 3 root root 4096 Aug 24 10:40 tmp > > > What should I be looking for? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: Session problem
I've fixed the problem. I don't know why, but suddenly windows prevents PHP from writing into C:\windows\temp directory. Moving the session and log files to another directory solved the problem. Until few days ago it worked. I've now to discovered what was changed in windows configuration. ""Walter Caielli"" ha scritto nel messaggio news:bd.40.31041.b7a60...@pb1.pair.com... > I'm facing the following basic problem: > > I have made two simple sample files to explain it: > > 1st file: >session_start(); >$_SESSION['SS_user'] = "user000"; > echo $_SESSION['SS_user']; > echo SID; > echo "".session_id(); > echo 'page 1'; > ?> > > 2nd file >session_start(); > echo "file Home"; > echo session_name().'+'.session_id(); > echo $_SESSION['SS_user']; > ?> > > $_SESSION seems to be empty. Nothing is print. Session Name and session ID > are the same but it seems that $_SESSION is not shared across the two > files. No HTML is made before sessioni_start(). > Why? > I'm using PHP 5.3.4 on IIS, windows XP SP3. Tested as localhost or from > another PC inside a LAN. > > Many thanks > Walter > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Session Problem
Also, make sure the session's are being saved properly. I had this same problem when PHP wasn't able to write to the temp directory. You can set up your own sessions dir with session.save_path in php.ini ""LoneWolf"" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >I am having a problem where it appears that the session is not being saved >properly. > > While on a page, I can start a session and set variables to it. however, > when I go to the next page.. the session variables appear to have been > cleared out. > > first page: > session_start(); > > $_SESSION["user_level"] = "test"; > > > > second page: > > session_start(); > > echo $_SESSION["user_level"] ; > > > > We just installed php on the 2003 server. Is there maybe a problem with > the php.ini file that I need to fix? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: session problem
weetat schrieb: Hi all, I have 2 php page , whenever i click the submit in 1st page , the $_SESSION['LIST_OF_DATA'] display nothing in the 2nd page. If i do echo print_r($_SESSION['LIST_OF_DATA']) in first page , it displayed the data correctly. Anybody have any ideas why php session behaviour is like that ? Thanks - weetat below is the 1st page : 'Jumping', 'itemData' => $arrayoffiles, 'perPage' => 10, 'delta' => 8, 'append' => true, 'clearIfVoid' => true, 'useSessions' => true, 'closeSession' => true, ); $pager = & Pager::factory($params); $data = $pager->getPageData(); $links = $pager->getLinks(); $_SESSION['LIST_OF_DATA'] = $data; ?> below is second page : Let me take a guess: Your FORM action is action="http:// " Barry -- Smileys rule (cX.x)C --o(^_^o) Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: session problem
yes i am Thank for you help Barry wrote: weetat schrieb: Hi all, I have 2 php page , whenever i click the submit in 1st page , the $_SESSION['LIST_OF_DATA'] display nothing in the 2nd page. If i do echo print_r($_SESSION['LIST_OF_DATA']) in first page , it displayed the data correctly. Anybody have any ideas why php session behaviour is like that ? Thanks - weetat below is the 1st page : 'Jumping', 'itemData' => $arrayoffiles, 'perPage' => 10, 'delta' => 8, 'append' => true, 'clearIfVoid' => true, 'useSessions' => true, 'closeSession' => true, ); $pager = & Pager::factory($params); $data = $pager->getPageData(); $links = $pager->getLinks(); $_SESSION['LIST_OF_DATA'] = $data; ?> below is second page : Let me take a guess: Your FORM action is action="http:// " Barry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: session problem
weetat schrieb: >> >> Let me take a guess: >> Your FORM action is action="http:// " >> >> Barry yes i am Thank for you help Ookay ... no problem ... probably . Barry -- Smileys rule (cX.x)C --o(^_^o) Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: session-problem
Probably i got the problem... but i don't know how to solve it!!! i include one of my class. in the constructor of this class i did a global... global $_SESSION; as soon as i delete that line. my script works perfect... is this not allowed anymore... to access $_SESSION in a constructor?? regards, jazper "Juerg Zgraggen" <[EMAIL PROTECTED]> schrieb im Newsbeitrag news:[EMAIL PROTECTED] > hi > > got a big session-problem and i have no idea what i'm doing wrong... > > i have quite a big web-app and i tried to upgrade the code. > ex: $frm_id to$_POST['frm_id'] > and$HTTP_SESSION_VAR['myId'] to $_SESSION['myId'] > ... ect... > > i changed the register_globals = Off in the php.ini and tried to browse my > webapp. > > now my problem: i wrote in my navigation-frame this code: > if( !isset($_SESSION['testint'] ) ) >{ >$_SESSION['testint'] = 1; >} > $_SESSION['testint']++; > print_r($_SESSION); > ?> > > after the print_r() i can see my 'testint'-session-variable on the > navigation-site. however on the other frame-site. i do NOT see this > 'testint'-session-variable when i reload it. and when i reload the > navigation-frame the variable does appear but does NOT increase. isset() > always return false!!! when i take a look at the session-file on my > Computer, i do NOT find the variable 'testint'... > > now when i make a complete new dummy php-file and copy-paste this > session-code on the navigation-site then the session works perfectly. even > when i call the navigation-site again AFTER processing this dummy-php-file. > the session for this variable works suddenly. > > what am i doing wrong??? > please give me a hint! > regards, jazper -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Session problem
Do not echo $query or any output before session_start(); or session_register("xxx"); (mean headers) //echo $query Or may be you can put ob_start(); before first output and put ob_end_flush(); after last headers ob_start(); echo $query . . //your code. . . session_register("ses_level"); ob_end_flush(); Hope this helps! "Shaun" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi, > > I get the following error when using using the following script to > authenticate a user. The login form is inside a frameset, is this whats > causing th eproblem, and is there a way round this? > > Warning: Cannot send session cookie - headers already sent by (output > started at /home/w/o/workmanagement/public_html/authenticate_user.php:12) in > /home/w/o/workmanagement/public_html/authenticate_user.php on line 35 > > authenticate_user.php: > require("dbconnect.php"); > > // Assume user is not authenticated > $auth = false; > > // Formulate the query > $query = "SELECT * FROM WMS_User WHERE > User_Username = '$_POST[username]' AND > User_Password = '$_POST[password]'"; > > echo $query; > > // Execute the query and put results in $result > $result = mysql_query( $query ) > or die ( 'Unable to execute query.' ); > > // Get number of rows in $result. > $num = mysql_numrows( $result ); > > if ( $num != 0 ) { > > // A matching row was found - the user is authenticated. > $auth = true; > > //get the data for the session variables > $suser_name = mysql_result($result, 0, "User_Name"); > $suser_password = mysql_result($result, 0, "User_Password"); > $stype_level = mysql_result($result, 0, "User_Type"); > > $ses_name = $suser_name; > $ses_pass = $suser_password; > $ses_level = $stype_level; > > session_register("ses_name"); //this is line 35 > session_register("ses_pass"); > session_register("ses_level"); > } > > //if user isn't authenticated redirect to appropriate page > if ( ! $auth ) { > include("login.php"); > exit; > } > > //if user is authenticated, include the main menu > else{ > include("home.php"); > } > > //close connection > mysql_close(); > ?> > > Thanks in as=dvance for your help > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Session problem
> I have a problem with sessions. If someone closes their internet explorer > window without logging off the session remains open. When you try to go > back to the site IE hangs until I manually remove the sess_ files from > the /tmp directory. Any insights on this one?? > > VR/Tim http://www.php.net/setcookie (find 'expire' in this manual) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Session problem
Make sure also that both pages have session_start(); on them so that sessions continue. I have used sessions and forms and basically I have the engines that process forms on different pages, and when the forms are submitted, the engine pages display a message and a link to the previous page, you might want to do this instead of haven people press the back button. - Victor > www.argilent.com -Original Message- From: Erwin [mailto:[EMAIL PROTECTED]] Sent: Tuesday, September 03, 2002 6:19 AM To: [EMAIL PROTECTED] Subject: [PHP] Re: Session problem > I am using session_start() and > session_register("variablename") . The when I click on > the back button from the browser it shows me the > following error: "Warning: Page has Expired The page > you requested was created using information you > submitted in a form. This page is no longer available. > As a security precaution, Internet Explorer does not > automatically resubmit your information for you. To > resubmit your information and view this Web page, > click the Refresh button. " That has nothing to do with your sessions. It has to do something with forms in HTML. If you use the POST method for forms, then the page will expire if you don't resubmit the values. You can also read that in the text. You cannot change this behaviour, because your browser does this for you. To force the browser to resubmit the values, you have to push the Refresh button. You won't get this behaviour if the form is submitted with the GET method, because the variables are then part of the URL (and thus automatically submitted if you push the back button) HTH Erwin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php __ Post your free ad now! http://personals.yahoo.ca -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Session problem
Walter, Session variables may be using cookies which in turn create temp files for storing such cookies. Ravi. On Tue, Dec 21, 2010 at 11:32 AM, Walter Caielli wrote: > I've fixed the problem. > I don't know why, but suddenly windows prevents PHP from writing into > C:\windows\temp directory. > Moving the session and log files to another directory solved the problem. > Until few days ago it worked. I've now to discovered what was changed in > windows configuration. > > > > ""Walter Caielli"" ha scritto nel messaggio > news:bd.40.31041.b7a60...@pb1.pair.com... > > I'm facing the following basic problem: > > > > I have made two simple sample files to explain it: > > > > 1st file: > > > session_start(); > >$_SESSION['SS_user'] = "user000"; > > echo $_SESSION['SS_user']; > > echo SID; > > echo "".session_id(); > > echo 'page 1'; > > ?> > > > > 2nd file > > > session_start(); > > echo "file Home"; > > echo session_name().'+'.session_id(); > > echo $_SESSION['SS_user']; > > ?> > > > > $_SESSION seems to be empty. Nothing is print. Session Name and session > ID > > are the same but it seems that $_SESSION is not shared across the two > > files. No HTML is made before sessioni_start(). > > Why? > > I'm using PHP 5.3.4 on IIS, windows XP SP3. Tested as localhost or from > > another PC inside a LAN. > > > > Many thanks > > Walter > > > > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >
Re: [PHP] Re: session-problem
* Thus wrote Juerg Zgraggen ([EMAIL PROTECTED]): > Probably i got the problem... but i don't know how to solve it!!! > > i include one of my class. > in the constructor of this class i did a global... > global $_SESSION; > > as soon as i delete that line. my script works perfect... > > is this not allowed anymore... to access $_SESSION in a constructor?? $_SESSION is a superglobal meaning you don't need to and shouldn't (as you found out the hard way :) global it. You can access it anytime: class foo { function foo { $this->var = $_SESSION['var']; } } Curt -- "I used to think I was indecisive, but now I'm not so sure." -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: session-problem
:-) cool thank you! is any "$_"-variable superglobal? $_REQUEST, $_POST, ...? cheers, jazper "Curt Zirzow" <[EMAIL PROTECTED]> schrieb im Newsbeitrag news:[EMAIL PROTECTED] > * Thus wrote Juerg Zgraggen ([EMAIL PROTECTED]): > > Probably i got the problem... but i don't know how to solve it!!! > > > > i include one of my class. > > in the constructor of this class i did a global... > > global $_SESSION; > > > > as soon as i delete that line. my script works perfect... > > > > is this not allowed anymore... to access $_SESSION in a constructor?? > > $_SESSION is a superglobal meaning you don't need to and shouldn't > (as you found out the hard way :) global it. You can access it > anytime: > > class foo { > function foo { > $this->var = $_SESSION['var']; > } > } > > Curt > -- > "I used to think I was indecisive, but now I'm not so sure." -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: session-problem
* Thus wrote Juerg Zgraggen ([EMAIL PROTECTED]): > :-) cool thank you! > is any "$_"-variable superglobal? $_REQUEST, $_POST, ...? Correct. Curt -- "I used to think I was indecisive, but now I'm not so sure." -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Session problem
* Thus wrote Nadim Attari: > > > I have a problem with sessions. If someone closes their internet explorer > > window without logging off the session remains open. When you try to go > > back to the site IE hangs until I manually remove the sess_ files from > > the /tmp directory. Any insights on this one?? > > > > VR/Tim > > http://www.php.net/setcookie > (find 'expire' in this manual) Actually you want: http://php.net/session Under cookie_lifetime. Curt -- First, let me assure you that this is not one of those shady pyramid schemes you've been hearing about. No, sir. Our model is the trapezoid! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php