Previous Thread
Next Thread
Print Thread
Rate Thread
Joined: May 2001
Posts: 283
Member
Member
Offline
Joined: May 2001
Posts: 283
Forgive me if I missed this elsewhere, I did search for it.

If a user enters a URL at the end of a sentence, where the period follows the url, UBB automatically hyperlinks the URL but includes the period as part of the URL.

For example:

I would like for you to visit http://www.catcherman.com.

The page won't show up because of the period in the URL and most users won't realize the flaw but instead will think that the site is down.

Is there a way to prevent the period from being added into the URL?

Thanks.

Sponsored Links
Joined: May 2001
Posts: 1,042
Likes: 7
Moderator
Moderator
Offline
Joined: May 2001
Posts: 1,042
Likes: 7
This is a designed behavior. When it catches the string www or http it will turn all characters attached to it(until it runs into a space) into a hyperlink. The best way to not let this happen is to use UBBCode. Like [ url=https://ubbdev.com/]ubbdev.com[/url].

Joined: May 2001
Posts: 283
Member
Member
Offline
Joined: May 2001
Posts: 283
Yes, this I know. I can create links all day long. It's some of my members that don't realize how to do this that I'm concerned about. Of course I could educate them, but then new members will join and start the problem all over again.

Is there a way to have UBB remove a period if it occurs before a space?

Joined: May 2001
Posts: 283
Member
Member
Offline
Joined: May 2001
Posts: 283
Bump. Still looking for help here too...

Joined: Jan 2003
Posts: 3,456
Likes: 2
Master Hacker
Master Hacker
Offline
Joined: Jan 2003
Posts: 3,456
Likes: 2
I wouldn't know how to do this in code, but I wonder if this possible.

using http://www.ccc.com. as the example.

if($last_character eq ".") {
$url = $url - $last_character;
}

now I don't have any clue on how to do that in code,but maybe someone will see that and know how

EDIT: changes the link cause I realized my random link went to a porn site shocked

Sponsored Links
Joined: Jan 2000
Posts: 5,073
Admin Emeritus
Admin Emeritus
Joined: Jan 2000
Posts: 5,073
The problem being that the dot at the end CAN be a legal character...


UBB.classic: Love it or hate it, it was mine.
Joined: May 2001
Posts: 283
Member
Member
Offline
Joined: May 2001
Posts: 283
To be honest, I'd be willing to take the chance. I've never used a URL with a period at the end and if there was a problem with one I could go back and give it the proper URL code. This would only need to work when creating automatic URLs.

Joined: May 2000
Posts: 1,356
Addict
Addict
Joined: May 2000
Posts: 1,356
Quote
quote:
Originally posted by Weird Al:
if($last_character eq ".") {
$url = $url - $last_character;
}

did you hear something called regex?

Code
$url =~ s,.$,,;
but Charles is right. The url can be like this:

http://www.ccc.com/?this=that.

and the program in this site can expect 'that.' as a parameter (for example)...

Joined: May 2001
Posts: 283
Member
Member
Offline
Joined: May 2001
Posts: 283
I don't get it.

Joined: May 2000
Posts: 1,356
Addict
Addict
Joined: May 2000
Posts: 1,356
then, do not touch to the code in your ubb files wink

Sponsored Links
Joined: May 2001
Posts: 283
Member
Member
Offline
Joined: May 2001
Posts: 283
Quote
quote:
Originally posted by Burak:
then, do not touch to the code in your ubb files wink
There's no need to be rude. I was only asking for clarification.

Joined: May 2000
Posts: 1,356
Addict
Addict
Joined: May 2000
Posts: 1,356
huh? rude? if you dont know how the code works and you touch it, you can get is a not-working forum software.

Well thats not my problem anyway...

If you want to add something its up to you...

Joined: Mar 2000
Posts: 21,079
Likes: 3
I type Like navaho
I type Like navaho
Joined: Mar 2000
Posts: 21,079
Likes: 3
Quote
quote:
Originally posted by catcherman:
Yes, this I know. I can create links all day long. It's some of my members that don't realize how to do this that I'm concerned about. Of course I could educate them, but then new members will join and start the problem all over again.
You might take a different approach and make a forum for educating newbies, much like we did at threadsdev... "how do I make a post" "how do I post a link" etc... otherwise you'll always have newbies making random mistakes and you'll never be able to code enough to make it eejit-proof. Better to teach them the correct way up front. smile Making the FAQ more prominent too is another way...


- Allen wavey
- What Drives You?
Joined: May 2001
Posts: 283
Member
Member
Offline
Joined: May 2001
Posts: 283
Well, thanks for the help. I knew of that solution, as I mentioned it earlier in this thread. I was just wondering if there was another solution. I've seen it done on PHP boards and vBulletin boards.

Joined: May 2001
Posts: 1,042
Likes: 7
Moderator
Moderator
Offline
Joined: May 2001
Posts: 1,042
Likes: 7
Code
# above in ubb_lib.cgi 
return ($check);
} # end auto_url
# add
$check =~ s/<a href="(.+?)." target="_blank">(.+?).</a>/<a href="$1" target="_blank">$2</a>./si;
Untested, but i'm guessing it should work.

Joined: Jan 2003
Posts: 3,456
Likes: 2
Master Hacker
Master Hacker
Offline
Joined: Jan 2003
Posts: 3,456
Likes: 2
it works. I tested it.

Joined: May 2001
Posts: 283
Member
Member
Offline
Joined: May 2001
Posts: 283
Quote
quote:
Originally posted by Brett:
Untested, but i'm guessing it should work.
Close Brett, but I noticed a bug. If you add more than one URL with a period after it in the same post, the new code only fixes the first one.


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
isaac
isaac
California
Posts: 1,157
Joined: July 2001
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
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 20221218)