Commit a3ad4628 authored by Leigh B. Stoller's avatar Leigh B. Stoller
Browse files

Jezz, what did I do. I messed up this file completely.

parent 958ab56a
<html>
<head>
<title>Start a New Project</title>
<link rel="stylesheet" href="tbstyle.css" type="text/css">
<title>New Users Approved</title>
<link rel='stylesheet' href='tbstyle.css' type='text/css'>
</head>
<body>
<?php
include("defs.php3");
$auth_usr = "";
if ( ereg("php3\?([[:alnum:]]+)",$REQUEST_URI,$Vals) ) {
$auth_usr=$Vals[1];
addslashes($auth_usr);
} else {
unset($auth_usr);
}
$row = 0;
if (isset($auth_usr)) {
$uid = addslashes($auth_usr);
$query_result = mysql_db_query($TBDBNAME,
"SELECT * FROM users WHERE uid=\"$uid\"");
if (! $query_result) {
$err = mysql_error();
TBERROR("Database Error getting info for $uid: $err\n", 1);
$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);
}
$row = mysql_fetch_array($query_result);
}
$expiretime = date("m/d/Y", time() + (86400 * 90));
?>
<table align="center" border="1">
<tr>
<td colspan="4">
<h1 align="center">Apply to Use the Utah Network Testbed</h1>
</td>
</tr>
<tr>
<td align="center" colspan="4">
Fields marked with * are required;
those marked + are highly recommended.
</td>
</tr>
<form action=grpadded.php3 method="post">
<tr>
<td colspan=2>
Project Information <em>(replace the example entries)</em>
</td>
<td colspan=2>
Project Head Information
</td>
</tr>
<?php
#
# Name: and Username:
#
echo "<tr>
<td>*Name (no blanks):</td>
<td><input type=\"text\" name=\"gid\" value=\"ucb-omcast\"></td>
<td>*Username:</td>
<td class=\"left\">
<input name=\"grp_head_uid\"";
if ($row) {
echo "type=\"readonly\" value=\"$row[uid]\">";
}
else {
echo "type=\"text\">";
}
echo " </td>
</tr>\n";
#
# Long Name: and Full Name:
#
echo "<tr>
<td>*Long name:</td>
<td><input type=\"text\" name=\"grp_name\"
value=\"UCB Overlay Multicast\"></td>
<td>*Full Name:</td>
<td class=\"left\">
<input name=\"usr_name\"";
if ($row) {
echo " type=\"readonly\" value=\"$row[usr_name]\">";
}
} else {
echo " type=\"text\">";
}
echo " </td>
</tr>\n";
#
# URL: and Title/Position:
#
echo "<tr>
<td>+URL:</td>
<td><input type=\"text\" name=\"grp_URL\"
value=\"http://www.cs.berkeley.edu/netgrp/omcast/\"></td>
<td>*Title/Position:</td>
<td class=\"left\">
<input name=\"usr_title\"";
if ($row) {
echo " type=\"readonly\" value=\"$row[usr_title]\">";
} else {
echo " type=\"text\" value=\"Professor Emeritus\">";
}
echo " </td>
</tr>\n";
#
# Expires: and Affiliation:
#
echo "<tr>
<td>When do&nbsp;you<br>
expect&nbsp;to&nbsp;be&nbsp;done<br>
using&nbsp;the&nbsp;testbed?</td>
<td><input type=\"text\" name=\"grp_expires\"
value=\"$expiretime\"></td>
<td>*Institutional<br>Affiliation:</td>
<td class=\"left\">
<input name=\"usr_affil\"";
if ($row) {
echo " type=\"readonly\" value=\"$row[usr_affil]\">";
} else {
echo " type=\"text\" value=\"UCB Networks Group\">";
}
echo " </td>
</tr>\n";
#
# Blank and Email:
#
echo "<tr>
<td></td>
<td></td>
<td>*Email<br>Address:</td>
<td class=\"left\">
<input name=\"email\"";
if ($row) {
echo " type=\"readonly\" value=\"$row[usr_email]\">";
} else {
echo " type=\"text\">";
}
echo " </td>
</tr>\n";
#
# Password and Postal Address:
#
echo "<tr>
<td>*Password:</td>
<td><input type=\"password\" name=\"password1\"></td>
<td>*Postal<br>Address:</td>
<td class=\"left\">
<input name=\"usr_addr\"";
if ($row) {
echo " type=\"readonly\" value=\"$row[usr_addr]\">";
} else {
echo " type=\"text\">";
unset($auth_usr);
}
echo " </td>
</tr>\n";
#
# If a new usr, then provide a second password confirmation field.
# Otherwise, a blank spot.
#
echo "<tr>";
if (! $row) {
echo "<td>*Retype<br>New Password:</td>
<td class=\"left\">
<input type=\"password\" name=\"password2\"></td>";
echo "
<h1>Approving new users...</h1>
";
$query="SELECT gid FROM grp_memb WHERE uid='$auth_usr' and trust='group_root'";
$result = mysql_db_query("tbdb", $query);
$select = "SELECT";
$group[0]="";
$n=0;
while ($row = mysql_fetch_row($result)) {
$gid = $row[0];
$group[$n]=$gid;
$n = $n + 1;
if ($select == "SELECT") {
$select .= " DISTINCT uid FROM grp_memb WHERE gid='$gid'";
} else {
$select .= " OR gid='$gid'";
}
}
else {
echo "<td></td>
<td></td>";
$selected = mysql_db_query("tbdb", $select);
$find = "SELECT";
while ($row = mysql_fetch_row($selected)) {
$uid = $row[0];
if ($find == "SELECT") {
$find .= " DISTINCT uid,status,usr_email FROM users WHERE (status='newuser' OR status='unapproved') AND (uid='$uid'";
} else {
$find .= " OR uid='$uid'";
}
}
echo " <td>*Phone #:</td>
<td class=\"left\">
<input name=\"usr_phones\"";
if ($row) {
echo " type=\"readonly\" value=\"$row[usr_phone]\">";
} else {
echo " type=\"text\">";
$find .= ")";
$found = mysql_db_query("tbdb", $find);
while ($row = mysql_fetch_row($found)) {
$uid = $row[0];
$status=$row[1];
$email=$row[2];
$cmd = "select gid from grp_memb where uid='$uid' and trust='none' and (";
$cmd .= "gid='$group[0]'";
$n=1;
while ( isset($group[$n]) ) { $cmd .= " or gid='$group[$n]'"; $n++; }
$cmd .=")";
$result = mysql_db_query("tbdb",$cmd);
$row=mysql_fetch_row($result);
$gid=$row[0];
if (isset($$uid)) {
if ( $$uid == "approve") {
$trust=${"$uid-trust"};
if ($status=="newuser") {
$newstatus='unverified';
} else { #Status is 'unapproved'
$newstatus='active';
}
$cmd = "update users set status='$newstatus' where uid='$uid'";
$cmd .= "and status='$status'";
$result = mysql_db_query("tbdb",$cmd);
$cmd = "update grp_memb set trust='$trust' where uid='$uid'";
$cmd .= "and trust='none' and gid='$gid'";
$result = mysql_db_query("tbdb",$cmd);
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.".
"\n\nThanks,\nTestbed Ops\nUtah Network Testbed\n",
"From: Testbed Ops <testbed-ops@flux.cs.utah.edu>\n".
"Cc: Testbed WWW <testbed-www@flux.cs.utah.edu>\n".
"Errors-To: Testbed WWW <testbed-www@flux.cs.utah.edu>");
echo "<h3><p>User $uid was changed to status $newstatus and ";
echo "granted $trust permissions for group $gid.</p></h3>\n";
} elseif ( $$uid == "deny") {
# Delete all rows from grp memb that are for that person, no privs
# and one of the groups that the user is a leader of
$cmd = "delete from grp_memb where uid='$uid' and trust='none' and (";
$cmd .= "gid='$group[0]'";
$n=1;
while ( isset($group[$n]) ) { $cmd .= " or gid='$group[$n]'"; $n++; }
$cmd .=")";
$result = mysql_db_query("tbdb",$cmd);
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.".
"\n\nThanks,\nTestbed Ops\nUtah Network Testbed\n",
"From: Testbed Ops <testbed-ops@flux.cs.utah.edu>\n".
"Cc: Testbed WWW <testbed-www@flux.cs.utah.edu>\n".
"Errors-To: Testbed WWW <testbed-www@flux.cs.utah.edu>");
echo "<h3><p>User $uid was denied membership in your group.</p></h3>\n";
} else {
echo "<h3><p>User $uid was postponed for later decision.</p></h3>\n";
}
}
}
echo " </td>
</tr>\n";
?>
<tr>
<td colspan="4">
*Please describe how and why you'd like
to use the testbed, including an estimate of the number of nodes
and their type.<br> If the research is sponsored (funded),
list the sponsors.</td>
</tr>
<tr>
<td colspan="4" align="center" class="left">
<textarea name="why" rows="10" cols="70"></textarea></td>
</tr>
<tr>
<td colspan="4" align="center">
<b><input type="submit" value="Submit"></b></td>
</tr>
</form>
</table>
echo "
</body>
</html>
</html>";
?>
Supports Markdown
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