Commit 8abe92b2 authored by Leigh Stoller's avatar Leigh Stoller

Checking in contents of the current testbed WWW pages for Mac, who is

at OSDI.
parent 130885da
<?php
if (!isset($PHP_AUTH_USER)) {
Header("WWW-Authenticate: Basic realm=\"testbed\"");
Header("HTTP/1.0 401 Unauthorized");
die("User authenication is required to view these pages\n");
} else {
addslashes($PHP_AUTH_USER);
$PSWD = crypt("$PHP_AUTH_PW", strlen($PHP_AUTH_USER));
$query = "SELECT * FROM users WHERE uid=\"$PHP_AUTH_USER\" AND usr_pswd=\"$PSWD\" AND trust_level > 0";
$result = mysql_db_query("tbdb", $query);
$numusers = mysql_num_rows($result);
$query2 = "SELECT timeout FROM login WHERE uid=\"$PHP_AUTH_USER\"";
$result2 = mysql_db_query("tbdb", $query2);
$n = mysql_num_rows($result2);
$row = mysql_fetch_row($result2);
if (($n == 0) || ($numusers == 0) || ($row[0] < time())) {
$cmnd = "DELETE FROM login WHERE uid=\"$PHP_AUTH_USER\"";
mysql_db_query("tbdb", $cmnd);
Header("WWW-Authenticate: Basic realm=\"testbed\"");
Header("HTTP/1.0 401 Unauthorized");
die ("Authorization Failed\n");
}
$timeout = time() + 1800;
$cmnd = "UPDATE login SET timeout=\"$timeout\" where uid=\"$PHP_AUTH_USER\"";
mysql_db_query("tbdb", $cmnd);
}
?>
<html>
<head>
<title>New Project</title>
<link rel="stylesheet" href="tbstyle.css" type="text/css">
</head>
<body>
<H1>Begin a project</h1>
<H1>Create a New Project</h1>
<?php
$auth_usr = "";
if ( ereg("php3\?([[:alnum:]]+)",$REQUEST_URI,$Vals) ) {
$auth_usr=$Vals[1];
addslashes($auth_usr);
$query = "SELECT timeout FROM login WHERE uid=\"$auth_usr\"";
$result = mysql_db_query("tbdb", $query);
$n = mysql_num_rows($result);
if ($n == 0) {
echo "<h3>You are not logged in. Please go back to the ";
echo "<a href=\"tbdb.html\" target=\"_top\"> Home Page </a> ";
echo "and log in first.</h3></body></html>";
exit;
} else {
$row = mysql_fetch_row($result);
if ($row[0] < time()) { # if their login expired
echo "<h3>You have been logged out due to inactivity.
Please log in again.</h3>\n</body></html>";
$cmnd = "DELETE FROM login WHERE uid=\"$auth_usr\"";
mysql_db_query("tbdb", $cmnd);
exit;
} else {
$timeout = time() + 86400;
$cmnd = "UPDATE login SET timeout=\"$timeout\" where uid=\"$auth_usr\"";
mysql_db_query("tbdb", $cmnd);
}
}
} else {
unset($auth_usr);
}
?>
<?php
addslashes($PHP_AUTH_USER);
$utime = time();
......@@ -71,4 +73,4 @@ echo "<tr><th>Expiration date:</th><td><input type=\"text\" value=\"$year:$month
</form>
</table>
</body>
</html>
\ No newline at end of file
</html>
......@@ -8,7 +8,21 @@ echo "
<body>
<h1>Adding information to the Testbed Database</h1>\n";
$my_passwd=$pswd;
$enc = crypt("$my_passwd", strlen($uid));
$mypipe = popen(escapeshellcmd(
"/usr/testbed/bin/checkpass $my_passwd $grp_head_uid '$usr_name:$email'"),
"w+");
if ($mypipe) {
$retval=fgets($mypipe,1024);
if (strcmp($retval,"ok\n")!=0) {
die("<h3>The password you have chosen will not work:<p>$retval</h3>");
}
} else {
mail("newbold@cs.utah.edu","TESTBED: checkpass failure",
"\n$usr_name ($grp_head_uid) just tried to set up a testbed account,\n".
"but checkpass pipe did not open (returned '$mypipe').\n".
"\nThanks,\nMac\n");
}
$enc = crypt("$my_passwd");
array_walk($HTTP_POST_VARS, 'addslashes');
if (isset($pid)) { #add a project to the database
if ($trust == 2) {
......
<html>
<head>
<title>New Group</title>
<title>New Project</title>
<link rel="stylesheet" href="tbstyle.css" type="text/css">
</head>
<body>
......@@ -15,13 +15,15 @@ if ( ereg("php3\?([[:alnum:]]+)",$REQUEST_URI,$Vals) ) {
?>
<table align="center" border="1">
<tr><td colspan="4">
<H1 align="center">Apply to use the Utah&nbsp;Network&nbsp;Testbed</h1>
<H1 align="center">Apply to Use the Utah&nbsp;Network&nbsp;Testbed</h1>
</td></tr>
<tr><td align="center" colspan="4">
Only fields marked with * are required</td></tr>
<form action=grpadded.php3 method="post">
<tr><td colspan=2>Group Information</td>
<td colspan=2>Group Head Information</td></tr>
<tr><td>Group Name:</td><td><input type="text" name="gid"></td>
<td>Username:</td><td class="left">
<tr><td colspan=2>Project Information</td>
<td colspan=2>Project Head Information</td></tr>
<tr><td>*Project Name:</td><td><input type="text" name="gid"></td>
<td>*Username:</td><td class="left">
<?php
if (isset($auth_usr)) {
/* if this person is logged into the database,
......@@ -34,24 +36,23 @@ if ( ereg("php3\?([[:alnum:]]+)",$REQUEST_URI,$Vals) ) {
} else {
echo "<input type=\"text\" name=\"grp_head_uid\"></td></tr>\n";
}
echo "<tr><td>Group long name:</td><td><input type=\"text\" name=\"grp_name\"></td>
<td>Full Name:</td><td class=\"left\">";
echo "<tr><td>*Project long name:</td><td><input type=\"text\" name=\"grp_name\"></td>
<td>*Full Name:</td><td class=\"left\">";
if (isset($row)) {
echo "<input type=\"readonly\" value=\"$row[usr_name]\"";
} else {
echo "<input type=\"text\"";
}
echo "name=\"usr_name\"></td></tr>
<tr><td>Group URL:</td><td><input type=\"text\" name=\"grp_URL\"></td>
<td>Email<br>Address:</td><td class=\"left\">";
<tr><td>Project URL:</td><td><input type=\"text\" name=\"grp_URL\"></td>
<td>*Email<br>Address:</td><td class=\"left\">";
if (isset($row)) {
echo "<input type=\"readonly\" value=\"$row[usr_email]\" ";
} else {
echo "<input type=\"text\" ";
}
echo "name=\"email\"></td></tr>
<tr><td>When&nbsp;do&nbsp;you<br>expect&nbsp;to&nbsp;be&nbsp;done
<br>using&nbsp;the&nbsp;testbed?</td>
<tr><td>When&nbsp;do&nbsp;you<br>expect&nbsp;to&nbsp;be&nbsp;done<br>using&nbsp;the&nbsp;testbed?</td>
<td><input type=\"text\" value="; #set a default expiration date
$mytime = date("m/d/Y", time() + (86400 * 90)); #add 30 days
echo "\"$mytime\"";
......@@ -63,8 +64,8 @@ if (isset($row)) {
echo "<input type=\"text\" name=\"usr_addr\">";
}
echo "</td></tr>
<tr><td>Group Affiliation:</td><td><input type=\"text\" name=\"grp_affil\"></td>
<td>Phone #:</td><td class=\"left\"><input ";
<tr><td>*Project Affiliation:</td><td><input type=\"text\" name=\"grp_affil\"></td>
<td>*Phone #:</td><td class=\"left\"><input ";
if (isset($row)) {
echo "type=\"readonly\" value=\"$row[usr_phone]\"";
} else {
......@@ -72,8 +73,8 @@ if (isset($row)) {
}
echo "name=\"usr_phones\"></td></tr>\n";
?>
<tr><td>Password:</td><td><input type="password" name="password1"></td>
<td>Retype<br>Password:</td><td><input
<tr><td>*Password:</td><td><input type="password" name="password1"></td>
<td>*Retype<br>Password:</td><td><input
<?php
if (isset($row)) {
echo "type=\"hidden\" value=\"$row[usr_pswd]\"";
......@@ -82,12 +83,12 @@ if (isset($row)) {
}
?>
name="password2">&nbsp;</td></tr>
<tr><td colspan="4">Please describe how and why you plan
to use the Testbed</td></tr>
<tr><td colspan="4">*Please describe how and why you plan
to use the Testbed:</td></tr>
<tr><td colspan="4" class="left"><textarea name="why"
rows="10" cols="62"></textarea></td></tr>
<tr><td colspan="4" align="center"><input type="submit"
value="Submit"></td></tr>
<tr><td colspan="4" align="center"><b><input type="submit"
value="Submit"></b></td></tr>
</form>
</table>
</body>
......
<?php
if (!isset($PHP_AUTH_USER)) {
Header("WWW-Authenticate: Basic realm=\"testbed\"");
Header("HTTP/1.0 401 Unauthorized");
die("User authenication is required to view these pages\n");
} else {
addslashes($PHP_AUTH_USER);
$PSWD = crypt("$PHP_AUTH_PW", strlen($PHP_AUTH_USER));
$query = "SELECT * FROM users WHERE uid=\"$PHP_AUTH_USER\" AND usr_pswd=\"$PSWD\" AND trust_level > 0";
$result = mysql_db_query("tbdb", $query);
$numusers = mysql_num_rows($result);
$query2 = "SELECT timeout FROM login WHERE uid=\"$PHP_AUTH_USER\"";
$result2 = mysql_db_query("tbdb", $query2);
$n = mysql_num_rows($result2);
if (($n == 0) && ($numusers != 0)){
$cmnd = "INSERT INTO login VALUES ('$PHP_AUTH_USER', '0')";
mysql_db_query("tbdb", $cmnd);
} else {
$row = mysql_fetch_row($result2);
if (($numusers == 0) || ($row[0] < time())) {
$cmnd = "DELETE FROM login WHERE uid=\"$PHP_AUTH_USER\"";
mysql_db_query("tbdb", $cmnd);
Header("WWW-Authenticate: Basic realm=\"testbed\"");
Header("HTTP/1.0 401 Unauthorized");
die ("Authorization Failed\n");
}
}
$timeout = time() + 1800;
$cmnd = "UPDATE login SET timeout=\"$timeout\" where uid=\"$PHP_AUTH_USER\"";
mysql_db_query("tbdb", $cmnd);
}
?>
<html>
<head>
<title>New Project</title>
<link rel="stylesheet" href="tbstyle.css" type="text/css">
</head>
<body>
<H1>Begin a project</h1>
<H1>Create a New Project</h1>
<?php
$auth_usr = "";
if ( ereg("php3\?([[:alnum:]]+)",$REQUEST_URI,$Vals) ) {
$auth_usr=$Vals[1];
addslashes($auth_usr);
$query = "SELECT timeout FROM login WHERE uid=\"$auth_usr\"";
$result = mysql_db_query("tbdb", $query);
$n = mysql_num_rows($result);
if ($n == 0) {
echo "<h3>You are not logged in. Please go back to the ";
echo "<a href=\"tbdb.html\" target=\"_top\"> Home Page </a> ";
echo "and log in first.</h3></body></html>";
exit;
} else {
$row = mysql_fetch_row($result);
if ($row[0] < time()) { # if their login expired
echo "<h3>You have been logged out due to inactivity.
Please log in again.</h3>\n</body></html>";
$cmnd = "DELETE FROM login WHERE uid=\"$auth_usr\"";
mysql_db_query("tbdb", $cmnd);
exit;
} else {
$timeout = time() + 86400;
$cmnd = "UPDATE login SET timeout=\"$timeout\" where uid=\"$auth_usr\"";
mysql_db_query("tbdb", $cmnd);
}
}
} else {
unset($auth_usr);
}
?>
<?php
addslashes($PHP_AUTH_USER);
$utime = time();
$year = date("Y", $utime);
$month = date("m", $utime);
......@@ -55,7 +51,7 @@ echo "<table border=\"1\" align=\"center\">
<tr><td colspan=\"2\">Only fields in bold red are required</td></tr>
<tr><th>Project Name:</th><td><input type=\"text\" name=\"pid\"></td></tr>
<tr><th>Group association:</th>\n";
$query = "SELECT gid FROM grp_memb WHERE uid=\"$PHP_AUTH_USER\"";
$query = "SELECT gid FROM grp_memb WHERE uid=\"$auth_usr\"";
$result = mysql_db_query("tbdb", $query);
$n = mysql_num_rows($result);
if ($n > 1) {
......@@ -76,4 +72,4 @@ echo "<tr><th>Expiration date:</th><td><input type=\"text\" value=\"$year:$month
</form>
</table>
</body>
</html>
\ No newline at end of file
</html>
......@@ -12,72 +12,74 @@ if ( ereg("php3\?([[:alnum:]]+)",$REQUEST_URI,$Vals) ) {
} else {
unset($uid);
}
echo "<h1>Apply for Group Membership</h1>\n";
echo "<h1>Apply for Project Membership</h1>\n";
echo "<table align=\"center\" border=\"1\">\n";
echo "<tr><td align='center' colspan=\"4\">\n";
echo "Only fields in bold, red type are required</td></tr>\n";
echo "Only fields marked with * are required</td></tr>\n";
if (isset($uid)) {
echo "<form action=\"added.php3?$uid\" method=\"post\">\n";
echo "<input type=\"hidden\" name=\"logged_in\" value=\"true\">";
echo "<tr><td>Username:</td><td class=\"left\">";
echo "<tr><td>*Username:</td><td class=\"left\">";
echo "<input type=\"readonly\" name=\"uid\" value=\"$uid\"></td>";
$query = mysql_db_query("tbdb","select usr_expires,usr_email,usr_addr,usr_name,usr_phone,usr_pswd from users where uid='$uid'");
$row = mysql_fetch_row($query);
echo "<td>Expiration date:</td>";
echo "<td class=\"left\"><input type=\"readonly\" name=\"usr_expires\" ";
echo "value=\"$row[0]\"</td></tr>\n";
echo "<tr><td>email:</td><td class=\"left\"><input type=\"readonly\" ";
echo "<tr><td>*Email:</td><td class=\"left\"><input type=\"readonly\" ";
echo "name=\"usr_email\" value=\"$row[1]\"></td>";
echo "<td>Mailing Address:</td><td class=\"left\">";
echo "<input type=\"readonly\" name=\"usr_addr\" ";
echo "value=\"$row[2]\"></td></tr>";
echo "<tr><td>Full Name:</td><td class=\"left\">";
echo "<tr><td>*Full Name:</td><td class=\"left\">";
echo "<input type=\"readonly\" name=\"usr_name\" ";
echo "value=\"$row[3]\"></td>";
echo "<td>Phone #:</td><td class=\"left\">";
echo "<input type=\"readonly\" name=\"usr_phone\" ";
echo "value=\"$row[4]\"></td></tr>";
echo "<tr><td>Password:</td><td>";
echo "<tr><td>*Password:</td><td>";
echo "<input type=\"password\" name=\"pswd\"></td>";
echo "<td>Retype Password:</td><td>";
echo "<td>*Retype Password:</td><td>";
echo "<input type=\"hidden\" name=\"pswd2\" ";
echo "value=\"$row[5]\">&nbsp;</td></tr>";
} else {
echo "<form action=\"added.php3\" method=\"post\">\n";
echo "<tr><td>Username:</td><td><input type=\"text\" name=\"uid\"></td>";
echo "<tr><td>*Username:</td><td><input type=\"text\" name=\"uid\"></td>";
echo "<td>Expiration date:</td>";
echo "<td><input type=\"text\" name=\"usr_expires\"";
$time = date("m/d/Y", time() + (86400 * 90)); #add 90 days
echo "value=\"$time\"></td></tr>\n";
echo "<tr><td>email:</td><td><input type=\"text\" name=\"usr_email\"></td>";
echo "<tr><td>*Email:</td><td><input type=\"text\" name=\"usr_email\"></td>";
echo "<td>Mailing Address:</td><td>";
echo "<input type\"text\" name=\"usr_addr\"></td></tr>";
echo "<tr><td>Full Name:</td><td>";
echo "<tr><td>*Full Name:</td><td>";
echo "<input type=\"text\" name=\"usr_name\"></td>";
echo "<td>Phone #:</td><td>";
echo "<input type=\"text\" name=\"usr_phone\"></td></tr>";
echo "<tr><td>Password:</td><td>";
echo "<tr><td>*Password:</td><td>";
echo "<input type=\"password\" name=\"pswd\"></td>";
echo "<td>Retype Password:</td><td>";
echo "<td>*Retype Password:</td><td>";
echo "<input type=\"password\" name=\"pswd2\"></td></tr>";
}
echo "<tr><td>Group:</td><td><b>";
$query = "SELECT gid FROM groups";
$result = mysql_db_query("tbdb", $query);
$n = mysql_num_rows($result);
if ($n == 1) { # if only one option make a readonly field
$row = mysql_fetch_row($result);
echo "<input type=\"readonly\" value=\"$row[0]\" name=\"grp\"></td>\n";
} elseif ($n > 1) { # if more than one option make a select button
echo "<select name=\"grp\">\n";
while ($row = mysql_fetch_row($result)) {
$gid = $row[0];
echo "<option value=$gid>$gid</option>\n";
}
echo "</select></td>\n";
} else { # if no options say this
echo "There don't seem to be any groups in the database</td>\n";
}
echo "<tr><td>*Project:</td><td><b>";
echo "<input type=\"text\" name=\"grp\"></td>";
# This used to give the selection box with all the groups...
#$query = "SELECT gid FROM groups";
#$result = mysql_db_query("tbdb", $query);
#$n = mysql_num_rows($result);
#if ($n == 1) { # if only one option make a readonly field
# $row = mysql_fetch_row($result);
# echo "<input type=\"readonly\" value=\"$row[0]\" name=\"grp\"></td>\n";
#} elseif ($n > 1) { # if more than one option make a select button
# echo "<select name=\"grp\">\n";
# while ($row = mysql_fetch_row($result)) {
# $gid = $row[0];
# echo "<option value=$gid>$gid</option>\n";
# }
# echo "</select></td>\n";
#} else { # if no options say this
# echo "There don't seem to be any groups in the database</td>\n";
#}
?>
<td colspan="2" align="center">
<b><input type="submit" value="Submit"></b></td></tr>
......
......@@ -26,7 +26,7 @@ Please log in again.</h3>\n</body></html>";
mysql_db_query("tbdb", $cmnd);
exit;
} else {
$timeout = time() + 600;
$timeout = time() + 86400;
$cmnd = "UPDATE login SET timeout=\"$timeout\" where uid=\"$auth_usr\"";
mysql_db_query("tbdb", $cmnd);
}
......@@ -44,8 +44,9 @@ more or less access to your nodes:
<ol>
<li>User - Can log into machines in your experiments.
<li>Local Root - Can have root access on machines, can create new experiments.
<li>Group Root - Can approve users, create projects, and update any group info or personal info for group members.
</ol>
";
#echo "<li>Group Root - Can approve users, create projects, and update any group info or personal info for group members.";
echo "</ol>
</p></h3>\n";
$query="SELECT gid FROM grp_memb WHERE uid='$auth_usr' and trust='group_root'";
$result = mysql_db_query("tbdb", $query);
......@@ -101,8 +102,9 @@ if ( mysql_num_rows($found) == 0 ) {
<option value='later'>Postpone</option></select></td>
<td><select name=\"$uid-trust\">
<option value='user'>User</option>
<option value='local_root'>Local Root</option>
<option value='group_root'>Group Root</option></select></td>
<option value='local_root'>Local Root</option>";
#echo "<option value='group_root'>Group Root</option>";
echo "</select></td>
<td>&nbsp;$uid&nbsp;</td><td>&nbsp;$name&nbsp;</td><td>&nbsp;$email&nbsp;</td>
<td>&nbsp;$addr&nbsp;</td><td>&nbsp;$phone&nbsp;</td>
</tr>\n";
......
......@@ -26,7 +26,7 @@ Please log in again.</h3>\n</body></html>";
mysql_db_query("tbdb", $cmnd);
exit;
} else {
$timeout = time() + 600;
$timeout = time() + 86400;
$cmnd = "UPDATE login SET timeout=\"$timeout\" where uid=\"$auth_usr\"";
mysql_db_query("tbdb", $cmnd);
}
......@@ -90,7 +90,7 @@ while ($row = mysql_fetch_row($found)) {
$cmd = "update grp_memb set trust='$trust' where uid='$uid'";
$cmd .= "and trust='none' and gid='$gid'";
$result = mysql_db_query("tbdb",$cmd);
mail("$usr_email","TESTBED: Group Approval",
mail("$email","TESTBED: Group Approval",
"\nThis message is to notify you that you have been approved ".
"as a member of \nthe $gid group with $trust permissions.\n".
"\nYour status as a Testbed user is now $newstatus.".
......@@ -109,7 +109,7 @@ while ($row = mysql_fetch_row($found)) {
while ( isset($group[$n]) ) { $cmd .= " or gid='$group[$n]'"; $n++; }
$cmd .=")";
$result = mysql_db_query("tbdb",$cmd);
mail("$usr_email","TESTBED: Group Membership Denied",
mail("$email","TESTBED: Group Membership Denied",
"\nThis message is to notify you that you have been denied ".
"as a member of \nthe $gid group.\n".
"\nYour status as a Testbed user is still $status.".
......
#!/bin/csh -v -x
echo "Replacing $1 with $2 in all files in 3 seconds"
sleep 3
foreach file (*.php3)
echo "Processing $file"
set str = "s/$1/$2/g;print;"
perl -ne $str < $file > .my_tmp
echo "Okay? (2 sec)"
sleep 2
cp .my_tmp $file
rm .my_tmp
end
echo "Done."
......@@ -36,30 +36,30 @@
<li><h3>What do I need to do to be able to use the Testbed?</h3>
<p>If you're here on your own, or you're the leader of a group
of people who want to use the Testbed, the first step is to
apply for a group. A group is an entity that has been approved
to use the Testbed, and the group leader is held responsible
for the actions of members of his group. He can allow users to
join his group and use the Testbed as a member of his group.
To get a group, click on the link in the side bar titled
'Apply for a Group'. Fill out the requested information, and
apply for a project. A project is an entity that has been approved
to use the Testbed, and the project leader is held responsible
for the actions of members of his project. He can allow users to
join his project and use the Testbed as a member of his project.
To get a project, click on the link in the side bar titled
'Apply to Start a Project'. Fill out the requested information, and
your request will be submitted to the Approval Committee.
</p>
<li><h3>Someone told me to join their group. How do I do
<li><h3>Someone told me to join their project. How do I do
that?</h3>
<p>The process of joining an existing group is quite
simple. Go to the 'Apply for Group Membership' page, fill out
the form, and wait for the group leader to approve you. Then
you're in. Your group leader primarily will control how much
<p>The process of joining an existing project is quite
simple. Go to the 'Apply to Join a Project' page, fill out
the form, and wait for the project leader to approve you. Then
you're in. Your project leader primarily will control how much
access you have to Testbed resources, within the limits given
to the group as a whole.
to the project as a whole.
</p>
<li><h3>I'm already a Testbed user, but I'm collaborating with
another group. How can I join that group too?</h3>
<p>Go back to the 'Apply for Group Membership' page, put in
your username and password, and the group you want to join. We
another project. How can I join that project too?</h3>
<p>Go back to the 'Apply for Project Membership' page, put in
your username and password, and the project you want to join. We
already have everything else on file. Then submit the request,
and the leader of the group you want to join will be notified,
and if he approves you, you'll be a member of his group as
and the leader of the project you want to join will be notified,
and if he approves you, you'll be a member of his project as
well.
</p>
<li><h3>I've been approved. How do I use my account?</h3>
......@@ -68,7 +68,7 @@
be authorized to start projects or experiments, or maybe
you'll just be authorized to use the nodes in an
experiment. Either way, your options will show up in the side
bar. If someone in your group starts a project or experiment,
bar. If someone in your project starts a project or experiment,
they'll need to ap you to it if they want you in it. Once
they do that, they can tell you what nodes are reserved for
the experiment, and your unix account on those nodes will be
......
......@@ -7,8 +7,21 @@
<?php
$returning=0;
$my_passwd = $password1;
$salt = strlen("$grp_head_uid");
$enc = crypt("$my_passwd",$salt);
$mypipe = popen(escapeshellcmd(
"/usr/testbed/bin/checkpass $my_passwd $grp_head_uid '$usr_name:$email'"),
"w+");
if ($mypipe) {
$retval=fgets($mypipe,1024);
if (strcmp($retval,"ok\n")!=0) {
die("<h3>The password you have chosen will not work:<p>$retval</h3>");
}
} else {
mail("newbold@cs.utah.edu","TESTBED: checkpass failure",
"\n$usr_name ($grp_head_uid) just tried to set up a testbed account,\n".
"but checkpass pipe did not open (returned '$mypipe').\n".
"\nThanks,\nMac\n");
}
$enc = crypt("$my_passwd");
array_walk($HTTP_POST_VARS, 'addslashes');
if (isset($gid) && isset($password1) && isset($email) &&
(($password1 == $password2) || ($enc == $password2))) {
......@@ -19,14 +32,14 @@ if (isset($gid) && isset($password1) && isset($email) &&
$result2 = mysql_db_query("tbdb", $query2);
if ($row = mysql_fetch_row($result2)) {
die("<h3>The group name you have chosen is already in use. ".
"Please select another. If you are a returning user, you must "
"log in and use your current password.</h3>");
"Please select another. If you are a returning user, you must ".
"log in and use your current password.</h3>");
} elseif ($row = mysql_fetch_row($result)) {
#returning user, making new group
$usr_pswd = $row[0];
if ($usr_pswd != $enc) {
die("<H3>The username that you have chosen is already in use. ".
"Please select another. If you are a returning user, you must "
"Please select another. If you are a returning user, you must ".
"log in and use your current password.</h3>\n");
}
$returning=1;
......
......@@ -11,17 +11,21 @@ if (isset($login)) {
unset($login);
if (isset($auth_usr)) {
addslashes($auth_usr);
$PSWD = crypt("$auth_passwd", strlen($auth_usr));
#echo "<pre>GOT PWD $PSWD</pre>";
$query = "SELECT * FROM users WHERE uid=\"$auth_usr\" ".
"AND usr_pswd=\"$PSWD\"";
$query = "SELECT usr_pswd FROM users WHERE uid=\"$auth_usr\"";
$result = mysql_db_query("tbdb", $query);
$correct = mysql_num_rows($result);
if ($correct) {
$row = mysql_fetch_row($result);
$usr_pswd = $row[0];
#print "Got $usr_pswd from Database\n<br>";
$salt = substr($usr_pswd,0,2);
if ($salt[0] == $salt[1]) { $salt = $salt[0]; }
#print "Got $salt for salt\n<br>";
$PSWD = crypt("$auth_passwd",$salt);
#echo "<pre>GOT PWD $PSWD</pre>";
if ($PSWD == $usr_pswd) {
$query2 = "SELECT timeout FROM login WHERE uid=\"$auth_usr\"";
$result2 = mysql_db_query("tbdb", $query2);
$exists = mysql_num_rows($result2);
$timeout = time() + 600;
$timeout = time() + 86400;
if ($exists) {
$cmnd="update login set timeout='$timeout' where uid='$auth_usr'";
mysql_db_query("tbdb", $cmnd);
......@@ -67,7 +71,7 @@ Please log in again.</h3>\n";
$cmnd = "DELETE FROM login WHERE uid=\"$auth_usr\"";
mysql_db_query("tbdb", $cmnd);
} else {
$timeout = time() + 600;
$timeout = time() + 86400;
$cmnd = "UPDATE login SET timeout=\"$timeout\" where uid=\"$auth_usr\"";
mysql_db_query("tbdb", $cmnd);
}
......@@ -79,12 +83,30 @@ if (isset($auth_usr)) {
$result = mysql_db_query("tbdb", $query);
$status_row = mysql_fetch_row($result);
$status = $status_row[0];
$query="SELECT trust FROM grp_memb WHERE uid='$auth_usr'";
$result = mysql_db_query("tbdb", $query);
$row = mysql_fetch_row($result);
$trust = $row[0];
if ($status == "active") {
#echo "<p><A href='modify.html'>Update user information</A></p>\n";
#echo "<p><A href='addusr.php3?$auth_usr'>Add a user to your group</A></p>";
#echo "<p><A href='addproj.php3?$auth_usr'>Begin a project</A></p>\n";
#echo "<p><A href='addexp.php3?$auth_usr'>Begin an experiment</A></p>\n";
echo "<A href='approval.php3?$auth_usr'>New User Approval</A>\n";
if ($trust == "group_root") {
# Only group leaders can do these options
echo "<A href='approval.php3?$auth_usr'>New User Approval</A>\n";
echo "<p>Add a New User";
#echo "<p><A href='addusr.php3?$auth_usr'>Add a New User</A>";
echo "<p>Begin a Project";
#echo "<p><A href='addproj.php3?$auth_usr'>Begin a Project</A>\n";
echo "</p>";
}
if (($trust == "group_root") || ($trust == "local_root")) {
# Only local root people can do these options
echo "Begin an Experiment";
#echo "<p><A href='addexp.php3?$auth_usr'>Begin an Experiment</A>\n";
echo "</p>";
}
# Every active user can do these options
echo "<b>Update user information";
#echo "<p><A href='modify.html'>Update user information</A>\n";
echo "</p>\n";
} elseif ($status == "unapproved") {
echo "Your account has not been approved yet. Please try back ";
echo "later. Contact ";
......@@ -106,10 +128,10 @@ if (isset($auth_usr)) {
<?php
echo "<A href='addgrp.php3";
if (isset($auth_usr)) { echo "?$auth_usr"; }
echo "'>Apply for a Group</A>\n";
echo "'>Apply to Start a Project</A>\n";
echo "<p><A href='addusr.php3";
if (isset($auth_usr)) { echo "?$auth_usr"; }
echo "'>Apply for Group Membership</A>";
echo "'>Apply to Join a Project</A>";
?>
<hr><A href='faq.html'>Frequently<br>Asked<br>Questions</a></p>
<table cellpadding='0' cellspacing='0' width="100%">
......@@ -118,7 +140,7 @@ echo "'>Apply for Group Membership</A>";
if (!isset($auth_usr)) {
echo "<tr><td>Username:<input type='text' name='auth_usr' size=8></td></tr><tr><td>Password:<input type='password' name='auth_passwd' size=8></td></tr><tr><td align='center'><b><input type='submit' value='Login' name='login'></td></tr></b>";
} else {
echo "<tr><td align='center'><b><input type='submit' value='Logout' name='logout'></b></td></tr>";
echo "<tr><td><input type='hidden' name='auth_usr' value='$auth_usr'</td><td align='center'><b><input type='submit' value='Logout' name='logout'></b></td></tr>";
}
?>
</form>
......
......@@ -25,7 +25,7 @@ Please log in again.</h3>\n</body></html>";
mysql_db_query("tbdb", $cmnd);
exit;
} else {
$timeout = time() + 600;
$timeout = time() + 86400;
$cmnd = "UPDATE login SET timeout=\"$timeout\" where uid=\"$auth_usr\"";
mysql_db_query("tbdb", $cmnd);
}
......
......@@ -26,7 +26,7 @@ Please log in again.</h3>\n</body></html>";
mysql_db_query("tbdb", $cmnd);
exit;
} else {
$timeout = time() + 600;
$timeout = time() + 86400;
$cmnd = "UPDATE login SET timeout=\"$timeout\" where uid=\"$auth_usr\"";
mysql_db_query("tbdb", $cmnd);
}
......
......@@ -5,11 +5,7 @@
<base href='https://plastic.cs.utah.edu/' target='dynamic'>
</head>
<body>
<h1>Utah Network Testbed</h1>
<h3>Welcome to the Utah Network Testbed. Yadda yadda, ...</h3>
<tt>SEE ALSO <a href="faq.html">faq.html</a>...</tt>
<h1>Welcome to Testbed Control</h1>
<h2>What is the Testbed?</h2>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment