Hi,
I set this site up partly in php sometime ago. The index page draws its main contents down from a database. Not all though, the template is created by html and css. About a month ago i went into it to check it and found the index page was just showing as a blank page. I could not find what was wrong with the code so I uploaded the index page again. This seemed to do the trick as the index page was now visible. It was also visible if i went back to it from other pages on the site. however after after another weeek i went back to it and it was blank again. I went through the same proccess and got it back. a week later the same problem. There is obviously quite a flaw here but I cant track it down. any ideas?
the website is www.louandelcats.co.uk
Below is the index page code and the function file:
The functions file:Code:<?php require_once("connect/connection.php"); include("includes/functions.php"); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!-- saved from url=(0014)about:internet --> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Home</title> <script type="text/javascript" language="JavaScript1.2" src="menu.js"></script> <style type="text/css"> <!-- .style3 { font-size: 12px; color: #000000; } .style4 {color: #FF0000} .style5 {color: #008000} .style6 {color: #808080} --> </style> <link href="articles/content1.css" rel="stylesheet" type="text/css" /> <style type="text/css"> <!-- #Layer2 { position:absolute; width:200px; height:115px; z-index:4; left: 776px; top: 831px; } --> </style> <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-18301581-1']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script> </head> <body background="images/catchatstuff/orangeback.jpg" > <div id="wrapper"> <div id="banner"><img src="images/catchatstuff/newbanner2.gif" align="left" alt="banner index" width="964" height="80" border="2" /></div> <div id="ccbox"><img src="images/catchatstuff/catchatlogo3.gif" width="200" height="100" border="0" usemap="#Map" /> <map name="Map" id="Map"><area shape="rect" coords="12,9,187,93" href="phpbb/index.php" /> </map></div> <div id="menu"><?php require("includes/addmenu.js");?></div> <div align="center" > <p ><script src="http://services.newsgator.com/ngws/headlines.aspx?uid=1118043&mid=6"></script></p> </div> <div id="marklogo"><a href="http://www.markets2000.co.uk"><img src="images/catchatstuff/design graphic.gif" alt="web site design by markets2000" width="127" height="60" border="0" usemap="#Map11" /></a> <map name="Map11" id="Map11"><area shape="rect" coords="13,7,116,54" href="http://www.markets2000.co.uk" /> </map></div> <div id="dataped"><img src="images/catchatstuff/pedhigh.gif" alt="This months highlight" /></div> <div id="mainarea"> <div id="contentind"> <div id="contentbox"><?php tablerows(" ","intro", "4");?><div id="sig"><img src="images/catchatstuff/sig1.gif" alt="Louandel web master " width="135" height="43" /></div> </div><!--contentbox--> <div class="contentbox"> <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="508" height="100"> <param name="movie" value="images/catchatstuff/newflash.swf" /> <param name="quality" value="high" /> <embed src="images/catchatstuff/newflash.swf" width="508" height="100" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"></embed> </object> </div><!--flash--> <div id="half"> <div id="spotex"><img src="images/articleimage/streetcat.jpg" alt="Cat Care" width="293 height="42" style="float:right" /> <?php tablerows("topleft_tit","topleft_cont","4");?> <div id="Layer2"><img src="images/catchatstuff/lilel1.gif" width="141" height="93" /></div> </div> <div id="spotex"><img src="images/articleimage/catcare1.jpg" /><?php tablerows("botleft_tit","botleft_cont","4"); ?> </div> </div> <div id="half"> <div id="spotex"><?php tablerows("topright_tit","topright_cont", "4"); ?></div> <div id="spotex"><img src="images/articleimage/catandlap1.jpg" /><?php tablerows("botright_tit","botright_cont","4");?></div> </div> <div id="newindex"><img src="images/articleimage/articleask.gif" alt="Send in your own articles" width="480" height="90" border="0" usemap="#Map2" /> <map name="Map2" id="Map2"> <area shape="rect" coords="54,15,443,76" href="articles/articleRules.php" alt="Article rules" /> </map> </div> </div> <!-- contentind --> <?php require("includes/index_footer.php");
thanks for your helpCode:<?php /*---------------------------------------mysqli prep-------------------------------------------*/ function mysqli_prep($value){ global $connection; $magic_quotes_active = get_magic_quotes_gpc(); $new_enough_php = function_exists("mysqli_real_escape_string"); if($new_enough_php){ if ($magic_quotes_active){ $value = stripslashes($value);} $value = mysqli_real_escape_string($connection, $value); }else{ if(!$magic_quotes_active){$value = addslashes($value);} } return $value; } /*--------------------------------------------------redirect--------------------------------*/ function redirect_to($location = NULL){ if($location != NULL){ header("Location:{$location}"); exit; } } /*------------------------------------------------------index page----------------------------*/ // indexpage function tablerows($field, $field2, $id){ if(!$id){ die; } global $connection; $query = "SELECT * FROM cms_index WHERE id = $id"; $result = mysqli_query($connection, $query); if(!$result){die("Database query failed".mysqli_error($connection));} while($row = mysqli_fetch_array($result)){ echo $row[$field]; echo $row[$field2]; } } // this next line is for security. you should always be careful when you embed variables in sql. // the action is a typecast and changes the variable to "int" $id = isset( $_GET['id'] ) ? (int) $_GET['id'] : ''; /*---------------------------------------New function for index CMS---------------------------*/ function tablerows1($field, $id){ if(!$id){ die; } global $connection; $query = "SELECT * FROM cms_index WHERE id = $id"; $result = mysqli_query($connection, $query); if(!$result){die("Database query failed".mysqli_error($connection));} while($row = mysqli_fetch_array($result)){ echo $row[$field]; } } // this next line is for security. you should always be careful when you embed variables in sql. // the action is a typecast and changes the variable to "int" $id = isset( $_GET['id'] ) ? (int) $_GET['id'] : ''; // the following is for content for catcare, showcat and Kitten central function careshowkit($field, $id){ if(!$id){ die; } global $connection; $query = "SELECT * FROM cms_careshowkit WHERE id = $id"; $result = mysqli_query($connection, $query); if(!$result){die("Database query failed".mysqli_error($connection));} while($row = mysqli_fetch_array($result)){ echo $row[$field]; } } // this next line is for security. you should always be careful when you embed variables in sql. // the action is a typecast and changes the variable to "int" $id = isset( $_GET['id'] ) ? (int) $_GET['id'] : ''; //the following is a function for pedigree function pedigree($field, $id){ if(!$id){ die; } global $connection; $query = "SELECT * FROM cms_pedigree WHERE id = $id"; $result = mysqli_query($connection, $query); if(!$result){die("Database query failed".mysqli_error($connection));} while($row = mysqli_fetch_array($result)){ echo $row[$field]; } } // this next line is for security. you should always be careful when you embed variables in sql. // the action is a typecast and changes the variable to "int" $id = isset( $_GET['id'] ) ? (int) $_GET['id'] : ''; /*---------------------------------------------linda image path--------------------------------*/ function image_path($field){ if(!$id){ die; } global $connection; $query = "SELECT * FROM photographs "; $result = mysqli_query($connection, $query); if(!$result){die("Database query failed".mysqli_error($connection));} while($row = mysqli_fetch_array($result)){ echo $row[$field]; } } ?>



Reply With Quote



27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="508" height="100">
Bookmarks