Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Nov 2010
    Location
    Oregon
    Posts
    243
    Thanks
    23
    Thanked 10 Times in 10 Posts

    file include not getting proper error if !file exists

    For some reason I cant get this to work??

    if show file = yes; and if the file exists "include the file" - if we cant find the file "error file not found"
    if show file = no; show the html code <!-- file disabled -->

    Code:
    <?php 
    if($showinclude7 != 'no') 
       if(!file_exists{include "$fileinclude7"; } { 
          die ("File not found");} 
             else { echo"<!-- file didabled-->";} 
    ?>
    Last edited by DataTalk; 12-06-2010 at 12:52 PM.

  • #2
    Super Moderator
    Join Date
    Feb 2009
    Location
    England
    Posts
    539
    Thanks
    8
    Thanked 63 Times in 54 Posts
    PHP Code:
    if ($showinclude7 != 'no') {
      if (
    file_exists($fileinclude7)) {
        include(
    $fileinclude7);
      } else {
        die(
    'File not found');
      }
    } else {
      echo(
    '<!-- File disabled -->');

    lamped.co.uk :: Design, Development & Hosting
    marcgray.co.uk :: Technical blog

  • Users who have thanked Lamped for this post:

    DataTalk (12-06-2010)

  • #3
    Regular Coder
    Join Date
    Nov 2010
    Location
    Oregon
    Posts
    243
    Thanks
    23
    Thanked 10 Times in 10 Posts
    Thanks - was having a PHP brain fart on this logic!!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •