PDA

View Full Version : Hiding variables in PHP



amatureflashguy
April 21st, 2005, 01:25 AM
hello,
I have a question about varibles in PHP. I have a flash project I am working on and want it available for viewing online, but don't want it to be downloadable because it may be tampered with. What I was wondering is if there is a way to assign the variable the name such as flash = "mymovie.swf" and making it so that mymovie.swf is shown in the broswer window, but the actual name mymovie.swf doesn't appear in the HTML page source. If somebody could help me out with this, or recomend another method for me to use, that would be very appreciated!
thanx

b.rich
April 21st, 2005, 01:48 AM
nope. the html needs to render the path to the movie but you could make a container flash movie that loads the other movies. If someone seeks it tho.. they will find it.

amatureflashguy
April 22nd, 2005, 12:14 AM
nope. the html needs to render the path to the movie but you could make a container flash movie that loads the other movies. If someone seeks it tho.. they will find it.
I see what you mean. I'm not sure if you know much about action script, but I have a blank index.swf file that would show up for download instead of the actual swf im using, and it loads the swf i want by using the script
loadMovieNum (flash, 1);
and flash is actually a varible that is loaded from an external php file. Like you said, if someone seeks it they will find it...the only way I could think of anybody finding the actual name the .swf is to write their own php file and print the contents of mine by using a method such as
<?php
print("$flash");
?>
into a php script. Granted I'm realativly new to php and am teaching myself, but is there a way I could specify that only the IP address of my server has access to my file? and any other IP address would get blocked out? or print something else instead of the .swf name?

nobody
April 22nd, 2005, 12:37 AM
Well if you want it so only you from your IP address could access the page you could do something like...



$yourIP = 122.34.632; /*obviously change this to your IP address*/
if ($_SERVER['REMOTE_ADDR'] != $yourIP) {
echo 'You are not permitted to view this site';
} else {
/*echo page contents*/
}

This will at least protect the main page that's displaying the flash page, however the end user could still access your flash file if they went a searching. A more effective way of only allowing yoursel into this page/file would be to put them into the same director and use an .htaccess to password protect it.

Hope this helped at least a little.

amatureflashguy
April 22nd, 2005, 11:06 PM
This will at least protect the main page that's displaying the flash page, however the end user could still access your flash file if they went a searching. A more effective way of only allowing yoursel into this page/file would be to put them into the same director and use an .htaccess to password protect it.

thanx, that IP trick worked just like I wanted to. you mentioned something about .htaccess. I've heard of that before but I'm not familiar with what it is. How would I go about doing that for my page/file?

nobody
April 23rd, 2005, 12:00 AM
Just do a google search for htaccess, there's about a jazillion or so tutorials out there on it. Good luck :)

amatureflashguy
April 23rd, 2005, 02:09 PM
thanx a lot for your help!