I want a php page to return a variable only if it was requested from a certain file.

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
Hello, can anyone help me with this? I am new to PHP.
I would like to load a variable from a php file, the php script should
only give the variable if it was requested by a page on my site.

the php script would have to be something like:

some test here, if this script was accesed from
http://www.adriantnt.com then...

I will need this to be used with swf flash files.
The swf flash file will be included in a page on my site, the swf will
contain action script that loads the variable from the above php
script, I want this variable to be returned only if it was requested by
the swf file on my site and not just by entering the php link in
browser so that no one can see the variable value except my swf file.
Can this be done ?
Thank you.


Re: I want a php page to return a variable only if it was requestedfrom a certain file.

adrianTNT wrote:

Quoted text here. Click to load it

Check the output of phpinfo();  There are many variables there that will
be of interest - Specifically, check the $_SERVER array - You're bound
to find a 'REFER' or QUERY_STRING in there - however don't expect this
to be 100% secure (either by being spoofed, or via a web browser that
doesn't provide this in its headers when it visits your webpage) - If
you really want to tie things down then you'll have to come up with some
alternative method to reduce folks from reading/viewing your flash...

To test it, have your flash perform its POST to a script that just
contains phpinfo(); command - then view the output.


Site Timeline