46 lines
1.7 KiB
PHP
46 lines
1.7 KiB
PHP
<?php
|
|
|
|
session_start();
|
|
|
|
if (!isset($_SESSION['zalogowany']) || $_SESSION['perm']=='normal')
|
|
{
|
|
$_SESSION['blad_perm'] = '<span style="color:red">Brak uprawnien!</span>';
|
|
header('Location: index.php');
|
|
exit();
|
|
}
|
|
if($_POST['title3'] == NULL || $_POST['description3'] == NULL || $_POST['date_start3'] == NULL || $_POST['date_stop3'] == NULL || $_POST['time_start3'] == NULL || $_POST['time_stop3'] == NULL || $_POST['location3'] == NULL)
|
|
{
|
|
$_SESSION['add_log'] = "Nie wypełnione pola!";
|
|
header('Location: add_event.php');
|
|
}
|
|
elseif($_POST['time_start2'] >= $_POST['time_stop2'] || $_POST['time_start2'] >= $_POST['time_stop2'])
|
|
{
|
|
$_SESSION['add_log'] = "Zła data lub czas!";
|
|
header('Location: add_event.php');
|
|
}
|
|
else
|
|
{
|
|
ini_set("display_errors", 0);
|
|
require_once "dbconnect.php";
|
|
$polaczenie = mysqli_connect($host, $db_user, $db_password);
|
|
mysqli_query($polaczenie, "SET CHARSET utf8");
|
|
mysqli_query($polaczenie, "SET NAMES 'utf8' COLLATE 'utf8_polish_ci'");
|
|
mysqli_select_db($polaczenie, $db_name);
|
|
$y1 = $_POST['title3'];
|
|
$y2 = $_POST['description3'];
|
|
$y3 = $_POST['date_start3'];
|
|
$y4 = $_POST['date_stop3'];
|
|
$y5 = $_POST['time_start3'];
|
|
$y6 = $_POST['time_stop3'];
|
|
$y7 = $_POST['location3'];
|
|
$y8 = $_POST['quantity3'];
|
|
$y9 = $_POST['quantity_min3'];
|
|
$query = "INSERT INTO events (title,description,date_start,date_stop,time_start,time_stop,location,quantity,quantity_min) VALUES ('".$y1."','".$y2."','".$y3."','".$y4."','".$y5."','".$y6."','".$y7."','".$y8."','".$y9."')";
|
|
$rezultat = mysqli_query($polaczenie, $query);
|
|
|
|
header('Location: events.php');
|
|
|
|
}
|
|
|
|
unset($_SESSION['controller']);
|
|
?>
|