30 lines
		
	
	
		
			552 B
		
	
	
	
		
			PHP
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			30 lines
		
	
	
		
			552 B
		
	
	
	
		
			PHP
		
	
	
		
			Executable File
		
	
	
	
	
<?php
 | 
						|
 | 
						|
require '../header.php';
 | 
						|
 | 
						|
$data = array();
 | 
						|
 | 
						|
if ( !isset($_REQUEST['id']) || !is_numeric($_REQUEST['id']) ) {
 | 
						|
   exit();
 | 
						|
}
 | 
						|
 | 
						|
$id = intval($_REQUEST['id']);
 | 
						|
 | 
						|
$link = new WebLink($id);
 | 
						|
if ( $link->delete() === false ) {
 | 
						|
   $data['success'] = false;
 | 
						|
   $data['message'] = "Invalid link! Cannot delete!";
 | 
						|
   pushData();
 | 
						|
}
 | 
						|
 | 
						|
$data['success'] = true;
 | 
						|
$data['message'] = "Link deleted!";
 | 
						|
pushData();
 | 
						|
 | 
						|
function pushData() {
 | 
						|
   global $data;
 | 
						|
   header('Content-Type: application/json');
 | 
						|
   echo json_encode($data);
 | 
						|
   exit();
 | 
						|
}
 |