Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
emulab
emulab-devel
Commits
22c34b36
Commit
22c34b36
authored
Nov 15, 2000
by
Leigh B. Stoller
Browse files
Add a node control page for admin people.
parent
5a3a1047
Changes
4
Hide whitespace changes
Inline
Side-by-side
www/index.php3
View file @
22c34b36
...
...
@@ -99,6 +99,8 @@ if (isset($uid)) {
if
(
$admin
)
{
echo
"<A href='approveproject_list.php3?uid=
$uid
'>
New Project Approval</A><p>
\n
"
;
echo
"<A href='nodecontrol_list.php3?uid=
$uid
'>
Node Control</A><p>
\n
"
;
}
if
(
$trusted
)
{
# Only group leaders can do these options
...
...
www/nodecontrol.php3
0 → 100644
View file @
22c34b36
<?php
include
(
"defs.php3"
);
#
# Note, no output yet so we can do a redirect.
#
#
# Only known and logged in users can do this.
#
LOGGEDINORDIE
(
$uid
);
#
# Admin users can control other nodes.
#
$isadmin
=
ISADMIN
(
$uid
);
if
(
!
$isadmin
)
{
USERERROR
(
"You do not have admin privledges!"
,
1
);
}
#
# Check to make sure that this is a valid nodeid
#
$query_result
=
mysql_db_query
(
$TBDBNAME
,
"SELECT node_id FROM nodes WHERE node_id=
\"
$node_id
\"
"
);
if
(
mysql_num_rows
(
$query_result
)
==
0
)
{
USERERROR
(
"The node
$node_id
is not a valid nodeid"
,
1
);
}
#
# Now change the information.
#
$insert_result
=
mysql_db_query
(
$TBDBNAME
,
"UPDATE nodes SET "
.
"def_boot_image_id=
\"
$def_boot_image_id
\"
, "
.
"def_boot_cmd_line=
\"
$def_boot_cmd_line
\"
, "
.
"next_boot_path=
\"
$next_boot_path
\"
, "
.
"next_boot_cmd_line=
\"
$next_boot_cmd_line
\"
"
.
"WHERE node_id=
\"
$node_id
\"
"
);
if
(
!
$insert_result
)
{
$err
=
mysql_error
();
TBERROR
(
"Database Error changing node setup for
$node_id
:
$err
"
,
1
);
}
#
# Zap back to the list. Seems better than a silly "we did it" message.
#
header
(
"Location: nodecontrol_list.php3?uid=
$uid
"
);
?>
www/nodecontrol_form.php3
0 → 100644
View file @
22c34b36
<html>
<head>
<title>
Node Control
</title>
<link
rel=
"stylesheet"
href=
"tbstyle.css"
type=
"text/css"
>
</head>
<body>
<?php
include
(
"defs.php3"
);
#
# Only known and logged in users can do this.
#
LOGGEDINORDIE
(
$uid
);
#
# Admin users can control other nodes.
#
$isadmin
=
ISADMIN
(
$uid
);
if
(
!
$isadmin
)
{
USERERROR
(
"You do not have admin privledges!"
,
1
);
}
echo
"<center><h1>
Node Control Center:
$node_id
</h1></center>"
;
#
# Check to make sure thats this is a valid nodeid
#
$query_result
=
mysql_db_query
(
$TBDBNAME
,
"SELECT * FROM nodes WHERE node_id=
\"
$node_id
\"
"
);
if
(
mysql_num_rows
(
$query_result
)
==
0
)
{
USERERROR
(
"The node
$node_id
is not a valid nodeid"
,
1
);
}
$row
=
mysql_fetch_array
(
$query_result
);
$node_id
=
$row
[
node_id
];
$type
=
$row
[
type
];
$def_boot_image_id
=
$row
[
def_boot_image_id
];
$def_boot_cmd_line
=
$row
[
def_boot_cmd_line
];
$next_boot_path
=
$row
[
next_boot_path
];
$next_boot_cmd_line
=
$row
[
next_boot_cmd_line
];
echo
"<table border=2 cellpadding=0 cellspacing=2
align='center'>
\n
"
;
#
# Generate the form.
#
echo
"<form action=
\"
nodecontrol.php3?uid=
$uid
\"
method=
\"
post
\"
>
\n
"
;
echo
"<tr>
<td>Node ID:</td>
<td class=
\"
left
\"
>
<input type=
\"
readonly
\"
name=
\"
node_id
\"
value=
\"
$node_id
\"
>
</td>
</tr>
\n
"
;
echo
"<tr>
<td>Node Type:</td>
<td class=
\"
left
\"
>
<input type=
\"
readonly
\"
name=
\"
node_type
\"
value=
\"
$type
\"
>
</td>
</tr>
\n
"
;
#
# This should be a menu.
#
echo
"<tr>
<td>Def Boot Image:</td>
<td class=
\"
left
\"
>
<input type=
\"
text
\"
name=
\"
def_boot_image_id
\"
size=
\"
20
\"
value=
\"
$def_boot_image_id
\"
></td>
</tr>
\n
"
;
echo
"<tr>
<td>Def Boot Command Line:</td>
<td class=
\"
left
\"
>
<input type=
\"
text
\"
name=
\"
def_boot_cmd_line
\"
size=
\"
40
\"
value=
\"
$def_boot_cmd_line
\"
></td>
</tr>
\n
"
;
echo
"<tr>
<td>Next Boot Path:</td>
<td class=
\"
left
\"
>
<input type=
\"
text
\"
name=
\"
next_boot_path
\"
size=
\"
40
\"
value=
\"
$next_boot_path
\"
></td>
</tr>
\n
"
;
echo
"<tr>
<td>Next Boot Command Line:</td>
<td class=
\"
left
\"
>
<input type=
\"
text
\"
name=
\"
next_boot_cmd_line
\"
size=
\"
40
\"
value=
\"
$next_boot_cmd_line
\"
></td>
</tr>
\n
"
;
echo
"<tr>
<td colspan=2 align=center>
<b><input type=
\"
submit
\"
value=
\"
Submit
\"
></b>
</td>
</tr>
</form>
</table>
\n
"
;
?>
</body>
</html>
www/nodecontrol_list.php3
0 → 100644
View file @
22c34b36
<html>
<head>
<title>
Node Control
</title>
<link
rel=
"stylesheet"
href=
"tbstyle.css"
type=
"text/css"
>
</head>
<body>
<?php
include
(
"defs.php3"
);
#
# Only known and logged in users can do this.
#
LOGGEDINORDIE
(
$uid
);
#
# Admin users can control nodes.
#
$isadmin
=
ISADMIN
(
$uid
);
if
(
!
$isadmin
)
{
USERERROR
(
"You do not have admin privledges!"
,
1
);
}
echo
"<center><h1>
Node Control Center
</h1></center>"
;
#
# Suck out info for all the nodes.
#
$query_result
=
mysql_db_query
(
$TBDBNAME
,
"SELECT * from nodes where type='pc' or type='shark'"
);
if
(
!
$query_result
)
{
TBERROR
(
"Database Error retrieving node information"
,
1
);
}
echo
"<table border=2 cellpadding=0 cellspacing=2
align='center'>
\n
"
;
echo
"<tr>
<td>Change</td>
<td>ID</td>
<td>Type</td>
<td>Def Image</td>
<td>Def Cmdline</td>
<td>Next Path</td>
<td>Next Cmdline</td>
</tr>
\n
"
;
while
(
$row
=
mysql_fetch_array
(
$query_result
))
{
$node_id
=
$row
[
node_id
];
$type
=
$row
[
type
];
$def_boot_image_id
=
$row
[
def_boot_image_id
];
$def_boot_cmd_line
=
$row
[
def_boot_cmd_line
];
$next_boot_path
=
$row
[
next_boot_path
];
$next_boot_cmd_line
=
$row
[
next_boot_cmd_line
];
if
(
!
$def_boot_cmd_line
)
$def_boot_cmd_line
=
"NULL"
;
if
(
!
$next_boot_path
)
$next_boot_path
=
"NULL"
;
if
(
!
$next_boot_cmd_line
)
$next_boot_cmd_line
=
"NULL"
;
echo
"<tr>
<td align=center>
<A href='nodecontrol_form.php3?uid=
$uid
&node_id=
$node_id
'>
<img alt=
\"
o
\"
src=
\"
redball.gif
\"
></A></td>
<td>
$node_id
</td>
<td>
$type
</td>
<td>
$def_boot_image_id
</td>
<td>
$def_boot_cmd_line
</td>
<td>
$next_boot_path
</td>
<td>
$next_boot_cmd_line
</td>
</tr>
\n
"
;
}
echo
"</table>
\n
"
;
?>
</body>
</html>
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment