www
/
wwwroot
/
magazinmiorita.be
➕ New
📤 Upload
✎ Editing:
apifunc.php
← Back
<?php ob_start(); header('Access-Control-Allow-Origin: *'); include('includes/temp.config.php'); if(isset($_GET['ucat'])){ $get_cat = $database->execute("select * from sma_categories"); while($row = $database->fetch($get_cat)){ $slug = strtolower(str_replace('/', '', $row['name'])); $slug = strtolower(str_replace(' ', '-', $slug)); $slug = strtolower(str_replace('--', '-', $slug)); $update_remote = $database->execute("update sma_categories set `slug` = '$slug' where id = '".$row['id']."'"); } }else{ ini_set("display_errors",0); function replaceSpace($string){ $string = trim(preg_replace('/\s+/', ' ', $string)); return htmlspecialchars(addslashes($string)); } $get_data = $database->execute("select * from sma_products where code = '".$_POST['code']."'"); $row = $database->assoc($get_data); $get_cat = $database->execute("select * from sma_categories where code = 'C".($_POST['cat_id'] ? $_POST['cat_id'] : '1')."'"); $crow = $database->assoc($get_cat); $get_scat = $database->execute("select * from sma_categories where code = 'SC".($_POST['scat_id'] ? $_POST['scat_id'] : '1')."'"); $srow = $database->assoc($get_scat); $json = array(); $copy_img = false; if($database->num($get_data) != 0){ $image = str_replace('uploads/images/', '', $_POST['image']); $update_remote = $database->execute("update sma_products set `image` = '".($image != '' ? $image : 'no_image.png')."', category_id = '".$crow['id']."', subcategory_id = '".$srow['id']."' where code = '".$_POST['code']."'"); $url = 'http://www.magazinmiorita.be/'.$_POST['image']; $img = '/home/miorita/public_html/pos/assets/uploads/'.str_replace('uploads/images/', '', $_POST['image']); //file_put_contents($img, file_get_contents($url)); } if($update_remote){ $act_status = '<span style="color:green">Actualizat</span>'; }else{ $act_status = '<span style="color:red">Eroare</span>'; } $json['text'] = ' <tr> <td width="150">'.$act_status.': </td> <td width="150">'.$row['code'].'</td> <td width="350">'.$row['name'].'</td> <td width="350">'.str_replace('uploads/images/', '', $_POST['image']).'</td> </tr>'; echo json_encode($json); } ?>
💾 Save Changes
Cancel
📤 Upload File
×
Select File
Upload
Cancel
➕ Create New
×
Type
📄 File
📁 Folder
Name
Create
Cancel
✎ Rename Item
×
Current Name
New Name
Rename
Cancel
🔐 Change Permissions
×
Target File
Permission (e.g., 0755, 0644)
0755
0644
0777
Apply
Cancel