głowne pliki aplikacji
This commit is contained in:
parent
805d53da75
commit
1daf0bd313
46
add.php
Normal file
46
add.php
Normal file
@ -0,0 +1,46 @@
|
||||
<?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']);
|
||||
?>
|
73
leave.php
Normal file
73
leave.php
Normal file
@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
session_start();
|
||||
|
||||
if (!isset($_SESSION['zalogowany']))
|
||||
{
|
||||
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);
|
||||
|
||||
$zapytanietxt = "SELECT manager.employeeID, events.id_events, events.slots FROM manager, events WHERE events.id_events = manager.id_events AND manager.id_events = '".$_SESSION['id_eve']."'";
|
||||
$rezultat = mysqli_query($polaczenie, $zapytanietxt);
|
||||
$ile = mysqli_num_rows($rezultat);
|
||||
|
||||
|
||||
$a1 = $_SESSION['e_slots'];
|
||||
|
||||
|
||||
|
||||
require_once "dbconnect.php";
|
||||
|
||||
$polaczenie = @new mysqli($host, $db_user, $db_password, $db_name);
|
||||
if ($polaczenie->connect_errno!=0)
|
||||
{
|
||||
echo "Error: ".$polaczenie->connect_errno;
|
||||
}
|
||||
else
|
||||
{
|
||||
#$login = $_SESSION['employeeID'];
|
||||
|
||||
$login = htmlentities($login, ENT_QUOTES, "UTF-8");
|
||||
|
||||
if ($rezultat = @$polaczenie->query(
|
||||
sprintf("SELECT manager.employeeID, events.id_events FROM manager, events WHERE events.id_events = manager.id_events AND manager.id_events = '".$_SESSION['id_eve']."' AND manager.employeeID='".$_SESSION['employeeID']."'",
|
||||
mysqli_real_escape_string($polaczenie,$login))))
|
||||
{
|
||||
$ilu_userow = $rezultat->num_rows;
|
||||
if($ilu_userow>0)
|
||||
{
|
||||
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);
|
||||
|
||||
$zapytanietxt = "DELETE FROM manager WHERE manager.employeeID ='".$_SESSION['employeeID']."' AND manager.id_events ='".$_SESSION['id_eve']."'";
|
||||
$rezultat = mysqli_query($polaczenie, $zapytanietxt);
|
||||
#$ile = mysqli_num_rows($rezultat);
|
||||
header('Location: events.php');
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$wiersz = $rezultat->fetch_assoc();
|
||||
|
||||
$_SESSION['id_log'] = "Jeszcze nie dołączyłeś do eventu!";
|
||||
unset($_SESSION['blad']);
|
||||
$rezultat->free_result();
|
||||
|
||||
header('Location: events.php');
|
||||
}
|
||||
}
|
||||
}
|
||||
unset($_SESSION['controller']);
|
||||
?>
|
49
login.php
Normal file
49
login.php
Normal file
@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
session_start();
|
||||
|
||||
if ((!isset($_POST['login'])) || (!isset($_POST['haslo'])))
|
||||
{
|
||||
header('Location: index.php');
|
||||
exit();
|
||||
}
|
||||
|
||||
$login = $_POST['login'];
|
||||
$haslo = $_POST['haslo'];
|
||||
|
||||
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);
|
||||
$zapytanie = "SELECT * FROM users WHERE employeeID='".$login."' AND password='".$haslo."'";
|
||||
$rezultat = mysqli_query($polaczenie, $zapytanie);
|
||||
$ilu_userow = mysqli_num_rows($rezultat);
|
||||
#$ilu_userow = $rezultat->num_rows;
|
||||
if($ilu_userow>0)
|
||||
{
|
||||
$_SESSION['zalogowany'] = true;
|
||||
|
||||
$wiersz = $rezultat->fetch_assoc();
|
||||
$_SESSION['employeeID'] = $wiersz['employeeID'];
|
||||
$_SESSION['name'] = $wiersz['name'];
|
||||
$_SESSION['surnname'] = $wiersz['surnname'];
|
||||
$_SESSION['login'] = $_SESSION['employeeID'];
|
||||
$_SESSION['perm'] = $wiersz['perm'];
|
||||
|
||||
unset($_SESSION['blad']);
|
||||
$rezultat->free_result();
|
||||
header('Location: index.php');
|
||||
|
||||
} else {
|
||||
|
||||
$_SESSION['blad'] = '<span style="color:red">Nieprawidłowy login lub hasło!</span>';
|
||||
header('Location: login_page.php');
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
$polaczenie->close();
|
||||
|
||||
?>
|
115
login_page.php
Normal file
115
login_page.php
Normal file
@ -0,0 +1,115 @@
|
||||
<?php
|
||||
|
||||
session_start();
|
||||
|
||||
#if ((isset($_SESSION['zalogowany'])) && ($_SESSION['zalogowany']==true))
|
||||
{
|
||||
#header('Location: events.php');
|
||||
#exit();
|
||||
}
|
||||
|
||||
?>
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="pl">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||||
<title>Event Manager</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="author" content="Piotr Szefler">
|
||||
<meta http-equiv="X-Ua-Compatible" content="IE=edge">
|
||||
<style>
|
||||
/* Bordered form */
|
||||
form {
|
||||
border: 3px solid #f1f1f1;
|
||||
}
|
||||
|
||||
/* Full-width inputs */
|
||||
input[type=text], input[type=password] {
|
||||
width: 100%;
|
||||
padding: 12px 20px;
|
||||
margin: 8px 0;
|
||||
display: inline-block;
|
||||
border: 1px solid #ccc;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
/* Set a style for all buttons */
|
||||
button {
|
||||
background-color: #4CAF50;
|
||||
color: white;
|
||||
padding: 14px 20px;
|
||||
margin: 8px 0;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
/* Add a hover effect for buttons */
|
||||
button:hover {
|
||||
opacity: 0.8;
|
||||
}
|
||||
|
||||
/* Extra style for the cancel button (red) */
|
||||
.cancelbtn {
|
||||
width: auto;
|
||||
padding: 10px 18px;
|
||||
background-color: #f44336;
|
||||
}
|
||||
|
||||
/* Center the avatar image inside this container */
|
||||
.imgcontainer {
|
||||
text-align: center;
|
||||
margin: 24px 0 12px 0;
|
||||
}
|
||||
|
||||
/* Avatar image */
|
||||
img.avatar {
|
||||
width: 40%;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
/* Add padding to containers */
|
||||
.container {
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
/* The "Forgot password" text */
|
||||
span.psw {
|
||||
float: right;
|
||||
padding-top: 16px;
|
||||
}
|
||||
|
||||
/* Change styles for span and cancel button on extra small screens */
|
||||
@media screen and (max-width: 300px) {
|
||||
span.psw {
|
||||
display: block;
|
||||
float: none;
|
||||
}
|
||||
.cancelbtn {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<form action="login.php" method="post">
|
||||
|
||||
<div class="container">
|
||||
<label for="uname"><b>EmployeeID</b></label>
|
||||
<input type="text" placeholder="Enter EmployeeID" name="login" required>
|
||||
|
||||
<label for="psw"><b>Password</b></label>
|
||||
<input type="password" placeholder="Enter Password" name="haslo" required>
|
||||
|
||||
<button type="submit">Login</button>
|
||||
</div>
|
||||
|
||||
|
||||
</form>
|
||||
<?php
|
||||
if(isset($_SESSION['blad'])) echo $_SESSION['blad'];
|
||||
?>
|
||||
</body>
|
||||
</html>
|
9
logout.php
Normal file
9
logout.php
Normal file
@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
session_start();
|
||||
|
||||
session_unset();
|
||||
|
||||
header('Location: login_page.php');
|
||||
|
||||
?>
|
Loading…
Reference in New Issue
Block a user