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

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • adrianTNT

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

    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_sec ret_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.

  • Randell D.

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



    adrianTNT wrote:
    [color=blue]
    > 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_sec ret_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.
    >[/color]


    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

    Comment

    Working...