Example #1
0
 public function sqlExecuteAction()
 {
     $host = $_SESSION['host'];
     $username = $_SESSION['username'];
     $password = $_SESSION['password'];
     $db = $_GET['database'];
     $sql = $_GET['sql'];
     $cmd = "\$host = \"{$host}\";\n        \$username = \"{$username}\";\n        \$password = \"{$password}\";\n        \$db = \"{$db}\";\n        \$co = new \\mysqli(\$host, \$username, \$password);\n        \$co->select_db(\$db);\n        \$sql = \"{$sql}\";\n        \$result = mysqli_query(\$co, \$sql);\n        \$results = array();\n        while(\$row = mysqli_fetch_row(\$result)) {\n            \$results[] = \$row;\n        }\n\n        echo(json_encode(\$results));\n        ";
     $bundle = new BundleService();
     $result = $bundle->callEval($cmd);
     die($result);
 }
 public function uploadAction()
 {
     $content_dir = "uploads";
     $tmp_file = $_FILES['file']['tmp_name'];
     if (!is_uploaded_file($tmp_file)) {
         $_SESSION['flash'] = array("failure", "Furez can't find the file");
         exit(header("Location: " . $_SESSION['basepath']));
     }
     $name_file = $_FILES['file']['name'];
     if (!move_uploaded_file($tmp_file, $content_dir . "/" . $name_file)) {
         $_SESSION['flash'] = array("failure", "Error, Furez can't succed to copy file in {$content_dir}");
         exit(header("Location: " . $_SESSION['basepath']));
     }
     $filepath = $_POST['exportdir'] . "/" . $_FILES['file']['name'];
     $cmd = "\$file = \$_POST['file'];\n                file_put_contents('" . $filepath . "', \$file);\n                if (file_exists('" . $filepath . "')) {\n                    echo 'Succeed! Furez upload the file';\n                }";
     $bundle = new BundleService();
     $result = $bundle->callCurlUpload($cmd);
     $_SESSION['flash'] = array("success", $result);
     header("Location: " . $_SESSION['basepath']);
 }