View Full Version : determine IP address of server
dsdsdsdsd
10-21-2005, 09:23 PM
hello;
I have a URL : www.webpage.com = 123.456.7.890 ;
at the URL I have : index.html , with an OBJECT and EMBED tag ;
the tag calls : www.adifferentwebpage.com/an.swf ;
in the swf I WANT : var v = get_IP_address_of_hosting_webpage() ;
v ==> www.webpage.com OR 123.456.7.890
( v !==> www.adifferentwebpage.com )
any thoughts?
dsdsdsdsd
Asheville NC USA
pwang
10-21-2005, 09:41 PM
i guess you'll need server side scripts, such as PHP/Perl, to do that :)
dsdsdsdsd
10-21-2005, 09:48 PM
pwang, thanks for your response;
I imagine that surely a flash instance must have an inherent knowledge of its hosting IP address;
But I suppose that I could call a php from the swf and that that call might send along itself the calling IP address to the php;
thanks
dsdsdsd
CyanBlue
10-21-2005, 10:22 PM
No, Flash has no idea on the user's IP address... It's got to be supplied by the server side script...
Flash Gordon
10-21-2005, 11:22 PM
use a seperate preloader and then make all of your paths relative. That should prevent anyone from running the swf locally, right?
flyingchalupa
10-21-2005, 11:30 PM
will "swfName._url" not work?
dsdsdsdsd
10-21-2005, 11:51 PM
flyingchalupa, this._url returns the address of the swf's originating server but not the server of the hosting html which has the EMBED tag;
Flash Gordon, I will have to think about the preloader; however I do want people ( 'members' ) to be able to EMBED the swf; however their webpage's address must match the address that the member 'registered';
CyanBlue, why did you move my post; if I conclude that my line of thinking - that this issue is an ActionScript issue - is incorrect then I will attempt a different line of thinking - that this issue is a server side issue; I do not appreciate Big Brother, at any level, 'assisting' me;
nevertheless, I will take your hint that the issue is server side;
dsdsdsdsd
Flash Gordon
10-22-2005, 12:10 AM
dsdsdsdsd ,
You might want to edit that post a little bit. CyanBlue is one of the most helpful people here, besides oldnewbie (or whatever his name is). He is right, Flash doesn't have that capability of what you are asking. I was just providing a work around, but he is right.
Here is a bit to get you started. In the first frame of your blank seperate preloader add this.
var LV: LoadVars = new LoadVars();
LV.onLoad - function() {
if(LV.response == "swfs/myMovie.swf") {
gotoAndPlay(3);
} else {
gotoAndStop(2);
}
LV.sendAndLoad("myPHP.php", LV, "POST");
// also disable right click
//search for how
echo "&response=" . $_SERVER['PHP_SELF']; //this will determine the folder the swf is in.
// you could check it against that.
//or
//anything else you see fit from here:
//http://www.php.net/manual/en/reserved.variables.php#reserved.variables.server
CyanBlue
10-22-2005, 12:28 AM
Um... Sorry if I bothered you... But I thought that the topic belongs more toward the SSL rather than the AS... Remember that the forum is for everybody and I just did not want to confuse any newbie who read this thread and think that you can get the IP address via AS... That's the only reason why I moved the thread... :)
Flash Gordon
10-22-2005, 12:39 AM
I just did not want to confuse any newbie who read this thread He was talking about me :o
madgett
10-22-2005, 03:32 AM
Access your site by its IP address: http://127.0.0.1/somedir/somefile.html then access the _url property of the _root:this.createTextField("txt", 0, 0, 0, 0, 0);
txt.autoSize = true;
txt.text = _root._url;
dsdsdsdsd
10-22-2005, 04:19 AM
hello;
Flash Gordon, I have been tinkering with your suggestion;
however I would like to rephrase my question:
when a sendAndLoad ( "some.php" , ... ) is performed the php has to know where to return the result; the php must know the URL of the requesting swf; I would presume that the swf inherently sends to the php its address;
this is not the same as $_SERVER[ 'REQUEST_URI'] or $_SERVER[ 'PHP_SELF'] or $_SERVER[ 'SERVER_NAME'] all of which refer to the location of the php file which is in the same server folder as the swf;
dsdsdsdsd
Flash Gordon
10-22-2005, 05:55 AM
the php has to know where to return the resultNO! php does NOT care WHO requests it. It still has the same out put.
vBulletin® v3.7.1, Copyright ©2000-2009, Jelsoft Enterprises Ltd.