Location: PHPKode > projects > WH Community > wh_community/delete_gb.php
<?php require('layout/header.php'); ?>

    <script type="text/javascript">
    	function showSuccessMessage() {
    	showNotification({
    	type : "success",
    	message: "<?php echo $lang['success_gb_delete']; ?>"
    	});    
        }                                
    
    function showErrorMessage() {
    	showNotification({
    	type : "error",
    	message: "<?php echo $lang['couldnot_gb_delete']; ?>"
    	});    
        }                                
    </script>

<div id="content_wrapper">
    <div class="content"><?php

        if(!isset($_SESSION['signed_in'])) {
        
		echo '<p class="false">' . $lang['just_for_users'] . '!</p>
              <p>' . $lang['you_need_to'] . ' <a href="signin.php">' . $lang['signin_s'] . '</a>.
              - ' . $lang['not_yet'] . ' <a href="signup.php">' . $lang['registered'] . '</a>?</p>';

		}else{
		
		echo '<table align="center" class="usertable">
		<tr>
			<td align="center"><ul class="usermenu">
				<li><a href="myprofile.php">' . $lang['my_profile'] . '</a></li>
				<li><a href="guestbook.php">' . $lang['guestbook'] . '</a></li>
				<li><a href="messagebox.php">' . $lang['messagebox'] . '</a></li>
				<li><a href="password.php">' . $lang['password'] . '</a></li>
				<li><a href="inbox.php">' . $lang['inbox'] . '</a></li>
				<li><a href="outbox.php">' . $lang['outbox'] . '</a></li>
				<li><a href="create_pm.php">' . $lang['m_newpm'] . '</a></li>
				<li><a href="mypostings.php">' . $lang['my_posts'] . '</a></li>
				<li><a href="infos.php">' . $lang['informations'] . '</a></li>
				<li><a href="todo.php">' . $lang['m_todo'] . '</a></li>
				<li><a href="news.php">' . $lang['news'] . '</a></li>
			</ul></td>
		</tr>
		<tr>
			<td><h1>' . $lang['delete_gb_entry'] . '</h1></td>
		</tr>';
		
		include('functions/bbcode.php');
		include('functions/badwords.php');
		
		echo '<tr><td>';
		
		if((isset($_GET['gb_id'])) && (is_numeric($_GET['gb_id']))) {
		
		$id = mysql_real_escape_string($_GET['gb_id']);
		$id = intval($_GET['gb_id']);
	
			}else{
			
			echo '<p align="center" class="false">' . $lang['invalid_id'] . '!</p>';
			exit();
			}
		
		echo '<p><img src="images/icons/trash.png" alt="Trash"></p>';
			
		$query = "DELETE FROM guestbook WHERE gb_id = '" . $id . "' AND gb_id2 = '" . (int)$_SESSION['user_id'] . "'";
		$result = mysql_query($query) OR die(mysql_error());
			
		if($result) {
		
		echo '<p class="right">' . $lang['success_gb_delete'] . '</p>
			  <p><a href="guestbook.php?user_id=' . (int)$_SESSION['user_id'] . '">' . $lang['go_on'] . '</a></p>';
		echo "<script type=\"text/javascript\">showSuccessMessage();</script>";
			
			}else{
			
			echo '<p class="false">' . $lang['couldnot_gb_delete'] . '.</p>';
			echo "<script type=\"text/javascript\">showErrorMessage();</script>";
			}
		
		echo '</td></tr>';
		}
		
		echo '</table>';
		
		echo '<div class="spacer_div">&nbsp;</div>';

		?>
    </div>
</div>

<div id="infobox_wrapper">
    <div class="infobox">
        <?php include('layout/infobox.php'); ?>
    </div>
</div>

<?php require('layout/footer.php'); ?>
Return current item: WH Community