Check for internal and external links like on this forum

Started by mickjav, August 07, 2021, 08:42:38 AM

Previous topic - Next topic

mickjav

I did search the mods without luck

If there is a mod to do below please point me in the right direction

https://stackoverflow.com/questions/22964579/how-to-check-whether-a-url-is-external-url-or-internal-url-with-php

my intention is to use this for my forums so a function would be the way to go if there is no mod available I'll try and build one, just not sure where to put it but more than willing to give it a go

shadav

depends on what you are trying to do

for instance this mod
Anti-Spam Links
you can set the post count for members to post external links
- do not allow links
- links set to nonactive
- links set to nofollow

or Check Before Posting lets you to put in specific sites that are not allowed to be posted

these two will redirect external links Redirect Links and Redirector

Registered Links stops guests from seeing links

mickjav

sorry wasn't Specific enough if you look in my sig you'll see the link has [nofollow] but links without that added will not create a new window which is what I want for local links within my site.

Aleksi "Lex" Kilpinen

The nofollow is a different thing, and is used to limit link exposure from possible spammers.
SMF does have support for [url] and [iurl] separately, to allow you to decide how the link should be opened:
URL: https://www.simplemachines.org
IURL: https://www.simplemachines.org
Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

Illori


mickjav


mickjav


Aleksi "Lex" Kilpinen

Could be whatever rewriting you have going on there, your urls don't look like the default SMF urls to me.
Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

mickjav

Haven't changed them one is just posted as is

one uses the "[url]" Links

This is the full URL https://www.databasedreams.co.uk/charts/weekly-charts-analysis/uk-singlesalbums-charts-06-august-2021-to-12-august-2021-analysis/

Which is a local for me.

Aleksi "Lex" Kilpinen

Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

mickjav

It was a create a forum Forum that might explain it

thanks

mickjav

This does work in part for links to my gallery, downloads, pages etc

mickjav


Aleksi "Lex" Kilpinen

Quote from: mickjav on August 07, 2021, 05:44:49 PM
This does work in part for links to my gallery, downloads, pages etc
That would confirm my suspicion that the problem is likely the rewritten urls.

Quote from: mickjav on August 07, 2021, 05:52:52 PM
Is there a reason I couldn't use something like the reply here

https://stackoverflow.com/questions/4366730/how-do-i-check-if-a-string-contains-a-specific-word

With that could I not check for my site address??
That is basically what the mod does, for SMF urls. Sure you can probably expand on that idea and include other urls as well.
Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

mickjav

Thanks I'll look into altering it, At least I can use the current one for my librarian project

thanks for the help mick

Advertisement: