Commit cb7f8fe9 authored by Leigh B. Stoller's avatar Leigh B. Stoller

Rework the add project page.

parent 93d0244c
<html>
<head>
<title>New Project</title>
<title>Start a New Project</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];
......@@ -12,95 +14,164 @@ if ( ereg("php3\?([[:alnum:]]+)",$REQUEST_URI,$Vals) ) {
} 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);
}
$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&nbsp;Network&nbsp;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>
<tr><td>*Name (no blanks):</td><td><input type="text" name="gid" value="ucb-omcast">
</td>
<td>*Username:</td><td class="left">
<?php
if (isset($auth_usr)) {
/* if this person is logged into the database,
fill the user info fields with info from the database */
$uid = addslashes($auth_usr);
$query = "SELECT * FROM users WHERE uid=\"$uid\"";
$result = mysql_db_query("tbdb", $query);
$row = mysql_fetch_array($result);
echo "<input type=\"readonly\" value=\"$row[uid]\" name=\"grp_head_uid\"></td></tr>\n";
} else {
echo "<input type=\"text\" name=\"grp_head_uid\"></td></tr>\n";
}
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\">";
if (isset($row)) {
echo "<input type=\"readonly\" value=\"$row[usr_name]\"";
<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
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";
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 "<input type=\"text\"";
echo " type=\"text\">";
}
echo "name=\"usr_name\"></td></tr>
<tr><td>+URL:</td><td><input type=\"text\" name=\"grp_URL\"
value=\"http://www.cs.berkeley.edu/netgrp/omcast/\">
</td>
<td>*Email<br>Address:</td><td class=\"left\">";
if (isset($row)) {
echo "<input type=\"readonly\" value=\"$row[usr_email]\" ";
echo " </td>
</tr>\n";
echo "<tr>
<td>+URL:</td>
<td><input type=\"text\" name=\"grp_URL\"
value=\"http://www.cs.berkeley.edu/netgrp/omcast/\"></td>
<td>*Email<br>Address:</td>
<td class=\"left\">
<input name=\"email\"";
if ($row) {
echo " type=\"readonly\" value=\"$row[usr_email]\">";
} else {
echo "<input type=\"text\" ";
echo " type=\"text\">";
}
echo "name=\"email\"></td></tr>
<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\" value="; #set a default expiration date
$mytime = date("m/d/Y", time() + (86400 * 90)); #add 30 days
echo "\"$mytime\"";
echo "name=\"grp_expires\"></td>
<td>*Postal<br>Address:</td><td class=\"left\">";
if (isset($row)) {
echo "<input type=\"readonly\" value=\"$row[usr_addr]\" name=\"usr_addr\">";
echo " </td>
</tr>\n";
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>*Postal<br>Address:</td>
<td class=\"left\">
<input name=\"usr_addr\"";
if ($row) {
echo " type=\"readonly\" value=\"$row[usr_addr]\">";
} else {
echo "<input type=\"text\" name=\"usr_addr\">";
echo " type=\"text\">";
}
echo "</td></tr>
<tr><td>*Your institutional<br>affiliation:</td><td><input type=\"text\" name=\"grp_affil\" value=\"UCB Networks Group\"></td>
<td>*Phone #:</td><td class=\"left\"><input ";
if (isset($row)) {
echo "type=\"readonly\" value=\"$row[usr_phone]\"";
echo " </td>
</tr>\n";
echo "<tr>
<td>*Your institutional<br>affiliation:</td>
<td><input type=\"text\" name=\"grp_affil\"
value=\"UCB Networks Group\"></td>
<td>*Phone #:</td>
<td class=\"left\">
<input name=\"usr_phones\"";
if ($row) {
echo " type=\"readonly\" value=\"$row[usr_phone]\">";
} else {
echo "type=\"text\"";
}
echo "name=\"usr_phones\"></td></tr>\n";
echo " type=\"text\">";
}
echo " </td>
</tr>\n";
echo "<tr>
<td>*Password:</td>
<td><input type=\"password\" name=\"password1\"></td>
</tr>\n";
#
# If a new usr, then provide a second password confirmation field.
#
if ($row) {
echo "<tr>
<td>Retype<br>New Password:</td>
<td class=\"left\">
<input type=\"password\" name=\"password2\"></td>
</tr>\n";
}
?>
<tr>
<td>*Password:</td><td><input type="password" name="password1"></td>
<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>*Retype<br>Password:</td><td><input
<?php
if (isset($row)) {
echo "type=\"hidden\" value=\"$row[usr_pswd]\"";
} else {
echo "type=\"password\"";
}
?>
name="password2">&nbsp;</td></tr>
<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. If the research is sponsored (funded),
list the sponsors.
</td></tr>
<tr><td colspan="4" 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>
<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>
</table>
</body>
</html>
......@@ -53,21 +53,17 @@ if (!isset($usr_phones) ||
$formerror = "Phone #";
}
#
# Not sure about the passwd. If the user is already known, then is he
# supposed to plug his passwd in?
# The first password field must always be filled in. The second only
# if a new user, and we will catch that later.
#
if ((!isset($password1) || strcmp($password1, "") == 0) ||
(!isset($password2) || strcmp($password2, "") == 0)) {
if (!isset($password1) ||
strcmp($password1, "") == 0)
$formerror = "Password";
}
if ($formerror != "No Error") {
echo "<h3><br><br>
Missing field; Please go back and fill out the \"$formerror\" field!\n
</h3>
</body>
</html>";
die("");
USERERROR("Missing field; ".
"Please go back and fill out the \"$formerror\" field!", 1);
}
#
......@@ -77,10 +73,8 @@ $project_query = "SELECT gid FROM groups WHERE gid=\"$gid\"";
$project_result = mysql_db_query($TBDBNAME, $project_query);
if ($row = mysql_fetch_row($project_result)) {
die("<h3><br><br>".
"The project name \"$gid\" you have chosen is already in use. ".
"Please select another.\n".
"</h3>");
USERERROR("The project name \"$gid\" you have chosen is already in use. ".
"Please select another.", 1);
}
#
......@@ -100,19 +94,16 @@ if ($row = mysql_fetch_row($pswd_result)) {
if ($salt[0] == $salt[1]) { $salt = $salt[0]; }
$encoding = crypt("$password1", $salt);
if (strcmp($encoding, $db_encoding)) {
die("<h3><br><br>".
"The password provided was incorrect. ".
"Please go back and retype the password.\n".
"</h3>");
USERERROR("The password provided was incorrect. ".
"Please go back and retype the password.", 1);
}
$returning = 1;
}
else {
if (strcmp($password1, $password2)) {
die("<h3><br><br>".
"You typed different passwords in each of the two password ".
"entry fields. <br> Please go back and correct them.\n".
"</h3>");
USERERROR("You typed different passwords in each of the two password ".
"entry fields. <br> Please go back and correct them.",
1);
}
$mypipe = popen(escapeshellcmd(
"/usr/testbed/bin/checkpass $password1 $grp_head_uid '$usr_name:$email'"),
......@@ -120,18 +111,15 @@ else {
if ($mypipe) {
$retval=fgets($mypipe, 1024);
if (strcmp($retval,"ok\n") != 0) {
die("<h3><br><br>".
"The password you have chosen will not work: ".
"<br><br>$retval<br>".
"</h3>");
USERERROR("The password you have chosen will not work: ".
"<br><br>$retval<br>", 1);
}
}
else {
mail($TBMAIL_WWW, "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\n");
TBERROR("TESTBED: checkpass failure\n".
"\n$usr_name ($grp_head_uid) just tried to set up a testbed ".
"account,\n".
"but checkpass pipe did not open (returned '$mypipe').", 1);
}
$returning = 0;
}
......
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