Ik ben nog een behoorlijk newbie op php gebied. Ben een zeer ervaren xhtml- en css-er Maar ben pas net begonnen met php. Ik heb een website met cms aangeslote gemaakt. Het cms script is 1 grote puinhoop. Ik doe jullie het nu nog even niet aan deze te moeten doorkijken. Dus wil vragen of jullie het script van mijn index kunnen bekijken? Is het beetje goed gescript.. beetje netjes en veilig? Hoor graag al het comentaar. Dingen als wat een zooi heb ik niks aan graag met goede argumenten!
<?php
error_reporting(E_ALL);
ini_set("display_errors", 1);
if (isset($_GET['id']) && is_numeric($_GET['id'])) {
$id = $_GET['id'];
}
else
{
$id = 1;
}
include("config.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Titel</title>
<link href="style.css" rel="stylesheet" type="text/css" />
<!--[if gte IE 5.5000]>
<script language="JavaScript">
function correctPNG() // correctly handle PNG transparency in Win IE 5.5 or higher.
{
for(var i=0; i<document.images.length; i++)
{
var img = document.images[i]
var imgName = img.src.toUpperCase()
if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
{
var imgID = (img.id) ? "id='" + img.id + "' " : ""
var imgClass = (img.className) ? "class='" + img.className + "' " : ""
var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
var imgStyle = "display:inline-block;" + img.style.cssText
if (img.align == "left") imgStyle = "float:left;" + imgStyle
if (img.align == "right") imgStyle = "float:right;" + imgStyle
if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
var strNewHTML = "<span " + imgID + imgClass + imgTitle
+ " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
+ "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
+ "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>"
img.outerHTML = strNewHTML
i = i-1
}
}
}
window.attachEvent("onload", correctPNG);
</script>
<![endif]-->
</head>
<body>
<div id="container">
<div id="top">
<div id="top_hoek-lt"></div>
<div id="top_hoek-lb"></div>
<div id="top_hoek-rt"></div>
<div id="top_hoek-rb"></div>
<div id="top_images-l"></div>
<div id="top_logo"></div>
<div id="top_images-r"></div>
<div id="top_hoofdmenu_t"><a href="" id="top_hoofdmenu_button-4">Beeld & Geluid</a><a href="" id="top_hoofdmenu_button-8">Gereedschap</a><a href="" id="top_hoofdmenu_button-6">PC & Toebehoren</a><a href="" id="top_hoofdmenu_button-7">Huishouden</a><br />
</div>
<div id="top_hoofdmenu_b"><a href="" id="top_hoofdmenu_button-2">Muziek & DVD</a><a href="" id="top_hoofdmenu_button-5">Automaterialen</a><a href="" id="top_hoofdmenu_button-3">Speelgoed</a><br />
</div>
<div id="top_menu"><a href="index.php?id=1">home</a> | <a href="index.php?id=5">zoeken</a> | <a href="index.php?id=100&scr=basket/?_hidemenu=1">winkelwagen</a> | <a href="index.php?id=6">algemene voorwaarden</a> | <a href="index.php?id=7">contact</a></div>
</div>
<div id="menu">
<div id="menu_hoek-t"></div>
<div id="menu_content">
<h1>Home</h1>
<div class="menu_content-rand"></div>
<ul id="menu_content">
<li><a href="#">Boeken</a></li>
<li><a href="#">Muziek & DVD</a></li>
<li><a href="#">Speelgoed</a></li>
<li><a href="#">Beeld & Geluid</a></li>
<li><a href="#">Automaterialen</a></li>
<li><a href="#">PC & Toebehoren</a></li>
<li><a href="#">Huishouden</a></li>
<li><a href="#">Gereedschap</a></li>
<li><a href="#">Verzorging</a></li>
</ul>
<div class="menu_content-rand" style="margin-bottom:0"></div><br />
</div>
<div id="menu_hoek-b">
<div id="menu_hoek-br"></div>
</div>
</div>
<?php
if($id == 1)
{
include("main.php");
}
elseif($id == 2)
{
include("tips.php");
}
elseif($id == 3)
{
include("nieuws.php");
}
elseif($id == 4)
{
include("verwacht.php");
}
elseif($id == 5)
{
include("zoeken.php");
}
elseif($id == 6)
{
include("voorwaarden.php");
}
elseif($id == 7)
{
include("contact.php");
}
elseif($id > 99)
{
if (isset($_GET['scr'])) {
$scr = strip_tags($_GET['scr']);
}
else
{
$scr = "basket/";
}
echo '<div id="sub"><IFRAME title="webshop" id="webshop" name="webshop" src="http://www.winkel.nl/shop/';
echo $scr;
echo'&_searchblock=0"scrolling="no" frameborder="0" border="0" marginheight="10" marginwidth="0" width="610" height="800" style="margin-left:5px; z-index:0"></IFRAME></div>';
}
else
{
echo 'Error neem contact op met de beheerder';
}
?>
<div id="top5_title"></div>
<div id="top5">
<div id="top5_hoek-t"></div>
<div id="top5_content">
<?php
if(!isset($_GET['mode']))
{
$resultt = mysql_query("SELECT * FROM producten WHERE top5 > '0' ORDER BY top5 LIMIT 0, 5");
}
if(isset($resultt))
{
while($row_qpt=mysql_fetch_assoc($resultt))
{
echo '<div class="top5_prod">';
echo' <table border="0">
<tr>
<td width="13"><div class="top5_nr">' .$row_qpt['top5'] .'</div></td>
<td width="127"><a href="index.php?id=100&scr=productinfo'.$row_qpt['cat'] .'/?artikelnummer='.$row_qpt['art_nr'] .'"><img src="'.$row_qpt['img_sm'] .'" width="85" align="top" border="0" alt="Boeken, Dvds, webshop." class="top5_foto" /></a>';
if ($row_qpt['nieuw'] > "0")
{
echo '<div class="top5_nieuw"><img src="images/label_nieuw.png" alt="Nieuw" width="55" height="55" /></div>';
}
if ($row_qpt['actie'] > "2")
{
echo '<div class="top5_nieuw"><img src="nieuw.png" alt="Nieuw" width="55" height="55" /></div>';
}
echo'</td>
</tr>
<tr>
<td> </td>
<td><div class="top5_prijs">€'.$row_qpt['prijs'] .'</div></td>
</tr>
</table></div>';
}}
else
{
echo'Error neem contact op met de beheerder';
}
?><br />
</div>
<div id="top5_hoek-b">
<div id="top5_hoek-br"></div>
</div>
</div>
<div id="copyright">----</div>
</div>
</body>
</html>
en mijn main script
<div id="main">
<div class="main_hoeken">
<div class="main_top-left"></div>
<div class="main_top-right"></div>
<div class="main_nieuw_inside">
<table width="590" border="0" style="margin:auto auto" align="center">
<tr>
<?php
// Kijken of er een id word meegegeven
if(!isset($_GET['mode']))
{
$resultn = mysql_query("SELECT * FROM producten WHERE nieuw > '0' ORDER BY nieuw LIMIT 0, 4");
}
if(isset($resultn))
{
while($row_qpn=mysql_fetch_assoc($resultn))
{
echo ' <td>
<div class="main_nieuw_prod">
<div class="img"><a href="index.php?id=100&scr=productinfo'.$row_qpn['cat'] .'/?artikelnummer='.$row_qpn['art_nr'] .'"><img src="'.$row_qpn['img_sm'] .'" border="0" width="85" alt="Boeken, Dvds, webshop." /></a></div>
<div class="main_nieuw_prijs">€'.$row_qpn['prijs'] .'</div>
<div class="main_nieuw"><img src="images/label_nieuw.png" alt="Nieuw" width="55" height="55" /></div>
';
if ($row_qpn['top5'] > "0")
{
echo '<div class="main_top5"><img src="images/label_top5.png" alt="Top5" width="55" height="55" /></div>';
}
echo' </div>
</td>';
}}
else
{
echo'Error neem contact op met de beheerder';
}
?>
</tr>
</table>
</div>
<div class="main_bottom-left"></div>
<div class="main_bottom-right"></div>
</div>
<div id="main_tnv">
<div id="main_tips">
<ul class="main_list">
<?php
// Kijken of er een id word meegegeven
if(!isset($_GET['mode']))
{
$resultt = mysql_query("SELECT * FROM producten WHERE tips > '0' ORDER BY id LIMIT 0, 2");
}
if(isset($resultt))
{
while($row_qpt=mysql_fetch_assoc($resultt))
{
echo '<li><strong>'.$row_qpt['naam'] .', </strong>'. substr($row_qpt['info'], 0, 100) . ' ... <a href="index.php?id=100&scr=productinfo'.$row_qpt['cat'] .'/?artikelnummer='.$row_qpt['art_nr'] .'"></a></li>';
}}
else
{
echo'Error neem contact op met de beheerder';
}
?>
</ul>
</div>
<div id="main_lnieuws">
<ul class="main_list">
<li><strong>23-07-2006</strong> Duis molestie. Nam nunc purus, interdum vel, pharetra nec, consequat eu, risus. Aliquam erat volutpa ... <a href="#"></a></li>
<li><strong>23-07-2006</strong> Lorem ipsum dolor sit amet, consectetuer adipiscing elit. In quis sapien. Nulla quis ante. Duis dict ... <a href="#"></a></li>
</ul>
</div>
<div id="main_verwacht">
<ul class="main_list">
<?php
// Kijken of er een id word meegegeven
if(!isset($_GET['mode']))
{
$resultv = mysql_query("SELECT * FROM producten WHERE verwacht > '0' ORDER BY id LIMIT 0, 2");
}
if(isset($resultv))
{
while($row_qpv=mysql_fetch_assoc($resultv))
{
echo '<li><strong>'.$row_qpv['naam'] .', </strong>'. substr($row_qpv['info'], 0, 100) . ' ... <a href="index.php?id=4#id='.$row_qpv['id'] .'"></a></li>
';
}}
else
{
echo'Error neem contact op met de beheerder';
}
?>
</ul>
</div>
</div>
<div class="main_hoeken">
<div class="main_top-left"></div>
<div class="main_top-right"></div>
<div class="main_actie_inside">
<table width="590" border="0" style="margin:auto auto" align="center">
<tr>
<?php
error_reporting(E_ALL);
ini_set("display_errors", 1);
include("config.php");
// Kijken of er een id word meegegeven
if(!isset($_GET['mode']))
{
$resulta = mysql_query("SELECT * FROM producten WHERE actie > '0' ORDER BY actie LIMIT 0, 4");
}
if(isset($resulta))
{
while($row_qpa=mysql_fetch_assoc($resulta))
{
echo ' <td>
<div class="main_nieuw_prod">
<div class="img"> <a href="index.php?id=100&scr=productinfo'.$row_qpa['cat'] .'/?artikelnummer='.$row_qpa['art_nr'] .'"><img src="'.$row_qpa['img_sm'] .'" width="85" border="0" alt="Boeken, Dvds, webshop." /></a></div>
<div class="main_nieuw_prijs">€'.$row_qpa['prijs'] .'</div>
<div class="main_actie_bg"><img src="images/label_actie.png" alt="Actie" width="81" height="75" />
<div class="main_actie">€'.$row_qpa['prijs'] .'</div>
</div>';
if ($row_qpa['top5'] > "0")
{
echo '<div class="main_top5"><img src="images/label_top5.png" alt="Top5" width="55" height="55" /></div>';
}
echo' </div>
</td>';
}}
else
{
echo'Error neem contact op met de beheerder';
}
?>
</tr>
</table>
</div>
<div class="main_bottom-left"></div>
<div class="main_bottom-right"></div>
</div>
</div>