$item->picture = HOST . "includes/webservices/images/" . $filename . "x" . $random . ".jpg"; $html .= "<tr>"; $html .= " <td><img src='" . $item->picture . "' height='40' width='40'/></td>"; $html .= " <td>" . $item->name . "</td>"; $html .= " <td><a class='btn btn-primary' href='updateproducttype.php?id=" . $item->id . "'>Update</a></td>"; $html .= " <td><button class='btn btn-danger btndelete'>Delete <span hidden>" . $item->id . "</span></button></td>"; $html .= "</tr>"; } $filename = 0; echo $html; } else { echo "no data"; } } else { if ($_GET['itemtype'] == "productpic") { $items = ProductPic::get_all(); if (count($items) > 0) { foreach ($items as $item) { $filename++; $random = rand(0, 1); file_put_contents("images/" . $filename . "x" . $random . ".jpg", base64_decode($item->picture)); $item->picture = HOST . "includes/webservices/images/" . $filename . "x" . $random . ".jpg"; $html .= "<tr>"; $html .= " <td>productid " . $item->productid . "</td>"; $html .= " <td><img src='" . $item->picture . "' height='40' width='40'/></td>"; $html .= " <td><a class='btn btn-primary' href='updateproductpic.php?id=" . $item->id . "'>Update</a></td>"; $html .= " <td><button class='btn btn-danger btndelete'>Delete <span hidden>" . $item->id . "</span></button></td>"; $html .= "</tr>"; } $filename = 0; echo $html;
Store::get_by_id($_GET['itemid'])->delete(); } else { if ($_GET['itemtype'] == "storetype") { StoreType::get_by_id($_GET['itemid'])->delete(); } else { if ($_GET['itemtype'] == "storepic") { StorePic::get_by_id($_GET['itemid'])->delete(); } else { if ($_GET['itemtype'] == "product") { Product::get_by_id($_GET['itemid'])->delete(); } else { if ($_GET['itemtype'] == "producttype") { ProductType::get_by_id($_GET['itemid'])->delete(); } else { if ($_GET['itemtype'] == "productpic") { ProductPic::get_by_id($_GET['itemid'])->delete(); } else { if ($_GET['itemtype'] == "traffic") { Traffic::get_by_id($_GET['itemid'])->delete(); } else { if ($_GET['itemtype'] == "review") { Review::get_by_id($_GET['itemid'])->delete(); } else { if ($_GET['itemtype'] == "featureditem") { FeaturedItem::get_by_id($_GET['itemid'])->delete(); } else { $message = "unknown parameter passed"; } } } }