Be a Supporter!

Site-lock help

  • 263 Views
  • 2 Replies
New Topic Respond to this Topic
Guil07
Guil07
  • Member since: Oct. 13, 2007
  • Offline.
Forum Stats
Member
Level 03
Blank Slate
Site-lock help 2009-02-24 11:23:17 Reply

Hey everyone..

Here's a very useful script for site-locking a swf:
http://www.flashrights.com/domaincontrol .htm

Only problem is, my site (crappy - free server) is at
http://guil07.freehostia.com/
(no "www." for some [free server] reason).

To test the code I changed it to this:

onEnterFrame = function () {
	textbox2.text = domain;
	urlStart = _url.indexOf("://") + 3;
	urlEnd = _url.indexOf("/", urlStart);
	domain = _url.substring(urlStart, urlEnd);
	LastDot = domain.lastIndexOf(".") - 1;
	domEnd = domain.lastIndexOf(".", LastDot) + 1;
	domain = domain.substring(domEnd, domain.length);
	if (domain != "guil07.freehostia.com") {
		textbox.text = "BAD";
	} else {
		textbox.text = "GOOD";
	}
};

where textbox and textbox2 are just dynamic text boxes on the stage..
It turns out this code returns domain as freehostia.com - but I want it to return guil07.freehostia.com

I've never worked with lastIndexOf and IndexOf, so any help or suggestions would be appreciated =)

~Guil


BBS Signature
Denvish
Denvish
  • Member since: Apr. 25, 2003
  • Offline.
Forum Stats
Member
Level 46
Blank Slate
Response to Site-lock help 2009-02-24 11:31:36 Reply

onEnterFrame = function () {
	textbox2.text = domain;
	urlStart = _url.indexOf("://") + 3;
	urlEnd = _url.indexOf("/", urlStart);
	domain = _url.substring(urlStart, urlEnd);
	if(domain.indexOf("www.")>-1){
		domain=domain.substr(4);
	}
	if (domain != "guil07.freehostia.com") {
		textbox.text = "BAD";
	} else {
		textbox.text = "GOOD";
	}
};

- - Flash - Music - Images - -

BBS Signature
Guil07
Guil07
  • Member since: Oct. 13, 2007
  • Offline.
Forum Stats
Member
Level 03
Blank Slate
Response to Site-lock help 2009-02-24 11:45:30 Reply

<3

Thanks Denvish, really appreciate it.

~Guil


BBS Signature