<?php
/*
    CREATIVE COMMONS - Attribution-No Derivative Works 3.0 Germany:
    - You may not alter, transform, or build upon this work.
    - Dieses Werk darf nicht bearbeitet oder in anderer Weise verändert werden.
*/
header("content-type: text/html; charset=utf-8");
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
        <html xmlns="http://www.w3.org/1999/xhtml">
          <head>
            <meta http-equiv="content-type"	content="text/html;charset=utf-8" />
            <link rel="stylesheet" type="text/css" media="screen, print" href="../styles/gigkalender.css" />
            <title></title>
          </head>
          <body>';
// Pfad definieren
  $Path = str_replace('\\','/', __FILE__);
  $Path = str_replace('guestbook/guestbook_delete.php', '', $Path);
// Funktionen inkludieren
  include_once ($Path."gigkalender.ini.php");
  include_once ($Path."functions/standard.php");
  include_once ("functions.php");
  include_once($Path."includes/frontend_language_selector.php");
  include($language);
if (isset($_REQUEST['http-equiv'])) $http_equiv = $_REQUEST['http-equiv'];
  else $http_equiv = '';
echo '<div  class="GigKalender"><div class="Guestbook">';
// Inhalt-Anfang
  if ( $_REQUEST['code']!="" )
  {
    if ( isGuestbookEntryPresent( $_REQUEST['code']) )
    {
      if ( isset($_POST['delete']))
      {
        $Code = $_REQUEST['code'];
        // Get IP from Guestbook entry
          $sql="SELECT IP FROM ".DB_PREFIX."guestbook WHERE CODE = '".$Code."' LIMIT 1";
          $result = mysql_db_query($DB_NAME, $sql);
          if ($result)
          {
            if ( mysql_num_rows($result)==1)
            {
              $temp = mysql_fetch_assoc($result);
              $IP = $temp['IP'];
            }
            else echo 'Error 46<br />';
          }
        $sql = "DELETE FROM ".DB_PREFIX."guestbook WHERE Code = '$Code'";
        $resultat = mysql_query($sql);
        if ($resultat)
        {
          echo $L_129.'<br />';
          // Block IP adress
          if (isset($blockIP))
          {
            $IPArray = explode (', ', getSetup('SetupGuestbookSpamIPs'));
            $IPArray[] = $IP;
            $IPArray = array_unique ($IPArray);
            $newIPs = implode (', ', $IPArray);
            $sql = "UPDATE ".DB_PREFIX."setup SET SetupGuestbookSpamIPs = '$newIPs'";
            $resultat = mysql_db_query($DB_NAME, $sql);
            if ($resultat)
            {
              echo 'IP address blocked!<br />';
            }
            else echo 'Error 67<br />';
          }
        }
        else { echo $L_130; }
      }
      if ( isset($_POST['cancel']) )
      {
        echo $L_131;
      }
      if ( isset($_POST['delete']) OR isset($_POST['cancel']) )
      {
        // URL bestimmen
          if ( $SetupGuestbookURL=='' ) $URL = $http_equiv;
            else $URL = $SetupGuestbookURL;
          $URL = str_replace("&","&amp;",$URL);
        echo '<br /><br /><br /><a href="'.$URL.'">'.$L_155.'</a>';
      }
      if ( !isset($_POST['delete']) AND !isset($_POST['cancel'] ))
      {
        $SCRIPT_URI = str_replace("&","&amp;",$_SERVER['HTTP_REFERER']);
        echo $L_132.'<br /><br /><br />
        <form method="post" action="'.$_SERVER['PHP_SELF'].'?page=delete&amp;code='.$_REQUEST['code'].'" accept-charset="UTF-8">
          <fieldset>
            This guestbook entry is spam?<br />
            &nbsp;<input type="checkbox" name="blockIP" value="1" class="checkbox" />
             &nbsp;Block the IP address!<br />
            <br />
            <input name="delete" type="submit" value="'.$L_Button02.'" class="button" />
            <input name="cancel" type="submit" value="'.$L_Button03.'" class="button" />
            <input type="hidden" name="http-equiv" value="'.$SCRIPT_URI.'" />
          </fieldset>
        </form>';
      }
    }
    else echo '<span class="ErrorMessage">'.$L_217.' (Code: '.$_REQUEST['code'].')</span><br />';
  }
  else { echo '<span class="ErrorMessage">'.$L_133.'</span>'; }
  echo '</div></div>';
  echo '</body>
      </html>';
?>