PDA

View Full Version : Ed, please tell me what I am doing wrong


22 Jun 2000, 11:42
Hi Ed and congrats for the new appointment :)

I need your help please.

My BB members love smilies, it seems, and we have a nifty and useful collection of nice ones. However, I've discovered that the animated ones create problems aplenty for Netscape users.

So, I created a sub dir in the smilies dir, called netscape, and put there a copy of all the smilies, only not animated (same name though).

Then, I added a field to the smilie table in the database, called smiliepath2, and placed there the paths to the smilie/netscape/ images.

Then, I put the following in global.php, at around like 202 (where it says // smilies):



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



But it doesn't work. Now all the smilies are coming from the smilies/netscape/ dir -- which means my "if (strstr($HTTP_USER_AGENT,"MSIE"))" is not working.

Can you please advise me what I am doing wrong, and what I should do to get it right?

Thanks,

Bira

22 Jun 2000, 11:49
With that code you also take away smilies from Opera, Mozilla (probably has the same netscape problems), and etc users.

22 Jun 2000, 11:52
rangersfan,

1) I am not taking it away - they will simply see a static smilie rather than an animated one.

2) I would love to know how I can determine someone is using Netscape, and do "if browser==netscape then use smiliepath2" (in which case only the Netscape users will be affected).

But right now, only the "else" works, regardless what browser you have, including MSIE :(

22 Jun 2000, 11:54
bira - check out my smilies

http://www.hedgehogwheels.com/forums/index.php?action=showsmilies

I haven't had any complaints yet from any users about threads not loading though.

22 Jun 2000, 11:57
I haven't picked up a PHP book but is the 'strstr' function a string match or a sub-string match function? I would think it would work if it is just searching for the ocurrence of "MSIE" in the string, otherwise you need to use a function that does that.

22 Jun 2000, 11:58
rangersfan, well good for you I guess :)

The procedure I set to check if a user has Internet Explorer is the correct one. The why isn't it working? Could it be that global.php doesn't communicate with the user's browser or something like that? Maybe I should do something else?

Someone please help me :(

22 Jun 2000, 12:03
As a test .... all you have to do is echo the string back to the screen to see if it has anything in it to see if it is being read.

22 Jun 2000, 12:07
rangersfan, copy the bellow code to a text file, save it as browser.php and test it in IE and in Netscape:



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



You will see that it works just fine.

22 Jun 2000, 13:12
I started playing around with your code in a separate file, and it works fine. It even works fine when I require global.php above it.

So what's the problem?

Well, we forgot to account for the fact that that smilies stuff is in a function. Functions have a local scope.

bira - just above your code, add:


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------

That will give you access to the variable.

22 Jun 2000, 13:22
THANK YOU!!!!!!!

It works beautifully :) :) :)