php gastenboek

Overzicht Reageren

Sponsored by: Vacatures door Monsterboard

Andy Dm

Andy Dm

11/10/2010 02:43:04
Quote Anchor link


    Heeft er soms iemand een idee hoe ik smiley's kan toevoegen in dit script?

    script waar de smiley's zouden moeten inkomen

    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
    <?
    session_start();
    $string = $_SESSION['secc'];
    $str1 = substr($string,0,2);
    $str2 = substr($string,2,2);
    header("Content-type: image/jpeg");
    $ardimg = @imagecreate(40, 20) or die("Cannot Initialize new GD image stream");
    $background_color = imagecolorallocate($ardimg,150,150,150);
    $text_color = imagecolorallocate($ardimg,0,0,0);
    imagestring($ardimg,5,2,0,$str1,$text_color);
    $text_color = imagecolorallocate($ardimg,255,255,255);
    imagestring($ardimg,6,19,5,$str2,$text_color);
    imagejpeg($ardimg);
    imagedestroy($ardimg);
    ?>


    en het script van het gastenboek zelf

    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
    <?
    //--Change the following variables

    //Title of your guestbook

      $title = "Welcome to my guestbook";
    //Change "admin" with your own password. It's required when you delete an entry
      $admin_password = "admin";
    //Enter your email here
      $admin_email = "[email protected]";
    //Your website URL
      $home = "http://www.yourdomain.com";
    //Send you an email when someone add your guestbook, YES or NO
      $notify = "NO";
    //Your Operating System
    //For Windows/NT user : WIN
    //For Linux/Unix user : UNIX

      $os = "UNIX";
    //Maximum entry per page when you view your guestbook
      $max_entry_per_page = 10;
    //Name of file used to store your entry, change it if necessary
      $data_file = "ardgb18.dat";
    //Maximum entry stored in data file
      $max_record_in_data_file = 300;
    //Maximum entries allowed per session, to prevent multiple entries made by one visitor
      $max_entry_per_session = 2;
    //Enable Image verification code, set the value to NO if your web server doesn't support GD lib
      $imgcode = "YES";
    //Color & font setting
      $background = "#555555";
      $table_top = "#D3B68E";
      $table_content_1a = "#EDEEE8";
      $table_content_1b = "#E4E4E4";
      $table_content_2a = "#FFF8F0";
      $table_content_2b = "#FFEFDF";
      $table_bottom = "#D3B68E";
      $table_border = "#000000";
      $title_color = "#FFFF00";
      $link = "#0000FF";
      $visited_link = "#0000FF";
      $active_link = "#FF0000";
      $font_face = "verdana";
      $message_font_face = "arial";
      $message_font_size = "2";

    //-- Don't change bellow this line unless you know what you're doing

    $do = isset($_REQUEST['do']) ? trim($_REQUEST['do']) : "";
    $id = isset($_GET['id']) ? trim($_GET['id']) : "";
    $page = isset($_GET['page']) ? $_GET['page'] : 1;
    $self = $_SERVER['PHP_SELF'];

    if (!file_exists($data_file)) {
        echo "<b>Error !!</b> Can't find data file : $data_file.<br>";
        exit;
    }
    else {
        if ($max_record_in_data_file != "0") {
            $f = file($data_file);
            rsort($f);
            $j = count($f);
            if ($j > $max_record_in_data_file) {
                $rf = fopen($data_file,"w");
                if (strtoupper($os) == "UNIX") {
                   if (flock($rf,LOCK_EX)) {
                      for ($i=0; $i<$max_record_in_data_file; $i++) {
                          fwrite($rf,$f[$i]);        
                      }

                      flock($rf,LOCK_UN);
                   }
                }
    else {
                   for ($i=0; $i<$max_record_in_data_file; $i++) {
                      fwrite($rf,$f[$i]);        
                   }
                }

                fclose($rf);
            }
        }
    }

    session_start();
    $newline = (strtoupper($os) == "WIN") ? "\r\n" : "\n";
    switch ($do) {
    case
    "":
       $record = file($data_file);
       rsort($record);
       $jmlrec = count($record);
    ?>

       <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
       <html>
       <head>
       <title><?=$title?></title>
       <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
       </head>
       <body bgcolor="<?=$background?>" link="<?=$link?>" vlink="<?=$visited_link?>" alink="<?=$active_link?>" topmargin="0" marginheight="0" style="font-family:<?=$font_face?>">
       <div align="center">
       <font size="6" color="<?=$title_color?>"><b><?=$title?></b></font><br>
       <font size="2" color="<?=$title_color?>">(:: <b><a href="<?=$home?>"><font color="<?=$title_color?>">Home</font></a></b> ::)</font><br><br>
       <table width="600" cellpadding="0" cellspacing="1" border="0">
       <tr bgcolor="<?=$table_border?>">
       <td>
          <table width="100%" cellpadding="4" cellspacing="1" border="0">
          <tr>
            <td bgcolor="<?=$table_top?>" colspan="3" width="100%">
               <font size="2" color="#ffffff"><b>Click <a href="<?="$self?do=add_form&page=$page"?>">here</a> to sign the guestbook</font></b>
            </td>
          </tr>
    <?
          $jml_page
    = ceil($jmlrec/$max_entry_per_page);
          $nomrec = $page * $max_entry_per_page - $max_entry_per_page;
          $no = $page*$max_entry_per_page-$max_entry_per_page;
          //$no = ($jmlrec - $page * $max_entry_per_page) + $max_entry_per_page + 1;
          if ($jmlrec == 0) {
              echo '<tr><td colspan="3" bgcolor="#FFE1E1" align="center"><font size="3">There are no entries yet.</font></td></tr>';
          }

            $w = 0; //--Color
            for ($i=0; $i<$max_entry_per_page; $i++) {
                $nomrec++;
                $no++;
                //$no--;
                $recno = $nomrec-1;
                if (isset($record[$recno])) {
                   $row = explode("|~|",$record[$recno]);
                   if ($w==0) {
                       $warna = $table_content_1a;
                       $warna2 = $table_content_1b;
                       $w=1;
                   }
    else {
                       $warna = $table_content_2a;
                       $warna2 = $table_content_2b;
                       $w=0;
                   }

                   echo "<tr>
                           <td bgcolor=\"$warna2\" align=\"center\" valign=\"top\" width=\"15\">
                             <font size=\"2\">$no</font>
                           </td>
                           <td bgcolor=\"$warna\" width=\"570\">
                           <table border=\"0\" width=\"100%\">
                           <tr>
                            <td>
                             <font size=\"1\">$row[2]</font><br>
                             <font size=\"2\"><b>$row[3]</b></font>
                            </td>
                        "
    ;
                   echo "<td align=\"right\" valign=\"top\">";
                            if (trim($row[4]) != "") {
                                echo "<a href=\"mailto:$row[4]\"><img src=\"imgs/email.gif\" border=\"0\" alt=\"$row[4]\"></a>";
                            }

                            if (trim($row[6]) != "" && trim($row[6]) != "http://") {
                               if (ereg("^http://", trim($row[6]))) echo " <a href=\"$row[6]\" target=\"_blank\"><img src=\"imgs/homepage.gif\" border=\"0\" alt=\"$row[6]\"></a>";
                               else echo " <a href=\"http://$row[6]\" target=\"_blank\"><img src=\"imgs/homepage.gif\" border=\"0\" alt=\"$row[6]\"></a>";
                            }

                   echo '</td></tr></table>';
                   echo "<br><table border=\"0\" width=\"100%\">
                         <tr><td width=\"5\">&nbsp;</td><td>
                         <font size=\"2\" face=\"$message_font_face\" size=\"$message_font_size\">"
    .stripslashes($row[5])."</font>
                         </td></tr>
                         </table>
                        "
    ;
                   echo '</td>';
                   echo "<td valign=\"top\" bgcolor=\"$warna2\" align=\"center\" width=\"15\">
                         <a href=\"$self?do=del&id=$row[1]&page=$page\">
                         <img src=\"imgs/del.gif\" alt=\"Delete entry # $no\" border=0 align=\"center\"></a>
                         </td>
                         </tr>"
    ;
                }
    //--end if        
            } //--end for
          echo "<tr><td colspan=\"3\" bgcolor=\"$table_bottom\" align=\"center\" width=\"600\"><font size=\"2\">";            
          if ($jml_page > 1) {      
              if ($page != 1) echo "[<a href=\"$self?page=1\">Top</a>] "; else echo '[Top] ';
              echo 'Page # ';
              if ($jml_page > 10) {
                   if ($page < 5) {
                      $start = 1;
                      $stop = 10;
                  }
    elseif ($jml_page - $page < 5) {
                      $start = $jml_page - 9;
                      $stop = $jml_page;
                  }
    else {
                      $start = $page-4;
                      $stop = $page+5;
                  }

                  if ($start != 1) echo '... ';
                  for ($p=$start; $p<=$stop; $p++) {
                      if ($p == $page) echo "<font color=\"$active_link\"><b>$p</b></font>&nbsp;&nbsp;";
                      else echo "<a href=\"$self?page=$p\">$p</a>&nbsp;&nbsp;";
                  }

                  if ($stop != $jml_page) echo '... ';                  
                  echo "of $jml_page ";
              }
    else {
                  for ($p=1; $p<=$jml_page; $p++) {
                      if ($p == $page) echo "<font color=\"$active_link\"><b>$p</b></font>&nbsp;&nbsp;";
                      else echo "<a href=\"$self?page=$p\">$p</a>&nbsp;&nbsp;";
                  }
              }
          
              if ($page != $jml_page) echo "[<a href=\"$self?page=$jml_page\">Bottom</a>]";
              else echo '[bottom]';
          }
    else echo 'Page #1 of 1';
          echo '</font></td></tr>';
    ?>

            </table>        
            </td>
            </tr>
            </table>
            <br>
            <!-- Please don't remove this copyright notice.-->
            <a href="http://www.promosi-web.com/script/guestbook/" target="_blank"><font size="2" color="<?=$title_color?>">PHP Guestbook</font></a> &middot; <a href="http://hello.web.id" target="_blank"><font size="2" color="<?=$title_color?>">Web Directory</font></a></font>
            <!-- Thank you -->
       </div>
       </body>
       </html>
    <?
    break;
    case
    "add_form":
    $_SESSION['secc'] = strtoupper(substr(sha1(time().$admin_email),0,4));
    if (!isset($_SESSION['add'])) $_SESSION['add'] = 0;

    if (!isset($_SESSION['name'])) $_SESSION['name'] = "";
    if (!isset($_SESSION['email'])) $_SESSION['email'] = "";
    if (!isset($_SESSION['url'])) $_SESSION['url'] = "http://";
    if (!isset($_SESSION['comment'])) $_SESSION['comment'] = "";
    ?>

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <html>
    <head>
    <title><?=$title?></title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>

    <body bgcolor="<?=$background?>" style="font-family:<?=$font_face?>">
    <div align="center">
      <font size="5" color="<?=$title_color?>"><b><?=$title?></b></font><br>
      <font size="1"><b><a href="<?=$home?>"><font color="<?=$title_color?>">Home</font></a> :: <a href="<?=$self?>"><font color="<?=$title_color?>">View entry</font></a></b></font>
      <br><br>
      <form method="post" action="<?=$self?>">
      <input type="hidden" name="do" value="add">
        <table width="500" border="0" cellspacing="0" cellpadding="0" bgcolor="<?=$table_border?>">
          <tr>
          <td>
            <div align="center">
                <table width="100%" border="0" cellspacing="1" cellpadding="5">
                  <tr bgcolor="<?=$table_content_1a?>">
                    <td width="28%">
                      <div align="right"><font size="2">*Name : </font></div>
                    </td>
                    <td width="72%">
                      <input type="text" name="vname" size="30" maxlength="70" value="<?=$_SESSION['name']?>">
                    </td>
                  </tr>
                  <tr bgcolor="<?=$table_content_1a?>">
                    <td width="28%">
                      <div align="right"><font size="2">Email : </font></div>
                    </td>
                    <td width="72%">
                      <input type="text" name="vemail" size="30" maxlength="100" value="<?=$_SESSION['email']?>">
                    </td>
                  </tr>
                  <tr bgcolor="<?=$table_content_1a?>">
                    <td width="28%">
                      <div align="right"><font size="2">Website : </font></div>
                    </td>
                    <td width="72%">
                      <input type="text" name="vurl" size="30" maxlength="150" value="<?=$_SESSION['url']?>">
                    </td>
                  </tr>
                  <tr bgcolor="<?=$table_content_1a?>">
                    <td valign="top" width="28%">
                      <div align="right"><font size="2">*Comment : </font></div>
                    </td>
                    <td width="72%">
                      <textarea name="vcomment" cols="40" rows="7" wrap="virtual"><?=$_SESSION['comment']?></textarea>
                      <br><font size="1">* Required field</font>
                    </td>
                  </tr>
                  <?if (strtoupper($imgcode) == "YES") {?>
                  <tr bgcolor="<?=$table_content_1a?>">
                    <td width="28%">
                      <div align="right"><font size="2">Verification Code :</font></div>
                    </td>
                    <td width="72%">
                      <font size="1">Please retype this code below :</font>
                      <img src="image.php?<?=time()?>" border="1"><br>
                      <input type="text" name="vsecc" size="4" maxlength="4">
                    </td>
                  </tr>
                  <?}?>
                  <tr bgcolor="<?=$table_content_1b?>">
                    <td colspan="2">
                      <div align="center">
                        <font size="2">
                        <input type="submit" value="Submit">
                        <input type="reset" value="Reset">
                        <input type="button" value="Back" onClick="window.location='<?="$self?page=$page"?>'">
                        </font>
                       </div>
                    </td>
                  </tr>
                </table>
            </div>
          </td>
        </tr>
      </table>
      </form>
    </div>
    </body>
    </html>
    <!-- End of entry form -->
    <?
    break;
    case
    "add":
       $vname = isset($_POST['vname']) ? trim($_POST['vname']) : "";
       $vemail = isset($_POST['vemail']) ? trim($_POST['vemail']) : "";
       $vurl = isset($_POST['vurl']) ? trim($_POST['vurl']) : "";
       $vcomment = isset($_POST['vcomment']) ? trim($_POST['vcomment']) : "";
       $vsecc = isset($_POST['vsecc']) ? strtoupper($_POST['vsecc']) : "";

       if (strlen($vname) > 70) $vname = substr($vname,0,70);
       if (strlen($vemail) > 100) $vemail = substr($vemail,0,100);
       if (strlen($vurl) > 150) $vurl = substr($vurl,0,150);

       $_SESSION['name'] = $vname;
       $_SESSION['email'] = $vemail;
       $_SESSION['url'] = $vurl;
       $_SESSION['comment'] = stripslashes($vcomment);

       if ($vname == "" || $vcomment == "") {
           input_err("You may left some fields.");
       }


       if ($vemail != "" && !preg_match("/([\w\.\-]+)(\@[\w\.\-]+)(\.[a-z]{2,4})+/i", $vemail)) {
           input_err("Invalid email address.");
       }


       if ($vurl != "" && strtolower($vurl) != "http://") {
           if (!preg_match ("#^http://[_a-z0-9-]+\\.[_a-z0-9-]+#i", $vurl)) {
               input_err("Invalid URL format.");
           }
       }


       $test_comment = preg_split("/[\s]+/",$vcomment);
       $jmltest = count($test_comment);
       for ($t=0; $t<$jmltest; $t++) {
          if (strlen(trim($test_comment[$t])) > 70) {
              input_err("Invalid word found on your entry : ".stripslashes($test_comment[$t]));
          }
       }


       if (isset($_SESSION['add']) && $_SESSION['add'] >= $max_entry_per_session) {
           input_err("Sorry, only $max_entry_per_session message(s) allowed per session.",false);
       }
    elseif (!isset($_SESSION['add'])) {
           exit;
       }


       if ($vsecc != $_SESSION['secc'] && strtoupper($imgcode) == "YES") {
           input_err("Invalid verification code");
       }

       //--only 2000 characters allowed for comment, change this value if necessary
       $maxchar = 2000;
       if (strlen($vcomment) > $maxchar) $vcomment = substr($vcomment,0,$maxchar)."...";

       $idx = date("YmdHis");
       $tgl = date("F d, Y - h:i A");

       $vname = str_replace("<","&lt;",$vname);
       $vname = str_replace(">","&gt;",$vname);
       $vname = str_replace("~","-",$vname);
       $vname = str_replace("\"","&quot;",$vname);
       $vcomment = str_replace("<","&lt;",$vcomment);
       $vcomment = str_replace(">","&gt;",$vcomment);
       $vcomment = str_replace("|","",$vcomment);
       $vcomment = str_replace("\"","&quot;",$vcomment);
       $vurl = str_replace("<","",$vurl);
       $vurl = str_replace(">","",$vurl);
       $vurl = str_replace("|","",$vurl);
       $vemail = str_replace("<","",$vemail);
       $vemail = str_replace(">","",$vemail);
       $vemail = str_replace("|","",$vemail);

       if (strtoupper($os) == "WIN") {
           $vcomment = str_replace($newline,"<br>",$vcomment);
           $vcomment = str_replace("\r","",$vcomment);
           $vcomment = str_replace("\n","",$vcomment);
       }
    else {
           $vcomment = str_replace($newline,"<br>",$vcomment);
           $vcomment = str_replace("\r","",$vcomment);
       }


       if (isset($_SERVER['HTTP_X_FORWARDED_FOR']) && eregi("^[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}$",$_SERVER['HTTP_X_FORWARDED_FOR'])) {
           $ipnum = $_SERVER['HTTP_X_FORWARDED_FOR'];
       }
    else {
           $ipnum = getenv("REMOTE_ADDR");
       }


       $newdata = "|~|$idx|~|$tgl|~|$vname|~|$vemail|~|$vcomment|~|$vurl|~|$ipnum|~|";
       $newdata = stripslashes($newdata);
       $newdata .= $newline;

       if (!is_spam($newdata)) {
            $tambah = fopen($data_file,"a");
            if (strtoupper($os)=="UNIX") {
                if (flock($tambah,LOCK_EX)) {
                    fwrite($tambah,$newdata);
                    flock($tambah,LOCK_UN);
                }
            }
    else {
                fwrite($tambah,$newdata);
            }

            fclose($tambah);

            //--send mail
            if (strtoupper($notify) == "YES") {
                $msgtitle = "Someone signed your guestbook";
                $vcomment = str_replace("&quot;","\"",$vcomment);  
                $vcomment = stripslashes($vcomment);
                $vcomment = str_replace("<br>","\n",$vcomment);
                $msgcontent = "Local time : $tgl\n\nThe addition from $vname :\n----------------------------\n\n$vcomment\n\n-----End Message-----";
                @
    mail($admin_email,$msgtitle,$msgcontent,"From: $vemail\n");
            }

            //--clear session
            $_SESSION['name'] = "";
            $_SESSION['email'] = "";
            $_SESSION['url'] = "http://";
            $_SESSION['comment'] = "";
            $_SESSION['add']++;
            $_SESSION['secc'] = "";
            redir($self,"Thank you, your entry has been added.");
        }
    else {
            redir($self,"Sorry, your entry can't be added into the guestbook.");
        }

    break;

    case
    "del":
       $record = file($data_file);
       $jmlrec = count($record);
       for ($i=0; $i<$jmlrec; $i++) {
           $row = explode("|~|",$record[$i]);
           if ($id == $row[1]) {
              ?>

              <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
              <html>
              <head>
              <title>Delete record</title>
              <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
              </head>
              <body bgcolor="<?=$background?>" style="font-family:<?=$font_face?>">
              <div align="center">
              <font size="4" color="<?=$title_color?>">Delete Confirmation</font>
              <br><br>
              <table border="0" cellpadding="5" cellspacing="1" width="450">
                <tr>
                <td bgcolor="<?=$table_top?>">
                <font size="2">
                <font size="1"><b><?=$row[2]?></font><br><?=$row[3]?></b> - <a href="mailto:<?=$row[4]?>"><?=$row[4]?></a>
                <br><br><?=$row[5]?>
                <br><br><font size="1">IP : <?=$row[7]?></font>
                </font>
                </td>
                </tr>
              </table>
              <form action="<?=$self?>" method="post">
                  <input type="hidden" name="do" value="del2">
                  <input type="hidden" name="id" value="<?=$id?>">
                  <input type="hidden" name="page" value="<?=$page?>">
                  <font color="<?=$title_color?>" size="2"><b>Admin password : </b></font> <input type="password" name="pwd">
                  <br><br>
                  <font size="2" color="<?=$title_color?>"><b>&raquo;</b><input type="checkbox" name="byip" value="<?=$row[7]?>"> Delete all records that using this IP : <?=$row[7]?></font>
                  <br><br>
                  <input type="submit" value="Delete"> <input type="button" value="Cancel" onClick="window.location='<?="$self?page=$page"?>'">
              </form>
              </div>
              </body>
              </html>
              <?
           }
       }
          
    break;

    case
    "del2":
       $pwd = isset($_POST['pwd']) ? trim($_POST['pwd']) : "";
       $id = isset($_POST['id']) ? trim($_POST['id']) : "";
       $page = isset($_POST['page']) ? $_POST['page'] : 1;
       $byip = isset($_POST['byip']) ? $_POST['byip'] : "";

       if ($pwd != $admin_password) {
             redir("$self?page=$page","Invalid admin password !");
       }


       $record = file($data_file);
       $jmlrec = count($record);
       for ($i=0; $i<$jmlrec; $i++) {
           $row = explode("|~|",$record[$i]);
           if ($byip == "") {
               if ($row[1] == $id) {
                   $record[$i] = "";
                   break;
               }
           }
    else {
               if ($row[7] == $byip) {
                   $record[$i] = "";
               }
           }
       }


       $update_data = fopen($data_file,"w");
       if (strtoupper($os) == "UNIX") {
          if (flock($update_data,LOCK_EX)) {
             for ($j=0; $j<$jmlrec; $j++) {
                 if ($record[$j] != "") {
                     fputs($update_data,$record[$j]);
                 }
             }

             flock($update_data,LOCK_UN);
          }
       }
    else {
             for ($j=0; $j<$jmlrec; $j++) {
                 if ($record[$j] != "") {
                     fputs($update_data,$record[$j]);
                 }
             }
       }

       fclose($update_data);
       redir("$self?page=$page","Record has been deleted !");
    break;
    }
    //--end switch


    function redir($target,$msg) {
    global $background,$font_face,$title_color;
    ?>

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <html>
    <head>
    <meta http-equiv="refresh" content="1; url=<?=$target?>">
    </head>
    <body bgcolor="<?=$background?>">
    <div align="center"><font color="<?=$title_color?>" face="<?=$font_face?>"><h3><?=$msg?></h3>Please wait...</font></div>
    </body>
    </html>
    <?
    exit;
    }

    function
    input_err($err_msg,$linkback=true) {
    global $background,$font_face;
    ?>

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <html>
    <head>
    <title>Error !</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>
    <body bgcolor="<?=$background?>">
    <div align="center">
    <br>
    <table border="1" bgcolor="#000000" cellspacing="0" cellpadding="6">
    <tr>
        <td bgcolor="#FFCC00" align="center">
            <font size="3" color="#000000" face="<?=$font_face?>"><b><?=$err_msg?></b><br>
            <?if ($linkback) {?>
            <font size="2">Click <a href="javascript:history.back()">here</a> and try again.</font>
            <?}?>
            </font>
        </td>
    </tr>
    </table>
    </div>
    </body>
    </html>
    <?
    exit;
    }

    function
    is_spam($string) {
        $data = "spamwords.dat";
        $is_spam = false;
        if (file_exists($data)) {
            $spamword = file($data);
            $jmlrec = count($spamword);
            for ($i=0; $i<$jmlrec; $i++) {
                $spamword[$i] = trim($spamword[$i]);
                if (eregi($spamword[$i],$string)) {
                    $is_spam = true;
                    break;
                }
            }
        }

        return $is_spam;
    }

    ?>
     
    PHP hulp

    PHP hulp

    24/11/2024 01:58:38
     
    Radio Dancemania

    Radio Dancemania

    11/10/2010 02:48:05
    Quote Anchor link
    zo dan. je wilde toch alleen smilies??
     
    Andy Dm

    Andy Dm

    11/10/2010 02:49:07
    Quote Anchor link
    ik wil smiley's toevoegen in dat gastenboek,
    maar ben een php beginneling... lol
    weet niet echt waar of hoe ik ze moet plaatsen..
     
    Radio Dancemania

    Radio Dancemania

    11/10/2010 02:51:11
    Quote Anchor link
    maar iets als :
    Code (php)
    PHP script in nieuw venster Selecteer het PHP script
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    <?php
    function smilie($bericht)
    {

    $smilie    = array("(a)",":@");
    $smilieHtml = array('<img src="images/smilies/angel.png" border="0">','<img src="images/smilies/angry.png" border="0">');

          $bericht    = str_replace($smilie, $smilieHtml, $bericht);
          return $bericht;
    }

    ?>


    Toevoeging op 11/10/2010 02:51:49:

    zou moeten werken .. alleen moet je dan een map maken met dus de smilies en deze dan vervangen door de tekst hierboven(dit is overigens een simpele opzet..

    Toevoeging op 11/10/2010 02:52:23:

    en je kan de array's dus zo lang maken als je zelf wilt;)
    Gewijzigd op 11/10/2010 02:53:07 door Radio Dancemania
     
    Milo S

    Milo S

    11/10/2010 08:47:36
    Quote Anchor link
    Plaats de volgende keer relevante code...

    Misschien is he ook een optie om gewoon met een database te gaan werken? Je zult merken dat dit later in onderhoud veel makkelijker is.
     



    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.