Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 03-01-2004, 12:08 AM   #1
d-woo
Member
 
Join Date: Feb 2004
Posts: 60
Send a message via Yahoo to d-woo
Default SWF to run only on specified IP Address

I'm designing and hosting Flash sites on my dedicated server.

Is there a way (script) for me to ensure that the SWFs only run if they are hosted on my server (IP Address)?
d-woo is offline   Reply With Quote
Old 03-01-2004, 08:07 AM   #2
CyanBlue
Super Moderator
 
CyanBlue's Avatar
 
Join Date: Jan 2002
Location: Centreville, VA
Posts: 26,666
Default

You can have some server side script to check the IP address and then decide whether to display the SWF file or not...
Search the forum with 'REMOTE_ADDR' to find out how to do that in PHP...

I think you might be able do that in JavaScript but I don't know how...
__________________
CyanBlue / Jason Je / Macromedia Certified Flash Developer & Designer
http://CyanBlue.FlashVacuum.com
http://www.FlashVacuum.com
http://tutorials.FlashVacuum.com

Do NOT PM, Email or Call me... Your question belongs right in this forum...
CyanBlue is offline   Reply With Quote
Old 03-01-2004, 09:44 AM   #3
Ruben
Me
 
Ruben's Avatar
 
Join Date: Jul 2002
Location: Netherlands, Europe
Posts: 3,512
Send a message via MSN to Ruben Send a message via Skype™ to Ruben
Default

Good one.

But if you'r not a hero when it comes down to serversidescripting you could do something like letting the swf open the original URL.

So if the page where you have the swf would be 'http://www.somedomein.com/movie.html', on the first frame of the movie you'd place the script:

Code:
getURL("http://www.somedomein.com/movie.html","_self");
Then anybody who'd place the swf on his/her site would only recommend you're site. Even without meaning to

- Ruben
__________________
.
Originally Posted by MichaelxxOA
"He sounded like he knew which words he was going to use before he knew what he was going to say. I hate that shit."
Ruben is offline   Reply With Quote
Old 03-01-2004, 04:10 PM   #4
d-woo
Member
 
Join Date: Feb 2004
Posts: 60
Send a message via Yahoo to d-woo
Default

Thanks CyanBlue,

I am familiar with how to perform the IP Address check in PHP....but if they take the SWF file and host it elsewhere I'm outta luck.

Is there a way to perform this check in the SWF?


Thanks Ruben,

But if their domain is www.theirdomain.com and the hosting for their that domain is moved to another service then www.theirdomain.com is still going to work...outta luck again.

I like the thought process.
d-woo is offline   Reply With Quote
Old 03-01-2004, 04:22 PM   #5
d-woo
Member
 
Join Date: Feb 2004
Posts: 60
Send a message via Yahoo to d-woo
Default

I am now going to attempt a combination of both suggestions.

I will apply the getURL in the SWF file first frame, except it will get a PHP file (on my domain) that checks the remote IP address.

a. If it passes---> proceed

b. If it fails ---> display a "nice" message

Not exactly sure how to execute this ("a" and "b")...but here goes

I'll keep you posted.

Thanks!
d-woo is offline   Reply With Quote
Old 03-01-2004, 04:22 PM   #6
d-woo
Member
 
Join Date: Feb 2004
Posts: 60
Send a message via Yahoo to d-woo
Default

The PHP file that checks the IP address will reside on my domain.
d-woo is offline   Reply With Quote
Old 03-01-2004, 04:28 PM   #7
splict
spend my time in blender
 
splict's Avatar
 
Join Date: Oct 2003
Location: tampa, fl
Posts: 1,138
Default

well nothings going to be fullproof, but this may help:
PHP Code:
stop();
myURL "actionscript.org";
if(
_root._url.indexOf(myURL)!=-1gotoAndPlay(2); 
__________________

Certified Flash MX 2004 Developer
splict is offline   Reply With Quote
Old 03-01-2004, 09:33 PM   #8
CyanBlue
Super Moderator
 
CyanBlue's Avatar
 
Join Date: Jan 2002
Location: Centreville, VA
Posts: 26,666
Default

Obviously, I didn't undersand the question correctly...
__________________
CyanBlue / Jason Je / Macromedia Certified Flash Developer & Designer
http://CyanBlue.FlashVacuum.com
http://www.FlashVacuum.com
http://tutorials.FlashVacuum.com

Do NOT PM, Email or Call me... Your question belongs right in this forum...
CyanBlue is offline   Reply With Quote
Old 03-01-2004, 09:46 PM   #9
splict
spend my time in blender
 
splict's Avatar
 
Join Date: Oct 2003
Location: tampa, fl
Posts: 1,138
Default

@CyanBlue Are you sure? Maybe I didn't understand it?

@d-woo
Quote:
Hi Splict,

In the actionscript:

Code:
stop(); 
myURL = "actionscript.org"; 
if(_root._url.indexOf(myURL)!=-1) gotoAndPlay(2);
What does the "if(_root._url.indexOf(myURL)!=-1)"
actually checking for (the -1) ?
what this code does is use ._url to check where the file is being run from. Then, the .indexOf checks the string (the url we just got) for the string in the parentheses (which is whatever you define in myURL). If indexOf doesn't find a match it will return -1.

So we check the current url (_root._url) against the url we have defined (myURL) and if it is in there (!= -1) we send the movie to frame 2 and let it play otherwise, it stays stopped. Of course you could adjust that and have it do whatever you wanted. You can find out more about these two functions in the manual - they explain them better than I could, probably

This method would need to be in the swf to work, but I think thats what you wanted, right? Or will you be hosting other people's files?
__________________

Certified Flash MX 2004 Developer

Last edited by splict; 03-04-2004 at 10:08 PM.
splict is offline   Reply With Quote
Old 03-02-2004, 12:22 AM   #10
d-woo
Member
 
Join Date: Feb 2004
Posts: 60
Send a message via Yahoo to d-woo
Default

Okay guys....the light is on now for me

I was not clear on my objective...my apologies.

My concern is not that some visitor will take the SWFs and run them on some other domain. The solutions that you all have provided would prevent that. My concern is that they would run the SWFs on another server (same domain name).


Here is the full scenario.

1. I host websites on a dedicated box.
2. Each new client has his own domain, www.client1domain.com, www.client2domain.com, etc that they own and control.
3. I design flash sites and host them on my server.....same shared IP for all clients. Clients pay for their sites over 3 payments.

I want the SWFs to only be able to run on my server....the shared IP. If the clients take the SWF and move their domain names (which won't change) to another hosting company I want to render the SWFs inoperable...unless, of course, they have completed their payments.

Now, I thought of a solution a few hours ago.

Similar to the URL check, could I possibly check for a variable that is in a MySQL database (localhost) ....if that database is not available (i.e. the SWF is being run on another server) then the SWF stops?...as in Splict's example.

Green text shows what was edited on March 6th, 2004

Last edited by d-woo; 03-05-2004 at 12:44 PM.
d-woo is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT. The time now is 06:36 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.