if (is_dir("$link/index.php"))

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Jackount
Forum Newbie
Posts: 13
Joined: Wed Aug 10, 2011 5:38 am

if (is_dir("$link/index.php"))

Post by Jackount »

Code: Select all

if (is_dir("$link/index.php"))
I have this in my code. The $link variable is initialized in the start of the script:

Code: Select all

$link = $_POST['link'];
from a html document:

Code: Select all

<input id="textbarNewurl" type="text" name="link" size="30" maxlength="60" />
inside a form calling the php script. all under control, I'm sure.

The is_dir function is supposed to check whether there is a index page in the folder with the name of whatever the user has inputted. It does not do that??? What have I done wrong?
When I check in explorer, there IS a index.php file in that folder.
Thanks in purpose.
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: if (is_dir("$link/index.php"))

Post by Celauran »

Jackount wrote:The is_dir function is supposed to check whether there is a index page in the folder with the name of whatever the user has inputted.
No it isn't.
User avatar
egg82
Forum Contributor
Posts: 156
Joined: Sat Oct 01, 2011 9:29 pm
Location: Colorado, USA

Re: if (is_dir("$link/index.php"))

Post by egg82 »

in short, checking for index.php will always return false
this, however...
Jackount
Forum Newbie
Posts: 13
Joined: Wed Aug 10, 2011 5:38 am

Re: if (is_dir("$link/index.php"))

Post by Jackount »

lol... must've misunderstood the php.net manual for is_dir... thanks!
Post Reply