dvd-index

Gesponsorde koppelingen

PHP script bestanden

  1. dvd-index

« Lees de omschrijving en reacties

SQL Table

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
CREATE TABLE `dvds` (
  `id` int(10) NOT NULL auto_increment,
  `titel` varchar(60) NOT NULL default '',
  `genre` varchar(20) NOT NULL default '',
  `jaar` varchar(4) NOT NULL default '',
  `kijkwijzer1` int(1) NOT NULL default '0',
  `kijkwijzer2` int(1) NOT NULL default '0',
  `kijkwijzer3` int(1) NOT NULL default '0',
  `kijkwijzer4` int(1) NOT NULL default '0',
  `kijkwijzer5` int(1) NOT NULL default '0',
  `kijkwijzer6` int(1) NOT NULL default '0',
  `kijkwijzer7` int(1) NOT NULL default '0',
  `kijkwijzer8` int(1) NOT NULL default '0',
  `kijkwijzer9` int(1) NOT NULL default '0',
  `kijkwijzer10` int(1) NOT NULL default '0',
  `datum` varchar(20) NOT NULL default '',
  PRIMARY KEY  (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=19 ;


index.php
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
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
<html>
<head>
<link rel="stylesheet" content="text/css" href="style.css">
<title>DVD RECORDS</title>
</head>
<body>
<?php
mysql_connect("host","user","pass")or die("<br><br><b>Foutmelding: Onjuiste login gegevens voor de DB...</b>");
mysql_select_db("db")or die("<br><br><b>Foutmelding: Kan DB niet openen...</b>");
?>

<table cellspacing = "5" cellpadding = "3" width="100%">
    <tr>
            <td class="cellborder" align="center">
            <b>- DVD RECORDS -</b><br><br>
            Beheer al je dvds voor een compleet overzicht van de titels, genres, kijkwijzers en ontwikkeljaar.
        </td>
    </tr>
    <tr>
        <td class="cellborder" align="center">
            <?php
            if(!isset($_GET['add'])){
                echo '<a href="index.php?add=dvd"><img src="add.gif" border="0">
            &nbsp;<b>DVD Toevoegen</b>&nbsp;<img src="add.gif" border="0"></a>
            <form method="post" action="index.php?act=zoeken'
;
            if(isset($_GET['orderby'])){echo '&orderby='.$_GET['orderby'];}
            echo '"><b>Zoeken:</b>&nbsp;&nbsp;
            <input type="text" name="zoeken" class="frm_zoeken">
            <input type="submit" class="frm_dvdsearch" value="Zoeken"></form>'
;
            }
else{
            echo '<a href="index.php"><img src="del.gif" border="0">
            &nbsp;<b>Sluiten</b>&nbsp;<img src="del.gif" border="0"></a>'
;
                if(isset($_POST['dvdtoevoegen'])){
                    if(empty($_POST['titel']) || empty($_POST['jaar']) || !is_numeric($_POST['jaar'])){
                        echo '<span class="fout"><br><br><b>Één of meer velden zijn niet juist ingevuld...<br>
                        Het kan ook zijn dat je een jaar hebt ingevoerd die niet uit cijfers bestaat.</b><br><br></span>'
;
                    }
else{
                        if(isset($_POST['leeftijd']) && $_POST['leeftijd'] == 1){$a1 = 1;}else{$a1 = 0;}
                        if(isset($_POST['leeftijd']) && $_POST['leeftijd'] == 2){$a2 = 1;}else{$a2 = 0;}
                        if(isset($_POST['leeftijd']) && $_POST['leeftijd'] == 3){$a3 = 1;}else{$a3 = 0;}
                        if(isset($_POST['leeftijd']) && $_POST['leeftijd'] == 4){$a4 = 1;}else{$a4 = 0;}
                        if(isset($_POST['5']) && $_POST['5'] == 1){$a5 = 1;}else{$a5 = 0;}
                        if(isset($_POST['6']) && $_POST['6'] == 1){$a6 = 1;}else{$a6 = 0;}
                        if(isset($_POST['7']) && $_POST['7'] == 1){$a7 = 1;}else{$a7 = 0;}
                        if(isset($_POST['8']) && $_POST['8'] == 1){$a8 = 1;}else{$a8 = 0;}
                        if(isset($_POST['9']) && $_POST['9'] == 1){$a9 = 1;}else{$a9 = 0;}
                        if(isset($_POST['10']) && $_POST['10'] == 1){$a10 = 1;}else{$a10 = 0;}
                        mysql_query("INSERT INTO dvds (titel,genre,jaar,kijkwijzer1,kijkwijzer2,kijkwijzer3
                        ,kijkwijzer4,kijkwijzer5,kijkwijzer6,kijkwijzer7,kijkwijzer8,kijkwijzer9,kijkwijzer10,datum)
                        VALUES ('"
.$_POST['titel']."','".$_POST['genre']."','".$_POST['jaar']."','".$a1."','".$a2."','".$a3."','".$a4."','".$a5."','".$a6."','".$a7."','".$a8."','".$a9."','".$a10."','".date("d M Y - G:i")."')") or die("<b>Foutmelding:</b> ".mysql_error());
                        echo '<span class="goed"><br><br><b>"'.$_POST['titel'].'" is succesvol toegevoegd!</b><br><br></span>';
                    }
                }

            echo '<form method="post" action="index.php?add=dvd">
            <table>
                <tr>
                    <td>
                        <b>Titel:</b>&nbsp;&nbsp;
                    </td>
                    <td>
                        <input type="tekst" name="titel" class="frm_titel"'
;
                        if(isset($_POST['dvdtoevoegen']) && isset($_POST['titel']) && (empty($_POST['jaar']) || !is_numeric($_POST['jaar']))){
                            echo 'value = "'.$_POST['titel'].'"';
                        }

                        echo '>
                    </td>
                </tr>
                <tr>
                    <td>
                        <b>Genre:</b>&nbsp;&nbsp;
                    </td>
                    <td>
                        <select name="genre" class="frm_genre">
                        <option value="Actie">Actie</value>
                        <option value="Avontuur">Avontuur</value>
                        <option value="Komedie">Komedie</value>
                        <option value="Crime">Crime</value>
                        <option value="Drama">Drama</value>
                        <option value="Horror">Horror</value>
                        <option value="Musical">Musical</value>
                        <option value="Science Fiction">Science Fiction</value>
                        <option value="Oorlog">Oorlog</value>
                        <option value="Western">Western</value>
                        <option value="Animatie">Animatie</value>
                        </select>
                        <b>Jaar:</b>&nbsp;&nbsp;<input type="tekst" name="jaar" class="frm_jaar"'
;
                        if(isset($_POST['dvdtoevoegen']) && isset($_POST['jaar']) && (empty($_POST['jaar']) || !is_numeric($_POST['jaar']))){
                            echo 'value = "'.$_POST['jaar'].'"';
                        }

                        echo '>
                    </td>
                </tr>
                <tr>
                    <td colspan="2" align="center">
                        <br><table cellspacing="0" cellpadding="0">
                            <tr>'
;
                                for($i = 1; $i != 5; $i++)
                                {

                                    echo '<td align="center">
                                    <input type="radio" name="leeftijd" value="'
.$i.'"';
                                    if(isset($_POST['dvdtoevoegen']) && empty($_POST['titel']) || (empty($_POST['jaar']) || !is_numeric($_POST['jaar']))){
                                        if(isset($_POST["leeftijd"]) && $_POST["leeftijd"] == $i){
                                        echo 'checked="checked"';
                                        }
                                    }

                                    echo '>
                                    </td>'
;
                                }

                                for($i = 5; $i != 11; $i++)
                                {

                                    echo '<td align="center">
                                    <input type="checkbox" name="'
.$i.'" value="1"';
                                    if(isset($_POST['dvdtoevoegen']) && empty($_POST['titel']) || (empty($_POST['jaar']) || !is_numeric($_POST['jaar']))){
                                        if(isset($_POST[$i]) && $_POST[$i] == 1){
                                        echo 'checked="checked"';
                                        }
                                    }

                                    echo '>
                                    </td>'
;
                                }

                            echo '</tr>
                            <tr>'
;
                                for($i = 1; $i != 11; $i++)
                                {

                                echo '<td>
                                    <img src="'
.$i.'.gif">
                                </td>'
;
                                }

                            echo '</tr>
                        </table>
                    </td>
                    <tr>
                        <td align="center" colspan="2"><br>
                            <input type="submit" class="frm_dvdsubmit" value="DVD Toevoegen" name="dvdtoevoegen">
                        </td>
                    </tr>
                </tr>
            </table>
            </form>'
;
            }

            ?>

        </td>
    </tr>
    <tr>
        <td class="cellborder" align="center">
            <?php
            if(isset($_GET['del']) && $_GET['del'] != ""){
                $aantal = mysql_num_rows(mysql_query("SELECT * FROM dvds WHERE id = '".$_GET['del']."'"));
                if($aantal == 0){
                    echo '<span class="fout"><br><b>Er bestaat geen DVD met de gekozen ID!</b><br><br></span>';
                }
else{
                    mysql_query("DELETE FROM dvds WHERE id = '".$_GET['del']."'") or die("<b>Foutmelding: </b>".mysql_error());
                    echo '<span class="goed"><br><b>De DVD is succesvol verwijderd!</b><br><br></span>';
                }
            }

            ?>

            <table cellspacing="3" cellpadding="3" width="100%">
                <tr>
                    <td width="300" class="item">
                        <b><a href="index.php?orderby=titel">Titel</a></b>
                    </td>
                    <td width="300" class="item">
                        <b><a href="index.php?orderby=genre">Genre</a></b>
                    </td>
                    <td width="100" class="item">
                        <b><a href="index.php?orderby=jaar">Jaar</a></b>
                    </td>
                    <td class="item">
                        <b>Kijkwijzer</b>
                    </td>
                    <td class="item" width="75" align="center">
                        <b>Verwijder</b>
                    </td>
                </tr>
                <?php
                if((isset($_GET['act']) && $_GET['act'] == "zoeken") && (isset($_POST['zoeken']) && $_POST['zoeken'] != "")){
                    if(isset($_GET['orderby']) && ($_GET['orderby'] == "titel" || $_GET['orderby'] == "genre" || $_GET['orderby'] == "jaar")){
                    $select_dvds = mysql_query("SELECT * FROM dvds WHERE titel LIKE '%".$_POST['zoeken']."%' ORDER BY ".$_GET['orderby']."");
                    }
else{
                    $select_dvds = mysql_query("SELECT * FROM dvds WHERE titel LIKE '%".$_POST['zoeken']."%' ORDER BY id");
                    }

                    while($dvdsweergeven = mysql_fetch_assoc($select_dvds)){
                    echo '<tr>
                    <td class="rij">
                        '
.$dvdsweergeven['titel'].'
                    </td>
                    <td class="rij">
                        '
.$dvdsweergeven['genre'].'
                    </td>
                    <td class="rij">
                        '
.$dvdsweergeven['jaar'].'
                    </td>
                    <td class="rij">'
;
                    for($i = 1; $i != 11; $i++)
                    {

                      echo ($dvdsweergeven['kijkwijzer'.$i] == 1) ?  "<img src=\"".$i.".gif\">" : "";
                    }

                    echo '</td>
                    <td align="center" valign="middle" class="rij">
                        <a href="index.php?del='
.$dvdsweergeven['id'].'"><img src="del.gif" border="0"></a>
                    </td>
                    </tr>'
;
                    }
                }
else{
                
                if(isset($_GET['orderby']) && ($_GET['orderby'] == "titel" || $_GET['orderby'] == "genre" || $_GET['orderby'] == "jaar")){
                $select_dvds = mysql_query("SELECT * FROM dvds ORDER BY ".$_GET['orderby']."");
                }
else{
                $select_dvds = mysql_query("SELECT * FROM dvds ORDER BY id");
                }

                while($dvdsweergeven = mysql_fetch_assoc($select_dvds)){
                echo '<tr>
                    <td class="rij">
                        '
.$dvdsweergeven['titel'].'
                    </td>
                    <td class="rij">
                        '
.$dvdsweergeven['genre'].'
                    </td>
                    <td class="rij">
                        '
.$dvdsweergeven['jaar'].'
                    </td>
                    <td class="rij">'
;
                    for($i = 1; $i != 11; $i++)
                    {

                      echo ($dvdsweergeven['kijkwijzer'.$i] == 1) ?  "<img src=\"".$i.".gif\">" : "";
                    }

                    echo '</td>
                    <td align="center" valign="middle" class="rij">
                        <a href="index.php?del='
.$dvdsweergeven['id'].'"><img src="del.gif" border="0"></a>
                    </td>
                </tr>'
;
                }
                }

                ?>

            </table>
        </td>
    </tr>
</table>
</body>
</html>


style.css
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
/* DVD RECORDS CSS BESTAND */

body{
font-family: Arial, Helvetica, sans-serif;
color: #303030;
}

a{
color: #333333;
text-decoration: none;
}

table{
font-size: 12px;
}

.cellborder{
border: solid 1px #AAAAAA;
}

/* FORM STYLES */

.frm_titel{
border: solid 1px #AAAAAA;
width: 100%;
}

.frm_jaar{
border: solid 1px #AAAAAA;
width: 75;
}

.frm_genre{
border: solid 1px #AAAAAA;
width: 288;
}

.frm_zoeken{
border: solid 1px #AAAAAA;
width: 288;
}

.frm_dvdsearch{
border: solid 1px #AAAAAA;
}

.frm_dvdsubmit{
border: solid 1px #AAAAAA;
}

/* KLEUREM */

.fout{
color: AA0000;
}

.goed{
color: 00AA00;
}

/* DVDS INDEX */

.item{
border: solid 1px #AAAAAA;
background-color: #DDDDDD;
}

.rij{
border-top: solid 1px #AAAAAA;
}

 
 

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.