-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathphp python trial.php
More file actions
104 lines (98 loc) · 2.58 KB
/
Copy pathphp python trial.php
File metadata and controls
104 lines (98 loc) · 2.58 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<!DOCTYPE html>
<html>
<head>
<title>Crowd Prediction</title>
</head>
<body>
<form action = "#" method="POST">
<table>
<tr>
<td>Month:</td>
<td>
<select name = "month">
<option value=1>Jan</option>
<option value=2>Feb</option>
<option value=3>mar</option>
<option value=4>apr</option>
<option value=5>may</option>
<option value=6>jun</option>
<option value=7>jul</option>
<option value=8>aug</option>
<option value=9>sept</option>
<option value=10>oct</option>
<option value=11>nov</option>
<option value=12>dec</option>
</select>
</td>
</tr>
<tr>
<td>Date:</td>
<td><input type="number" name="date"></td>
</tr>
<tr>
<td>Hour:</td>
<td><input type="number" name="hour"></td>
</tr>
<tr>
<td colspan="2"><input type="submit" name="submit"></td>
</tr>
</table>
</form>
</body>
</html>
<?php
#exec("C:");
#shell_exec("chdir C:\\xampp\\htdocs\\crowdly\\venv\\Scripts 2>&1");
#shell_exec("activate.bat");
#var_dump($op1); //make sure to change this path
/*exec("activate.bat", $op2);*/
if(isset($_POST['submit']) && !empty($_POST) )
{
$m = $_REQUEST["month"];
$d = $_REQUEST["date"];
$h = $_REQUEST["hour"];
echo "On ".$d."/".$m." from ".$h." to ".($h+1).",<br>";
shell_exec("cd ..");
shell_exec("cd ..");
$output = shell_exec("C:\\Users\\Admin\\AppData\\Local\\Programs\\Python\\Python35-32\\python.exe C:\\xampp\\htdocs\\crowdly\\predictor.py $m $d $h 2>&1");
#exec('C:\\Python27\\python.exe C:\\sud.py', $output);
var_dump($output); //make sure to change this path
echo "<br> Approximate number of people would be ".(int)$output;
echo "<br>Station will be ";
if((int)$output <= 250)
{
echo "mostly empty at this time";
}
else if((int)$output >250 && (int)$output <= 750)
{
echo "crowed at this time";
}
else
{
echo "heavily crowed at this time";
}
}
/*$file = fopen("D:\\xampp\\htdocs\\crowd\\result.txt", "r");
echo fread($file, filesize("D:\\xampp\\htdocs\\crowd\\result.txt"));
fclose($file);*/
?>
<select class="form-control" id="month" name="month">
<?php
$con = mysqli_connect("10.31.13.26","student","student","Interns");
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
else
{
$sql = "SELECT name,class from central";
$result = mysql_query($con,$sql);
echo $result;
for($i = 0; $i<mysqli_num_rows($result);$i++)
{
$row=mysqli_fetch_assoc($result);
<option value=$row['class']>$row['name']</option>
}
}
?>
</select>