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

    <script type="text/javascript">
    	function showSuccessMessage() {
    	showNotification({
    	type : "success",
    	message: "<?php echo $lang['succ_del_add']; ?>"
    	});    
        }                                
    
    function showErrorMessage() {
    	showNotification({
    	type : "error",
    	message: "<?php echo $lang['couldnot_del_add']; ?>"
    	});    
        }                                
    </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 '<h1>' . $lang['delete_address'] . '</h1><br>';
		
		echo '<tr><td>';
		
		if((isset($_GET['add_id'])) && (is_numeric($_GET['add_id']))) {
		
		$id = mysql_real_escape_string($_GET['add_id']);
		$id = intval($_GET['add_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 address WHERE add_id = '" . $id . "' AND add_id2 = '" . (int)$_SESSION['user_id'] . "'";
		$result = mysql_query($query) OR die(mysql_error());
			
		if($result) {
		
		echo '<p class="right">' . $lang['succ_del_add'] . '</p>
			  <p><a href="address_book.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_del_add'] . '.</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