This repository has been archived by the owner on Aug 27, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
37081a1
commit 1252f86
Showing
2 changed files
with
151 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
<?php | ||
|
||
require_once "../login.php"; | ||
require_once "../teacher/defs.php"; | ||
|
||
use \ScA\Student\TGLogin\TGLogin; | ||
use \ScA\Teacher; | ||
|
||
$is_logged_in = (TGLogin::from_cookie() != NULL) || (Teacher\is_logged_in()); | ||
|
||
if (!$is_logged_in) { | ||
header("Location: ../?nauth"); | ||
exit; | ||
} | ||
|
||
|
||
require_once "../defs.php"; | ||
|
||
use const ScA\DB; | ||
use const ScA\DB_HOST; | ||
use const ScA\DB_PWD; | ||
use const ScA\DB_USER; | ||
|
||
$table = 'actions'; | ||
|
||
$conn = new mysqli(DB_HOST, DB_USER, DB_PWD, DB); | ||
|
||
// Check connection | ||
if ($conn->connect_error) { | ||
die("Connection failed: " . $conn->connect_error); | ||
} | ||
|
||
?> | ||
|
||
<html lang='en'> | ||
|
||
<head> | ||
<meta charset="utf-8"> | ||
<title>XII Sc A - actions</title> | ||
<script src='script.js'> | ||
</script> | ||
<link rel='stylesheet' type='text/css' href='stylesheet.css' /> | ||
</head> | ||
|
||
<body onload="clean()"> | ||
|
||
<h1 align='center'>XII Sc A - actions</h1> | ||
<hr /> | ||
<p align='center'> | ||
<i> | ||
<?php | ||
date_default_timezone_set("Asia/Kolkata"); | ||
echo "Report generated on " . date("d M Y h:i:sa") . " IST." | ||
?> | ||
</i> | ||
<hr /> | ||
</p> | ||
|
||
<?php | ||
// Query | ||
$result = $conn->query("SELECT * FROM {$table} ORDER BY `{$table}`.`Timestamp` ASC"); | ||
|
||
if (!$result) { | ||
die("Query to show fields from table failed."); | ||
} | ||
|
||
echo " | ||
<div class='tab' id='{$sub}'> | ||
<table> | ||
<tr> | ||
<th>Timestamp</th> | ||
<th>Action</th> | ||
<th>Log</th> | ||
</tr>"; | ||
|
||
while ($action = $result->fetch_assoc()) { | ||
echo "<tr>"; | ||
|
||
echo "<td>" . $action["Timestamp"] . "</td>"; | ||
echo "<td>" . $action["Action"] . "</td>"; | ||
|
||
if ($r = $action["Log"]) { | ||
$r = str_replace("\n", "\n<br/>", htmlspecialchars($r)); | ||
echo "<td class='code'>{$r}</td>"; | ||
} else { | ||
echo "<td></td>"; | ||
} | ||
|
||
echo "</tr>"; | ||
} | ||
|
||
echo "</table>"; | ||
$result->free(); | ||
|
||
|
||
?> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
body { | ||
background-color: #222222; | ||
font-family: "Arial", "Courier", "Letter Gothic"; | ||
color: #BBBBBB; | ||
} | ||
|
||
p { | ||
text-align: center; | ||
} | ||
|
||
.center { | ||
margin: auto; | ||
} | ||
|
||
|
||
table { | ||
margin: auto; | ||
border-style: solid; | ||
color: #BFBFBF; | ||
border-collapse: collapse; | ||
} | ||
|
||
th { | ||
padding: 15px 20px; | ||
border-style: solid; | ||
} | ||
|
||
tr { | ||
border-style: solid; | ||
} | ||
|
||
td { | ||
padding: 10px 15px; | ||
border-style: solid; | ||
text-align: center; | ||
vertical-align: middle; | ||
} | ||
|
||
h1 { | ||
margin: auto; | ||
padding: 10px 0px; | ||
} | ||
|
||
hr { | ||
color: #888888; | ||
fill: #888888; | ||
} | ||
|
||
.code { | ||
font-family: "Consolas"; | ||
text-align: left; | ||
} |