website/plan_add.php
Jeff Teunissen 9e6f75ccbd Update for PHP 7.x
PHP 7 doesn't like the old short tags we were using (it's possible to re-enable
them, but won't be for version 8, so we might as well switch now), and the old
MySQL APIs are now gone entirely, replaced with something different.

This should make everything work at least as well as it used to.

Also, one file used to be checked in with CRLF line endings. ??
2022-04-27 13:14:47 -04:00

47 lines
1.5 KiB
PHP

<?php // Preamble
$pageName = "Post a new Plan Entry";
$need = 'auth';
require "parts/preamble.php"; // Load most of document
need ("boxes html news sql");
// set up local vars
$mode = $_REQUEST['mode'];
$planSubj = addSlashes ($_REQUEST['planSubj']);
$planText = addSlashes ($_REQUEST['planText']);
$user = $userInfo['u_displayname'];
if ($planText && $planSubj && $mode == "Post") {
$query = 'INSERT INTO plans (p_date, p_user, p_title, p_plan) VALUES ('
."NOW(), '$user', '$planSubj', '$planText')";
$rows = sqlWriteQuery ($query);
if ($rows) {
echo '<P>Your plan entry has been posted successfully.</P>';
} else {
echo "<P>Somebody screwed up, MySQL said '$sqlError'. Bug a project admin or somethin', eh?</P>";
}
} else {
$date = date ('d M Y');
newsBoxOpen ();
if ($planText) {
newsBoxTitle ("Latest Plan for $user (Preview)");
printNews ($date, $user, stripSlashes ($planText));
}
newsBoxTitle ("Post Plan Entry");
$form = '<FORM action="' . thisURL . '" method="post">'
. 'Subject: '
. '<INPUT type="text" name="planSubj" size="59" value="'
. convertFromHTML (stripSlashes ($planSubj)) . '">'
. '</INPUT><BR>'
. '<TEXTAREA name="planText" rows="25" cols="64">'
. convertFromHTML (stripSlashes ($planText))
. '</TEXTAREA><BR>'
. '<INPUT align="center" type="submit" name="mode" value="Post"></INPUT>'
. '<INPUT align="center" type="submit" name="mode" value="Preview"></INPUT>'
.'</FORM>';
printNews ($date, $user, $form);
newsBoxClose ();
}
?>