if (!$dg->WriteFile($path_file, $buffer)) { $data['status'] = 0; $data['msg'] = 'Can not upload file. Please try again.'; } else { $src = str_replace('\\', '/', $root . $file); $data['status'] = 1; $data['src'] = $src; $data['src'] = str_replace(DS, '/', $data['src']); $data['item'] = array('title' => $file, 'url' => $data['src'], 'file_name' => $file, 'thumb' => $data['src'], 'file_type' => 'image'); } echo json_encode($data); exit; break; case 'qrcode': $text = $_GET['text']; $file = $dg->qrcode($text); echo $file; break; case 'user': $email = $_POST['email']; $password = $_POST['password']; $id = md5($email . $password); setcookie('design', $id, time() + 86400 * 1000, "/"); echo $id; exit; break; // save design // save design case 'saveDesign': $dg->saveDesign(); break;