PHP code causing no footer to appear

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

arwebsitedesign
New php-forum User
New php-forum User
Posts: 1
Joined: Tue Feb 04, 2014 6:37 am

PHP code causing no footer to appear

Postby arwebsitedesign » Tue Feb 04, 2014 6:44 am

Hi Guys,

I'm quite new to PHP so please bear with me.... I have the following code which goes is a search bar and it searches all files in my top level directory except for the pages I specify (which is the big list that takes up most of this code!!!!)....

Code: Select all

     <?php

        if (isset($_POST['search_field'])) { search_results(); return; }
        function search_results() {
          $search_text = htmlspecialchars(($_POST['search_field']));
          $found = false;
          if ($search_text != '') {
            $h_dir = @opendir('.');
         while ($filename = readdir($h_dir)) {
              if ($filename == '.' || $filename == '..'  || $filename == 'index.php'  || $filename == 'advertisingforestofdean.php'  || $filename == 'weddingpartyeventdecorationandhireforestofdean.php'  || $filename == 'advert_kmeventdecorfull.php'  || $filename == 'cakemakersforestofdean.php'  || $filename == 'photographersforestofdean.php'  || $filename == 'accommodationforestofdean.php'  || $filename == 'contact.php'  || $filename == 'terms.php'  || $filename == 'offersforestofdean.php'  || $filename == 'giftsandlocalshoppingforestofdean.php'  || $filename == 'cateringforestofdean.php'  || $filename == 'test.php'  || $filename == 'testinfo.php'  || $filename == 'eatinganddrinkingoutforestofdean.php'  || $filename == 'advert_foresttrader.php'  || $filename == 'advert_foresttraderinfo.php'  || $filename == 'advert_foresttraderinfofull.php'  || $filename == 'pestcontrolforestofdean.php'  || $filename == 'advert_forestofdeanpestcontrolfull.php'  || $filename == 'windowsforestofdean.php'  || $filename == 'designersprintersforestofdean.php'  || $filename == 'animalcareforestofdean.php'  || $filename == 'electriciansforestofdean.php'  || $filename == 'jewelleryforestofdean.php'  || $filename == 'sitemap.xml'  || $filename == 'search.php'  || $filename == 'payment.php'  || $filename == 'taxifirmsforestofdean.php'  || $filename == 'propertyandgardenmaintenanceforestofdean.php'  || $filename == 'menu.php'  || $filename == 'sidebar.php'  || $filename == 'accountantsforestofdean.php'  || $filename == 'sportsexerciseperformingartsforestofdean.php' || $filename == 'sportsperformingartsforestofdean.php' || $filename == 'plumbersheatingengineersforestofdean.php'  || $filename == 'newsletterforestofdean.php'  || $filename == 'thingstodoforestofdean.php'  || $filename == 'kinesiologyholisticforestofdean.php'  || $filename == 'nurseriesplaygroupsforestofdean.php'  || $filename == 'advert_annyclairescraftfull.php'  || $filename == 'advert_deanfieldfull.php'  || $filename == 'advert_foresttraders.php'  || $filename == 'advert_thebeautyrooms.php'  || $filename == 'advert_forestofdeanchaircoversandsashhire5.php'  || $filename == 'eventsforestofdean.php'  || $filename == 'events_detail.php'  || $filename == 'advert_forestofdeanchaircoversandsashhirefull.php'  || $filename == 'televisionaerialsatelliteforestofdean.php'  || $filename == 'computertechnologyforestofdean.php'  || $filename == 'carpentersforestofdean.php'  || $filename == 'events.php'  || $filename == 'events_detail.php'   || $filename == 'headeradverts.php'   || $filename == 'advert_davidaitkentheoddjobman.php'   || $filename == 'advert_perfectnightinfull.php'   || $filename == 'photographsforestofdean.php'    || $filename == 'eatingintakeawayforestofdean.php'  || $filename == 'discosentertainmentforestofdean.php'  || $filename == 'psychicreadingsforestofdean.php'  || $filename == 'bodyshopforestofdean.php'  || $filename == 'buyingsellingvehiclesforestofdean.php' || $filename == 'sewingfabricalterationsforestofdean.php' || $filename == 'about.php' || $filename == 'aboutforesttraders.php' || $filename == 'mainmenu.php' || $filename == 'weddingservicesforestofdean.php' || $filename == 'competitionforestofdean.php' || $filename == 'competitionheader.php' || $filename == 'physiotherapistsforestofdean.php' || $filename == 'advert_personalisedlabels.php' || $filename == 'buildersforestofdean.php' || $filename == 'cakemakersforestofdean.php' || $filename == 'therapistsforestofdean.php' || $filename == 'internetcafeforestofdean.php' || $filename == 'websitedesignforestofdean.php' || $filename == 'advert_minerscountryinn.php'  || $filename == 'advert_daelectricalfull.php' || $filename == 'doggroomersforestofdean.php' || $filename == 'balloonsforestofdean.php' || $filename == 'advert_millhall_full.php' || $filename == 'testimonialsforestofdean.php' || $filename == 'kitchenandbathroomfittersforestofdean.php' || $filename == 'financialservicesforestofdean.php' || $filename == 'bouncycastlehireforestofdean.php' || $filename == 'windowcleanersforestofdean.php' || $filename == 'paintersanddecoratorsforestofdean.php' || $filename == 'facepaintersforestofdean.php' || $filename == 'windowsdoorsglazingforestofdean.php' || $filename == 'embroideryprintingforestofdean.php' || $filename == 'itsupportforestofdean.php' || $filename == 'campingcaravanningplacestostayforestofdean.php' || $filename == 'signageforestofdean.php' || $filename == 'functionroomhireandstoragefacilitiesforestofdean.php' || $filename == 'eventplannersforestofdean.php' || $filename == 'sportsequipmentrepairsforestofdean.php' || $filename == 'advert_designersignsfull.php' || $filename == 'advert_deanwoodfull.php' || $filename == 'advert_deanwoodconferencefull.php' || $filename == 'sidebar2.php' || $filename == 'domesticappliancerepairsforestofdean.php' || $filename == 'advert_positivesolutions_full.php' || $filename == 'petsittingservicesforestofdean.php' || $filename == 'mortgagesandinsuranceservicesforestofdean.php' || $filename == 'positivesolutionsdisclaimer.php' || $filename == 'advert_blingbox_full.php' || $filename == 'televisionaerialsatelliteforestofdean.php' || $filename == 'ovencleanersforestofdean.php' || $filename == 'advert_ovenpig_full.php' || $filename == 'wallandfloortilersforestofdean.php' || $filename == 'floristsforestofdean.php' || $filename == 'lifecoachingforestofdean.php' || $filename == 'computerrepairsforestofdean.php' || $filename == 'advert_pdspry_full.php' || $filename == 'advertisingbusinessesfromotherareas.php' || $filename == 'morebusinesses.php' || $filename == 'blog.php' || $filename == 'buildersandroofersforestofdean.php') continue;
                  $file_data = file($filename);
                  foreach($file_data as $file_line) {
                    if(stristr($file_line, $search_text)) {
                      include $filename;
                 $found = true;
                      break;
                    }
                  }
            }
          }
          if ($found == false) echo '<p class="error">Nothing found containing "<strong>'.$search_text.'</strong>".</p>';
        }
      ?>


Although this works great, this is not displaying the footer to my website. Now this search works on other websites but this is the first mobile friendly website I am doing, which uses a framework rather than a fixed width. Therefore I don't know if this is the PHP code or the HTML.... Could a PHP expert just have a quick look over my code and check it is OK? That would be great!!

Thanks

Return to “PHP coding => General”

Who is online

Users browsing this forum: No registered users and 1 guest