Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!doctype html>
- <?php
- session_start();
- if(isset($_SESSION['status'])) {
- echo "<br>currently logged in: " . $_SESSION["name"] . ".<br>";
- }
- else
- {
- session_destroy();
- header("Location: runnerLoginForm.html");
- }
- ?>
- <html>
- <head>
- <meta charset="utf-8">
- <title>Untitled Document</title>
- </head>
- <body>
- <style>
- body, html {
- height: 100%;
- background-color: azure;
- font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
- text-align: center;
- }
- div {
- border: 1px solid gray;
- padding: 8px;
- }
- h1 {
- text-align: center;
- text-transform: uppercase;
- color: #4CAF50;
- letter-spacing: 10px;
- text-size: 20px;
- }
- p {
- text-align: center;
- letter-spacing: 3px;
- }
- td, th {
- border: 1px solid green;
- padding: 0.5rem;
- text-align: center;
- }
- table {
- border-collapse: collapse;
- }
- a:link, a:visited {
- background-color: #4CAF50;
- color: white;
- padding: 14px 25px;
- text-align: center;
- text-decoration: none;
- display: inline-block;
- }
- a:hover, a:active {
- background-color: #4CAF50;
- }
- </style>
- </style>
- <h1>XC Attendance
- </h1>
- <p>
- <a href="runnerHome.php">Your Log</a>
- <a href="absencePostForm.html">Post your absence</a>
- <a href="runnerHome.php?hello=true">Logout</a>
- </p>
- <br>
- <?php
- function logout() {
- session_destroy();
- //echo "refreshing";
- header("Location: auctionLoginForm.html");
- }
- if (isset($_GET['hello']))
- {
- logout();
- //setcookie("user", "", time() - 3600);
- }
- echo "<br>currently logged in: " . $_SESSION["name"] . "<br>";
- function sanitize($data)
- {
- // apply stripslashes if magic_quotes_gpc is enabled
- if(get_magic_quotes_gpc())
- {
- $data = stripslashes($data);
- }
- return $data;
- }
- $pers = $_SESSION["name"];
- $servername = "localhost";
- $username = "playground18";
- $password = "Cdz5SOVrY2p8fnWS";
- $dbname = "playground18";
- $date = $_GET['date'];
- $description = $_GET['description'];
- try {
- $conn = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password);
- // set the PDO error mode to exception
- $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
- $sql = "INSERT INTO tanay_xcatt_absences (person, absence_date, explanation)
- VALUES ('$pers', '$date', '$description')";
- // use exec() because no results are returned
- $conn->exec($sql);
- echo "New absence posted successfully";
- }
- catch(PDOException $e)
- {
- echo $sql . "<br>" . $e->getMessage();
- }
- $conn = null;
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement