function delete_row($page_type, $id) { if (empty($page_type)) { die(json_encode(array("error" => "Page Type not declared!!!"))); } else { //Table information declaration $table_info['site menu']['tbl'] = "site_menu"; $table_info['site menu']['key'] = "menu_id"; $table_info['site content']['tbl'] = "site_content"; $table_info['site content']['key'] = "content_id"; $table_info['user list']['tbl'] = "mn_user"; $table_info['user list']['key'] = "mn_user_id"; $table_info['admin list']['tbl'] = "admin"; $table_info['admin list']['key'] = "AdminID"; $table_info['product']['tbl'] = "product"; $table_info['product']['key'] = "ProductId"; $table_info['category']['tbl'] = "category"; $table_info['category']['key'] = "CategoryId"; $table_info['product_review']['tbl'] = "product_review"; $table_info['product_review']['key'] = "review_Id"; //login to delete $table = $table_info[strtolower($page_type)]['tbl']; $key = $table_info[strtolower($page_type)]['key']; if (remove_row($table, $key, $id)) { echo json_encode(array("msg" => "deleted successfully")); } else { echo json_encode(array("error" => "could not delete Fatal Error")); } } }
function imageList($startFrom = 0, $numberToList = null, $orderBy = 'added', $order = 'ASC', $searchFor = null) { global $settings, $ADD_DB_REPORT, $DBCOUNT, $DbPrivate, $IMAGEDB; if (is_object($IMAGEDB)) { $db = $IMAGEDB; } else { $db = loadDBGlobal(); } $imageList = false; if ($db->db_not_empty()) { // do image search if (!is_null($searchFor)) { $db->set_db($db->db_search($searchFor, array('alt', 'name'))); } // order image db by new to old $db->order_by($orderBy, $order); //ASC|DESC $img_db = $db->fetch_all(); //count private images $DbPrivate = $db->db_count('private', 1); //remove private images if (!checklogin() && $settings['SET_PRIVATE_IMG_ON']) { $img_db = remove_row($img_db, 'private', 1); } // setup global $DBCOUNT $DBCOUNT = count($img_db); if (!is_numeric($startFrom) && $startFrom == 'rand') { if (is_null($numberToList)) { $numberToList = 4; } if ($DBCOUNT >= $numberToList) { $imageList = uniqueRand($numberToList, $img_db); } } else { if (is_null($numberToList)) { $numberToList = $settings['SET_IMG_ON_PAGE']; } if ($numberToList == 'all') { $numberToList = null; } $imageList = array_slice($img_db, $startFrom, $numberToList); } } return $imageList; }
padding: 1%; border-radius: 10px; } body { padding-top: 70px; } h4 {text-align: center;} </style> <title>Contact requests</title> </head> <body> <h1 align="center"> Contact request: </h1> <?php if (isset($_POST['idRow'])) { remove_row(); } ?> <table class="table table-hover"> <tr> <th>User name</th> <th>User email</th> <th>User phone number</th> <th>Message</th> <th>Listing location</th> <th>Action</th> </tr> <?php print contact_requests(); ?>