00:00
00:00
Newgrounds Background Image Theme

Snowycity just joined the crew!

We need you on the team, too.

Support Newgrounds and get tons of perks for just $2.99!

Create a Free Account and then..

Become a Supporter!

Strip Function

4,221 Views | 8 Replies
New Topic Respond to this Topic

Strip Function 2005-06-14 13:50:40


I was making a security script for my sites flash movies and I forgot that when its uploaded to ng I wont know the exact location of the flash. So I wont know what to put for the location its looking for, making the movie not able to be played.

I remember seeing a tutorial that would strip the location and use an array for allowed sites. I got the array crap down but I dont remember how to strip the url. I think the tutorial was psychogoldfish's protection, but its not up anymore...

Response to Strip Function 2005-06-14 15:22:06


So in other words you want to proceed with hotlinking NG flash's which they strictly dislike?


Merkd.com - It Pays to Play

Earn real money by betting and investing; or, sponsor, challenge, compete,

recruit, communicate, network, earn money playing games, and much more.

Response to Strip Function 2005-06-14 15:51:05


No no no no, lol. Well I finally made the script but it doesn't seem to work, but wut it is supposed to do is provent anyone else besides sites i put on an allow list to from putting the flash on their site.

Here is the script I came up with, it should work but I dont know why. I have been trying at it for almost 2 hours and it looks like it should work but it doesn't.

var my_str = String = "http://www.frostbite-studios.com/security.swf";
var my_array = Array = my_str.split(".com", 1);

var reallocation = my_array;

var allowlocation = "http://www.frostbite-studios";

if (reallocation == allowlocation) {
trace("IT WORKS!");
} else {trace("YOU FAILED!");}

Response to Strip Function 2005-06-14 17:11:59


You have to test _root._url against your array of allowed sites.


BBS Signature

Response to Strip Function 2005-06-14 17:12:45


I know im just not doing that because im to lazy to reupload everytime i test it

Response to Strip Function 2005-06-14 17:51:00


Yes I had that, but now lets say I submit a flash with that to newgrounds. I wouldn't know its exact location. Thats why I strip the _root._url down to only the domain and if the domains match it lets the movie play. But no flash has to be gay and make the script not work when it looks like it should...

Response to Strip Function 2005-06-15 10:36:16


Yes yes I know, I went to the macromedia forums asking for help cause no one else here seems to know AS and they gave me the same answer. Thnx anyway, im just glad its all freaking over I spent almost all trying to find the function and then to find out that it wasn't working made me feel mad.

Thnx

Response to Strip Function 2005-06-16 07:00:51


I don't do as but here's my try(php syntax):
$arr[0]='www.ungrounded.com';//Remember ng uses this domain for the flashfiles
$arr[1]='www.yourdomain.com';
$rurl=lower($_root->_url);
foreach($arr as $url) {
if($url==$rurl) {
$ok=true;
break;
}

}
if(!$ok) {
echo 'Watch this movie at http://www.yoursite.com and f the site you found this on';
}


Each time someone abuses hittest, God kills a kitten. Please, learn real collision testing.

Response to Strip Function 2005-06-16 08:50:57


This won't work on your local filesystem. Also make sure you change the "goodurl" and "badurl" jumps to something appropriate in your file:

_____________________________________________

this_url = _root._url;

// list of allowed urls.
allowed_urls = new Array("uploads.ungrounded.net", "uploads.newgrounds.com", "www.yoursite.com", "yoursite.com", "yoursite.mirror.com");

// Take out the http://, and get the domain
// Life would be so much easier if Flash supported regular expressions
// as a standard.
this_url = this_url.substr(7, this_url.length);
this_url = this_url.substr(0, this_url.indexOf("/"));

var found_good_url = 0;
for(var i=0; i<allowed_urls.length; i++)
{
if(this_url == allowed_urls[i])
{
found_good_url = 1;
break;
}
}

if(found_good_url == 1)
{
gotoAndStop("goodurl");
} else
{
gotoAndStop("badurl");
}