Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Snitz Forums 2000 MOD-Group
 MOD Add-On Forum (W/Code)
 Page Rank and Search Ranking protection MOD help
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

aspwiz
Junior Member

250 Posts

Posted - 25 July 2003 :  08:45:51  Show Profile  Visit aspwiz's Homepage
hi... no doubt users who know snitz well will recognise this url transformation function in inc_func_common.asp :-
<script language="javascript1.2" runat="server">
function edit_hrefs(sURL, iType) {
	sOutput = new String(sURL);

	if (iType == 1) {
		sOutput = sOutput.replace(/\b(http\:\/\/[\w+\.]+[\w+\.\:\/\@\_\?\=\&\-\'\#\%\~\;\,\$\!\+\*]+)/gi,
			"<a href=\"$1\" target=\"_blank\">$1<\/a>");
	} else if (iType == 2) {
		sOutput = sOutput.replace(/\b(https\:\/\/[\w+\.]+[\w+\.\:\/\@\_\?\=\&\-\'\#\%\~\;\,\$\!\+\*]+)/gi,
			"<a href=\"$1\" target=\"_blank\">$1<\/a>");
	} else if (iType == 3) {
		sOutput = sOutput.replace(/\b(www\.[\w+\.\:\/\@\_\?\=\&\-\'\#\%\~\;\,\$\!\+\*]+)/gi,
			"<a href=\"http://$1\" target=\"_blank\">$1<\/a>");
	} else if (iType == 4) {
		sOutput = sOutput.replace(/\b([\w+\-\'\#\%\.\_\,\$\!\+\*]+@[\w+\.?\-\'\#\%\~\_\.\;\,\$\!\+\*]+\.[\w+\.?\-\'\#\%\~\_\.\;\,\$\!\+\*]+)/gi,
			"<a href=\"mailto\:$1\">$1<\/a>");
	} else if (iType == 5) {
		sOutput = sOutput.replace(/\b(ftp\:\/\/[\w+\.]+[\w+\.\:\/\@\_\?\=\&\-\'\#\%\~\;\,\$\!\+\*]+)/gi,
			"<a href=\"$1\" target=\"_blank\">$1<\/a>");
	} else if (iType == 6) {
		sOutput = sOutput.replace(/\b(file\:\/\/\/[\w+\:\/\\]+[\w+\/\w+\.\:\/\\\@\_\?\=\&\-\'\#\%\~\;\,\$\!\+\*]+)/gi,
		  	"<a href=\"$1\" target=\"_blank\">$1<\/a>");
	}

	return sOutput;
}
</script>

I want all url's to be changed to redirect via a redirect page.
For instance www.microsoft.com would become redirect.asp?url=http://www.microsoft.com

I can achieve this for urls entered directly such as www.microsoft.com and www.microsoft.com," target="_blank">http://www.microsoft.com, but i cannot make it happen when url's are entered with forum code url tags [ url] and [/ url]

Here is my modified function:-


<script language="javascript1.2" runat="server">
function edit_hrefs(sURL, iType) {
	sOutput = new String(sURL);

	if (iType == 1) {
		sOutput = sOutput.replace(/\b(http\:\/\/[\w+\.]+[\w+\.\:\/\@\_\?\=\&\-\'\#\%\~\;\,\$\!\+\*]+)/gi,
			"<a href=\"redirect.asp?url=$1\" target=\"_blank\">$1<\/a>");
	} else if (iType == 2) {
		sOutput = sOutput.replace(/\b(https\:\/\/[\w+\.]+[\w+\.\:\/\@\_\?\=\&\-\'\#\%\~\;\,\$\!\+\*]+)/gi,
			"<a href=\"redirect.asp?url=$1\" target=\"_blank\">$1<\/a>");
	} else if (iType == 3) {
		sOutput = sOutput.replace(/\b(www\.[\w+\.\:\/\@\_\?\=\&\-\'\#\%\~\;\,\$\!\+\*]+)/gi,
			"<a href=\"redirect.asp?url=http://$1\" target=\"_blank\">$1<\/a>");
	} else if (iType == 4) {
		sOutput = sOutput.replace(/\b([\w+\-\'\#\%\.\_\,\$\!\+\*]+@[\w+\.?\-\'\#\%\~\_\.\;\,\$\!\+\*]+\.[\w+\.?\-\'\#\%\~\_\.\;\,\$\!\+\*]+)/gi,
			"<a href=\"mailto\:$1\">$1<\/a>");
	} else if (iType == 5) {
		sOutput = sOutput.replace(/\b(ftp\:\/\/[\w+\.]+[\w+\.\:\/\@\_\?\=\&\-\'\#\%\~\;\,\$\!\+\*]+)/gi,
			"<a href=\"redirect.asp?url=$1\" target=\"_blank\">$1<\/a>");
	} else if (iType == 6) {
		sOutput = sOutput.replace(/\b(file\:\/\/\/[\w+\:\/\\]+[\w+\/\w+\.\:\/\\\@\_\?\=\&\-\'\#\%\~\;\,\$\!\+\*]+)/gi,
		  	"<a href=\"redirect.asp?url=$1\" target=\"_blank\">$1<\/a>");
	}

	return sOutput;
}
</script>


Like I say it works fine unless you enter a url with [ url][/ url] tags.....

Can anyone test the above and tell me what exactly I am doing wrong?? This is severely driving me nuts.

Edited by - aspwiz on 28 July 2003 07:13:12

aspwiz
Junior Member

250 Posts

Posted - 27 July 2003 :  09:53:59  Show Profile  Visit aspwiz's Homepage
hmmm....

I am still really struggling creating this MOD.

I feel it is a really important MOD as it will protect forum's search engine placements.

If a url can be transformed from www.hotmail.com to javascript:openWindow5('redirect.asp?url=http://www.hotmail.com') then our forums then have protection from unknowingly linking to what google see's as 'bad neighbourhoods'. If any boards have a google page rank of 3 or more then this protection will be crucial.

Any website that links directly to a 'bad neighbourhood' is extremely penalised both in page rank and search engine positioning. However if this MOD can be made to work then google will not see it as a direct link... and will not follow the redirect.

Can any PLEASE help me figure out this MOD so we can add some protection to high ranking boards with lots of posts!!!

Thanks...

Rob
Go to Top of Page

Nikkol
Forum Moderator

USA
6907 Posts

Posted - 27 July 2003 :  11:49:25  Show Profile
you also need to look as the functions ReplaceURLs. There another function I believe, but I can't seem to find it right now.

Nikkol ~ Help Us Help You | ReadMe | 3.4.03 fixes | security fixes ~
Go to Top of Page

aspwiz
Junior Member

250 Posts

Posted - 27 July 2003 :  12:43:43  Show Profile  Visit aspwiz's Homepage
I've tried 3 functions in total.... can't seem to figure what the hell is going on...
especially with the jscript one....
Go to Top of Page

aspwiz
Junior Member

250 Posts

Posted - 28 July 2003 :  06:39:58  Show Profile  Visit aspwiz's Homepage
I can get all links going now except ones that are built up with forum code ([ url] [/ url])..... nearly there I think.

Is anyone else working on this?

Rob
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.45 seconds. Powered By: Snitz Forums 2000 Version 3.4.07