View Full Version : if (file_exists()) LIER!
Flash Gordon
11-19-2005, 08:46 PM
Code:
<?php
$file = $_SERVER['HTTP_HOST'] . "/" . $_GET['interview'] . ".swf"; //tried several variations of this as well.
echo $file;
if (file_exists($file)) {
//embed stuff
} else {
//echo IP
}
?>
Problem: The if statment always returns false. However, if I copy and paste the the echoed $file line into the browser, the file plays.
WHY? Am I over looking something stupid?
Thanks.
FG
EDIT:
This way works $file = getcwd() . "/" . $_GET['interview'] . ".swf"; But i would like to know what I am doing wrong up above.
CyanBlue
11-19-2005, 08:59 PM
I think you've got to provide the physical path to the file... That's where the original problem was... Or, am I not getting your point??? :)
Flash Gordon
11-19-2005, 09:06 PM
Perhaps, I miss understand too.
If I take the result from this line: $file = $_SERVER['HTTP_HOST'] . "/" . $_GET['interview'] . ".swf"; (which equals www.mysite.com/interview1.swf)
If I paste www.mysite.com/interview1.swf into my browser address bar, the swf plays. However, my php script says it doesn't exist?
The output of getcwd() . "/" $_GET['interview'] . ".swf"; equals something weird like this: /usr/pdf/local/mysite/httpdoc/interview1.swf.
Wouldn't www.mysite.com/interview1.swf be the physical path?
physical path : /usr/pdf/local/mysite/httpdoc/interview1.swf
this is somthing like C:/ProgramFiles/MMacromedia/Settings
www.mysite.com/interview1.swf
this is a WEB adress
you have in your Apache.ini file what adress is pointing to what Directori
for example
http://www.modernmusicians.com/~xeef/
woud point to
/usr/pdf/local/WhatEver
the server coud serv diferent domain names too
whit file_exists (in general any file operation) you have just access over it's
physical path in your case you try it over HTTP (it think there is some sort of a Warper so you coud READ it like a browser do but you CAN'T make much more or maximum as i can do whit it from my here)
this woud by BAD :
$file = "http://www.actionscript.org/security/seting.ini"
if (file_exists($file)) {
echo "cracker on the rigth way ;)";
}
Flash Gordon
11-19-2005, 10:51 PM
thanks to both of you!
:)
|
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.