Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > PHP Script Woes Due to Browsers

PHP Script Woes Due to Browsers
Thread Tools
E's Lil Theorem
Mac Elite
Join Date: Sep 2004
Location: Theory - everything works in theory
Status: Offline
Reply With Quote
Jun 16, 2005, 07:17 PM
 
I have a couple of PHP scripts that work fine in Safari, but fail to work in Firefox (Mac and PC) and IE (Mac and PC). I'm not aware of any differences between coding PHP for any of these browsers (e.g., the way you would code htlm/css specifically for one of these browsers), but right now it certainly seems that some exist.

Can anyone shed any light?
     
skalie
Mac Elite
Join Date: Mar 2002
Location: Clogland
Status: Offline
Reply With Quote
Jun 16, 2005, 07:27 PM
 
Can't really blame the php as it's server side, maybe the html/css it's producing, but not the php itself.

Yes I know that wasn't very helpful.
     
E's Lil Theorem  (op)
Mac Elite
Join Date: Sep 2004
Location: Theory - everything works in theory
Status: Offline
Reply With Quote
Jun 16, 2005, 07:44 PM
 
Originally Posted by skalie
Can't really blame the php as it's server side, maybe the html/css it's producing, but not the php itself.

Yes I know that wasn't very helpful.
Thanks! I'll take a look at that though given the way it's working (or not working), I don't see how this could be the problem.
     
justinkim
Mac Enthusiast
Join Date: Sep 2000
Location: New York, NY USA
Status: Offline
Reply With Quote
Jun 17, 2005, 12:47 AM
 
I agree with skalie. Assuming all the browsers are being served off the same server, it's almost certainly the html being generated by the php. And there are very real differences in how all those browsers render html and css (though in my experience, html and css that render well in Safari usually renders well in Firefox).

What are the pages supposed to do?
     
Chuckit
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status: Offline
Reply With Quote
Jun 17, 2005, 01:35 AM
 
PHP is the same in any browser, because no browser sees the PHP code anyway. PHP is a preprocessor, which means it is already done executing and all you have left is the generated HTML by the time the server sends any data to the browser.
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
     
E's Lil Theorem  (op)
Mac Elite
Join Date: Sep 2004
Location: Theory - everything works in theory
Status: Offline
Reply With Quote
Jun 17, 2005, 02:44 AM
 
Well, if it's the code being generated, I can't figure it out. Maybe I need to step away from it for a few days

Originally Posted by justinkim
...

What are the pages supposed to do?
It's an image rating script I got from SourceForge.net.

You can see my implementation of it here: http://www.sexytummies.com/sexytummyornot/. Check it out with Safari to see how it's suppose to work. It used to work well with all browsers until I added the "rate all, just girls or just guys" feature. After I added this feature, IE and Firefox stopped working properly. A shame, really.
     
Millennium
Clinically Insane
Join Date: Nov 1999
Status: Offline
Reply With Quote
Jun 17, 2005, 06:32 AM
 
Actually, it's theoretically possible to get a browser-specific error in PHP, but only if you depend on the headers which the browser sends, as that's the only real communication between PHP and the browser. The most common way to get an error like this is to try and sniff the user's browser through the User-Agent string and then break on some specific case. You can also get into trouble if you depend on one of the more obscure headers, and some browser or other either doesn't send it or sends it in a format you didn't expect, but few scripts out there today do anything like that anyway.

This said, it's very unusual for badly-written browser sniffers to work on Safari but not anything else. Usually it goes the other way around; they code only for IE and/or Netscape, and fail to handle other browsers. More likely this is an HTML or CSS issue, as the others have mentioned.
You are in Soviet Russia. It is dark. Grue is likely to be eaten by YOU!
     
skalie
Mac Elite
Join Date: Mar 2002
Location: Clogland
Status: Offline
Reply With Quote
Jun 17, 2005, 06:43 AM
 
Originally Posted by Millennium
Actually, it's theoretically possible to get a browser-specific error in PHP
....just not very easy to do
     
E's Lil Theorem  (op)
Mac Elite
Join Date: Sep 2004
Location: Theory - everything works in theory
Status: Offline
Reply With Quote
Jun 19, 2005, 05:46 PM
 
Well, I can't figure it out

If any of you have the time to help me out, here is the code.

Thanks in advance.
     
ctlq
Junior Member
Join Date: Nov 2004
Location: Michigan
Status: Offline
Reply With Quote
Jun 20, 2005, 06:33 PM
 
where specifically are the errors because the page looked the same in all browsers to me
     
E's Lil Theorem  (op)
Mac Elite
Join Date: Sep 2004
Location: Theory - everything works in theory
Status: Offline
Reply With Quote
Jun 21, 2005, 01:40 AM
 
Originally Posted by ctlq
where specifically are the errors because the page looked the same in all browsers to me
Well, I've been trying different things, so right now it's broken for all browsers. But, ideally, you should be able to rate all images, only males, or only females. Also, when you rate an image, a new one should load.

EDIT:

It looks like the problem is with the getRandomUser($geekcategory, $geeksex) function. This is the function that needed to be modified to allow users to rate all, femmes or guys. If I use the old version of the function getRandomUser(), the script works fine.

Here they both are:

[PHP]
<?
function getRandomUser($geekcategory, $geeksex)

...

function getRandomUserOLD()

?>
[/PHP]

EDIT 2: I found a workaround. Thanks to all who gave it a shot.
( Last edited by E's Lil Theorem; Jun 21, 2005 at 09:52 PM. )
     
   
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 03:21 AM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,