-
Notifications
You must be signed in to change notification settings - Fork 1
/
hadoop_request_entry.php
executable file
·43 lines (37 loc) · 1.78 KB
/
hadoop_request_entry.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
<html>
<body>
<?php
require_once 'db_connect.php';
session_start();
require_once 'checksession.php';
require_once 'logging.php';
if($_SERVER['REQUEST_METHOD']=='POST'){
$no_of_slaves = $_POST['number_vm']-1;
$param = array(
":hadoop_name" => $_POST['hadoop_name'],
":number_slave" => $no_of_slaves,
":ram" => $_POST['ram'],
":cpu" => (int)$_POST['cpu'],
":storage" => $_POST['storage'],
":doe" => $_POST['date'],
":username"=>$_SESSION['username']
);
$db = getDBConnection();
$sql="INSERT INTO `hadoop` (username,hadoop_name,number_slave,cpu,ram,storage,doe,status) VALUES (:username,:hadoop_name,:number_slave,:cpu,:ram,:storage,:doe,'pending')";
$stmt = prepareQuery($db,$sql);
executeQuery($stmt,$param);
$sql = "INSERT INTO `name_description` (name,description) VALUES (:hadoop_name,:description)";
$param = array(
":hadoop_name"=>$_POST["hadoop_name"],
":description"=>$_POST['description']
);
$stmt = prepareQuery($db,$sql);
if(executeQuery($stmt,$param)){
notifyAllAdmins("HADOOP", $_SESSION['username']." requested hadoop cluster ".$_POST['hadoop_name']);
logHadoopRequest($_POST['hadoop_name'],$_SESSION['username']);
header("location:pending_details.php");
}
}
?>
</body>
</html>