Previous Thread
Next Thread
Print Thread
Rate Thread
Joined: Feb 2001
Posts: 2,268
Junior Member
Junior Member
Offline
Joined: Feb 2001
Posts: 2,268
What I want to do is search the user agent string (contained in $Agent) for yahoo and then change the $Agent string to an image link. I think that the forward slashes in the $Agent string are causing stristr to fail, but I don't know how to remove them. A search and replce mabey?

Here is my code:

Code
  if (stristr($Agent, 'yahoo') !== false) {<br />      $Agent = "<img border=\"0\" align=\"middle\" src=\"{$config['imageurl']}/yahoo.gif\" alt=\"Yahoo bot eating all our bandwidth\" />;<br />//} 


I'll try a search and replace first and see if that makes a difference -but any ideas are welcome!

Sponsored Links
Joined: Feb 2001
Posts: 2,268
Junior Member
Junior Member
Offline
Joined: Feb 2001
Posts: 2,268
Nevermind: I made a typo. Can you find the missing " ?...

I hate it when I do that!

Joined: Feb 2001
Posts: 2,268
Junior Member
Junior Member
Offline
Joined: Feb 2001
Posts: 2,268
Take a look at my who's online display

Joined: Mar 2000
Posts: 528
Junior Member
Junior Member
Offline
Joined: Mar 2000
Posts: 528
Nice!

Joined: Feb 2001
Posts: 2,268
Junior Member
Junior Member
Offline
Joined: Feb 2001
Posts: 2,268
Thanks -maybe a future mod...

Sponsored Links
Joined: Sep 2003
Posts: 803
Coder
Coder
Offline
Joined: Sep 2003
Posts: 803
Oh please, oh please

thats a nice touch

Joined: Jan 2005
Posts: 39
User
User
Offline
Joined: Jan 2005
Posts: 39
That would be an AWESOME enhancement HackMOD!!!

Joined: Jul 2002
Posts: 79
Power User
Power User
Offline
Joined: Jul 2002
Posts: 79
Ok

So what is a user agent????

(said shyly and feeling dumb)

Joined: Feb 2001
Posts: 2,268
Junior Member
Junior Member
Offline
Joined: Feb 2001
Posts: 2,268
[]StanCA said:
Ok

So what is a user agent????

(said shyly and feeling dumb) [/]

When someone surfs to your web site the http get packet (the request that they send for a specific page) has information in it that can identify the browser that they are using, their operating system (XP, NT, OSX, etc.) and some other odds and ends. The standard whos online display just shows the user agent text -kinda boring. The mod that I've done replaces the text with a graphic if the user agent is known. If it's unknown the standard text is still displayed -for now. I may change that to some sort of generic image since it's impossible to check for every possible user agent and may prove to be too slow if I tried.

Joined: Jul 2002
Posts: 79
Power User
Power User
Offline
Joined: Jul 2002
Posts: 79
is the full code for that in the first post???

Sponsored Links
Joined: Feb 2001
Posts: 2,268
Junior Member
Junior Member
Offline
Joined: Feb 2001
Posts: 2,268
LOL! Nope -just a sample.

I spent a lot of time hashing out the logic for that hack and to make it a little faster in determining what the user agent is. There are a couple of problems with the way I have it set up...
  • You'd have to have Josh's Who's Online User Info hack installed (I think that's what he called it).
  • If he didn't update it to make it more "template friendly" then you'd have even more hacking to do since I remember, a long time ago, hacking Josh's hack

Joined: Mar 2000
Posts: 21,079
Likes: 3
I type Like navaho
I type Like navaho
Joined: Mar 2000
Posts: 21,079
Likes: 3
Does look good Dal, would be a nice mod


- Allen wavey
- What Drives You?
Joined: Feb 2001
Posts: 2,268
Junior Member
Junior Member
Offline
Joined: Feb 2001
Posts: 2,268
I'm almost finished with it. When I'm done I'll use Beyond Compare to compile the changes and package it as a mod.

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
That's pretty sweet. Especially the firefox logo.


Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
Bill B
Bill B
Issaquah, WA
Posts: 87
Joined: December 2001
Forum Statistics
Forums63
Topics37,574
Posts293,926
Members13,850
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20240506)