Graag wat coment op mijn script.

Overzicht Reageren

Sponsored by: Vacatures door Monsterboard

Crazyme

Crazyme

03/08/2006 11:24:00
Quote Anchor link
Hallo allemaal,

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!

Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
<?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 &amp; Geluid</a><a href="" id="top_hoofdmenu_button-8">Gereedschap</a><a href="" id="top_hoofdmenu_button-6">PC &amp; 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 &amp; 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 &amp; DVD</a></li>
        <li><a href="#">Speelgoed</a></li>
        <li><a href="#">Beeld &amp; Geluid</a></li>
        <li><a href="#">Automaterialen</a></li>
        <li><a href="#">PC &amp; 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>&nbsp;</td>
    <td><div class="top5_prijs">&#8364;'
.$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

Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
<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">&#8364;'
.$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">&#8364;'
.$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">&#8364;'
.$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>
Gewijzigd op 01/01/1970 01:00:00 door Crazyme
 
PHP hulp

PHP hulp

13/05/2024 19:24:41
 
Terence Hersbach

Terence Hersbach

03/08/2006 13:00:00
Quote Anchor link
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?php
if($id == 1)
    {

       include("main.php");
    }

elseif($id == 2)
    {

        include("tips.php");
    }
...

elseif($id == 6)
    {

        include("voorwaarden.php");
    }

elseif($id == 7)
    {

        include("contact.php");
    }
?>

het is makkelijker om hier een switch van maken. Dat komt er dan ongeveer zo uit te zien:

Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
13
<?php
switch($id)
{
    case
1: include 'main.php'; break;
    case
2: include 'tips.php'; break;
    case
3: include 'nieuws.php'; break;
    case
4: include 'verwacht.php'; break;
    case
5: include 'zoeken.php'; break;
    case
6: include 'voorwaarden.php'; break;
    case
7: include 'contact.php'; break;
    default:
echo 'Error neem contact op met de beheerder';  break;
}

?>


edit:
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
<?php
error_reporting(E_ALL);
?>

moet je volgens mij bovenaan je script zetten. Je hebt het nu bijna onderaan staan..
Gewijzigd op 01/01/1970 01:00:00 door Terence Hersbach
 



Overzicht Reageren

 
 

Om de gebruiksvriendelijkheid van onze website en diensten te optimaliseren maken wij gebruik van cookies. Deze cookies gebruiken wij voor functionaliteiten, analytische gegevens en marketing doeleinden. U vindt meer informatie in onze privacy statement.