-
Notifications
You must be signed in to change notification settings - Fork 0
/
addCore.php
55 lines (51 loc) · 1.79 KB
/
addCore.php
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php
include("includes/header.php");
include("functions/functions.php");
include("includes/settings.php");
?>
<div class="jumbotron">
<div class="row text-center">
<form class="navbar-form">
<div class="input-group">
<div class="input-group add-on">
<input type="text" class="form-control" placeholder="Enter core name"
id="create" name="create">
<div class="input-group-btn">
<button class="btn btn-default" type="submit" name="submit" value="submit">Add Core</button>
</div>
</div>
</div>
<br>
<small><b>***core name should not contain spaces and special characters.</b></small>
</form>
</div>
</div>
<?php
if (isset($_GET['submit'])) {
if ($_GET['submit'] == 'submit') {
echo "<div class='jumbotron'>";
$keys = array_keys($_GET);
$coreName = '';
if (isset($_GET["create"]) && $_GET["create"] != '') {
$coreName = $_GET["create"];
if (!file_exists($target_dir . $coreName)) {
mkdir($target_dir . $coreName, 0777, true);
}
$realPath = escapeshellarg(realpath("./pyCalculation"));
exec("python $realPath\coreOperations.py $keys[0] $coreName 2>&1", $output, $ret_code);
echo "<pre>";
foreach ($output as $val) {
echo $val;
echo "<br>";
}
echo "</pre>";
} else {
echo '<script type="text/javascript">alert("Please enter core name!!!");</script>';
}
echo "</div>";
}
}
?>
<?php
include("includes/footer.php");
?>