By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,583 Members | 1,084 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,583 IT Pros & Developers. It's quick & easy.

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

P: n/a
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...
*/
$my_var="my_secret_value";
echo($my_var);
?>

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.

-Adrian.

Jul 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a


adrianTNT wrote:
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...
*/
$my_var="my_secret_value";
echo($my_var);
?>

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.

-Adrian.

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.

randelld
Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.