RE: [PHP] JavaScript/PHP Function -> Apache/IIS5 -> Client Properties
| From: | [ rswfire ] | Date: | Sun, 28 Jan 2001 02:00:45 +0000 |
| Subject: | RE: [PHP] JavaScript/PHP Function -> Apache/IIS5 -> Client Properties | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-37073@lists.php.net to get a copy of this message | ||
Jonathon,
I believe I have found the cause of the problem... But first let me explain what I am doing better.
Yes, I am trying to gather as many stats from the client as possible. Before a page is display, many classes are initialized. This particular class is the session class. After it retrieves all of the client properties, a session is created. If they don't have JavaScript, there's not much I can do, so I just use "basic settings" and give them a session.
This is done transparently. It creates this temporary file and then reloads the page with the long URI. This time the session class retrieves all of the properties and does put them into a database. Then, sets the session id. Then, it reloads the page again, getting rid of the long URI and just leaving the session id in the URI.
Well, here's where the problem appears to be. I believe the CGI version of PHP on Apache is trying to parse the page as a PHP file. Even though it is a simple HTML file. Below is the HTML that is produced from the previous code:
<HTML><HEAD><TITLE>[ Swift eNetwork ] eNetWizard : Determining Client Properties</TITLE><SCRIPT LANGUAGE="JavaScript">function GetProperties(){window.location.replace("http://swifte.dev:8080/php/php.exe?ENETWIZARD_GETCLIENT=TRUE&cName="+escape(navigator.appName)+"&cCodeName="+escape(navigator.appCodeName)+"&cVersion="+escape(navigator.appVersion)+"&cPlatform="+escape(navigator.platform)+"&cLanguage="+escape(navigator.language)+"&cJavaEnabled="+escape(navigator.javaEnabled())+"&cAvailHeight="+escape(screen.availHeight)+"&cAvailWidth="+escape(screen.availWidth)+"&cColorDepth="+escape(screen.colorDepth)+"&cHeight="+escape(screen.height)+"&cWidth="+escape(screen.width)+"&cPixelDepth="+escape(screen.pixelDepth));}</SCRIPT></HEAD><BODY BGCOLOR='#000000' OnLoad="GetProperties()"> </BODY></HTML>
Notice the swifte.dev:8080 --> After that is /php/php.exe -- I hate this. That should not be there and the filename is not there either. So of course it's having a problem. I did a check on phpinfo() and the variable $SCRIPT_NAME is set to /php/php.exe. The only other variables that have the filename are REQUEST_URI and PATH_INFO. But I'm still getting the same problem.
I don't exactly understand your code below. First of all, I do not want to use cookies at all - not anywhere on my network. Too much controversy. So I take advantage of the database in that respect. Secondly, does the code example below automatically submit itself?? I've never seen that done before...
Robert
From: "Jonathan Sharp" <webdev@flyerware.com> To: "[ rswfire ]" <rswfire@hotmail.com>, <php-general@lists.php.net> Subject: RE: [PHP] JavaScript/PHP Function -> Apache/IIS5 -> Client Properties Date: Sat, 27 Jan 2001 17:47:05 -0800 Hm...I'm not sure I completely understand...but I believe that you're trying to gather as many stats from the client as possible? What about having a page that is somewhat transparent to the user (if they support JS) that you have something like this... <script> function GetProperties() { document.theform.cVersion.value = navigator.appVersion; etc... document.theform.submit(); } </script> <body onLoad="GetProperties()"> <form action="mainpage.php" method="POST" name="theform"> <input type="hidden" name="cVersion"> </form> <img src="/img/a/nice/techno/dancing/woman.gif"><br> <b>Welcome to my beautiful site! One moment please...</b> </body> Then you'd have mainpage.php checkthrough all those values, and possibly dump them into a DB and create a SESSIONID which each page thereafter uses the sessionid to lookup the client settings from the db and build the page based upon that? Depending on how long it takes to set all the hidden fields and submit the form, it might even be transparent to the user...or...you might just have a generic front page if no session id is set and popup window that has all that java script and say something line "Customizing for YOU!" and then have that page POST to itself and then have the window close it self (and you've set a cookie with the session id of course) so then each page that he visits thereafter has the session id set. And you can customize for him/her... Cheers, -Jonathan Sharp Director of Technology - Imprev Inc. Renwick Development Group - Flyerware http://www.flyerware.com/ Phone: (425)688-9200 Cell: (425)766-1398 EPage: 4257661398@page.nextel.com -----Original Message----- From: [ rswfire ] [mailto:rswfire@hotmail.com] Sent: Saturday, January 27, 2001 5:25 PM To: php-general@lists.php.net Subject: [PHP] JavaScript/PHP Function -> Apache/IIS5 -> Client Properties I need to get a whole bunch of client properties from a visitor on my site before a page is displayed. I do this using JavaScript. I first determine if the visitor's browser supports JavaScript, and if it does I run a function that basically builds a temporary page and returns a bunch of client properties for me. Here's the code: if ($Browser_JavaScriptOK == TRUE) { echo "<HTML>"; echo "<HEAD>"; echo "<TITLE>[ Swift eNetwork ] eNetWizard : Determining Client Properties</TITLE>"; echo "<SCRIPT LANGUAGE=\"JavaScript\">"; echo "function GetProperties()"; echo "{"; echo "window.location.replace(\"http://".$GLOBALS["HTTP_HOST"].$GLOBALS["SCRIPT_N AME"]."?ENETWIZARD_GETCLIENT=TRUE&cName=\"+escape(navigator.appName)+\"&cCod eName=\"+escape(navigator.appCodeName)+\"&cVersion=\"+escape(navigator.appVe rsion)+\"&cPlatform=\"+escape(navigator.platform)+\"&cLanguage=\"+escape(nav igator.language)+\"&cJavaEnabled=\"+escape(navigator.javaEnabled())+\"&cAvai lHeight=\"+escape(screen.availHeight)+\"&cAvailWidth=\"+escape(screen.availW idth)+\"&cColorDepth=\"+escape(screen.colorDepth)+\"&cHeight=\"+escape(scree n.height)+\"&cWidth=\"+escape(screen.width)+\"&cPixelDepth=\"+escape(screen. pixelDepth));"; echo "}"; echo "</SCRIPT>"; echo "</HEAD>"; echo "<BODY BGCOLOR='#000000' OnLoad=\"GetProperties()\"> "; echo "</BODY>"; echo "</HTML>"; exit; } This code is run and then goes back to the calling page with all of the variables. I then process the variables and put them into a class and build the page. This works on IIS5, but when I try to do this on Apache, it freezes up and after a time comes back with an error message saying PHP.EXE did something wrong and will be closed. Can anyone tell me what is happening? Do you know of any other way to reliably return client properties? Thankz... _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net_________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com