$str_subids = $_REQUEST['subids']; $pattern = '/\\d{14}x\\d{5}/'; preg_match_all($pattern, $str_subids, $subids); foreach ($subids[0] as $key => $subid) { import_sale_info($leadsType, $amount, $subid); } break; case 'delete_link': $id = rq('id', 2); delete_offer($id); cache_links_update(); exit; break; case 'restore_link': $id = rq('id', 2); delete_offer($id, 0); cache_links_update(); exit; break; case 'delete_sale': $type = $_REQUEST['type']; $click_id = rq('click_id', 2); $conversion_id = rq('conversion_id', 2); delete_sale($click_id, $conversion_id, $type); exit; break; case 'get_sales': $sales = get_sales($_POST['sType'], $_POST['sStart'], $_POST['sEnd']); echo json_encode($sales); exit; break;
<?php require_once "../includes/functions.php"; require_once "../includes/session.php"; include "../includes/header.php"; check_login(); //makes sure people cannot skip to this page without logging in delete_offer(); //if the user clicks on "delete offer," this function will run $user_id = $_SESSION["id"]; ?> <div id="page" style="font-size:16px; font-family: Verdana;"> <h1 class="h1_spacing">My Books to Sell:</h1> <b><i>Please close your offer if you have successfully sold your book!</i></b> <br /><br /> <?php $query = "SELECT * "; //know which books the user is selling $query .= "FROM sell "; $query .= "WHERE seller_id = {$user_id} "; $query .= "ORDER BY id ASC"; $sell_set = mysqli_query($connection, $query); while ($sell_order = mysqli_fetch_assoc($sell_set)) { $output = print_book_details_for_sales($sell_order); $output .= "<form action=\"sales.php?id="; //create a delete button that corresponds to the id in the "sell" database $output .= urlencode($sell_order["id"]); $output .= "\" method=\"post\">"; $output .= "<input type=\"submit\" name=\"delete\" value="; if ($sell_order["buyers"] > 0) { $output .= "\"Close Offer\">";
} else { $q = "delete from `tbl_sources` where `id` = '" . mysql_escape_string($id) . "'"; } db_query($q); $q = "select count(id) as `cnt` from `tbl_sources`"; $rs = db_query($q); $r = mysql_fetch_assoc($rs); $out = array('total' => intval($r['cnt']), 'have_favorits' => $r['cnt'] > 0 ? 1 : 0); echo json_encode($out); exit; break; case 'restore_link': $ids = rq('id', -2); $cat_type = rq('cat_type'); $cat_id = rq('cat_id', 2); delete_offer($ids, 0); cache_outs_update($ids); $offers_arr = offers_total($cat_type, $cat_id); $out = array('total' => $offers_arr['total'], 'total_html' => tpx('links_table_total', $offers_arr), 'more' => $offers_arr['more']); echo json_encode($out); exit; break; // ну а вдруг кто-то уберёт exit ;) // ну а вдруг кто-то уберёт exit ;) case 'delete_sale': $conversion_id = rq('conversion_id', 2); delete_sale_by_id($conversion_id); exit; break; case 'get_sales': $sales = get_sales($_POST['sType'], $_POST['sStart'], $_POST['sEnd']);