Black Eagle Team Minishell
Path:
/
home
/
c
/
c
/
p
/
ccpsafy
/
www.old
/
VSEL
/
[
Home
]
File: admin.php.old
<?php session_start(); header("Cache-control: private"); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> <title>VSEL Admin</title> <link rel="stylesheet" href="styles.css" type="text/css"> </head> <!-- Very Simple Events List v1.01 Copyright (C) 2006 Eric Kittell, eric@ekittell.com This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Mar 15, 2006 version 1.01 added minutes, option to hide time, and cleaned up code --> <body> <?php include 'config.php'; // AUTHENTICATION if (isset($_POST['pw'])) { $pw = $_POST['pw']; $_SESSION['pw'] = $pw; } elseif (isset($_GET['pw'])) { $pw = $_GET['pw']; $_SESSION['pw'] = $pw; } elseif (isset($_SESSION['pw'])) { $pw = $_SESSION['pw']; } if ($pw == $adminpass) { include 'library/opendb.php'; include 'library/timeFunctions.php'; include 'library/displayFunctions.php'; // get variables from form post for which record to change, and what to do with it $action = $_GET['action']; $id = $_GET['id']; // THE DELETE OPTION if($action == 'delete') { // set up delete query $query = "DELETE FROM events WHERE id =" . $id; // do the query mysql_query($query) or die('Error, query failed'); echo "event deleted successfully!<br><br><a href='admin.php'>add a new event</a>"; } // THE ADD OR EDIT OPTION elseif (isset($_POST['add']) || isset($_POST['edit'])) { // get date from form post $date = $_POST['year'] . '-' . $_POST['month'] . '-' . $_POST['day']; // get time from form post $rawTime = $_POST['time']; // convert time to MySQL format if($rawTime > 11 ) { $rawTime = '0'; } $time = ($rawTime + $_POST['ampm']) . ':' . $_POST['minute'] . ':00'; // get showTime $showTime = $_POST['showTime']; // showTime to 1 or 0 if ($showTime == "on") { $showTime = 1; } else { $showtime = 0; } // get venue $venue = $_POST['venue']; // get description $description = $_POST['description']; // set up insert query if (isset($_POST['add'])) { $query = "INSERT INTO events (date, time, showTime, venue, description) VALUES ('$date', '$time', '$showTime', '$venue', '$description')"; } // set up update query elseif (isset($_POST['edit'])) { $query = "UPDATE events SET date = '$date', time = '$time', showTime = '$showTime', venue = '$venue', description = '$description' WHERE id ='$id'"; } // do the query mysql_query($query) or die('Error, insert query failed'); echo "events list updated successfully!<br><br><a href='admin.php'>add a new event</a>"; } // ADD/EDIT FORM else { // load stored values for editing event if($action == 'edit') { $query = "SELECT * FROM events WHERE id='$id'"; $result = mysql_query($query); $date = mysql_result($result,0,"date"); $time = mysql_result($result,0,"time"); $venue = mysql_result($result,0,"venue"); $description = mysql_result($result,0,"description"); $month = substr($date, 5, 2); $day = substr($date, 8, 2); $year = substr($date, 0, 4); $hour = realHour($time); $minute = substr($time, 3, 2); $ampm = realAMPM($time); $showTime = mysql_result($result,0,"showTime"); } ?> <form method="post"> <table width="400" border="0" cellspacing="1" cellpadding="2"> <tr> <td width="100">Date</td> <td> <select name="month" id="month"> <option value="01" <?php if ($month == "01") {echo "selected";} ?>>Jan <option value="02" <?php if ($month == "02") {echo "selected";} ?>>Feb <option value="03" <?php if ($month == "03") {echo "selected";} ?>>Mar <option value="04" <?php if ($month == "04") {echo "selected";} ?>>Apr <option value="05" <?php if ($month == "05") {echo "selected";} ?>>May <option value="06" <?php if ($month == "06") {echo "selected";} ?>>Jun <option value="07" <?php if ($month == "07") {echo "selected";} ?>>Jul <option value="08" <?php if ($month == "08") {echo "selected";} ?>>Aug <option value="09" <?php if ($month == "09") {echo "selected";} ?>>Sep <option value="10" <?php if ($month == "10") {echo "selected";} ?>>Oct <option value="11" <?php if ($month == "11") {echo "selected";} ?>>Nov <option value="12" <?php if ($month == "12") {echo "selected";} ?>>Dec </select> <select name="day" id="day"> <option value="01" <?php if ($day == "01") {echo "selected";} ?>>1 <option value="02" <?php if ($day == "02") {echo "selected";} ?>>2 <option value="03" <?php if ($day == "03") {echo "selected";} ?>>3 <option value="04" <?php if ($day == "04") {echo "selected";} ?>>4 <option value="05" <?php if ($day == "05") {echo "selected";} ?>>5 <option value="06" <?php if ($day == "06") {echo "selected";} ?>>6 <option value="07" <?php if ($day == "07") {echo "selected";} ?>>7 <option value="08" <?php if ($day == "08") {echo "selected";} ?>>8 <option value="09" <?php if ($day == "09") {echo "selected";} ?>>9 <option <?php if ($day == "10") {echo "selected";} ?>>10 <option <?php if ($day == "11") {echo "selected";} ?>>11 <option <?php if ($day == "12") {echo "selected";} ?>>12 <option <?php if ($day == "13") {echo "selected";} ?>>13 <option <?php if ($day == "14") {echo "selected";} ?>>14 <option <?php if ($day == "15") {echo "selected";} ?>>15 <option <?php if ($day == "16") {echo "selected";} ?>>16 <option <?php if ($day == "17") {echo "selected";} ?>>17 <option <?php if ($day == "18") {echo "selected";} ?>>18 <option <?php if ($day == "19") {echo "selected";} ?>>19 <option <?php if ($day == "20") {echo "selected";} ?>>20 <option <?php if ($day == "21") {echo "selected";} ?>>21 <option <?php if ($day == "22") {echo "selected";} ?>>22 <option <?php if ($day == "23") {echo "selected";} ?>>23 <option <?php if ($day == "24") {echo "selected";} ?>>24 <option <?php if ($day == "25") {echo "selected";} ?>>25 <option <?php if ($day == "26") {echo "selected";} ?>>26 <option <?php if ($day == "27") {echo "selected";} ?>>27 <option <?php if ($day == "28") {echo "selected";} ?>>28 <option <?php if ($day == "29") {echo "selected";} ?>>29 <option <?php if ($day == "30") {echo "selected";} ?>>30 <option <?php if ($day == "31") {echo "selected";} ?>>31 </select> , <select name="year" id="year"> <option <?php if ($year == (date('Y') - 3)) {echo "selected";} echo ">" . (date('Y') - 3); ?> <option <?php if ($year == (date('Y') - 2)) {echo "selected";} echo ">" . (date('Y') - 2); ?> <option <?php if ($year == (date('Y') - 1)) {echo "selected";} echo ">" . (date('Y') - 1); ?> <option <?php if (($year == date('Y')) OR (!isset($year))) {echo "selected";} echo ">" . date('Y'); ?> <option <?php if ($year == (date('Y') + 1)) {echo "selected";} echo ">" . (date('Y') + 1); ?> <option <?php if ($year == (date('Y') + 2)) {echo "selected";} echo ">" . (date('Y') + 2); ?> <option <?php if ($year == (date('Y') + 3)) {echo "selected";} echo ">" . (date('Y') + 3); ?> <option <?php if ($year == (date('Y') + 4)) {echo "selected";} echo ">" . (date('Y') + 4); ?> </select> </td> </tr> <tr> <td width="100">Time</td> <td> <input name="time" type="text" id="time" size="2" maxlength="2" <?php if (isset($hour)) {echo "value=" . $hour;} ?>> : <input name="minute" type="text" id="minute" size="2" maxlength="2" <?php if (isset($minute)) {echo "value=" . $minute;} else {echo "value='00'";} ?>> <select name="ampm" id="ampm"> <option value="12" <?php if ($ampm == "PM") {echo "selected";} ?>>PM <option value="0" <?php if ($ampm == "AM") {echo "selected";} ?>>AM </select> (show Time? <input name="showTime" type="checkbox" id="showTime" <?php if ($showTime) {echo "checked";} elseif (!isset($showTime)) {echo "checked";} ?>>) </td> </tr> <tr> <td width="100">Venue</td> <td> <textarea name="venue" id="venue" rows="5" cols="80"><?php if (isset($venue)) {echo $venue;} ?></textarea> </td> </tr> <tr> <td width="100">Description</td> <td> <textarea name="description" id="description" rows="5" cols="80"><?php if (isset($description)) {echo $description;} ?></textarea> </td> </tr> <tr> <td width="100"> </td> <td> <?php if ($action == 'edit') { echo "<input name='edit' type='submit' id='edit' value='update event'>"; } else { echo "<input name='add' type='submit' id='add' value='add event'>"; } ?> </td> </tr> </table> </form> <?php } ?> <table border="0" cellspacing="3"> <tr> <td colspan="9" align="center" class="highlight"> UPCOMING EVENTS </td> </tr> <?php $query = "SELECT * FROM events ORDER BY date, time"; $result = mysql_query($query); while($row = mysql_fetch_assoc($result)) { if ($row['date'] >= date('Y-m-d')) { displayEvents($row); displayActions($row); } } ?> </table> <BR> <BR> <table border="0" cellspacing="3"> <tr> <td colspan="9" align="center" class="highlight"> PAST EVENTS </td> </tr> <?php $query = "SELECT * FROM events ORDER BY date DESC, time DESC"; $result = mysql_query($query); while($row = mysql_fetch_assoc($result)) { if ($row['date'] <= date('Y-m-d')) { displayEvents($row); displayActions($row); } } include 'library/closedb.php'; } // AUTHENTICATION FAILED else { echo "Wrong password"; } ?> </table> <br /> <br /> <span class="small">VSEL v1.01 ©2006 <a href="http://ekittell.com" target="_blank">Eric Kittell</a> </span> </body> </html>
©
2020 Black Eagle Team