Files
HotLunches/classified.post.php
2026-10-19 15:22:52 -07:00

64 lines
1.6 KiB
PHP

<?php
require_once("include/globals.php");
if (SessionActive() != 1 || ! UserLoggedIn()) {
header("Location: /");
exit();
}
// Start the template and output buffering
startTemplate();
$CurrentTable = "classified_ads";
$TitleText = getLanguageText('TEXT-CLASSIFIED-ADS');
$templatePageTitle = "$TitleText " . getLanguageText('TEXT-ADMINISTRATION');
$headerArgs = "";
$school_name = $school_record['school_name'];
// Setup default values on insert
if (!isset($naction)) {
$naction = 'insert';
if (array_key_exists('naction',$_GET)) $naction = $_GET['naction'];
}
switch ($naction) {
default:
case 'add':
$PageTitle = "Insert a New Classified Ad";
$ButtonText = "Create Ad";
$next_naction = 'insert';
include "classified.form.php";
break;
case 'edit':
// Get ad record
$num = intval($_REQUEST['num']);
$uid = $_SESSION['UserInfo']['record_num'];
$query = "select * from classified_ads " .
"where school_num = $school_num " .
"and record_num = $num " .
"and posted_by = $uid";
$results = db_query($query);
$row = db_fetch_array($results);
extract($row);
$PageTitle = "Update a Classified Ad";
$ButtonText = "Update Ad";
$naction = 'update';
include "classified.form.php";
break;
case 'update':
$PageTitle = "Update a Classified Ad";
$ButtonText = "Update Ad";
$naction = 'update';
include "classified.form.php";
break;
}
endTemplate();
?>