banastratie-administratie-script

Gesponsorde koppelingen

PHP script bestanden

  1. banastratie-administratie-script

« Lees de omschrijving en reacties

***** bank/addtransaction.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
<script type="text/javascript">
    jQuery(document).ready(function() {
        jQuery("#dialogNew").dialog({
            width: 500,
            minWidth: 500,
            maxWidth: 750,
            height: 400,
            minHeight: 400,
            maxHeight: 600,
            modal: true,
            autoOpen: true,
            resizable: true,
            overlay: {
                backgroundColor: '#000',
                opacity: 0.5
            },
            buttons: {
                'Cancel': function() {
                    $(this).dialog('close');
                }
            }
        });

        jQuery().ready(function() {
            var container = $('div.container');
            // validate the form when it is submitted
            var validator = $("#addTransactionform").validate({
                errorContainer: container,
                errorLabelContainer: $("ol", container),
                wrapper: 'li',
                meta: "validate"
            });
        });

        jQuery('#datePickernew').datepicker({
            dateFormat: 'yy-mm-dd',
            minDate: -365,
            maxDate: 100,
            showOn: 'button',
            buttonImage: 'images/calendar.gif',
            buttonImageOnly: false,
            changeMonth: true,
            changeYear: false
        });
        
        jQuery("#blockDetails").click($.tooltip.block);
        <?
        $query
= "SELECT * FROM transacties WHERE member_id = ". $_SESSION['id'] ." ORDER BY tags";
        $result = mysql_query($query);
        while($row = mysql_fetch_assoc($result)) {
            if($dubbel !== trim($row['tags'])) {
                $java = $java .", '". trim($row['tags']) ."'";
                $dubbel = trim($row['tags']);
            }
        }

        echo "        var beschrijving = ['Overig'". $java ."];\n";
        ?>

        jQuery("#tags").autocomplete(beschrijving, {
            width: 320,
            max: 4,
            highlight: false,
            multiple: true,
            multipleSeparator: " ",
            scroll: true,
            scrollHeight: 300
        });
    });    
</script>
<?php
if($action == 'addtransaction') {
    if(isset($_POST['bank_id'])) { $bank_id = $_POST['bank_id']; } else { $transaction_error = false; }
    if(isset($_POST['user_id'])) { $user_id = $_POST['user_id']; } else { $transaction_error = false; }
    if(isset($_POST['bedrag_heel'])) { $bedrag_heel = $_POST['bedrag_heel']; } else { $transaction_error = false; }
    if(isset($_POST['bedrag_komma'])) { $bedrag_komma = $_POST['bedrag_komma']; } else { $transaction_error = false; }
    if(isset($_POST['type_of'])) { $type_of = $_POST['type_of']; } else {$transaction_error = false; }
    if(isset($_POST['begroot'])) { $begroot = $_POST['begroot']; } else { $transaction_error = false; }
    if(isset($_POST['tags'])) { $tags = $_POST['tags']; } else { $transaction_error = false; }
    if(isset($_POST['omschrijving'])) { $omschrijving = $_POST['omschrijving']; } else { $transaction_error = false; }
    if(isset($_POST['datum'])) { $datum = $_POST['datum']; } else { $transaction_error = false; }
    $bedrag = $bedrag_heel .'.'. $bedrag_komma;
    
    if(!$transaction_error) {
        if (!empty($datum)) {
            $query_transaction = "INSERT INTO `transacties` (`bank_id` ,`member_id` ,`bedrag` ,`tags` ,`bij_af` ,`begroting` ,`datum` ,`beschrijving` ) VALUES ('". $bank_id ."', '". $user_id ."', '". $bedrag ."', '". $tags ."', '". $type_of ."', '". $begroot ."', '". $datum ."', '". $omschrijving ."');";
            if(mysql_query($query_transaction)) {
                $query_transaction2 = "SELECT * FROM bankoverzicht WHERE id = ". $bank_id .";";
                $result_transaction2 = mysql_query($query_transaction2);
                $row = mysql_fetch_assoc($result_transaction2);
                $saldo_transaction2 = $row['saldo'];
                if(!$begroot) {
                    if($type_of) {
                        $saldo_new = $saldo_transaction2 + $bedrag;
                    }
else {
                        $saldo_new = $saldo_transaction2 - $bedrag;
                    }

                    $query_transaction3 = "UPDATE bankoverzicht SET saldo = '". $saldo_new ."' WHERE id =  ". $bank_id .";";
                    mysql_query($query_transaction3);
                    $error_text = 'De transactie is geslaagd. Uw nieuwe saldo = &euro; '. $saldo_new .'';
                    $error_class = 'true';
                }
else {
                    $error_text = 'De begroting staat klaar. Klik op de titel als je de begroting wilt overzetten';
                    $error_class = 'true';
                }
            }
else {
                $error_text = 'Er is een systeem fout opgetreden';
                $error_class = 'false';
                $action = false;
            }
        }
else {
            $error_text = 'Er is een systeem fout opgetreden';
            $error_class = 'false';
            $action = false;
        }
    }
else {
        $error_text = 'De datum is niet ingevuld';
        $error_class = 'false';
        $action = false;
    }
}


if(empty($action)) {
    if(isset($_GET['bank_id'])) { $bank_id = $_GET['bank_id']; } else { $transaction_error = false; }
    if(isset($_GET['duplicate_id'])) { $duplicate_id = $_GET['duplicate_id']; } else { $transaction_error = false; }
    if($duplicate_id) {
        $query_getTransactie = "SELECT * FROM transacties WHERE bank_id = ". $bank_id ." AND id = ". $duplicate_id ."";
        $result_getTransactie = mysql_query($query_getTransactie);
        $row = mysql_fetch_assoc($result_getTransactie);
    }

?>

<div id="dialogNew">
    <div class="addTransaction">
        <form autocomplete="off" method="post" id="addTransactionform" action="" name="addTransaction">
            <fieldset>
                <input type="hidden" name="action" value="addtransaction" />
                <input type="hidden" name="bank_id" value="<?php echo $bank_id; ?>" />
                <input type="hidden" name="user_id" value="<?php echo $_SESSION['id']; ?>" />
                <?php
                $bedrag_heel
= substr($row['bedrag'], 0, -3);
                $bedrag_komma = substr($row['bedrag'],  -2);
                ?>

                <div>
                    <label for="bedrag">Bedrag</label>
                    <input type="text" value="<?php echo $bedrag_heel; ?>" name="bedrag_heel" class="bedrag_heel {validate:{required:true,number:true}}"/>
                    <input type="text" value="<?php echo $bedrag_komma; ?>" name="bedrag_komma" maxlength="2" class="bedrag_komma {validate:{required:true,number:true,rangelength:[2,2]}}" />
                </div>
                <?php
                if(!$row['bij_af']) {
                    $select = 'selected="selected"';
                }

                ?>

                <div>
                    <label for="type_of">Bij / Af</label>
                    <select name="type_of" />
                        <option value="1">Bij</option>
                        <option value="0" <?php echo $select; ?>>Af</option>
                    </select>
                </div>
                <div>
                    <label for="begroot">Begroting</label>
                    <select name="begroot" />
                        <option value="1">Ja</option>
                        <option value="0" selected="selected">Nee</option>
                    </select>
                </div>
                <div>
                    <label for="tags">Tags</label>
                    <input id="tags" value="<?php echo trim($row['tags']); ?>" type="text" name="tags" maxlength="100" class="{validate:{required:true,rangelength:[5,100]}}" />
                </div>
                <div>
                    <label for="omschrijving">Omschrijving</label>
                    <textarea cols="30" rows="5" type="text" name="omschrijving" maxlength="255" class="{validate:{required:true,rangelength:[10,255]}}"><?php echo trim($row['beschrijving']); ?></textarea>
                </div>
                <?php
                if($row['datum']) {
                    $datum = date("Y-m-d", strtotime($row['datum']));
                }
else {
                    $datum = date("Y-m-d");
                }

                ?>

                <div>
                    <label for="datum">Datum</label>
                    <input type="text" value="<?php echo $datum ?>" id="datePickernew" maxlength="10" name="datum" maxlength="255" class="datum" />
                </div>
                <div style="text-align:right;">
                    <input type="submit" value="Opslaan" />
                </div>
                <div class="container">
                    <h4>Er zijn enkele fouten gevonden</h4>
                    <div class="error false">
                        <ol>
                            <li><label for="bedrag_heel" class="error">Alleen nummers!</label><div class="clear"></div></li>
                            <li><label for="bedrag_komma" class="error">Alleen nummers, 2 tekens verplicht!</label><div class="clear"></div></li>
                            <li><label for="tags" class="error">Minimaal 5 en maximaal 100 tekens</label><div class="clear"></div></li>
                            <li><label for="omschrijving" class="error">Minimaal 10 en maximaal 255 tekens</label><div class="clear"></div></li>
                        </ol>
                    </div>
                </div>
            </fieldset>
        </form>
    </div>
</div>
<?php
}
include 'bank/details.php';
?>


***** bank/deletetransaction.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
<script type="text/javascript">
jQuery(function() {
    jQuery("#dialogDelete").dialog({
        bgiframe: true,
        resizable: false,
        height: 140,
        modal: true,
        overlay: {
            backgroundColor: '#000',
            opacity: 0.7
        },
        buttons: {
            'Cancel': function() {
                $(this).dialog('close');
            }
        }
    });
});
</script>
<?php
if($action == 'deletetransaction') {
    if(isset($_POST['transaction_id'])) { $transaction_id = $_POST['transaction_id']; } else { $transaction_error = false; }
    if(isset($_POST['bank_id'])) { $bank_id = $_POST['bank_id']; } else { $transaction_error = false; }
    
    $query_getTransactie = "SELECT * FROM transacties WHERE bank_id = ". $bank_id ." AND id = ". $transaction_id ."";
    $result_getTransactie = mysql_query($query_getTransactie);
    $row = mysql_fetch_assoc($result_getTransactie);
    
    $saldoOld = $row['bedrag'];
    $bijafOld = $row['bij_af'];
    $begrotingOld = $row['begroting'];
    
    $query_transaction2 = "SELECT * FROM bankoverzicht WHERE id = ". $bank_id .";";
    $result_transaction2 = mysql_query($query_transaction2);
    $row2 = mysql_fetch_assoc($result_transaction2);
    
    $banksaldoOld = $row2['saldo'];
    
    if($begrotingOld == 1) {
        $query = "DELETE * FROM transacties WHERE id = ". $transaction_id .";";
        if(mysql_query($query)) {
            $error_text = 'De begroting is verwijdert.';
            $error_class = 'true';
        }
    }
elseif($begrotingOld == 0) {
        if($bijafOld == 1) {
            $banksaldo = $banksaldoOld - $saldoOld;
        }
elseif($bijafOld == 0) {
            $banksaldo = $banksaldoOld + $saldoOld;
        }

        $query = "DELETE FROM transacties WHERE id = ". $transaction_id .";";
        if(mysql_query($query)) {
            $query2 = "UPDATE bankoverzicht SET saldo = '". $banksaldo ."' WHERE id =  ". $bank_id .";";
            echo $query2 .'<br />';
            mysql_query($query2);
            $error_text = 'De transactie is verwijdert. Uw nieuwe saldo = &euro; '. $banksaldo .'';
            $error_class = 'true';
        }
    }
}


if(empty($action)) {
    if(isset($_GET['bank_id'])) { $bank_id = $_GET['bank_id']; } else { $transaction_error = false; }
    if(isset($_GET['transaction_id'])) { $transaction_id = $_GET['transaction_id']; } else { $transaction_error = false; }
    
    $query_getTransactie = "SELECT * FROM transacties WHERE bank_id = ". $bank_id ." AND id = ". $transaction_id ."";
    $result_getTransactie = mysql_query($query_getTransactie);
    $row = mysql_fetch_assoc($result_getTransactie);
?>

<div id="dialogDelete" title="Verwijderen">
    <div class="addTransaction">
        <form autocomplete="off" method="post" id="addTransactionform" action="" name="addTransaction">
            <fieldset>
                <input type="hidden" name="action" value="deletetransaction" />
                <input type="hidden" name="bank_id" value="<?php echo $bank_id; ?>" />
                <input type="hidden" name="user_id" value="<?php echo $_SESSION['id']; ?>" />
                <input type="hidden" name="transaction_id" value="<?php echo $transaction_id; ?>" />
                <div style="text-align:right;">
                    <input type="submit" value="Transactie verwijderen" />
                </div>
            </fieldset>
        </form>
    </div>
</div>
<?php
}
include 'bank/details.php';
?>


***** bank/details.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
<script type="text/javascript">
    jQuery(document).ready(function() {
        jQuery("#detailsBank").accordion({
            header: "h3",
            alwaysOpen: false,
            fillSpace: true
        });
        
        jQuery("#detailsBegroting").accordion({
            header: "h3",
            alwaysOpen: false,
            fillSpace: true
        });
        
        jQuery(".Details").tooltip({
            track: true,
            delay: 0,
            showURL: false,
            fixPNG: true,
            showBody: " - ",
            extraClass: "pretty fancy",
            top: -10,
            left: 5
        });
    });    
</script>
<?php
if(isset($_GET['bank_id'])) {
    $_SESSION['bank_id'] = $_GET['bank_id'];
}
else {
    $bank_error = true;
}


if($action == 'closeBank') {
    $_SESSION['bank_id'] = false;
    $bank_error = true;
    $error_text = 'Bank is gesloten'."\n";
    $error_class = 'true'."\n";
}


if(!$bank_error) {
    $query_getBank = "SELECT * FROM bankoverzicht WHERE id = ". $_SESSION['bank_id'] .";";
    $result_getBank = mysql_query($query_getBank);
    if($result_getBank) {
        $row = mysql_fetch_assoc($result_getBank);
        $bankID = $row['id'];
        $bankOwner = $row['member_id'];
        $bankNaam = $row['bank_naam'];
        $rekeningNummer = $row['rekening_nummer'];
        $saldo = $row['saldo'];
        if($_SESSION['id'] == $bankOwner) {
            $bank_error = false;
        }
else {
            $error_text = 'U bent niet de eigenaar van deze bankoverzicht '. $_SESSION['id'] .' == '. $bankOwner;
            $error_class = 'false'."\n";
            $bank_error = true;
        }
    }
else {
        $error_text = 'Er is een systeem fout opgetreden 2'."\n";
        $error_class = 'false'."\n";
        $bank_error = true;
    }
}
else {
    $error_text = 'Er is een systeem fout opgetreden 1'."\n";
    $error_class = 'false'."\n";
    $bank_error = true;
}


if($error_text) {
    echo '<div class="error '. $error_class .'">'."\n";
    echo '    '. $error_text;
    echo '</div>'."\n";
}


if(!$bank_error) {
    echo '<h3>Rekening overzicht van '. $bankNaam .' ('. $rekeningNummer .')</h3>'."\n";
    if($saldo <= 0) {
        $saldo_class = 'false'."\n";
    }
else {
        $saldo_class = 'true'."\n";
    }

    $totaalBij = 0;
    $totaalAf = 0;
?>

<div class="error <?php echo $saldo_class ?>">
    Uw huidige saldo: &euro; <?php echo $saldo; ?>
</div>
<div style="margin-bottom:15px;">
    <a href="?dir=bank&page=addtransaction&bank_id=<?php echo $_SESSION['bank_id'] ?>" id="open_addTransaction">Voeg een transactie toe</a> &nbsp;|&nbsp; <a href="?dir=bank&page=details&action=closeBank">Sluit overzicht</a>
</div>
<div class="right">
    <div id="detailsBegroting" style="padding:0; margin:0; width:380px; height:510px; overflow:hidden;">
<?php
    $tussen_saldo
= $saldo;
    $query_getTransactie = "SELECT * FROM transacties WHERE bank_id = ". $bankID ." AND begroting = 1 ORDER BY datum ASC, id ASC";
    $result_getTransactie = mysql_query($query_getTransactie);
    while($row = mysql_fetch_assoc($result_getTransactie)) {
        $datum_check = substr($row['datum'], 5, 2);
        if($datum_check !== $datum_check2) {
            if(!empty($datum_check2)) {
                echo '            </div>'."\n";
                echo '        </div>'."\n";
            }

            echo '        <div>'."\n";
            echo '            <h3><a href="#">Begroting voor '. date("F Y", strtotime($row['datum'])) .'</a></h3>'."\n";
            echo '            <div style="padding:0; margin:0; height:360px; overflow:auto;">'."\n";
        }

        $datum_check2 = $datum_check;
        if($row['bij_af'] == 1) {
            $tussen_saldo = $tussen_saldo + $row['bedrag'];
            $classValue = 'bij';
        }
elseif($row['bij_af'] == 0) {
            $tussen_saldo = $tussen_saldo - $row['bedrag'];
            $classValue = 'af';
        }

        echo '                <div class="transactie begroot toggleTitle">'."\n";
        echo '                    <img style="float:right;margin:5px;" class="Details" src="images/info.png" title="Informatie: - '. date("d F Y", strtotime($row['datum'])) .' - Saldo na transactie: &euro; '. number_format($tussen_saldo, 2, ',', '.') .' - - - Omschrijving: - '. $row['beschrijving'] .'" />';
        echo '                    <span style="margin-left:5px;" class="date">'. date("d M", strtotime($row['datum'])) .'</span>';
        echo '                    <span class="summary">'. $row['tags']  .'</span>';
        echo '                    <span class="value '. $classValue .'">&euro; '. number_format($row['bedrag'], 2, ',', '.')  .'</span>'."\n";
        echo '                    <span class="clear"></span>'."\n";
        echo '                </div>'."\n";
        echo '                <div class="toggleBody">'."\n";
        echo '                    <a href="?dir=bank&page=edittransaction&bank_id='. $_SESSION['bank_id'] .'&transaction_id='. $row['id'] .'">Aanpassen</a> | <a href="?dir=bank&page=deletetransaction&bank_id='. $_SESSION['bank_id'] .'&transaction_id='. $row['id'] .'">Verwijderen</a> | <a href="?dir=bank&page=addtransaction&bank_id='. $_SESSION['bank_id'] .'&duplicate_id='. $row['id'] .'">Kopieeren</a> | Betaald'."\n";
        echo '                </div>'."\n";
    }

    echo '            </div>'."\n";
    echo '        </div>'."\n";
    $datum_check2 = false;
?>

    </div>
</div>


<div class="left">
    <div id="detailsBank" style="padding:0; margin:0; width:410px; height:510px; overflow:hidden;">
<?php
    $tussen_saldo
= $saldo;
    $maxDate = date("Y-m",mktime(0, 0, 0, date("m")-4, date("d"),   date("Y")));
    $query_getTransactie = "SELECT * FROM transacties WHERE bank_id = ". $bankID ." AND begroting = 0 AND datum >= '". $maxDate ."' ORDER BY datum DESC, id DESC";
    $result_getTransactie = mysql_query($query_getTransactie);
    while($row = mysql_fetch_assoc($result_getTransactie)) {
        $datum_check = substr($row['datum'], 5, 2);
        if($datum_check !== $datum_check2) {
            if(!empty($datum_check2)) {
                echo '            </div>'."\n";
                echo '        </div>'."\n";
            }

            echo '        <div>'."\n";
            echo '            <h3><a href="#">'. date("F Y", strtotime($row['datum'])) .'</a></h3>'."\n";
            echo '            <div style="padding:0; margin:0; height:360px; overflow:auto;">'."\n";
        }

        $datum_check2 = $datum_check;
        if($row['bij_af'] == 1) {
            $classRow = 'bij';
        }
elseif($row['bij_af'] == 0) {
            $classRow = 'af';
        }

        echo '                <div class="transactie '. $classRow .' toggleTitle">'."\n";
        echo '                    <img style="float:right;margin:5px;" class="Details" src="images/info.png" title="Informatie: - '. date("d F Y", strtotime($row['datum'])) .' - Saldo na transactie: &euro; '. number_format($tussen_saldo, 2, ',', '.') .' - - - Omschrijving: - '. $row['beschrijving'] .'" />';
        echo '                    <span style="margin-left:5px;" class="date">'. date("d M", strtotime($row['datum'])) .'</span>';
        echo '                    <span class="summary">'. $row['tags']  .'</span>';
        echo '                    <span class="value">&euro; '. number_format($row['bedrag'], 2, ',', '.')  .'</span>'."\n";
        echo '                    <span class="clear"></span>'."\n";
        echo '                </div>'."\n";
        echo '                <div class="toggleBody">'."\n";
        echo '                    <a href="?dir=bank&page=edittransaction&bank_id='. $_SESSION['bank_id'] .'&transaction_id='. $row['id'] .'">Aanpassen</a> | <a href="?dir=bank&page=deletetransaction&bank_id='. $_SESSION['bank_id'] .'&transaction_id='. $row['id'] .'">Verwijderen</a> | <a href="?dir=bank&page=addtransaction&bank_id='. $_SESSION['bank_id'] .'&duplicate_id='. $row['id'] .'">Kopieeren</a>'."\n";
        echo '                </div>'."\n";
            $datum_check2 = $datum_check;
        if($row['bij_af'] == 1) {
            $tussen_saldo = $tussen_saldo - $row['bedrag'];
        }
elseif($row['bij_af'] == 0) {
            $tussen_saldo = $tussen_saldo + $row['bedrag'];
        }
    }

    echo '        </div>'."\n";
}

?>

    </div>
</div>


***** bank/edittransaction.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
240
241
242
243
244
245
246
247
<script type="text/javascript">
    jQuery(document).ready(function() {
        jQuery('#datePickeredit').datepicker({
            dateFormat: 'yy-mm-dd',
            minDate: -365,
            maxDate: 100,
            showOn: 'button',
            buttonImage: 'images/calendar.gif',
            buttonImageOnly: false,
            changeMonth: true,
            changeYear: false
        });
        
        jQuery("#dialogEdit").dialog({
            width: 500,
            minWidth: 500,
            maxWidth: 750,
            height: 400,
            minHeight: 400,
            maxHeight: 600,
            modal: true,
            autoOpen: true,
            resizable: true,
            overlay: {
                backgroundColor: '#000',
                opacity: 0.5
            },
            buttons: {
                'Cancel': function() {
                    $(this).dialog('close');
                }
            }
        });

        jQuery().ready(function() {
            var container = $('div.container');
            // validate the form when it is submitted
            var validator = $("#addTransactionform").validate({
                errorContainer: container,
                errorLabelContainer: $("ol", container),
                wrapper: 'li',
                meta: "validate"
            });
        });
        
<?
$query
= "SELECT * FROM transacties WHERE member_id = ". $_SESSION['id'] ." ORDER BY tags";
$result = mysql_query($query);
while($row = mysql_fetch_assoc($result)) {
    if($dubbel !== trim($row['tags'])) {
        $java = $java .", '". trim($row['tags']) ."'";
        $dubbel = trim($row['tags']);
    }
}

echo "        var beschrijving = ['Overig'". $java ."];\n";
?>

        jQuery("#tags").autocomplete(beschrijving, {
            width: 320,
            max: 4,
            highlight: false,
            multiple: true,
            multipleSeparator: " ",
            scroll: true,
            scrollHeight: 300
        });
    });    
</script>
<?php
if($action == 'edittransaction') {
    if(isset($_POST['transaction_id'])) { $transaction_id = $_POST['transaction_id']; } else { $transaction_error = false; }
    if(isset($_POST['bank_id'])) { $bank_id = $_POST['bank_id']; } else { $transaction_error = false; }
    if(isset($_POST['user_id'])) { $user_id = $_POST['user_id']; } else { $transaction_error = false; }
    if(isset($_POST['bedrag_heel'])) { $bedrag_heel = $_POST['bedrag_heel']; } else { $transaction_error = false; }
    if(isset($_POST['bedrag_komma'])) { $bedrag_komma = $_POST['bedrag_komma']; } else { $transaction_error = false; }
    if(isset($_POST['type_of'])) { $type_of = $_POST['type_of']; } else {$transaction_error = false; }
    if(isset($_POST['begroot'])) { $begroot = $_POST['begroot']; } else { $transaction_error = false; }
    if(isset($_POST['tags'])) { $tags = $_POST['tags']; } else { $transaction_error = false; }
    if(isset($_POST['omschrijving'])) { $omschrijving = $_POST['omschrijving']; } else { $transaction_error = false; }
    if(isset($_POST['datum'])) { $datum = $_POST['datum']; } else { $transaction_error = false; }
    $bedrag = $bedrag_heel .'.'. $bedrag_komma;
    
    $query_getTransactie = "SELECT * FROM transacties WHERE bank_id = ". $bank_id ." AND id = ". $transaction_id ."";
    $result_getTransactie = mysql_query($query_getTransactie);
    $row = mysql_fetch_assoc($result_getTransactie);
    
    $saldoOld = $row['bedrag'];
    $saldoNew = $bedrag;
    
    $bijafOld = $row['bij_af'];
    $bijafNew = $type_of;
    
    $begrotingOld = $row['begroting'];
    $begrotingNew = $begroot;
    
    $beschrijvingNew = $omschrijving;
    $tagsNew = $tags;
    $datumNew = $datum .' 00:00:00';
    
    $query_transaction2 = "SELECT * FROM bankoverzicht WHERE id = ". $bank_id .";";
    $result_transaction2 = mysql_query($query_transaction2);
    $row2 = mysql_fetch_assoc($result_transaction2);
    
    $banksaldo = $row2['saldo'];
    
    $changeCheck = false;
    
    if($saldoOld !== $saldoNew) {
        if($begrotingOld == 0) {
            if($bijafOld == 1) {
                $banksaldoTemp = $banksaldo - $saldoOld;
                $banksaldo = $banksaldoTemp + $saldoNew;
            }
elseif($bijafOld == 0) {
                $banksaldoTemp = $banksaldo + $saldoOld;
                $banksaldo = $banksaldoTemp - $saldoNew;
            }
        }

        $changeCheck = true;
    }

    
    if($bijafOld !== $bijafNew) {
        if($begrotingOld == 0) {
            if($bijafOld == 1) {
                $banksaldoTemp = $banksaldo - $saldoNew;
                $banksaldo = $banksaldoTemp - $saldoNew;
            }
elseif($bijafOld == 0) {
                $banksaldoTemp = $banksaldo + $saldoNew;
                $banksaldo = $banksaldoTemp + $saldoNew;
            }
        }

        $changeCheck = true;
    }

    
    if($begrotingOld !== $begrotingNew) {
        if($begrotingOld == 1) {
            if($bijafOld == 1) {
                $banksaldo = $banksaldo + $saldoNew;
            }
elseif($bijafOld == 0) {
                $banksaldo = $banksaldo - $saldoNew;
            }
        }
elseif($begrotingOld == 0) {
            if($bijafOld == 1) {
                $banksaldo = $banksaldo - $saldoNew;
            }
elseif($bijafOld == 0) {
                $banksaldo = $banksaldo + $saldoNew;
            }
        }

        $changeCheck = true;
    }

    
    if($changeCheck) {
        $query_transaction4 = "UPDATE transacties SET bedrag = '". $saldoNew ."', tags = '". $tagsNew ."', beschrijving = '". $beschrijvingNew ."', bij_af = '". $bijafNew ."', begroting = '". $begrotingNew ."', datum = '". $datumNew ."' WHERE id =  ". $transaction_id .";";
        mysql_query($query_transaction4);
        $query_transaction3 = "UPDATE bankoverzicht SET saldo = '". $banksaldo ."' WHERE id =  ". $bank_id .";";
        mysql_query($query_transaction3);
        $error_text = 'De transactie is geupdate. Uw nieuwe saldo = &euro; '. $banksaldo .'';
        $error_class = 'true';
    }
else {
        $query_transaction5 = "UPDATE transacties SET tags = '". $tagsNew ."', beschrijving = '". $beschrijvingNew ."', datum = '". $datumNew ."' WHERE id =  ". $transaction_id .";";
        mysql_query($query_transaction5);
        $error_text = 'Geen saldo veranderingen';
        $error_class = 'true';
    }
}


if(empty($action)) {
    if(isset($_GET['bank_id'])) { $bank_id = $_GET['bank_id']; } else { $transaction_error = false; }
    if(isset($_GET['transaction_id'])) { $transaction_id = $_GET['transaction_id']; } else { $transaction_error = false; }
    
    $query_getTransactie = "SELECT * FROM transacties WHERE bank_id = ". $bank_id ." AND id = ". $transaction_id ."";
    $result_getTransactie = mysql_query($query_getTransactie);
    $row = mysql_fetch_assoc($result_getTransactie);
?>

<div id="dialogEdit" title="Aanpassen">
    <div class="addTransaction">
        <form autocomplete="off" method="post" id="addTransactionform" action="" name="addTransaction">
            <fieldset>
                <input type="hidden" name="action" value="edittransaction" />
                <input type="hidden" name="bank_id" value="<?php echo $bank_id; ?>" />
                <input type="hidden" name="user_id" value="<?php echo $_SESSION['id']; ?>" />
                <input type="hidden" name="transaction_id" value="<?php echo $transaction_id; ?>" />
                <?php
                $bedrag_heel
= substr($row['bedrag'], 0, -3);
                $bedrag_komma = substr($row['bedrag'],  -2);
                ?>

                <div>
                    <label for="bedrag">Bedrag</label>
                    <input type="text" value="<?php echo $bedrag_heel; ?>" name="bedrag_heel" class="bedrag_heel {validate:{required:true,number:true}}"/>
                    <input type="text" value="<?php echo $bedrag_komma; ?>" name="bedrag_komma" maxlength="2" class="bedrag_komma {validate:{required:true,number:true,rangelength:[2,2]}}" />
                </div>
                <?php
                if(!$row['bij_af']) {
                    $select = 'selected="selected"';
                }

                ?>

                <div>
                    <label for="type_of">Bij / Af</label>
                    <select name="type_of" />
                        <option value="1">Bij</option>
                        <option value="0" <?php echo $select; ?>>Af</option>
                    </select>
                </div>
                <?php
                if($row['begroting']) {
                    $select2 = 'selected="selected"';
                }

                ?>

                <div>
                    <label for="begroot">Begroting</label>
                    <select name="begroot" />
                        <option value="0">Nee</option>
                        <option value="1" <?php echo $select2; ?>>Ja</option>
                    </select>
                </div>
                <div>
                    <label for="tags">Tags</label>
                    <input id="tags" value="<?php echo trim($row['tags']); ?>" type="text" name="tags" maxlength="100" class="{validate:{required:true,rangelength:[5,100]}}" />
                </div>
                <div>
                    <label for="omschrijving">Omschrijving</label>
                    <input type="text" value="<?php echo $row['beschrijving']; ?>" name="omschrijving" maxlength="255" class="{validate:{required:true,rangelength:[10,255]}}" />
                </div>
                <div>
                    <label for="datum">Datum</label>
                    <input type="text" value="<?php echo date("Y-m-d", strtotime($row['datum'])) ?>" id="datePickeredit" maxlength="10" name="datum" maxlength="255" class="datum" />
                </div>
                <div style="text-align:right;">
                    <input type="submit" value="Opslaan" />
                </div>
                <div class="container">
                    <h4>Er zijn enkele fouten gevonden</h4>
                    <div class="error false">
                        <ol>
                            <li><label for="bedrag_heel" class="error">Alleen nummers!</label><div class="clear"></div></li>
                            <li><label for="bedrag_komma" class="error">Alleen nummers, 2 tekens verplicht!</label><div class="clear"></div></li>
                            <li><label for="tags" class="error">Minimaal 5 en maximaal 100 tekens</label><div class="clear"></div></li>
                            <li><label for="omschrijving" class="error">Minimaal 10 en maximaal 255 tekens</label><div class="clear"></div></li>
                        </ol>
                    </div>
                </div>
            </fieldset>
        </form>
    </div>
</div>
<?php
}
include 'bank/details.php';
?>


***** bank/overview.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
<script type="text/javascript">
    jQuery(document).ready(function() {
        jQuery("#dialog").dialog({
            width: 500,
            height: 300,
            modal: true,
            autoOpen: false,
            resizable: false,
            overlay: {
                backgroundColor: '#000',
                opacity: 0.7
            },
            buttons: {
                'Cancel': function() {
                    $(this).dialog('close');
                }
            }
        });
        jQuery('#dialogOpen').click(function() {
            $('#dialog').dialog('open');
        });
    });
</script>
<?php
if($action == 'AddBank') {
    if(isset($_POST['banknaam'])) {
        $banknaam = $_POST['banknaam'];
    }
else {
        $bank_error = 'true';
    }


    if(isset($_POST['rekeningnummer'])) {
        $rekeningnummer = $_POST['rekeningnummer'];
    }
else {
        $bank_error = 'true';
    }


    if(isset($_POST['saldo_heel'])) {
        $saldo_heel = $_POST['saldo_heel'];
    }
else {
        $bank_error = 'true';
    }


    if(isset($_POST['saldo_komma'])) {
        $saldo_komma = $_POST['saldo_komma'];
    }
else {
        $bank_error = 'true';
    }

    
    if(!$bank_error) {
        if(!empty($rekeningnummer) && !empty($saldo_heel) && !empty($saldo_komma)) {
            if(is_numeric($rekeningnummer) && is_numeric($saldo_heel) && is_numeric($saldo_komma)){
                $saldo = $saldo_heel .'.'. $saldo_komma;
                $query_addBank = "INSERT INTO `bankoverzicht` (`member_id` ,`bank_naam` ,`rekening_nummer` ,`saldo` ) VALUES ( '". $_SESSION['id'] ."', '". $banknaam ."', '". $rekeningnummer ."', '". $saldo ."');";
                if(mysql_query($query_addBank)) {
                    $error_text = 'Er is een nieuwe bank toegevoegd aan uw lijstje';
                    $error_class = 'true';
                    $action = false;
                    
                    $banknaam = false;
                    $rekeningnummer = false;
                    $saldo_heel = false;
                    $saldo_komma = false;
                }
else {
                    $error_text = 'Er is een systeem fout opgetreden';
                    $error_class = 'false';
                    $action = false;
                }
            }
else {
                $error_text = 'Alleen nummeriek';
                $error_class = 'false';
                $action = false;
            }
        }
else {
            $error_text = 'Er zijn velden leeg';
            $error_class = 'false';
            $action = false;
        }
    }
else {
        $error_text = 'Er is een systeem fout opgetreden';
        $error_class = 'false';
        $action = false;
    }

    echo '<div class="error '. $error_class .'">';
    echo '    '. $error_text;
    echo '</div>';
}



if($_SESSION['login']) {
    echo '<h3>Overzicht van jouw financiele situatie</h3>';
    
    $order = 'saldo';
    echo '<table width="100%" cellpadding="0" cellspacing="0">';
    echo '    <tr>';
    echo '        <td class="tableHead">';
    echo '            Naam';
    echo '        </td>';
    echo '        <td class="tableHead">';
    echo '            Rekening nummer';
    echo '        </td>';
    echo '        <td class="tableHead">';
    echo '            Saldo';
    echo '        </td>';
    echo '        <td class="tableHead">';
    echo '            Opties';
    echo '        </td>';
    echo '    </tr>';
    $query_bank = "SELECT * FROM bankoverzicht WHERE member_id = ". $_SESSION['id'] ." ORDER BY ". $order .";";
    $result_bank = mysql_query($query_bank);
    while($row = mysql_fetch_assoc($result_bank)) {
        echo '    <tr>';
        echo '        <td>';
        echo '            '. $row['bank_naam'] .'';
        echo '        </td>';
        echo '        <td>';
        echo '            '. $row['rekening_nummer'] .'';
        echo '        </td>';
        echo '        <td>';
        echo '            &euro; '. number_format($row['saldo'], 2, ',', '.') .'';
        echo '        </td>';
        if($row['id'] == $_SESSION['bank_id']) {
            echo '        <td>';
            echo '            <a href="?dir=bank&page=details&bank_id='. $row['id'] .'">Geopend</a>';
            echo '        </td>';
        }
else {
            echo '        <td>';
            echo '            <a href="?dir=bank&page=details&bank_id='. $row['id'] .'">Open</a>';
            echo '        </td>';
        }

        echo '    </tr>';
    }

    echo '</table>';
    echo '<div>';
    echo '    <a id="dialogOpen" title="Voeg een nieuwe bankrekening toe" href="#">Voeg een nieuwe bank toe</a>';
    echo '</div>';
    echo '<div id="dialog">';
    echo '    <div style="padding:10px;">'."\n";
    echo '        <h4>Voeg een nieuwe bank toe</h4>'."\n";
    echo '        <form method="post" action="">'."\n";
    echo '            <fieldset>'."\n";
    echo '                <input type="hidden" value="AddBank" name="action" />'."\n";
    echo '                <div style="margin-bottom:5px;">'."\n";
    echo '                    <label style="width:150px;display:block;float:left;">Kies een bank</label>'."\n";
    echo '                    <select name="banknaam" style="width:200px;">'."\n";
    if($banknaam == 'ABN AMRO') {
        $abn = 'selected="selected"';
    }
elseif($banknaam == 'Fortis') {
        $for = 'selected="selected"';
    }
elseif($banknaam == 'ING') {
        $ing = 'selected="selected"';
    }
elseif($banknaam == 'Postbank') {
        $pos = 'selected="selected"';
    }
elseif($banknaam == 'Rabobank') {
        $rab = 'selected="selected"';
    }
elseif($banknaam == 'SNS') {
        $sns = 'selected="selected"';
    }

    echo '                        <option value="ABN AMRO" '. $abn .'>ABN AMRO</option>'."\n";
    echo '                        <option value="Fortis" '. $for .'>Fortis</option>'."\n";
    echo '                        <option value="ING" '. $ing .'>ING</option>'."\n";
    echo '                        <option value="Postbank" '. $pos .'>Postbank</option>'."\n";
    echo '                        <option value="Rabobank" '. $rab .'>Rabobank</option>'."\n";
    echo '                        <option value="SNS" '. $sns .'>SNS</option>'."\n";
    echo '                    </select>'."\n";
    echo '                </div>'."\n";
    echo '                <div style="margin-bottom:5px;">'."\n";
    echo '                    <label style="width:150px;display:block;float:left;">Rekening nummer</label>'."\n";
    echo '                    <input style="width:200px;" name="rekeningnummer" value="'. $rekeningnummer .'" type="text" />'."\n";
    echo '                </div>'."\n";
    echo '                <div style="margin-bottom:5px;">'."\n";
    echo '                    <label style="width:150px;display:block;float:left;">Start saldo</label>'."\n";
    echo '                    <input style="width:50px;" style="" name="saldo_heel" value="'. $saldo_heel .'" type="text" />,'."\n";
    echo '                    <input style="width:20px;" maxlength="2" name="saldo_komma" value="'. $saldo_komma .'" type="text" />'."\n";
    echo '                </div>'."\n";
    echo '                <div style="text-align:right;margin-bottom:5px;">'."\n";
    echo '                    <input value="Opslaan" type="submit" />'."\n";
    echo '                </div>'."\n";
    echo '            </fieldset>'."\n";
    echo '        </form>'."\n";
    echo '    </div>'."\n";
    echo '</div>'."\n";
}

?>


***** include/actions.php *****
<?php
if(isset($_GET['bank_id'])) {
    $_SESSION['bank_id'] = $_GET['bank_id'];
}
else {
    $bank_error = true;
}


if($action == 'closeBank') {
    $_SESSION['bank_id'] = false;
    $bank_error = true;
    $error_text = 'Bank is gesloten'."\n";
    $error_class = 'true'."\n";
}

?>


***** include/browser.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
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
<?php
/*****************************************************************

    File name: browser.php
    Author: Gary White
    Last modified: November 10, 2003
    
    **************************************************************

    Copyright (C) 2003  Gary White
    
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License
    as published by the Free Software Foundation; either version 2
    of the License, or (at your option) any later version.
    
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details at:
    http://www.gnu.org/copyleft/gpl.html

    **************************************************************

    Browser class
    
    Identifies the user's Operating system, browser and version
    by parsing the HTTP_USER_AGENT string sent to the server
    
    Typical Usage:
    
        require_once($_SERVER['DOCUMENT_ROOT'].'/include/browser.php');
        $br = new Browser;
        echo "$br->Platform, $br->Name version $br->Version";
    
    For operating systems, it will correctly identify:
        Microsoft Windows
        MacIntosh
        Linux

    Anything not determined to be one of the above is considered to by Unix
    because most Unix based browsers seem to not report the operating system.
    The only known problem here is that, if a HTTP_USER_AGENT string does not
    contain the operating system, it will be identified as Unix. For unknown
    browsers, this may not be correct.
    
    For browsers, it should correctly identify all versions of:
        Amaya
        Galeon
        iCab
        Internet Explorer
            For AOL versions it will identify as Internet Explorer (AOL) and the version
            will be the AOL version instead of the IE version.
        Konqueror
        Lynx
        Mozilla
        Netscape Navigator/Communicator
        OmniWeb
        Opera
        Pocket Internet Explorer for handhelds
        Safari
        WebTV
*****************************************************************/


class browser{

    var
$Name = "Unknown";
    var
$Version = "Unknown";
    var
$Platform = "Unknown";
    var
$UserAgent = "Not reported";
    var
$AOL = false;

    function
browser(){
        $agent = $_SERVER['HTTP_USER_AGENT'];

        // initialize properties
        $bd['platform'] = "Unknown";
        $bd['browser'] = "Unknown";
        $bd['version'] = "Unknown";
        $this->UserAgent = $agent;

        // find operating system
        if (eregi("win", $agent))
            $bd['platform'] = "Windows";
        elseif (eregi("mac", $agent))
            $bd['platform'] = "MacIntosh";
        elseif (eregi("linux", $agent))
            $bd['platform'] = "Linux";
        elseif (eregi("OS/2", $agent))
            $bd['platform'] = "OS/2";
        elseif (eregi("BeOS", $agent))
            $bd['platform'] = "BeOS";

        // test for Opera        
        if (eregi("opera",$agent)){
            $val = stristr($agent, "opera");
            if (eregi("/", $val)){
                $val = explode("/",$val);
                $bd['browser'] = $val[0];
                $val = explode(" ",$val[1]);
                $bd['version'] = $val[0];
            }
else{
                $val = explode(" ",stristr($val,"opera"));
                $bd['browser'] = $val[0];
                $bd['version'] = $val[1];
            }


        // test for WebTV
        }elseif(eregi("webtv",$agent)){
            $val = explode("/",stristr($agent,"webtv"));
            $bd['browser'] = $val[0];
            $bd['version'] = $val[1];
        
        // test for MS Internet Explorer version 1
        }elseif(eregi("microsoft internet explorer", $agent)){
            $bd['browser'] = "MSIE";
            $bd['version'] = "1.0";
            $var = stristr($agent, "/");
            if (ereg("308|425|426|474|0b1", $var)){
                $bd['version'] = "1.5";
            }


        // test for NetPositive
        }elseif(eregi("NetPositive", $agent)){
            $val = explode("/",stristr($agent,"NetPositive"));
            $bd['platform'] = "BeOS";
            $bd['browser'] = $val[0];
            $bd['version'] = $val[1];

        // test for MS Internet Explorer
        }elseif(eregi("msie",$agent) && !eregi("opera",$agent)){
            $val = explode(" ",stristr($agent,"msie"));
            $bd['browser'] = $val[0];
            $bd['version'] = $val[1];
        
        // test for MS Pocket Internet Explorer
        }elseif(eregi("mspie",$agent) || eregi('pocket', $agent)){
            $val = explode(" ",stristr($agent,"mspie"));
            $bd['browser'] = "MSPIE";
            $bd['platform'] = "WindowsCE";
            if (eregi("mspie", $agent))
                $bd['version'] = $val[1];
            else {
                $val = explode("/",$agent);
                $bd['version'] = $val[1];
            }

            
        // test for Galeon
        }elseif(eregi("galeon",$agent)){
            $val = explode(" ",stristr($agent,"galeon"));
            $val = explode("/",$val[0]);
            $bd['browser'] = $val[0];
            $bd['version'] = $val[1];
            
        // test for Chrome
        }elseif(eregi("Chrome",$agent)){
            $val = explode(" ",stristr($agent,"Chrome"));
            $val = explode("/",$val[0]);
            $bd['browser'] = $val[0];
            $bd['version'] = $val[1];
            
        // test for Konqueror
        }elseif(eregi("Konqueror",$agent)){
            $val = explode(" ",stristr($agent,"Konqueror"));
            $val = explode("/",$val[0]);
            $bd['browser'] = $val[0];
            $bd['version'] = $val[1];
            
        // test for iCab
        }elseif(eregi("icab",$agent)){
            $val = explode(" ",stristr($agent,"icab"));
            $bd['browser'] = $val[0];
            $bd['version'] = $val[1];

        // test for OmniWeb
        }elseif(eregi("omniweb",$agent)){
            $val = explode("/",stristr($agent,"omniweb"));
            $bd['browser'] = $val[0];
            $bd['version'] = $val[1];

        // test for Phoenix
        }elseif(eregi("Phoenix", $agent)){
            $bd['browser'] = "Phoenix";
            $val = explode("/", stristr($agent,"Phoenix/"));
            $bd['version'] = $val[1];
        
        // test for Firebird
        }elseif(eregi("firebird", $agent)){
            $bd['browser']="Firebird";
            $val = stristr($agent, "Firebird");
            $val = explode("/",$val);
            $bd['version'] = $val[1];
            
        // test for Firefox
        }elseif(eregi("Firefox", $agent)){
            $bd['browser']="Firefox";
            $val = stristr($agent, "Firefox");
            $val = explode("/",$val);
            $bd['version'] = $val[1];
            
      // test for Mozilla Alpha/Beta Versions
        }elseif(eregi("mozilla",$agent) &&
            eregi("rv:[0-9].[0-9][a-b]",$agent) && !eregi("netscape",$agent)){
            $bd['browser'] = "Mozilla";
            $val = explode(" ",stristr($agent,"rv:"));
            eregi("rv:[0-9].[0-9][a-b]",$agent,$val);
            $bd['version'] = str_replace("rv:","",$val[0]);
            
        // test for Mozilla Stable Versions
        }elseif(eregi("mozilla",$agent) &&
            eregi("rv:[0-9]\.[0-9]",$agent) && !eregi("netscape",$agent)){
            $bd['browser'] = "Mozilla";
            $val = explode(" ",stristr($agent,"rv:"));
            eregi("rv:[0-9]\.[0-9]\.[0-9]",$agent,$val);
            $bd['version'] = str_replace("rv:","",$val[0]);
        
        // test for Lynx & Amaya
        }elseif(eregi("libwww", $agent)){
            if (eregi("amaya", $agent)){
                $val = explode("/",stristr($agent,"amaya"));
                $bd['browser'] = "Amaya";
                $val = explode(" ", $val[1]);
                $bd['version'] = $val[0];
            }
else {
                $val = explode("/",$agent);
                $bd['browser'] = "Lynx";
                $bd['version'] = $val[1];
            }

        
        // test for Safari
        }elseif(eregi("safari", $agent)){
            $bd['browser'] = "Safari";
            $bd['version'] = "";

        // remaining two tests are for Netscape
        }elseif(eregi("netscape",$agent)){
            $val = explode(" ",stristr($agent,"netscape"));
            $val = explode("/",$val[0]);
            $bd['browser'] = $val[0];
            $bd['version'] = $val[1];
        }
elseif(eregi("mozilla",$agent) && !eregi("rv:[0-9]\.[0-9]\.[0-9]",$agent)){
            $val = explode(" ",stristr($agent,"mozilla"));
            $val = explode("/",$val[0]);
            $bd['browser'] = "Netscape";
            $bd['version'] = $val[1];
        }

        
        // clean up extraneous garbage that may be in the name
        $bd['browser'] = ereg_replace("[^a-z,A-Z]", "", $bd['browser']);
        // clean up extraneous garbage that may be in the version        
        $bd['version'] = ereg_replace("[^0-9,.,a-z,A-Z]", "", $bd['version']);
        
        // check for AOL
        if (eregi("AOL", $agent)){
            $var = stristr($agent, "AOL");
            $var = explode(" ", $var);
            $bd['aol'] = ereg_replace("[^0-9,.,a-z,A-Z]", "", $var[1]);
        }

        
        // finally assign our properties
        $this->Name = $bd['browser'];
        $this->Version = $bd['version'];
        $this->Platform = $bd['platform'];
        $this->AOL = $bd['aol'];
    }
}

?>


***** include/config.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
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
<?php
$dbHost
= '[ZELFINVULLEN]';
$dbName = '[ZELFINVULLEN]';
$dbUser = '[ZELFINVULLEN]';
$dbPass = '[ZELFINVULLEN]';

$dbConnect = mysql_connect($dbHost, $dbUser, $dbPass);
if(!$dbConnect) {
    die('Could not connect: ' . mysql_error());
}

$dbSelect = mysql_select_db($dbName);
if(!$dbSelect) {
    die ('Can\'t use database : ' . mysql_error());
}
[
/code]

*****
include/head.php *****
[
code]
    <!--
CSS files -->
    <
link href="css/template.css" rel="stylesheet" type="text/css" />
    <
link href="css/ui.all.css" rel="stylesheet" type="text/css" />
    <!--
jQuery -->
    <
script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js" type="text/javascript"></script>

    <!--Autocompleet -->
    <script src='js/jquery.bgiframe.min.js' type='text/javascript'></script>
    <script src='js/jquery.ajaxQueue.js' type='text/javascript'></script>
    <script src='js/thickbox-compressed.js' type='text/javascript'></script>
    <script src='js/jquery.autocomplete.js' type='text/javascript'></script>
    <!--Form check -->
    <script src="js/jquery.metadata.js" type="text/javascript"></script>
    <script src="js/jquery.validate.js" type="text/javascript"></script>
    <script src="js/cmxforms.js" type="text/javascript"></script>
    <!-- jQuery UI -->
    <script src="js/ui.core.js" type="text/javascript"></script>
    <script src="js/ui.datepicker.js" type="text/javascript"></script>
    <script src="js/ui.accordion.js" type="text/javascript"></script>
    <script src="js/ui.dialog.js" type="text/javascript"></script>
    <script src="js/ui.resizable.js" type="text/javascript"></script>
    <script src="js/ui.draggable.js" type="text/javascript"></script>
    <!--Tooltip -->
    <!-- <script src="js/jquery.dimensions.js" type="text/javascript"></script> -->
    <script src="js/jquery.tooltip.js" type="text/javascript"></script>
    <script src="js/chili-1.7.pack.js" type="text/javascript"></script>
    <!-- Treeview menu -->
    <script src="js/jquery.cookie.js" type="text/javascript"></script>
    <script src="js/jquery.treeview.js" type="text/javascript"></script>
    <script type="text/javascript">
    $(document).ready(function(){
        $("#browser").treeview({
            persist: "cookie",
            toggle: function() {
                console.log("%s was toggled.", $(this).find(">span").text());
            }
        });
    });
    </script>
    <!-- Toggle script -->
    <script type="text/javascript">
        $(document).ready(function() {
            //hide the all of the element with class ToggleBody
            $(".toggleBody").hide();
            //toggle the componenet with class ToggleBody
            $(".toggleTitle").click(function() {
                $(this).next(".toggleBody").slideToggle(200);
            });
        });
        
        $(document).ready(function() {
            //Show the all of the element with class ToggleBody2
            $(".toggleBody2").show();
            
            //toggle the componenet with class ToggleBody
            $(".toggleTitle2").click(function() {
                $(this).next(".toggleBody2").slideToggle(200);
            });
        });
    </script
    <?php
        // PHP files -->
        include 'include/config.php';
        include 'include/nav.php';
        include 'include/actions.php';
        include 'include/browser.php';
    ?>

    <!-- Title and Rest -->
    <title>Banaan.nu</title>
    <style>
        body {
            font-family: verdana;
            font-size: 10px;
        }
        h3 {
            font-size: 14px;
            font-weight: bold;
        }
    </style>


***** include/menu.php *****

<?php
if($_SESSION['login']) {
    $queryMenu = "SELECT * FROM members WHERE id = '". $_SESSION['id'] ."'";
    $resultMenu = mysql_query($queryMenu);
    $row = mysql_fetch_assoc($resultMenu);
    $bankMenu = $row['bank'];
    $urenMenu = $row['uren'];
}

?>


<ul id="browser" class="filetree treeview-famfamfam">
    <li>
        <span class="folder">Hoofdmenu</span>
        <ul>
            <li>
                <span class="file"><a href="?page=home">Home</a></span>
            </li>
            <li class="closed">
                <span class="folder">Profiel</span>
                <ul>
    <?php if(!$_SESSION['login']) { ?>
                    <li>
                        <span class="file"><a href="?page=login">Inloggen</a></span>
                    </li>
                    <li>
                        <span class="file"><a href="?page=register">Registreren</a></span>
                    </li>
    <?php } else { ?>
                    <li>
                        <span class="file"><a href="?page=settings">Instellingen</a></span>
                    </li>
                    <li>
                        <span class="file"><a href="?page=confirm">Uitloggen</a></span>
                    </li>
    <?php } ?>
                </ul>
            </li>
        </ul>
    </li>
    <?php if($_SESSION['login']) { ?>
    <li>
        <span class="folder">Bankzaken</span>
        <ul>
            <li>
                <span class="file"><a href="?dir=bank&page=overview">Overzicht</a></span>
            </li>
    <?php if($_SESSION['bank_id']) { ?>
            <li>
                <span class="file"><a href="?dir=bank&page=details&bank_id=<?php echo $_SESSION['bank_id']; ?>">Details</a></span>
            </li>
    <?php } ?>
        </ul>
    </li>
    <?php } if($_SESSION['login']) { ?>
    <li>
        <span class="folder">Downloaden</span>
        <ul>
            <li>
                <span class="file"><a href="?dir=download&page=download">Banaan.nu</a></span>
            </li>
        </ul>
    </li>
    <?php } ?>
</ul>


***** include/nav.php *****

<?php
if(isset($_GET['dir'])) {
    $dir = $_GET['dir'];
}
elseif (isset($_POST['dir'])) {
    $dir = $_POST['dir'];
}
else {
    $dir = 'page';
}


if(isset($_GET['page'])) {
    $page = $_GET['page'];
}
elseif (isset($_POST['page'])) {
    $page = $_POST['page'];
}
else {
    $page = 'home';
}


if(isset($_GET['type'])) {
    $type = $_GET['type'];
}
elseif (isset($_POST['type'])) {
    $type = $_POST['type'];
}
else {
    $type = 'php';
}


$url = './'. $dir .'/'. $page .'.'.$type;
if(file_exists($url)) {
    $url_error = false;
    
    if($page !== 'home' && $page !== 'register' && $page !== 'login') {
        if(!$_SESSION['login']) {
            $url_error = true;
            $pageError = 'Je bent niet ingelogd.';
        }
    }
}
else {
    $url_error = true;
    $pageError = 'Er is een fout opgetreden';
}


//Get Action
if(isset($_GET['action'])) {
    $action = $_GET['action'];
}
elseif (isset($_POST['action'])) {
    $action = $_POST['action'];
}
else {
    $action = false;
}

?>



***** page/confirm.php *****

<script type="text/javascript">
jQuery(function() {
    jQuery("#dialog").dialog({
        bgiframe: true,
        resizable: false,
        height: 140,
        modal: true,
        overlay: {
            backgroundColor: '#000',
            opacity: 0.7
        },
        buttons: {
            'Cancel': function() {
                $(this).dialog('close');
            }
        }
    });
    
    jQuery("#dialog2").dialog({
        width: 500,
        height: 400,
        modal: true,
        autoOpen: false,
        resizable: false,
        overlay: {
            backgroundColor: '#000',
            opacity: 0.7
        }
    });
    jQuery('#dialogOpen').click(function() {
        $('#dialog').dialog('open');
    });
});
</script>
<a href="#" id="dialogOpen">Mocht u verkeert gekozenhebben, klik dan hier om nog een keer te twijfelen!</a>
<div id="dialog" title="Uitloggen?">
    Heb je twijfels bij je uitlog behoefte?<br />
    <a href="?page=logout">Doorgaan...</a>
</div>


***** page/home.php *****

<h3>Welkom op Banaan.nu</h3>
<p>
    Ik heb een hele tijd geleden een script geschreven voor administratieve doeleinden. Dat heette toen "Uren log v3" (oid). Ooit zou ik die gaan uitbreiden, maar dat is er nooit van gekomen. Tot nu.
</p>
<p>
    De bedoeling is om weer wat scripts te gaan schrijven voor administratieve doeleinde. Ik ben begonnen met "Bankadministratie". Laat me een ding gelijk duidelijk maken. Draai dit sctipt alleen lokaal, of online met extra beveiliging. Mijn inlog script is niet veilig genoeg om je bank zaken erin te zetten.
</p>
<p>
    Heb je een idee, of wil je wat zeggen. Dan kan je me mailen op <a href="mailto:[email protected]">[email protected]</a>.
</p>
<p>
Nu beschikbaar<br />
<strong>Bankadministratie</strong><br />
Met de bankadrministratie kan u uw persoonlijke bankzaken bijhouden.<br />
<ul>
    <li style="margin-left:20px;">Toevoegen van banken</li>
    <li style="margin-left:20px;">Transactie / Begroting toevoegen</li>
    <li style="margin-left:20px;">Transactie / Begroting aanpassen</li>
</ul>
</p>


***** page/login.php *****

<script type="text/javascript">
$().ready(function() {
    var container = $('div.container');
    // validate the form when it is submitted
    var validator = $("#loginForm").validate({
        errorContainer: container,
        errorLabelContainer: $("ol", container),
        wrapper: 'li',
        meta: "validate"
    });
    
    $(".cancel").click(function() {
        validator.resetForm();
    });
});
</script>
<?php
if($action == 'login') {
    $login_error = false;
        
    if(isset($_POST['user_name'])) {
        $user_name = $_POST['user_name'];
    }
else {
        $login_error = 'true';
    }

    
    if(isset($_POST['password'])) {
        $password = md5($_POST['password']);
    }
else {
        $login_error = 'true';
    }

    
    if(!$login_error) {
        $query_login = "SELECT * FROM members WHERE user_name = '". $user_name ."'";
        $result_login = mysql_query($query_login);
        if($row = mysql_fetch_assoc($result_login)) {
            $query_password = "SELECT * FROM members WHERE password = '". $password ."'";
            $result_password = mysql_query($query_password);
            if($row = mysql_fetch_assoc($result_password)) {
                $_SESSION['login'] = true;
                $_SESSION['id'] = $row['id'];
                $_SESSION['voornaam'] = $row['first_name'];
                $_SESSION['tussenvoegsel'] = $row['middle_name '];
                $_SESSION['achternaam'] = $row['last_name'];
                $_SESSION['gebruikersnaam'] = $row['user_name'];
                $_SESSION['email'] = $row['email_adres'];
                $error_text = 'Alle gegevens kloppen. U bent ingelogd';
                $error_class = 'true';
            }
else {
                $error_text = 'Helaas, er is een probleem met de combinatie van Gebruikersnaam en Wachtwoord';
                $error_class = 'false';
                $action = false;
            }
        }
else {
            $error_text = 'Deze username staat niet bekent in ons systeem, probeer het nog eens.';
            $error_class = 'false';
            $action = false;
        }
    }
else {
        $error_text = 'Er is een systeem fout opgetreden';
        $error_class = 'false';
        $action = false;
    }

    echo '<div class="error '. $error_class .'">';
    echo '    '. $error_text;
    echo '</div>';
}


if(!$action) {
    if(!$_SESSION['login']) {
?>

<h3>Hier gaan we inloggen</h3>
<form action="" class="cmxform" id="loginForm" name="login" method="post">
    <fieldset>
        <input type="hidden" name="action" value="login" />
        <div class="Login">
            <label for="user_name">Gebruikersnaam</label><br />
            <input title="Voer hier uw gebruikersnaam in (ten minste 3 tekens)" type="text" name="user_name" value="<?php echo $user_name; ?>"  class="{validate:{required:true, rangelength:[3,100]}}" />
        </div>
        <div class="Login">
            <label for="password">Wachtwoord</label><br />
            <input title="Voer hier een wachtwoord in (tenminste 5 en maximaal 12 tekens)" type="password" name="password" class="{validate:{required:true, rangelength:[3,12]}}" />
        </div>
        <div class="Login">
            <br />
            <input type="submit" value="Inloggen" />
        </div>
        <div class="clear"></div>
    </fieldset>
</form>
<!-- our error container -->
<div class="container">
    <h5>Het formulier is nog goed ingevuld:</h5>
    <div class="error false">
        <ol>
            <li><label for="user_name" class="error">Voer hier uw gebruikersnaam in (ten minste 3 tekens)</label></li>
            <li><label for="password" class="error">Voer hier een wachtwoord in (tenminste 5 en maximaal 12 tekens)</label></li>
        </ol>
    </div>
</div>
<?php
    } else {
        echo '<div class="error true">';
        echo '    U bent al ingelogd';
        echo '</div>';
    }
}

?>



***** page/logout.php *****

<?php
if(isset($_SESSION['login'])) {
    if(session_destroy()) {
        echo '    <div class="error true">';
        echo '        U bent uitgelogd';
        echo '    </div>';
    }
else {
        echo '    <div class="error false">';
        echo '        Er is een fout opgetreden, u bent niet uigelogd';
        echo '    </div>';
    }
}
else {
    echo '    <div class="error false">';
    echo '        U kan niet uitloggen want u bent niet ingelogd';
    echo '    </div>';
}

?>



***** page/register.php *****

<script type="text/javascript">
$().ready(function() {
    // validate the comment form when it is submitted
    $("#commentForm").validate();
    // validate signup form on keyup and submit
    $("#registerForm").validate({
        rules: {
            voornaam: "required",
            achternaam: "required",
            gebruikersnaam: {
                required: true,
                minlength: 3
            },
            wachtwoord: {
                required: true,
                minlength: 5
            },
            wachtwoord_herhalen: {
                required: true,
                minlength: 5,
                equalTo: "#wachtwoord"
            },
            email: {
                required: true,
                email: true
            },
            akkoord: "required"
        },
        messages: {
            voornaam: "U heeft geen voornaam ingevuld",
            achternaam: "U heeft geen achternaam ingevuld",
            gebruikersnaam: {
                required: "U heeft geen gebruikersnaam ingevuld",
                minlength: "Een gebruikersnaam moet minimaal 3 karakters zijn"
            },
            wachtwoord: {
                required: "Vul hier een wachtwoord in",
                minlength: "Een wachtwoord moet minimaal 5 karakters lang zijn"
            },
            wachtwoord_herhalen: {
                required: "Vul hier nogmaals een wachtwoord in",
                minlength: "Een wachtwoord moet minimaal 5 karakters lang zijn",
                equalTo: "Uw wachtwoorden komen niet overeen"
            },
            email: "Voer een geldig e-mail adres in",
            akkoord: "U moet akkoord gaan met onze gebruikersvoorwaarden"
        }
    });
    
    // propose username by combining first- and lastname
    $("#gebruikersnaam").focus(function() {
        var firstname = $("#voornaam").val();
        var lastname = $("#achternaam").val();
        if(firstname && lastname && !this.value) {
            this.value = firstname + "." + lastname;
        }
    });
    
    // check if confirm password is still valid after password changed
    $("#wachtwoord").blur(function() {
        $("#wachtwoord_herhalen").valid();
    });
    
    $(".cancel").click(function() {
        validator.resetForm();
    });
});
</script>
<?php
if($action == 'register') {
    $register_error = false;
    
    if(isset($_POST['voornaam'])) {
        $voornaam = $_POST['voornaam'];
    }
else {
        $register_error = 'true';
    }

    
    if(isset($_POST['tussenvoegsel'])) {
        $tussenvoegsel = $_POST['tussenvoegsel'];
    }
else {
        $register_error = 'true';
    }

    
    if(isset($_POST['achternaam'])) {
        $achternaam = $_POST['achternaam'];
    }
else {
        $register_error = 'true';
    }

    
    if(isset($_POST['gebruikersnaam'])) {
        $gebruikersnaam = $_POST['gebruikersnaam'];
    }
else {
        $register_error = 'true';
    }

    
    if(isset($_POST['wachtwoord'])) {
        $wachtwoord = md5($_POST['wachtwoord']);
    }
else {
        $register_error = 'true';
    }

    
    if(isset($_POST['email'])) {
        $email = $_POST['email'];
    }
else {
        $register_error = 'true';
    }

    
    if(!$register_error) {
        $query_login = "SELECT * FROM members WHERE user_name = '". $gebruikersnaam ."'";
        $result_login = mysql_query($query_login);
        if(!$row = mysql_fetch_assoc($result_login)) {
            $query_register ="INSERT INTO `members` (`user_name` ,`password` ,`first_name` ,`middle_name` ,`last_name` ,`email_adres` ) VALUES ('". $gebruikersnaam ."', '". $wachtwoord ."', '". $voornaam ."', '". $tussenvoegsel ."', '". $achternaam ."', '". $email ."');";
            if(mysql_query($query_register)) {
                $error_text = 'Alle gegevens kloppen. Je bent geregistreerd';
                $error_class = 'true';
            }
else {
                $error_text = 'Er is een systeem fout opgetreden';
                $error_class = 'false';
                $action = false;
            }
        }
else {
            $error_text = 'Er is al een user met deze gebruikersnaam';
            $error_class = 'false';
            $action = false;
        }
    }
else {
        $error_text = 'Er is een systeem fout opgetreden';
        $error_class = 'false';
        $action = false;
    }

    echo '<div class="error '. $error_class .'">';
    echo '    '. $error_text;
    echo '</div>';
}


if(!$action) {
?>

<h3>Hier gaan we registreren</h3>
<form action="" class="cmxform" id="registerForm" name="login" method="post">
    <fieldset>
        <input type="hidden" name="action" value="register" />
        <div class="Register">
            <label for="voornaam">Voornaam</label>
            <input id="voornaam" name="voornaam" value="<?php echo $voornaam; ?>" />
            <div class="clear"></div>
        </div>
        <div class="Register">
            <label for="tussenvoegsel">Tussenvoegsel</label>
            <input id="tussenvoegsel" name="tussenvoegsel" value="<?php echo $tussenvoegsel; ?>" />
            <div class="clear"></div>
        </div>
        <div class="Register">
            <label for="achternaam">Achternaam</label>
            <input id="achternaam" name="achternaam" value="<?php echo $achternaam; ?>" />
            <div class="clear"></div>
        </div>
        <div class="Register">
            <label for="gebruikersnaam">Gebruikersnaam</label>
            <input id="gebruikersnaam" name="gebruikersnaam" value="<?php echo $gebruikersnaam; ?>" />
            <div class="clear"></div>
        </div>
        <div class="Register">
            <label for="wachtwoord">Wachtwoord</label>
            <input id="wachtwoord" name="wachtwoord" type="password" />
            <div class="clear"></div>
        </div>
        <div class="Register">
            <label for="wachtwoord_herhalen">Wachtwoord herhalen</label>
            <input id="wachtwoord_herhalen" name="wachtwoord_herhalen" type="password" />
            <div class="clear"></div>
        </div>
        <div class="Register">
            <label for="email">E-mail</label>
            <input id="email" name="email" value="<?php echo $email; ?>" />
            <div class="clear"></div>
        </div>
        <div class="Register">
            <label for="akkoord">Gebruikersvoorwaarden</label>
            <input type="checkbox" id="akkoord" name="akkoord" />
            <div class="clear"></div>
        </div>
        <div class="Register">
            <br />
            <input type="submit" value="Aanmelden" />
        </div>
        <div class="clear"></div>
    </fieldset>
</form>
<?php
}
?>



***** page/settings.php *****

<?php
if(!$action) {
    echo '<h3>Instellingen van '. $_SESSION['gebruikersnaam'] .'</h3>';
    $query_profiel = "SELECT * FROM members WHERE id = ". $_SESSION['id'] ."";
    $result_profiel = mysql_query($query_profiel);
    $row = mysql_fetch_assoc($result_profiel);
    echo '<table cellpadding="0" cellspacing="0" class="profile">';
    echo '<form method="post" action"" name="profile">';
    echo '    <tr>';
    echo '        <td class="profileTitle">';
    echo '            Gebruikersnaam:';
    echo '        </td>';
    echo '        <td class="profileUser">';
    echo '            '. $row['user_name'] .'';
    echo '        </td>';
    echo '    </tr>';
    echo '    <tr>';
    echo '        <td class="profileTitle">';
    echo '            Voornaam:';
    echo '        </td>';
    echo '        <td class="profileUser">';
    echo '            '. $row['first_name'] .'';
    echo '        </td>';
    echo '    </tr>';
    echo '    <tr>';
    echo '        <td class="profileTitle">';
    echo '            Tussenvoegsels:';
    echo '        </td>';
    echo '        <td class="profileUser">';
    echo '            '. $row['middle_name'] .'';
    echo '        </td>';
    echo '    </tr>';
    echo '    <tr>';
    echo '        <td class="profileTitle">';
    echo '            Achternaam:';
    echo '        </td>';
    echo '        <td class="profileUser">';
    echo '            '. $row['last_name'] .'';
    echo '        </td>';
    echo '    </tr>';
    echo '    <tr>';
    echo '        <td class="profileTitle">';
    echo '            E-mail';
    echo '        </td>';
    echo '        <td class="profileUser">';
    echo '            <a href="mailto:'. $row['email_adres'] .'">'. $row['email_adres'] .'</a>';
    echo '        </td>';
    echo '    </tr>';
    echo '</form>';
    echo '</table>';
}

?>

 
 

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.