zoeken in mysql

Overzicht Reageren

Sponsored by: Vacatures door Monsterboard

Pagina: « vorige 1 2

Stephan Sterrenberg

Stephan Sterrenberg

21/08/2007 22:03:00
Quote Anchor link
ik dacht dat het script zo was dat je de dag maand en jaar invoert en dan uitrekent wat de leeftijd is
en dan in de database zet
 
PHP hulp

PHP hulp

09/01/2025 04:06:05
 
Arjan Kapteijn

Arjan Kapteijn

21/08/2007 22:05:00
Quote Anchor link
Ik ken jouw scripts niet, geen idee.
 
Stephan Sterrenberg

Stephan Sterrenberg

21/08/2007 22:13:00
Quote Anchor link
zal het ff posten
kan je het zien
 
Stephan Sterrenberg

Stephan Sterrenberg

21/08/2007 22:13:00
Quote Anchor link
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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
<? session_start(); ?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1250">
<meta http-equiv="Content-Language" content="nl">
</style>
<meta name="Microsoft Theme" content="spring 1110">
</head>
<body>
<?

error_reporting(E_ALL);

include("config.php");
include("functions.php");

if(isset($_GET['act']))
{

    if($_GET['act'] == "view")
    {


        if(isset($_GET['user_id']))
        {

            $query = mysql_query("SELECT *,UNIX_TIMESTAMP(user_regdate) AS user_regdate FROM tbl_users WHERE user_id = '" . $_GET['user_id'] . "'");
            $result = mysql_result(mysql_query("SELECT COUNT(1) FROM tbl_users WHERE user_id = '" . $_GET['user_id'] . "'"),0);

            if(empty($result))
            {

                echo "<script>alert('User with this ID doesn\'t exist.'); history.go(-1);</script>";
            }

            else
            {
                while($row = mysql_fetch_assoc($query))
                {

                    $public_profile = $row['user_public'];

                    if(empty($public_profile))
                    {

                        if(isset($_SESSION['user_id']))
                        {

                            $show_profile = 1;
                        }

                        else
                        {
                            $show_profile = 0;
                        }
                    }

                    else
                    {
                        $show_profile = 1;
                    }

                    
                    if(!empty($row['user_geboorte']))
                        {

                        $geb = explode("-",$row['user_geboorte']);
                        $seconden = time() - mktime(0,0,0,$geb[1],$geb[0],$geb[2]);
                        $jaren = floor($seconden/60/60/24/365.25);
                        $geboorte = $jaren;
                        }

                    else {$geboorte = 'Onbekend';}
                    
                    if($row['user_geslacht'] == '1') {$geslacht = 'Man';}
                    elseif($row['user_geslacht'] == '2') {$geslacht = 'Vrouw';}
                    else {$geslacht = 'Onbekend';}
                
                    if($row['user_geaardheid'] == '1') {$geaardheid = 'Hetero';}
                    elseif($row['user_geaardheid'] == '2') {$geaardheid = 'Bi-sexueel';}
                    elseif($row['user_geaardheid'] == '3') {$geaardheid = 'Homo';}
                    elseif($row['user_geaardheid'] == '4') {$geaardheid = 'Anders';}
                    else {$geaardheid = 'Onbekend';}
                    
                    if($row['user_relatie'] == '1') {$relatie = 'Nee';}
                    elseif($row['user_relatie'] == '2') {$relatie = 'Ja';}
                    else {$relatie = 'Onbekend';}
                    
                    if($row['user_ikzoek'] == '1') {$ikzoek = 'Niks';}
                    elseif($row['user_ikzoek'] == '2') {$ikzoek = 'Vriendschap';}
                    elseif($row['user_ikzoek'] == '3') {$ikzoek = 'Relatie';}
                    elseif($row['user_ikzoek'] == '4') {$ikzoek = 'Seks';}
                    else {$ikzoek = 'Onbekend';}
                    
                    if(!empty($row['user_woonplaats'])) {$woonplaats = stripslashes($row['user_woonplaats']);}
                    else {$woonplaats = 'Onbekend';}
                    
                    if(!empty($row['user_lengte'])) {$lengte = stripslashes($row['user_lengte']);}
                    else {$lengte = 'Onbekend';}
                    
                    if(!empty($row['user_gewicht'])) {$gewicht = stripslashes($row['user_gewicht']);}
                    else {$gewicht = 'Onbekend';}
                    
                    if($row['user_land'] == '1') {$land = 'Belgie';}
                    elseif($row['user_land'] == '2') {$land = 'Nederland';}
                    elseif($row['user_land'] == '3') {$land = 'Anders';}
                    else {$land = 'Onbekend';}

                    if($row['user_provincie'] == '1') {$provincie = '(Drente)';}
                    elseif($row['user_provincie'] == '2') {$provincie = '(Flevoland)';}
                    elseif($row['user_provincie'] == '3') {$provincie = '(Friesland)';}
                    elseif($row['user_provincie'] == '4') {$provincie = '(Gelderland)';}
                    elseif($row['user_provincie'] == '5') {$provincie = '(Groningen)';}
                    elseif($row['user_provincie'] == '6') {$provincie = '(Limburg)';}
                    elseif($row['user_provincie'] == '7') {$provincie = '(Noord-Holland)';}
                    elseif($row['user_provincie'] == '8') {$provincie = '(Noord-Brabant)';}
                    elseif($row['user_provincie'] == '9') {$provincie = '(Overijssel)';}
                    elseif($row['user_provincie'] == '10') {$provincie = '(Utrecht)';}
                    elseif($row['user_provincie'] == '11') {$provincie = '(Zuid-Holland)';}
                    elseif($row['user_provincie'] == '12') {$provincie = '(Zeeland)';}
                    elseif($row['user_provincie'] == '13') {$provincie = '(Antwerpen)';}
                    elseif($row['user_provincie'] == '14') {$provincie = '(Limburg)';}
                    elseif($row['user_provincie'] == '15') {$provincie = '(Oost-vlaanderen)';}
                    elseif($row['user_provincie'] == '16') {$provincie = '(Vlaams-Brabant)';}
                    elseif($row['user_provincie'] == '17') {$provincie = '(Zuid-Vlaanderen)';}
                    elseif($row['user_provincie'] == '18') {$provincie = '(Waals-Brabant)';}
                    elseif($row['user_provincie'] == '19') {$provincie = '(Henegouwen)';}
                    elseif($row['user_provincie'] == '20') {$provincie = '(Luik)';}
                    elseif($row['user_provincie'] == '21') {$provincie = '(Luxemburg)';}
                    elseif($row['user_provincie'] == '22') {$provincie = '(Namen)';}
                    elseif($row['user_provincie'] == '23') {$provincie = '(Brussels Hoofdstedelijk Gewest)';}
                    
                    else {$provincie = '';}
                    
                    $row['user_mijzelf'] = nl2br(htmlspecialchars($row['user_mijzelf']));

                    if(!empty($cfg['smiles']))
                    {

                        $smile_select = mysql_query("SELECT * FROM tbl_smiles ORDER BY smile_id ASC");

                        while($smile = mysql_fetch_assoc($smile_select))
                        {

                            $smile['smile_tag'] = str_replace(">","&gt;", $smile['smile_tag']);
                            $smile['smile_tag'] = str_replace("<","&lt;", $smile['smile_tag']);
                            $row['user_mijzelf'] = str_replace("$smile[smile_tag]","<img src=\"smiles/" . $smile['smile_file'] . "\">", $row['user_mijzelf']);
                        }
                    }


                    $quote_tags = substr_count($row['user_mijzelf'], '[/quote]');
                    for($i = 0; $i <= $quote_tags; $i++)
                    {

                        $row['user_mijzelf'] = preg_replace('/\[quote=(.*?)\](.*?)\[\/quote\]/si', "<br><blockquote>\\1 Schreef:<br><table border=\"1\" style=\"border-collapse: collapse\" bordercolor=\"#000000\" width=\"80%\" cellpadding=\"2\"><tr><td> \\2 </td></tr></table></blockquote>", $row['user_mijzelf']);
                    }

                    $row['user_mijzelf'] = ereg_replace("([ ]{2})","\\1&nbsp;",$row['user_mijzelf']);
                    $row['user_mijzelf'] = preg_replace("/\[b\](.*?)\[\/b\]/si", "<b>\\1</b>",$row['user_mijzelf']);
                    $row['user_mijzelf'] = preg_replace("/\[u\](.*?)\[\/u\]/si", "<u>\\1</u>",$row['user_mijzelf']);
                    $row['user_mijzelf'] = preg_replace("/\[i\](.*?)\[\/i\]/si", "<i>\\1</i>",$row['user_mijzelf']);
                    $row['user_mijzelf'] = preg_replace("/\[img\](.*?)\[\/img\]/si", "<img src=\"\\1\">",$row['user_mijzelf']);
                    $row['user_mijzelf'] = preg_replace("/\[url\](.*?)\[\/url\]/si", "<a href=\"\\1\" target=\"_blank\">\\1</a>",$row['user_mijzelf']);
                    $row['user_mijzelf'] = wordwrap($row['user_mijzelf'], 100,"\n",1);
                    
                    $website = '';
                    if(!empty($row['user_url']))
                        {

                            $split_url = substr($row['user_url'],0,7);

                            if($split_url != "http://")
                            {

                                $url = "http://" . $row['user_url'];
                            }

                            else
                            {
                                $url = $row['user_url'];
                            }


                            $website = "<tr><td><b>Website: </b></td><td><a href=\"" . htmlspecialchars($url) . "\" target=\"_blank\"><span style=\"text-decoration: none\"><font color=orange>" . htmlspecialchars($row['user_url']) . "</font></span></a></td></tr></td></tr>";
                        }


                    if(!empty($show_profile))
                    {

                        echo "<table align=center width=\"75%\" cellspacing=\"0\" cellpadding=\"0\"><tr><th align=\"left\"><hr width=\"98%\" style=\"height: 1px; color: #CC9900\">" . $row['user_name'] . "<hr width=\"98%\" style=\"height: 1px; color: #CC9900;\"></th><th align=\"left\"><hr style=\"height: 1px; color: #CC9900\">Status<hr style=\"height: 1px; color: #CC9900\"></th></tr><tr><td width=40% valign=\"top\">";
                        
                        if($row['user_foto'] == "1")
                            {

                            ?>

                            <script type="text/javascript">
//aan te passen
vanaf_links = 100;
vanaf_boven = 100;
grootste_breedte  = 500+20;//afmetingen van het grootste beeld +20
grootste_hoogte = 500+20;  //afmetingen van het grootste beeld +20

if (parseInt(navigator.appVersion.charAt(0))>=4){
var isNN=(navigator.appName=="Netscape")?1:0;
var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}
var optNN='scrollbars=no,width='+grootste_breedte+',height='+grootste_hoogte+',left='+vanaf_links+',top='+vanaf_boven;
var optIE='scrollbars=no,width=10,height=10,left='+vanaf_links+',top='+vanaf_boven; // 10,10: aanpassen indien nodig

function popBeeld(BeeldURL,BeeldTitel){
if (isNN){imgWin=window.open('about:blank','',optNN);}
if (isIE){imgWin=window.open('about:blank','',optIE);}
with (imgWin.document){
writeln('<html><head><title>Bezig met inladen ...</title><style>body{margin:0px;}</style>');writeln('<sc'+'ript>');
writeln('var isNN,isIE;');writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
writeln('isNN=(navigator.appName=="Netscape")?1:0;');writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
writeln('function aanpassen_aan_beeldgrootte(){');writeln('if (isIE){');writeln('window.resizeTo(500,500);'); // 500,500: aanpassen indien nodig
writeln('width=500-(document.body.clientWidth-document.images[0].width);');// 500 aanpassen indien nodig
writeln('height=500-(document.body.clientHeight-document.images[0].height);');// 500 aanpassen indien nodig
writeln('window.resizeTo(width,height);}');writeln('if (isNN){');      
writeln('window.innerWidth=document.images["BeeldNaam"].width;');writeln('window.innerHeight=document.images["BeeldNaam"].height;}}');
writeln('function maak_titel(){document.title="'+BeeldTitel+'";}');writeln('</sc'+'ript>');
writeln('</head><body bgcolor=000000 scroll="no" onload="aanpassen_aan_beeldgrootte();maak_titel();self.focus()" onblur="self.close()">');
writeln('<img name="BeeldNaam" src='+BeeldURL+' style="display:block"></body></html>');
close();        
}}
</script>

                            <?php echo'<a href="javascript:popBeeld(\'fotos/'.$row['user_id'].'.jpg\',\'Foto\')"><center><img src="fotos/'.$row['user_id'].'_thumb.jpg" border="0"></center></a>';
                            }

                        else{
                            echo'<center><img src="geenfoto.jpg"></center>';
                            }

                        
                        echo "</td><td valign=\"top\">";
                        echo "<table style=\"font-size:10pt\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td><b><font size=2>Gebruikersnaam: &nbsp;</b></td><td>" . htmlspecialchars($row['user_name']) . "</td></tr>";
                        echo "<tr><td><b>Leeftijd: </b></td><td>" . $geboorte . "</td></tr>";
                        if ($geslacht == "Onbekend") {}
                        else {
                        echo "<tr><td><b>Geslacht: </b></td><td>" . $geslacht . "</td></tr>";}
                        if ($geaardheid == "Onbekend") {}
                        else {
                        echo "<tr><td><b>Geaardheid: </b></td><td>" . $geaardheid . "</td></tr>";}
                        if ($relatie == "Onbekend") {}
                        else {
                        echo "<tr><td><b>Relatie: </b></td><td>" . $relatie . "</td></tr>";}
                        if ($ikzoek == "Onbekend") {}
                        else {
                        echo "<tr><td><b>Ik zoek: </b></td><td>" . $ikzoek . "</td></tr>";}
                        if ($lengte == "Onbekend") {}
                        else {
                        echo "<tr><td><b>Lengte: </b></td><td>" . $lengte . " cm</td></tr>";}
                        if ($gewicht == "Onbekend") {}
                        else {
                        echo "<tr><td><b>Gewicht: </b></td><td>" . $gewicht . " kg</td></tr>";}
                        if ($woonplaats == "Onbekend") {}
                        else {
                        echo "<tr><td><b>Woonplaats: </b></td><td>" . $woonplaats . " ".$provincie."</td></tr>";}
                        echo "<tr><td><b>Land: </b></td><td>" . $land . "</td></tr>";
                        echo $website . "\n";
                        

                        $date_select = mysql_query("SELECT * FROM tbl_users WHERE user_id = '" . $row['user_id'] . "'");

                        while($date = mysql_fetch_assoc($date_select))
                        {

                            $date_format = $date['user_dateformat'];
                        }


                        $row['user-regdate'] = date("$date_format", $row['user_regdate']);
                        echo "<tr><td><b>Geregistreerd op: </b></td><td>" . $row['user-regdate'] . "</td></tr>";
                        
                        if ($row['user_lastactive'] == 'NULL')
                        {}

                        else
                        {
                        echo "<tr><td><b>Laatste keer online op: &nbsp;</b></td><td>" . $row['user_lastactive'] . "</td></tr>";
                        }


                        if($row['user_pm'])
                        {

                            $user_pm = "Ja";
                        }

                        else
                        {
                            $user_pm = "Nee";
                        }


                        echo "<tr><td><b>PM aan: </b></td><td>" . $user_pm . "</td></tr>";

                        $user_inbox = mysql_result(mysql_query("SELECT COUNT(1) FROM tbl_msg WHERE msg_to = " . $_GET['user_id'] . ""),0);

                        if(isset($row['user_pm']) AND !empty($row['user_pm']))
                        {

                            echo "<tr><td><b>Postvak IN: &nbsp;</b></td><td>";

                            if($user_inbox >= $cfg['max_msg'])
                            {

                                $user_inbox = "<font color=\"red\">" . $user_inbox;
                                $cfg['max_msg'] = $cfg['max_msg'] . "</font>";
                            }

                            else
                            {
                                $user_inbox = "$user_inbox";
                            }


                        echo $user_inbox . " / " . $cfg['max_msg'];
                        echo "</td></tr></table>";
                        }

                        echo "</td></tr><tr><td colspan=2><hr style=\"height: 1px; color: #CC9900\">";
                        echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=100%><tr><th align=left colspan=2><font size=2>" . $row['user_name'] . " zegt:</font><hr style=\"height: 1px; color: #CC9900\"></th></tr><tr><td width=500><font size=2>" . $row['user_mijzelf']. "</font></font></td></tr></table>";

                        if(isset($_SESSION['admin_login']))
                        {

                            echo "<br>\n";
                            echo "<a href=\"admin.php?act=edit&user_id=" . $row['user_id'] . "\"><span style=\"text-decoration: none\"><font color=red>Bewerk deze gebruiker</font></span></a>";
                        }


                        if($row['user_pm'] AND isset($_SESSION['user_id']) AND $user_inbox <= $cfg['max_msg'])
                        {

                            if($_GET['user_id'] != $_SESSION['user_id'])
                            {

                                echo "<br>\n";
                                echo "<a href=\"msg.php?act=new&user_id=" . $_GET['user_id'] . "\"><span style=\"text-decoration: none\"><font color=red>Stuur deze gebruiker een berichtje</font></span></a>";
                            }
                        }


                        echo "</td></tr></table>";
                        echo "<br>\n";
                    
                    }

                    else
                    {
                        echo "<script>alert('Alleen geregistreerde gebruikers kunnen dit profiel bekijken.'); history.go(-1);</script>";
                    }
                }
            }
        }

        else
        {
            echo "<script>alert('User with this ID doesn\'t exist.'); history.go(-1);</script>";
        }
    }


    if($_GET['act'] = "edit_profile" AND !isset($_GET['user_id']) AND !isset($_POST['change_profile']))
    {

        echo "<h1>Wijzig profiel</h1>";

        if(isset($_SESSION['user_id']))
        {

            $query = mysql_query("SELECT * FROM tbl_users WHERE user_id = '" . $_SESSION['user_id'] . "'");

            while($row = mysql_fetch_assoc($query))
            {

?>

<form method="POST">
<input type="hidden" value="1" name="change_profile">

<table border="0" cellspacing="3" cellpadding="0">
  <tr><td><b>Gebruikersnaam:</b>&nbsp;&nbsp;&nbsp;</td><td>
<input type="text" name="user" value="<? echo htmlspecialchars($row['user_name']) ?>"></td></tr>

<tr><td height="23"><b>Email Adres:</b></td><td height="23">
<input type="text" name="email" value="<? echo htmlspecialchars($row['user_email']) ?>"></td></tr>

<tr><td><b>Lengte:</b></td><td>
<input type="text" name="lengte" value="<? echo htmlspecialchars($row['user_lengte']) ?>" size="2" maxlength="3"> cm</td></tr>

<tr><td><b>Gewicht:</b></td><td>
<input type="text" name="gewicht" value="<? echo htmlspecialchars($row['user_gewicht']) ?>" size="2" maxlength="3"> kg</td></tr>

<?php
$geb
= explode("-",$row['user_geboorte']);

echo'<tr><td><b>Geboorte Datum:</b></td><td>
<select name="geb1">
<option></option>'
;

$aa = '0';
while($aa < 31) {
    $aa++;
    echo'<option value="'.$aa.'"'; if(!empty($geb[0]) && $geb[0] == $aa) {echo'selected';} echo'>'.$aa.'</option>';
    }


echo'</select>
<select name="geb2">
<option></option>'
;

$aa = '0';
while($aa < 12) {
    $aa++;
    echo'<option value="'.$aa.'"'; if(!empty($geb[1]) && $geb[1] == $aa) {echo'selected';} echo'>'.$aa.'</option>';
    }


echo'</select>
<select name="geb3">
<option></option>'
;

$aa = '1920';
while($aa < 2000) {
    $aa++;
    echo'<option value="'.$aa.'"'; if(!empty($geb[2]) && $geb[2] == $aa) {echo'selected';} echo'>'.$aa.'</option>';
    }


echo'</select>
</td></tr>

<tr><td><b>Geslacht:</b></td><td>
<select name="geslacht">
    <option value="0"></option>
    <option value="1"'
; if($row['user_geslacht'] == "1") {echo'selected';} echo'>Man</option>
    <option value="2"'
; if($row['user_geslacht'] == "2") {echo'selected';} echo'>Vrouw</option>
</select></td></tr>

<tr><td><b>Geaardheid:</b></td><td>
<select name="geaardheid">
    <option value="0"></option>
    <option value="1"'
; if($row['user_geaardheid'] == "1") {echo'selected';} echo'>Hetero</option>
    <option value="2"'
; if($row['user_geaardheid'] == "2") {echo'selected';} echo'>Bi-sexueel</option>
    <option value="3"'
; if($row['user_geaardheid'] == "3") {echo'selected';} echo'>Homo</option>
    <option value="4"'
; if($row['user_geaardheid'] == "4") {echo'selected';} echo'>Anders</option>
</select></td></tr>

<tr><td><b>Relatie:</b></td><td>
<select name="relatie">
    <option value="0"></option>
    <option value="1"'
; if($row['user_relatie'] == "1") {echo'selected';} echo'>Nee</option>
    <option value="2"'
; if($row['user_relatie'] == "2") {echo'selected';} echo'>Ja</option>
</select></td></tr>

<tr><td><b>Ik zoek:</b></td><td>
<select name="ikzoek">
    <option value="0"></option>
    <option value="1"'
; if($row['user_ikzoek'] == "1") {echo'selected';} echo'>Niks</option>
    <option value="2"'
; if($row['user_ikzoek'] == "2") {echo'selected';} echo'>Vriendschap</option>
    <option value="3"'
; if($row['user_ikzoek'] == "3") {echo'selected';} echo'>Relatie</option>
    <option value="4"'
; if($row['user_ikzoek'] == "4") {echo'selected';} echo'>Seks</option>
</select></td></tr>

<tr><td>Lengte:</td><td>

<tr style="'
; if($row['user_land'] != "2") {echo'display:none;';} echo'"><td><b>Provincie:</b></td><td>
<select name="provincienl">
    <option value="0"></option>
    <option value="1"'
; if($row['user_provincie'] == "1") {echo'selected';} echo'>Drente</option>
    <option value="2"'
; if($row['user_provincie'] == "2") {echo'selected';} echo'>Flevoland</option>
    <option value="3"'
; if($row['user_provincie'] == "3") {echo'selected';} echo'>Friesland</option>
    <option value="4"'
; if($row['user_provincie'] == "4") {echo'selected';} echo'>Gelderland</option>
    <option value="5"'
; if($row['user_provincie'] == "5") {echo'selected';} echo'>Groningen</option>
    <option value="6"'
; if($row['user_provincie'] == "6") {echo'selected';} echo'>Limburg</option>
    <option value="8"'
; if($row['user_provincie'] == "8") {echo'selected';} echo'>Noord-Brabant</option>
    <option value="7"'
; if($row['user_provincie'] == "7") {echo'selected';} echo'>Noord-Holland</option>
    <option value="9"'
; if($row['user_provincie'] == "9") {echo'selected';} echo'>Overijssel</option>
    <option value="10"'
; if($row['user_provincie'] == "10") {echo'selected';} echo'>Utrecht</option>
    <option value="11"'
; if($row['user_provincie'] == "11") {echo'selected';} echo'>Zuid-Holland</option>
    <option value="12"'
; if($row['user_provincie'] == "12") {echo'selected';} echo'>Zeeland</option>
</select></td></tr>

<tr style="'
; if($row['user_land'] != "1") {echo'display:none;';} echo'"><td><b>Provincie:</b></td><td>
<select name="provinciebe">
    <option value="0"></option>
    <option value="13"'
; if($row['user_provincie'] == "13") {echo'selected';} echo'>Antwerpen</option>
    <option value="14"'
; if($row['user_provincie'] == "14") {echo'selected';} echo'>Limburg</option>
    <option value="15"'
; if($row['user_provincie'] == "15") {echo'selected';} echo'>Oost-Vlaanderen</option>
    <option value="16"'
; if($row['user_provincie'] == "16") {echo'selected';} echo'>Vlaams-Braband</option>
    <option value="17"'
; if($row['user_provincie'] == "17") {echo'selected';} echo'>West-Vlaanderen</option>
    <option value="18"'
; if($row['user_provincie'] == "18") {echo'selected';} echo'>Waals-Brabant</option>
    <option value="19"'
; if($row['user_provincie'] == "19") {echo'selected';} echo'>Henegouwen</option>
    <option value="10"'
; if($row['user_provincie'] == "20") {echo'selected';} echo'>Luik</option>
    <option value="21"'
; if($row['user_provincie'] == "21") {echo'selected';} echo'>Luxemburg</option>
    <option value="22"'
; if($row['user_provincie'] == "22") {echo'selected';} echo'>Namen</option>
    <option value="23"'
; if($row['user_provincie'] == "23") {echo'selected';} echo'>Brussels Hoofdstedelijk Gewest</option>
</select></td></tr>

<tr style="'
; if($row['user_land'] != "1" && $row['user_land'] != "2") {echo'display:none;';} echo'"><td><b>Woonplaats:</b></td><td>
<input type="text" name="woonplaats" value="'
.$row['user_woonplaats'].'"></td></tr>';


?>


<tr><td><b>Website:</b></td><td>
<input type="text" name="url" value="<? echo htmlspecialchars($row['user_url']) ?>"></td></tr>

<tr>
    <td valign="top"><b>Over Mezelf: </b>
      <p> <font size="2"><strong>Uitleg over functies:</strong><br>
        [B] dik gedrukt [/B]<br>
        [U] Onderstreept [/U]<br>
        [I] Schuingedrukt [/I]<br>
        [URL] link [/URL]</font></td>
    <td>
      <textarea name="mijzelf" cols="60" rows="10"><? echo htmlspecialchars($row['user_mijzelf']) ?></textarea><br>
    </td>
  </tr></table>
<b>Openbaar Profiel :</b><br>
<select name="public">
<?
                if(!empty($row['user_public']))
                {

                    $selected = "";
                }

                else
                {
                    $selected = " selected";
                }

?>

<option value="1" selected>Ja</option>
<option value="0"<? echo $selected ?>>Nee</option>
</select><br>

<b>Datum Formaat :</b><br>
<input type="text" name="date" value="<? echo htmlspecialchars($row['user_dateformat']) ?>">
<a href="http://www.php.net/date" target="_blank">Meer info</a><br>

<b>PM aan :</b><br>
<select name="pm">
<?
                if(!empty($row['user_pm']))
                {

                    $selected = "";
                }

                else
                {
                    $selected = " selected";
                }

?>

<option value="1" selected>Ja</option>
<option value="0"<? echo $selected ?>>Nee</option>
</select> Bij nee worden alle berichten verijdert<br><br>


<i>Wijzig wachtwoord <font size="1">(alleen als je je wachtwoord wil wijzigen invullen)</font></i><br>
<b>Wachtwoord :</b><br>
<input type="password" name="pass"><br>

<b>Wachtwoord [Bevestigen] :</b><br>
<input type="password" name="pass2"><br><br>

<input type="submit" value="Opslaan">
<input type="reset" value="Resetten">
<input type="button" value="Annuleren" OnClick="history.go(-1)"><br><br>

<?
            }
        }

        else
        {
            echo "<script>alert('U ben niet aangemeld.'); document.location.href=('index.php')</script>";
        }
    }


    if(isset($_POST['change_profile']))
    {

        $name_exists = mysql_result(mysql_query("SELECT COUNT(1) FROM tbl_users WHERE user_name = '" . $_POST['user'] . "' AND user_id <> " . $_SESSION['user_id'] . ""),0);

        if(empty($name_exists))
        {

            if(preg_match("/^([a-z0-9_\-]+\.)*?[a-z0-9_\-]+@([a-z0-9\-_]{2,})\.[a-z0-9\-_]*(\.[a-z0-9\-_]{2,})*$/i",$_POST['email']))
            {

                echo "<h1>Profiel opslaan</h1>";
                
                $query = mysql_query("SELECT *,UNIX_TIMESTAMP(user_regdate) AS user_regdate FROM tbl_users WHERE user_id = '" . $_SESSION['user_id'] . "'");
                while($row = mysql_fetch_assoc($query))
                    {

                    if($row['user_land'] == '1') {$provincie = $_POST['provinciebe'];}
                    elseif($row['user_land'] == '2') {$provincie = $_POST['provincienl'];}
                    else {$provincie = '';}
                    }


                if(!empty($_POST['pass']) OR !empty($_POST['pass2']))
                {

                    if($_POST['pass'] != $_POST['pass2'])
                    {

                        echo "<script>alert('Wachtwoorden komen niet overeen met elkaar.'); history.go(-1)</script>";
                    }

                    else
                    {
                        mysql_query("UPDATE tbl_users SET
                            user_name = '"
. $_POST['user'] . "',
                            user_mijzelf = '"
. $_POST['mijzelf'] . "',
                            user_email = '"
. $_POST['email'] . "',
                            user_lengte = '"
. $_POST['lengte'] . "',
                            user_gewicht = '"
. $_POST['gewicht'] . "',
                            user_url = '"
. $_POST['url'] . "',
                            user_dateformat = '"
. $_POST['date'] . "',
                            user_public = '"
. $_POST['public'] . "',
                            user_pass = '"
. md5($_POST['pass']) . "',
                            user_pm = '"
. $_POST['pm'] . "',
                            user_geslacht='"
.addslashes($_POST['geslacht'])."',
                            user_geaardheid='"
.addslashes($_POST['geaardheid'])."',
                            user_relatie='"
.addslashes($_POST['relatie'])."',
                            user_ikzoek='"
.addslashes($_POST['ikzoek'])."',
                            user_woonplaats='"
.addslashes($_POST['woonplaats'])."',
                            user_provincie='"
.addslashes($provincie)."',
                            user_geboorte='"
.addslashes($_POST['geb1'])."-".addslashes($_POST['geb2'])."-".addslashes($_POST['geb3'])."' WHERE user_id = '" . $_SESSION['user_id'] . "'") or die(mysql_error());

                        echo "Gegevens zijn met succes gewijzigd !";
                        echo "<br>\n<br>\n";
                        echo "<a href=\"profile.php?act=view&user_id=" . $_SESSION['user_id'] . "\">Mijn profiel</a>";
                        echo "<br>\n";
                        echo "<a href=\"index.php\">Hoofd Pagina</a>";
                    }
                }

                else
                {        
                    mysql_query("UPDATE tbl_users SET
                        user_name = '"
. $_POST['user'] . "',
                        user_mijzelf = '"
. $_POST['mijzelf'] . "',
                        user_email = '"
. $_POST['email'] . "',
                        user_lengte = '"
. $_POST['lengte'] . "',
                        user_gewicht = '"
. $_POST['gewicht'] . "',
                        user_url = '"
. $_POST['url'] . "',
                        user_dateformat = '"
. $_POST['date'] . "',
                        user_public = '"
. $_POST['public'] . "',  
                        user_pm = '"
. $_POST['pm'] . "',
                        user_geslacht='"
.addslashes($_POST['geslacht'])."',
                        user_geaardheid='"
.addslashes($_POST['geaardheid'])."',
                        user_relatie='"
.addslashes($_POST['relatie'])."',
                        user_ikzoek='"
.addslashes($_POST['ikzoek'])."',
                        user_woonplaats='"
.addslashes($_POST['woonplaats'])."',
                        user_provincie='"
.addslashes($provincie)."',
                        user_geboorte='"
.addslashes($_POST['geb1'])."-".addslashes($_POST['geb2'])."-".addslashes($_POST['geb3'])."' WHERE user_id = '" . $_SESSION['user_id'] . "'") or die(mysql_error());

                    echo "Gegevens zijn met succes gewijzigd !";
                    echo "<br>\n<br>\n";
                    echo "<a href=\"profile.php?act=view&user_id=" . $_SESSION['user_id'] . "\">Mijn profiel</a>";
                }


                if(empty($_POST['pm']))
                {

                    $result= mysql_query("SELECT COUNT(1) FROM tbl_msg WHERE msg_to = '" . $_SESSION['user_id'] . "'");

                    if(!empty($result))
                    {

                        mysql_query("DELETE FROM tbl_msg WHERE msg_to = '" . $_SESSION['user_id'] . "'") or die(mysql_error());
                    }
                }
            }

            else
            {
                echo "<script>alert('Email adres foutief.'); history.go(-1)</script>";
            }
        }

        else
        {
            echo "<script>alert('Gebruikersnaam bestaat al.'); history.go(-1)</script>";
        }
    }
}

else
{
    echo "<script>alert('No ID Validated'); history.go(-1);</script>";
}


?>
</body></html>
 
Frank -

Frank -

21/08/2007 22:13:00
Quote Anchor link
wesley schreef op 21.08.2007 22:03:
ik dacht dat het script zo was dat je de dag maand en jaar invoert en dan uitrekent wat de leeftijd is
en dan in de database zet
Nee, de leeftijd zet je nooit in de database, die bereken je op het moment dat je die nodig hebt. Het verschilt van minuut tot minuut hoe oud je bent.

Berekende gegevens sla je nooit op in een database.
 
Arjan Kapteijn

Arjan Kapteijn

21/08/2007 22:16:00
Quote Anchor link
Ik zit hier niet op complete boekwerken door te nemen, post gewoon relevante code ofzo. Daarnaast denk ik dat ik, en andere hier, je al genoeg goede voorbeelden gegeven hebben. Je zegt zelf al een opleiding hierin gehad te hebben dus aan de slag!
 
Klaasjan Boven

Klaasjan Boven

21/08/2007 22:20:00
Quote Anchor link
@Wesley jij hebt dit gescript en je weet niet hoe je een zoeksqlletje moet maken??
Ik gok dat je dit ergens gedownload hebt
 
Frank -

Frank -

21/08/2007 22:26:00
Quote Anchor link
Allemachtig wat een berg ellende!

Hoe denk jij nu leeftijden te kunnen berekenen? Jij slaat niet eens de geboorteDATUM, de leeftijd is dus vrijwel onmogelijk te achterhalen. Oeps! Je slaat een string op met daarin iets wat een datum moet voorstellen... Tja, ga dat eerst maar eens in een DATE opslaan, in het ISO-formaat yyyy-mm-dd, dan ben je al een heel stuk dichter bij de oplossing.

Ps. Vergeet die tip niet die ik reeds heb gegeven: Vraag je cursusgeld terug...
 
Stephan Sterrenberg

Stephan Sterrenberg

21/08/2007 22:26:00
Quote Anchor link
downloaden is voor watjes
 
Arjan Kapteijn

Arjan Kapteijn

21/08/2007 22:28:00
Quote Anchor link
Overigens ook een redelijk onveilig script, ik kan met wat simpele get variabelen je hele database verwijderen.
 
Jan Koehoorn

Jan Koehoorn

21/08/2007 22:34:00
Quote Anchor link
@ wesley: lees nog even de regels van dit forum door alsjeblieft. Vooral het onderdeel over 'bumpen'.
 
M Ypma

M Ypma

21/08/2007 23:53:00
Quote Anchor link
voor je gigantische elseif constructie bestaat trouwens de switch, maar dat wist je natuurlijk wel ;)

ontopic:
je vragen zijn beantwoordt, en het is echt noodzakelijk je datamodel aan te passen, en wat meer te beveiligen... je moet je door deze adviezen niet aangevallen voelen maar juist geholpen! Ik snap het echt niet dat men altijd zo reageert... erg jammer
 

Pagina: « vorige 1 2



Overzicht Reageren

 
 

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