-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfunction.php
More file actions
53 lines (41 loc) · 1.45 KB
/
function.php
File metadata and controls
53 lines (41 loc) · 1.45 KB
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
<?php
include 'database.php';
$funcName = $_POST['fName'];
$x = $_POST['xVal'];
$y = $_POST['yVal'];
$file = $_POST['file'];
if($funcName == 'getColor'){
$output = shell_exec("./main.exe color " . $x . " " . $y . " " . $file);
print $output;
}
else if($funcName == 'compareSquares'){
$x2 = $_POST['xVal2'];
$y2 = $_POST['yVal2'];
$file = $_POST['file'];
$output = shell_exec("./main.exe compare " . $x . " " . $y . " " . $x2 . " " . $y2 . " 2" . " " . $file);
print $output;
}
else if($funcName == 'removeFile'){
$file = $_POST['file'];
$command_rm = escapeshellcmd("rm " . $file . ".txt");
$output_rm = shell_exec($command_rm);
print $output_rm;
}
else if($funcName == 'retrieveData') {
//get info from database
$sql = 'SELECT * FROM userData;';
$statement = $this->pdo->prepare($sql);
echo $statement;
$statement->execute();
$recordSet = $statement->fetchAll(PDO::FETCH_ASSOC);
$statement->closeCursor();
// $username = $recordSet['username'];
// $moves = $recordSet['moves'];
// $datePlayed = $recordSet['datePlayed'];
// $avatar = $recordSet['avatarURL'];
// $userInfo = array($username, $moves, $datePlayed, $duration, $avatar);
echo $recordSet;
}
else if($funcName == 'saveData') {
}
?>