";
if (!CheckUsernameAndPassword($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW'], GetLDAPOptions()))
return;
}
if (!empty($_GET["fComment"]))
{
include("db2.php");
$db_id = mysql_pconnect($host, $user, $pw);
if ($db_id==FALSE)
{
printf("mysql_connect returned the following error: %s\n", mysql_error());
die("");
}
mysql_select_db($db);
//for insert
if (strcmp($_GET["fMode"], "insert")==0)
$query0 = "INSERT RunComments SET ";
//for update
if (strcmp($_GET["fMode"], "update")==0)
$query0 = "UPDATE RunComments SET ";
//for both
$query0.= " fComment='".str_replace("'", "\'", $_GET["fComment"])."'";
$query0.= ", fUser='".$_SERVER['PHP_AUTH_USER']."'";
//for insert
if (strcmp($_GET["fMode"], "insert")==0)
{
$query0.=", fRunNumber=".$_GET["fRunNumber"];
$query0.= ", fFileNumber=".$_GET["fFileNumber"];
}
//for update
if (strcmp($_GET["fMode"], "update")==0)
{
$query2="SELECT fCommentKEY FROM RunComments ";
$query2.=" WHERE fRunNumber=".$_GET["fRunNumber"];
$query2.=" AND fFileNumber=".$_GET["fFileNumber"];
$query2.=" AND fComment='".str_replace("'", "\'", $_GET["fOldComment"])."'";
$result2=mysql_query($query2, $db_id);
$row2 = mysql_fetch_row($result2);
$commentkey=$row2[0];
mysql_free_result($result2);
$query0.=" WHERE fCommentKEY=".$commentkey;
}
$result0=mysql_query($query0, $db_id);
mysql_close($db_id);
}
}
//
// display part
//
include("db.php");
if (strcmp($_GET["fMode"], "tooltip")!=0)
{
printf("With this page, you can \n");
//view mode
if (strcmp($_GET["fMode"], "view")==0)
printf("view,\n");
else
printf("view,\n", str_replace($_GET["fMode"], 'view', $_SERVER['REQUEST_URI']));
//update mode
if (strcmp($_GET["fMode"], "update")==0)
printf("update and\n");
else
printf("update and \n", str_replace($_GET["fMode"], 'update', $_SERVER['REQUEST_URI']));
//insert mode
if (strcmp($_GET["fMode"], "insert")==0)
printf("insert\n");
else
printf("insert \n", str_replace($_GET["fMode"], 'insert', $_SERVER['REQUEST_URI']));
printf("entries in the table RunComment from the DB %s.
\n", $db);
//insert field for run number
printf("
Run# | Comment |
\n%s\n | \n", $row1[1]); printf("|
%s_%s | \n", $_GET["fRunNumber"], $_GET["fFileNumber"]); printf("\n"); printf("\n"); printf(" | \n"); printf("