CODE
<? $page_title = 'Летопись школы';
include('header.php');
session_start();
if (!$_SESSION[login]) {
echo "Нужно <a href='login.php'>Войти</a>";
include ('footer.php');
} else
{ include ('connection.php');
setlocale (LC_ALL, 'ru_RU.CP1251');
$month = strftime('%B');
$date = strftime('%d');
$year = strftime('%G');
$time = strftime('%H:%I');
?>
<center>
<div id="contenido">
<form method="post" action="<? echo $_SERVER['PHP_SELF'];?>">
<select name="month" id="month">
<option value="<?php echo $month; ?>"><?php echo $month; ?></option>
<option value="Январь">Январь</option>
...
</select><input type="text" name="date" id="date" value="<? echo $date; ?>">
<select name="year" "year">
<option value="<?php echo $year; ?>"><? echo $year; ?></option>
<option value="2004">2004</option>
...
</select>
<input type="text" name="time" id="time" value="<? echo $time; ?>"><br><br>Введите название вехи:<br>
<input type="text" name="title" id="title" size="40" /><br><br>
Вехо:<br>
<textarea cols="80" rows="20" name="entry" id="entry"></textarea>
<input type="submit" name="submit" id="submit" value="Отправить вехо" />
</form><a href="menu.php">Вернуться к меню</a><br><a href="editinglist.php">Редактировать летопись</a></div></center>
<?
if (isset($_POST['submit'])) {
$month = htmlspecialchars(strip_tags($_POST['month']));
$date = htmlspecialchars(strip_tags($_POST['date']));
$year = htmlspecialchars(strip_tags($_POST['year']));
$time = htmlspecialchars(strip_tags($_POST['time']));
$title = htmlspecialchars(strip_tags($_POST['title']));
$entry = $_POST['entry'];
$realtime = strtotime($month."".$date."".$year."".$time);
$entry = nl2br($entry);
if (!get_magic_quotes_gpc()) {
$title = addslashes($title);
$entry = addslashes($entry);
}
$sql = "INSERT INTO chronic (time, title, entry) VALUES ('$realtime', '$title', '$entry')";
$result = mysql_query($sql) or print('Заклинанния барохлят.<br />.'.$sql.' <br />'. mysql_error());
if ($result != false) {
print "<center>Вы успешно добавили событие.</center>";
}
mysql_close();
}
include('footer.php');
}
?>
include('header.php');
session_start();
if (!$_SESSION[login]) {
echo "Нужно <a href='login.php'>Войти</a>";
include ('footer.php');
} else
{ include ('connection.php');
setlocale (LC_ALL, 'ru_RU.CP1251');
$month = strftime('%B');
$date = strftime('%d');
$year = strftime('%G');
$time = strftime('%H:%I');
?>
<center>
<div id="contenido">
<form method="post" action="<? echo $_SERVER['PHP_SELF'];?>">
<select name="month" id="month">
<option value="<?php echo $month; ?>"><?php echo $month; ?></option>
<option value="Январь">Январь</option>
...
</select><input type="text" name="date" id="date" value="<? echo $date; ?>">
<select name="year" "year">
<option value="<?php echo $year; ?>"><? echo $year; ?></option>
<option value="2004">2004</option>
...
</select>
<input type="text" name="time" id="time" value="<? echo $time; ?>"><br><br>Введите название вехи:<br>
<input type="text" name="title" id="title" size="40" /><br><br>
Вехо:<br>
<textarea cols="80" rows="20" name="entry" id="entry"></textarea>
<input type="submit" name="submit" id="submit" value="Отправить вехо" />
</form><a href="menu.php">Вернуться к меню</a><br><a href="editinglist.php">Редактировать летопись</a></div></center>
<?
if (isset($_POST['submit'])) {
$month = htmlspecialchars(strip_tags($_POST['month']));
$date = htmlspecialchars(strip_tags($_POST['date']));
$year = htmlspecialchars(strip_tags($_POST['year']));
$time = htmlspecialchars(strip_tags($_POST['time']));
$title = htmlspecialchars(strip_tags($_POST['title']));
$entry = $_POST['entry'];
$realtime = strtotime($month."".$date."".$year."".$time);
$entry = nl2br($entry);
if (!get_magic_quotes_gpc()) {
$title = addslashes($title);
$entry = addslashes($entry);
}
$sql = "INSERT INTO chronic (time, title, entry) VALUES ('$realtime', '$title', '$entry')";
$result = mysql_query($sql) or print('Заклинанния барохлят.<br />.'.$sql.' <br />'. mysql_error());
if ($result != false) {
print "<center>Вы успешно добавили событие.</center>";
}
mysql_close();
}
include('footer.php');
}
?>