[PHP] Challenge: Sessions & Frames
I'm running into some weird trouble here. I'm a very experienced PHP programmer, but I rarely ever deal with framed sites. A client wants a framed PHP site that needs session data passed between the frames. I have index.php which is simply the parent with frameset HTML code that tells the URL for the top and bottom frames. The top frame is a nav bar that changes from time to time by means of Javascript updating it (I know this all should've been done without frames and Javascript, but the client is REQUIRING frames and JS is the fastest way to update the frames). The bottom frame is the main content area. All three objects here (parent, top frame, bottom frame) have a common header that does things like connect to the database, session_start() and register session variables. When I try to log in, the information is passed to the parent, which authenticates the user, and then changes the top frame to a header page that is more customized for the user. The bottom frame changes to the user's control panel. Here's where the problem comes in. As I move around in the bottom frame, going from page to page, the session seems to randomly die, and then it starts doing things like appending $PHP_SESSID to the links and stuff. If I try to login again, it seems to authenticate correctly in the parent, but when the parent tries to change the top frame and bottom frame, those frames don't always seem to recognize the login attempt. It's almost like each frame suddenly split into its own session, identified by its own $PHP_SESSID. Sometimes it works, sometimes it doesn't. I don't understand what's happening here. Any thoughts? - Jonathan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Challenge: Sessions & Frames
I understand your point, but I'm not sure that you understood mine. (see below) "Chris Shiflett" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > --- Jonathan Hilgeman <[EMAIL PROTECTED]> wrote: > Regardless of what you mean by that, it should be clear that nothing > except client-side scripting is going to happen until your browser makes > another request. PHP is sitting on the server, twiddling its thumbs. Now, > if one of these browsers requests a new URL, PHP can use the session > information in generating the response, but it can do nothing for the > other browser windows. Does this make sense? > > Basically, all of the frames will share the same session, simply because > it's the same browser sending each request. Well, at the beginning, all frames share the same session. This is the desired effect, sort of like 3 trains all hooked together, running on parallel tracks. And it works great for a while. The problem I'm having is that one or even two of the tracks will (at random times) curve away and now instead of the 3 trains being grouped together, they're all running on different tracks. And sometimes Train 1 and 2 stay in sync, while Train 3 goes off to la-la-land and decides to start its own session. I -do- use Javascript, client-side scripting to refresh the top frame when some data has changed and I want the top frame to re-read it. But SOMETIMES refreshing it will just cause the shared session to split (which is the main problem I'm having). This is what I don't understand. If each frame has code to start a session and all requests (to the parent, top frame, and bottom frame) are being sent by the same browser window, then I don't know how/why they decide to randomly start their own sessions sometimes. It's almost like one frame "forgets" that it was already in the middle of a session and starts up a new session for itself. I thought that maybe the cache was expiring, but it's just too soon for that to happen - this can happen within the first few seconds of being logged in. I also set session_cache_expire to 720 minutes (overkill, but I was desperate), and that didn't help. It's ALMOST like my browser isn't taking cookies, but I know for a fact that it is (especially since every once in a while, everything can stay in sync and work properly for a few minutes). I'm considering just scrapping the reliance on cookies and forcing the scripts to pass the PHPSESSID through every link, so that any time a train might decide to go off and do its own thing, I'll be yanking it back so that it stays consistent with the other trains. I figure that as long as I dictate what session to use, I won't have this problem. But that would be a real pain to have to go back and make sure all links are modified and working correctly to pass this variable (I have to worry about the 255-character limit on the GET query string, because some of my query strings get long when performing searches on the site). -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Found the Answer!
I found the answer (I'm 90% sure, at least) !!! Thanks to this very small user comment: "Jonathan Hilgeman" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I'm running into some weird trouble here. I'm a very experienced PHP > programmer, but I rarely ever deal with framed sites. A client wants a > framed PHP site that needs session data passed between the frames. > > I have index.php which is simply the parent with frameset HTML code that > tells the URL for the top and bottom frames. > > The top frame is a nav bar that changes from time to time by means of > Javascript updating it (I know this all should've been done without frames > and Javascript, but the client is REQUIRING frames and JS is the fastest way > to update the frames). > > The bottom frame is the main content area. > > All three objects here (parent, top frame, bottom frame) have a common > header that does things like connect to the database, session_start() and > register session variables. > > When I try to log in, the information is passed to the parent, which > authenticates the user, and then changes the top frame to a header page that > is more customized for the user. The bottom frame changes to the user's > control panel. > > Here's where the problem comes in. As I move around in the bottom frame, > going from page to page, the session seems to randomly die, and then it > starts doing things like appending $PHP_SESSID to the links and stuff. > > If I try to login again, it seems to authenticate correctly in the parent, > but when the parent tries to change the top frame and bottom frame, those > frames don't always seem to recognize the login attempt. It's almost like > each frame suddenly split into its own session, identified by its own > $PHP_SESSID. Sometimes it works, sometimes it doesn't. > > I don't understand what's happening here. Any thoughts? > > - Jonathan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Found the Answer!
Oops. Hit the post shortcut accidentally. Here's the post that led me to the answer: - orion at dr-alliance dot com 08-Aug-2003 03:52 Session ID's wont be carried over through meta refreshes, so make sure you add the variables (in GET format) to the URL. IE ) - It turns out that the Javascript that was refreshing the top frame (and occasionally changing it) did not preserve the invisible session ID. So when the top frame was refreshed, it started a new session. Then, clicking on any links from the top frame would try to change the session ID in the other frames, and the bottom frame would again try to refresh the top frame, so it was an endless cycle. My only thought of how it worked in the first place was because the page got cached or something. Crazy. Thanks everyone. - Jonathan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Code not working in 4.1
I used to run PHP 4.0.3 and at the beginning of some functions that used a lot of global variables, I would add the following lines so I could access all the global variables inside the functions. foreach($GLOBALS as $GlobalVarName => $GlobalVarValue) { global $$GlobalVarName; } I upgraded to 4.1 and this code now causes PHP to die about 50-100 lines after it is executed. Any ideas? - Jonathan -- 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] Sending Generic TCP/IP Data
I have a host and a port and I BELIEVE that the protocol is HTTPS but I'm not sure. In the event that it's not using HTTPS protocol - how would I go about sending just TCP/IP packets through a socket to the host, since cURL only supports certain protocols? - Jonathan -- 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: Sending Generic TCP/IP Data
Possibly - I've hit a small stop for a bit. My goal is to create a PHP API for PsiGate/LinkPoint/CardService. I will let everyone know if anything comes up. Thanks! - Jonathan "Laserjetter" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > use fsockopen to open a socket on the host and call it $f then > fwrite($f,$data)?? would that work? > > LJ > > "Jonathan Hilgeman" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > I have a host and a port and I BELIEVE that the protocol is HTTPS but I'm > > not sure. In the event that it's not using HTTPS protocol - how would I go > > about sending just TCP/IP packets through a socket to the host, since cURL > > only supports certain protocols? > > > > - Jonathan > > > > > > -- 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] Symbolic Links, Includes, and Relative Paths
I'm on a red hat system, and I've soft-linked two directories: /www/dir1/subdir /www/dir2/subdir --> /www/dir1/subdir Now, inside subdir is a file that tries to include("../info.php"); which prints out some information about the file paths and my database stuff. So there's: /www/dir1/info.php /www/dir1/subdir/includer.php /www/dir2/info.php /www/dir2/subdir --> /www/dir1/subdir Now, when I run /www/dir2/subdir/includer.php, it SHOULD include the file "../info.php" which translates into /www/dir2/info.php. However, the symbolic linking seems to have messed it up, and instead of running dir2's info.php, it seems to think it is in dir1, and instead includes dir1's info.php file. Has anyone run into this and/or know a fix for it? Thanks! - Jonathan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] cURL Reporting to Apache Error Log
The title says it all. Any secure transactions I send through cURL get logged in Apache's standard log file. How can I keep this from happening? - Jonathan -- 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: MYSQL_SOCKET
Edit your /etc/my.cnf file and search for the word socket. - Jonathan "Jay Paulson" <[EMAIL PROTECTED]> wrote in message 020f01c125d6$ce5b17f0$6e00a8c0@webdesign">news:020f01c125d6$ce5b17f0$6e00a8c0@webdesign... the variable MYSQL_SOCKET is set to /tmp/mysql.sock and i need it to be /var/lib/mysql/mysql.sock is there anyway i can set this variable in php? thanks... -- 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: Zend Optimizer
Zend Optimizer will speed up the code, but I do not believe it crunches the size of files. If you need smaller files for a graph, use PNG or JPEG - not the GIF format. The GIF format is old and unoptimized in PHP/GD, so it gets really big in size unless you have something like ImageMagick to optimize it after it has been created. PNGs are kind of like the new GIF format when working with PHP image generation. JPEG format is best reserved for photos and such. - Jonathan "Johan Alfredeen" <[EMAIL PROTECTED]> wrote in message 787A25971D7FDF44B47329A97BE4AD4677C484@exposition">news:787A25971D7FDF44B47329A97BE4AD4677C484@exposition... > Ok, I've searched the archives and even contacted the Zend staff on this > one, and I'm still confused. I also posted this question at the Zend > Optimizer Forum but have not received an answer. I'm hoping one of you has > some idea of how the Zend Optimizer works and can explain it. My webhost > offers PHP 4 on Linux/Apache with the Zend Optimizer (v0.99) Engine (v1.0.3) > and I have checked phpinfo() to make sure it's installed and running. I > would like to optimize a particular function that generates a graph image on > the fly. What do I need to do make use of the Zend Optimizer? Is it used > automatically or do I first need to compile the code into a binary file? If > someone knows a great source of info on this (other than www.zend.com), that > would be helpful too. > > Thanks, > Johan Alfredeen > -- 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] iODBC Troubles
I first tried unixODBC in order to get ODBC functionality on my FreeBSD 4.2 box with PHP 4.0.3 on Apache 1.3.14. It didn't work too well, and I kept getting an error about undefined symbols like pthread_mutex_init or something when trying to run command-line sample applications. So someone suggested I use iODBC instead and I responded: Okay, I uninstalled unixODBC and tried iODBC ( I actually began to try it before, but then thought of something that might work on unixODBC, so I went back to it ). Now iODBC's odbctest application works with myODBC installed. However, after I recompile PHP with iodbc parameters, I try to run the odbc_connect function. If I misspell the DSN or use a non-existent one, I will get the following message: Warning: SQL error: [iODBC][Driver Manager]Data source name not found and no default driver specified. Driver could not be loaded, SQL state IM002 in SQLConnect Now, if I spell the defined DSN correctly and reload the page, the application just hangs. If I look at my error logs I see this: /usr/libexec/ld-elf.so.1: /usr/local/lib/libmyodbc.so: Undefined symbol "pthread_mutex_init" Once for every time I reload the page. This is odd, because this was a problem message I was receiving when testing unixODBC on the command line. After I installed iODBC, the command-line application was able to connect and query perfectly! So what gives? Why does one application work and another does not? I set the following environment vars - some may not make sense, but I've been trying everything: $EnvVars["LD_LIBRARY_PATH"] = "/usr/local/lib:/usr/include"; $EnvVars["LD_RUN_PATH"] = "/usr/local/lib:/usr/include"; $EnvVars["ODBCINI"] = "/usr/local/src/odbcsdk/doc/odbc.ini"; $EnvVars["PATH"] = "/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/bin:/usr/X11R6/bin:/hom e/suroot/bin:/usr/libexec:/usr/include"; foreach($EnvVars as $Key => $Val) { putenv("$Key=$Val"); $HTTP_ENV_VARS["$Key"] = $Val; } I can see via phpinfo() that they are getting set. Any more ideas? - Jonathan -- 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] Now Here's a Winner
Okay, this has gone over my head. I am running Apache 1.3.19, with PHP 4.0.5 and mySQL 3.23.37. The Apache/PHP server is on a Windows development box, and the mySQL is on a remote box. The basic function of the script is to first present a form where a user can select records that match a date, and then they can choose whether to have the records be displayed on-screen, or be sent as a file. Now, on-screen works beautifully. But, if I try the following code and specify to send as a file: if($ExportTo == "display") { print $FinalContent; } elseif($ExportTo == "file") { $FileName = "export-$RecordDay-$RecordMonth-$RecordYear.csv"; Header("Content-Type: application/x-octet-stream"); Header("Content-Disposition: attachment; filename=$FileName"); print $FinalContent; exit; } - I get the popup window asking if I want to save it or open it. But the filename is not export-date.csv like it should be. Furthermore, if I choose to save the file and then open it in a text editor, what I see is not $FinalContents, which is the expected output, but instead I see the form that I just submitted FROM. Yes, it saves the exact page I'm looking at - the one with the submit button I just pushed. Now, I know that it is getting to those Header() tags because they are the only ones in the code. So it is going inside the elseif() block. It is confusing the heck out of me. - Jonathan -- 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] Line number of error
Is there any way to print the current line number? i.e. 43 print "blah"; 44 print "this is line $LineNumber"; 45 print "etc"; and have it result in : blahthis is line 44etc ? - Jonathan -- 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: Line number of error
Nevermind - found the answer. The current line number is held in the constant __LINE__ and the current file name is held in the constant __FILE__ So I can do the following: print "this is line " . __LINE__ . " in the file " . __FILE__; - Jonathan "Jonathan Hilgeman" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Is there any way to print the current line number? i.e. > > 43 print "blah"; > 44 print "this is line $LineNumber"; > 45 print "etc"; > > and have it result in : > blahthis is line 44etc > > ? > > - Jonathan > > -- 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] Sockets
I run a web application that opens a socket using cURL and sends data to a payment gateway and then receives confirmations, etc... Sometimes, a visitor clicks multiple times and I have the program check to see if a transaction is already in process, and if so, it redirects them to a page where they can check to see whether the transaction has gone through. So now I have 1 thread/request going, doing the processing, and returning the data, and a second thread where the visitor can check to see if thread 1 has come back from processing or not. Normally, this works okay. SOMETIMES, thread 1 does not come back with data from the gateway, as if the connection had timed out. Sometimes the gateway has processed the transaction, and sometimes not. So I would like to know if there's a program or something that will allow me to either log socket communication, or to monitor the sockets, etc... Can anyone help me out with this? - Jonathan -- 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]