showlasterror.php3 1.27 KB
Newer Older
Kevin Atkinson's avatar
 
Kevin Atkinson committed
1
2
3
<?php
#
# EMULAB-COPYRIGHT
4
# Copyright (c) 2000-2007 University of Utah and the Flux Group.
Kevin Atkinson's avatar
 
Kevin Atkinson committed
5
6
7
8
9
10
11
12
13
14
# All rights reserved.
#
include("defs.php3");

#
# Standard Testbed Header
#
PAGEHEADER("Last Error");

#
15
# Only known and logged in users.
Kevin Atkinson's avatar
 
Kevin Atkinson committed
16
#
17
18
19
$this_user = CheckLoginOrDie();
$uid       = $this_user->uid();
$isadmin   = ISADMIN();
Kevin Atkinson's avatar
 
Kevin Atkinson committed
20
21
22
23

#
# Verify page arguments.
#
24
$reqargs = RequiredPageArguments("experiment", PAGEARG_EXPERIMENT);
25
$exptidx = $experiment->idx();
Kevin Atkinson's avatar
 
Kevin Atkinson committed
26
27

#
28
# Must have permission to view experiment details.
Kevin Atkinson's avatar
 
Kevin Atkinson committed
29
#
30
31
32
if (!$isadmin &&
    !$experiment->AccessCheck($this_user, $TB_EXPT_READINFO)) {
    USERERROR("You do not have permission to view experiment last error!", 1);
Kevin Atkinson's avatar
 
Kevin Atkinson committed
33
34
35
}

$query_result =
36
37
38
39
    DBQueryFatal("select e.cause,e.confidence,e.mesg,cause_desc ".
		 "   from experiment_stats as s,errors as e, causes as c ".
	         "where s.exptidx = $exptidx and e.cause = c.cause and ".
		 "      s.last_error = e.session and rank = 0");
Kevin Atkinson's avatar
 
Kevin Atkinson committed
40
41
42
43
44

if (mysql_num_rows($query_result) != 0) {
  $row = mysql_fetch_array($query_result);
  echo "<h2>$row[cause_desc]</h2>\n";
  echo "<pre>\n";
Leigh B. Stoller's avatar
Leigh B. Stoller committed
45
  echo htmlspecialchars($row["mesg"])."\n";
Kevin Atkinson's avatar
 
Kevin Atkinson committed
46
47
48
49
50
51
52
53
54
55
56
57
58
  echo "\n";
  echo "Cause: $row[cause]\n";
  echo "Confidence: $row[confidence]\n";
  echo "</pre>\n";
} else {
  echo "Nothing\n";
}

#
# Standard Testbed Footer
# 
PAGEFOOTER();
?>