Jump to content

[SOLVED] file_exists() help


pcw

Recommended Posts

Hi, I was using file_exists in part of an installation script. It was working but now it isnt.

 

This is what I have got:

 

<?php
print"<table border=0>";
print"<tr><td bgcolor=#CCCCFF>";
print "<center><b>File testing</b></center></br>";
print "<b>Checking files exist:</b>\n<br>"; 
if ( file_exists("adminpw.txt") )
if ( file_exists("enter.php") )
if ( file_exists("login.php") )
if ( file_exists("license.txt") )
{
print "Check passed: All files are present\n<br>";
} else {
print "Check Failed: Please reinstall and check all files are present\n<br>";
}
etc.
?>

 

Can anyone tell me what is going wrong? Also is there a way I can use file_exists to check multiple files instead of typing file_exists for every file I need to check?

Link to comment
https://forums.phpfreaks.com/topic/148796-solved-file_exists-help/
Share on other sites

you aren't using the IF statement correctly.

 

<?php
if ( file_exists("adminpw.txt") & file_exists("enter.php") & file_exists("login.php") & file_exists("license.txt") )
{
print "Check passed: All files are present\n<br>";
} else {
print "Check Failed: Please reinstall and check all files are present\n<br>";
}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.