forked from hellovai/online-compiler
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathparse.php
More file actions
28 lines (27 loc) · 708 Bytes
/
parse.php
File metadata and controls
28 lines (27 loc) · 708 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<? include('include.php');
if($PASS) {
if(isset($_POST['compileType']) && isset($_POST['codeIn'])){
$compileType = get_code($_POST['compileType']);
$codeIn = $_POST['codeIn'];
do {
$outDir = uid($FILE_LEN);
} while(file_exists(basePath() . "/data/" . $outDir));
mkdir("./data/" . $outDir . "/");
$fout = fopen("./data/" . $outDir . "/" . $outDir . ".prog", 'w');
fwrite($fout, $codeIn);
fclose($fout);
$var = shell_exec("./compile.sh $outDir $compileType");
//TODO compiling shit
// generate .out file
if($var == 0) {
header('Location: index.php/' . $outDir);
} else{
echo $var;
}
}else{
header('Location: index.php');
}
} else {
get_page("site_down");
}
?>