| 1 |
<?php |
| 2 |
if ( ! defined( 'ABSPATH' ) ) |
| 3 |
exit; |
| 4 |
global $wpdb; |
| 5 |
$_POST = stripslashes_deep($_POST); |
| 6 |
$_GET = stripslashes_deep($_GET); |
| 7 |
$xyz_ihs_snippetId = intval($_GET['snippetId']); |
| 8 |
$xyz_ihs_pageno = intval($_GET['pageno']); |
| 9 |
if (! isset( $_REQUEST['_wpnonce'] ) || ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'ihs-del_'.$xyz_ihs_snippetId )) { |
| 10 |
wp_nonce_ays( 'ihs-del_'.$xyz_ihs_snippetId ); |
| 11 |
exit; |
| 12 |
} |
| 13 |
else { |
| 14 |
if($xyz_ihs_snippetId=="" || !is_numeric($xyz_ihs_snippetId)){ |
| 15 |
wp_safe_redirect(admin_url('admin.php?page=insert-html-snippet-manage')); |
| 16 |
exit(); |
| 17 |
} |
| 18 |
$snippetCount = $wpdb->query($wpdb->prepare( 'SELECT * FROM '.$wpdb->prefix.'xyz_ihs_short_code WHERE id=%d LIMIT 0,1',$xyz_ihs_snippetId )) ; |
| 19 |
if($snippetCount==0){ |
| 20 |
wp_safe_redirect(admin_url('admin.php?page=insert-html-snippet-manage&xyz_ihs_msg=2')); |
| 21 |
exit(); |
| 22 |
}else{ |
| 23 |
$wpdb->query($wpdb->prepare( 'DELETE FROM '.$wpdb->prefix.'xyz_ihs_short_code WHERE id=%d',$xyz_ihs_snippetId)) ; |
| 24 |
wp_safe_redirect(admin_url('admin.php?page=insert-html-snippet-manage&xyz_ihs_msg=3&pagenum='.$xyz_ihs_pageno)); |
| 25 |
exit(); |
| 26 |
} |
| 27 |
} |
| 28 |
?> |