<?php include '../../includes/inc.main.php'; if ($_GET['action'] == 'newimage') { if (count($_FILES['image']) > 0) { $TempDir = $Admin->ImgGalDir(); $Name = "user" . intval(rand() * rand() / rand()) . "__" . $Admin->AdminID; $Img = new FileData($_FILES['image'], $TempDir, $Name); echo $Img->BuildImage(200, 200); die; } } switch (strtolower($_POST['action'])) { //////////////////////////////////////////// NEW TEST USER /////////////////////////////////////////////////////////////// case 'generate': $curl = curl_init(); curl_setopt_array($curl, array(CURLOPT_URL => "https://api.mercadolibre.com/users/test_user?access_token=" . $_SESSION['access_token'], CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_POSTFIELDS => "{\n \"site_id\":\"MLA\"\n}", CURLOPT_HTTPHEADER => array("cache-control: no-cache", "conten: application/json", "content-type: application/json"))); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; //$Data = json_decode($response,true); //$DB->execQuery('INSERT','test_user','id,nickname,password,site_status,email,creation_date',$Data['id']",'".$Data['nickname']."','".$Data['password']."','".$Data['site_status']."','".$Data['email']."',NOW()"); } die; break; //////////////////////////////////////////// EDIT /////////////////////////////////////////////////////////////// //////////////////////////////////////////// EDIT ///////////////////////////////////////////////////////////////
public function Newimage() { if (count($_FILES['image']) > 0) { // $Images = $Admin->UserImages(); // Para cuando se requiera limitar la cantidad de imágenes. $TempDir = $this->ImgGalDir(); $Name = "user" . intval(rand() * rand() / rand()) . "__" . $this->AdminID; $Img = new FileData($_FILES['image'], $TempDir, $Name); echo $Img->BuildImage(200, 200); } }
public function Newimage() { if (count($_FILES['image']) > 0) { if ($_POST['newimage'] != $this->GetDefaultImg() && file_exists($_POST['newimage'])) { unlink($_POST['newimage']); } $TempDir = $this->ImgGalDir; $Name = "group" . intval(rand() * rand() / rand()); $Img = new FileData($_FILES['image'], $TempDir, $Name); echo $Img->BuildImage(200, 200); } }
$Status = $_POST['status'] == "on" ? 'A' : 'I'; $Insert = $DB->execQuery('insert', 'category', 'title,parent_id,status,image,creation_date', "'" . $Title . "'," . $Parent . ",'" . $Status . "','" . $Image . "',NOW()"); $ID = $DB->GetInsertId(); //echo $DB->lastQuery(); die; break; case 'update': $ID = $_POST['id']; $Edit = new Category($ID); if (count($_FILES['img']) > 0) { $Name = "file" . intval(rand() * rand() / rand() + rand()); $Img = new FileData($_FILES['img'], "../../../skin/images/categories/", $Name); if (file_exists($Edit->Data['image'])) { $Img->DeleteFile($Edit->Data['image']); } $Image = $Img->BuildImage(45, 45); $ImgFilter = ",img='" . $Image . "'"; } $Title = htmlentities($_POST['title']); $Parent = $_POST['parent']; $Status = $_POST['status'] == "on" ? 'A' : 'I'; $Insert = $DB->execQuery('update', 'category', "title='" . $Title . "',parent_id=" . $Parent . ",status='" . $Status . "'" . $ImgFilter, "category_id=" . $ID); //echo $DB->lastQuery(); die; break; case 'delete': $ID = $_POST['id']; $DB->execQuery('update', 'category', "status = 'I'", "category_id=" . $ID); die; break; ///////////////////////////////////// VALIDATIONS /////////////////////////////////////////////////