-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathaddcluster.php
More file actions
69 lines (58 loc) · 1.95 KB
/
addcluster.php
File metadata and controls
69 lines (58 loc) · 1.95 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
<?php
//check is user is logged in
include "inc/session_check.php";
if ($_SESSION['user'] != "mainadmin") {
header('Location: adminlogin.php');
die();
}
$title = "Add Cluster";
include "inc/config.php";
//check request is made to save cluster details
if (isset($_POST["save"]))
{
$name = $_POST["cname"];
$cpu = $_POST["cpu"];
$cores = $_POST["cores"];
$ram = $_POST["ram"];
$comment = $_POST["comment"];
$db = db_connect();
//save cluster details
$db_query = "insert into cluster (name,cpu,cores,ram,is_bookable,comment) values('".$name."','".$cpu."','".$cores."','".$ram."',1,'".$comment."' )";
$res = $db->query($db_query);
//redirect to cluster.php
header("Location:cluster.php");
die();
}
?>
<!--create add cluster page -->
<html>
<head>
<link rel="stylesheet" type="text/css" href="inc/style.css">
</head>
<body>
<!--div style="display:inline;"><a href="newbooking.php">New Booking</a> |
<a href="index.php">Existing Bookings</a> |
<a href="cluster.php">Cluster</a></div>
<div style="display:inline;margin: 0px 0px 0px 45%;"> </div>
<div style="display:inline;">Logged in as : <?php echo $_SESSION['user']; ?>
<a href="login.php?out=o">Logout</a></div-->
<?php
show_menu();
?>
<center>
<form action="addcluster.php" method="POST">
<table border=1>
<tr><th>Cluster Name </th><td><input type=text name="cname" size="50" required value=""></td></tr>
<tr><th>Cpu </th><td><input type=text name="cpu" size="50" required value=""></td></tr>
<tr><th>Cores </th><td><input type=text name="cores" size="50" required value=""></td></tr>
<tr><th>Ram </th><td><input type=text name="ram" size="50" required value=""></td></tr>
<tr><th>Comment</th><td><textarea name="comment" rows=5 cols=50 ></textarea></td></tr>
<tr><th></th><td>
<input type="submit" value="save">
<input type="hidden" name="save" value="1">
</td></tr>
</table>
</form>
</center>
</body>
</html>