diff --git a/dbconnect.php b/dbconnect.php new file mode 100644 index 0000000..7577ae3 --- /dev/null +++ b/dbconnect.php @@ -0,0 +1,9 @@ + \ No newline at end of file diff --git a/edit.php b/edit.php new file mode 100644 index 0000000..5288dee --- /dev/null +++ b/edit.php @@ -0,0 +1,103 @@ +Brak uprawnien!'; + header('Location: index.php'); + exit(); + } + + 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); + $controller = $_SESSION['quantity_controller']; + $stopdate = $_SESSION['e_dtstp']; + + if($_POST['title2'] == NULL ) + { + $g1 = $_SESSION['e_title']; + } + else + { + $g1 = $_POST['title2']; + } + if($_POST['description2'] == NULL) + { + $g2 = $_SESSION['e_descr']; + } + else + { + $g2 = $_POST['description2']; + echo "elo".$g2; + } + if($_POST['date_start2'] == NULL || ($_POST['date_start2'] >= $stopdate)) + { + $g3 = $_SESSION['e_dtstr']; //domyślna poprzednia + } + elseif(($_POST['date_start2'] < $stopdate)) + { + $g3 = $_POST['date_start2']; //nowa data + } + if($_POST['date_stop2'] == NULL || ($_POST['date_start2'] >= $_POST['date_stop2'])) + { + $g4 = $_SESSION['e_dtstp']; + } + elseif(($_POST['date_start2'] < $_POST['date_stop2'])) + { + $g4 = $_POST['date_stop2']; + } + if($_POST['time_start2'] == NULL || ($_POST['time_start2'] >= $_POST['time_stop2'])) + { + $g5 = $_SESSION['e_tmstr']; + } + elseif(($_POST['time_start2'] < $_POST['time_stop2'])) + { + $g5 = $_POST['time_start2']; + } + if($_POST['time_stop2'] == NULL || ($_POST['time_start2'] >= $_POST['time_stop2'])) + { + $g6 = $_SESSION['e_tmstp']; + } + elseif(($_POST['time_start2'] < $_POST['time_stop2'])) + { + $g6 = $_POST['time_stop2']; + } + if($_POST['location2'] == NULL) + { + $g7 = $_SESSION['e_loc']; + } + else + { + $g7 = $_POST['location2']; + } + if($_POST['quantity2'] == NULL || $controller > $_POST['quantity2']) + { + $g8 = $_SESSION['e_slots']; + } + elseif($controller <= $_POST['quantity2']) + { + $g8 = $_POST['quantity2']; + } + if($_POST['quantity_min2'] == NULL) + { + $g9 = $_SESSION['e_slots']; + } + else + { + $g9 = $_POST['quantity2_min']; + } + + $zapytanietxt = "UPDATE `events` SET `title` = '".$g1."', `description` = '".$g2."', `date_start` = '".$g3."', `date_stop` = '".$g4."', `time_start` = '".$g5."', `time_stop` = '".$g6."', `location` = '".$g7."', `quantity` = '".$g8."', `quantity_min` = '".$g9."' WHERE `events`.`id_events` =".$_SESSION['id_eve']; + $rezultat = mysqli_query($polaczenie, $zapytanietxt); + $ile = mysqli_num_rows($rezultat); + + + header('Location: events.php'); + +unset($_SESSION['controller']); +?> \ No newline at end of file diff --git a/edit_page.php b/edit_page.php new file mode 100644 index 0000000..0a1ed63 --- /dev/null +++ b/edit_page.php @@ -0,0 +1,72 @@ +Brak uprawnien!'; + header('Location: index.php'); + exit(); + } + +?> + + + + + + + Event Manager + + + + + + + + + + + + +
+ Uaktualnij wydarzenie

+ +
+ + Tytul:

+ Opis:

+ Data rozp.:

+ Data zako.:

+ Godzina rozp.:

+ Godzina zako.:

+ Lokalizacja:

+ Ilość miejsc max:

+ Ilość miejsc min:


+ +

+ +
+ +

Powrót

'; + unset($_SESSION['controller']); +?> +
+ + + + + + + + \ No newline at end of file diff --git a/events.php b/events.php new file mode 100644 index 0000000..dd3bc30 --- /dev/null +++ b/events.php @@ -0,0 +1,143 @@ + + + + + + + Event Manager + + + + + + + + + + + + + + +
+
+ + + '; + print_r($_SESSION); + echo ''; + */ + + if (!isset($_SESSION['zalogowany'])) + { + header('Location: index.php'); + exit(); + } + + 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); + + $zapytanietxt = "SELECT * FROM events"; + + $rezultat = mysqli_query($polaczenie, $zapytanietxt); + $ile = mysqli_num_rows($rezultat); + + + echo "

Witaj ".$_SESSION['login'].'! [ Wyloguj się! ';echo "] ["; + echo ' Archiwalne]

'; + + if(isset($_SESSION['blad_perm'])){ + echo "".$_SESSION['blad_perm']."";unset($_SESSION['blad_perm']); + } + elseif(isset($_SESSION['id_log'])){ + echo "".$_SESSION['id_log']."";unset($_SESSION['id_log']); + } + elseif(isset($_SESSION['slots_log'])){ + echo "".$_SESSION['slots_log']."";unset($_SESSION['slots_log']); + } +if ($ile>=1) +{ +if($_SESSION['perm']=='modder' || $_SESSION['perm']=='admin'){ + echo ''; +} +else{ + echo ''; +} +echo<<Nazwa Eventu + + + + + +END; +} +$akt_date = date("Y-m-d"); + + for ($i = 1; $i <= $ile; $i++) + { + + $row = mysqli_fetch_assoc($rezultat); + $a4 = $row['date_stop']; + + if($a4 >= $akt_date){ + $a1 = $row['title']; + $a2 = $row['description']; + $a3 = $row['date_start']; + $a5 = $row['time_start']; + $a6 = $row['time_stop']; + $a7 = $row['location']; + $a8 = $row['id_events']; + $a9 = $a6 - $a5; + $a5 = substr($a5,0,strlen($a5)-3); + $a6 = substr($a6,0,strlen($a6)-3); + + +echo<< + + + + + + + +END; + + } + } + echo "
"; + +?> + + +
ID EventuData rozpoczeciaGodzina rozpoczeciaIlość godzinLokalizacja

$a1

$a3$a5$a9$a7
+ + + + + + + + + + + diff --git a/events_arch.php b/events_arch.php new file mode 100644 index 0000000..f41e186 --- /dev/null +++ b/events_arch.php @@ -0,0 +1,137 @@ + + + + + + + Event Manager + + + + + + + + + + + + + +
+
+ + +
Witaj ".$_SESSION['login'].'! [ Wyloguj się! ';echo "] ["; + echo ' Powrót]

'; + + if(isset($_SESSION['blad_perm'])){ + echo "".$_SESSION['blad_perm']."";unset($_SESSION['blad_perm']); + } + elseif(isset($_SESSION['id_log'])){ + echo "".$_SESSION['id_log']."";unset($_SESSION['id_log']); + } + elseif(isset($_SESSION['slots_log'])){ + echo "".$_SESSION['slots_log']."";unset($_SESSION['slots_log']); + } +if ($ile>=1) +{ +if($_SESSION['perm']=='modder' || $_SESSION['perm']=='admin'){ + echo ''; +} +else{ + echo ''; +} +echo<<Nazwa Eventu + + + + + +END; +} +$akt_date = date("Y-m-d"); + + for ($i = 1; $i <= $ile; $i++) + { + + $row = mysqli_fetch_assoc($rezultat); + $a4 = $row['date_stop']; + + if($a4 < $akt_date){ + $a1 = $row['title']; + $a2 = $row['description']; + $a3 = $row['date_start']; + $a5 = $row['time_start']; + $a6 = $row['time_stop']; + $a7 = $row['location']; + $a8 = $row['id_events']; + $a9 = $a6 - $a5; + $a5 = substr($a5,0,strlen($a5)-3); + $a6 = substr($a6,0,strlen($a6)-3); + + +echo<< + + + + + + + +END; + + } + } + echo "
"; + +?> + + +
ID EventuData rozpoczeciaGodzina rozpoczeciaIlość godzinLokalizacja

$a1

$a3$a5$a9$a7
+ + + + + + + + + + +