<?php
// *** Include database connection
include_once("../../include/db_connect.php");
// *** Include echo functions
include_once("../../include/echo_functions.php");
// *************************** //
// ****** UPDATE TICKER ****** //
// *************************** //
if ($_POST['fromform'] == "ticker") {
// *** Grab variable from form
$tickertext = $_POST['The_Textarea'];
// *** sql statement to update the one field
$sql = "UPDATE ticker SET text = '$tickertext' WHERE id = '1' LIMIT 1";
$result = MYSQL_QUERY($sql);
// *** Goes back to admin panel
header('Location:../index.php');
}
// *************************** //
// ****** ADD NEW TOUR ******* //
// *************************** //
if ($_POST['fromform'] == "addtour") {
// *** Grab variables from form
$tourtype = $_POST['tourtype'];
$unixdate = strtotime($_POST['monthadd']." ".$_POST['dayadd'].", ".$_POST['yearadd']);
$numtickets = $_POST['addtickets'];
// *** sql statement add the new tour
$sql = "INSERT INTO tours (id, date, tickets, type) VALUES (NULL, '$unixdate', '$numtickets', '$tourtype')";
$result = MYSQL_QUERY($sql);
// *** Goes back to admin panel
header('Location:../index.php');
}
// *************************** //
// ******** EDIT TOUR ******** //
// *************************** //
if ($_POST['fromform'] == "edittour") {
// *** Puts all the form data into an array
$variablearray = $_POST;
// *** Loop through all the rows
while ($v<count(getTour('','','array',''))) {
// *** Set Id variable
$itemId = getSpecificTour($v,'id','');
// *** If delete item is selected, delete item with Id
if ($_POST["delete_".getSpecificTour($v,'id','')] == 'true') {
$sql = "DELETE FROM tours WHERE id = '$itemId'";
$result = MYSQL_QUERY($sql);
// *** Add the updated data to the database
} else {
// *** Creates Unix timestamp from string
$itemDate = strtotime($_POST["year_".$itemId]." ".$_POST["month_".$itemId].", ".$_POST["day_".$itemId]);
$itemTickets = $_POST["tickets_".$itemId];
$itemType = getSpecificTour('','type',$itemId);
// *** sql statement to update fields item with Id = $itemId
$sql = "UPDATE tours SET date = '$itemDate', tickets = '$itemTickets', type = '$itemType' WHERE id = '$itemId' LIMIT 1";
$result = MYSQL_QUERY($sql);
}
$v++; }
// *** Goes back to admin panel
header('Location:../index.php');
}
?>