<?php
require_once('connect.php'); // Pobranie pliku z funkcjami
if (!isset($_POST['button_add']) || empty($_POST['login']) || empty($_POST['pass']) || empty($_POST['pass2']) || empty($_POST['email']) || empty($_POST['stanowisko'])) {
$_SESSION['danger'] = 'Wypełnij pola poprawnie!';
header('Location: ../panel.php?a=pracownicy&action=add');
} else {
$login = vtxt($_POST['login']);
$pass = vtxt($_POST['pass']);
$pass2 = vtxt($_POST['pass2']);
$email = vtxt($_POST['email']);
$stanowisko = vtxt($_POST['stanowisko']);
$_SESSION['danger'] = 'Login nie mieści się w danym zakresie!';
header('Location: ../panel.php?a=pracownicy&action=add');
$_SESSION['danger'] = 'Hasło nie mieści się w danym zakresie!';
header('Location: ../panel.php?a=pracownicy&action=add');
$_SESSION['danger'] = 'Adres email nie mieści się w danym zakresie!';
header('Location: ../panel.php?a=pracownicy&action=add');
elseif ($login == $pass)
$_SESSION['danger'] = 'Login nie może być taki sam jak hasło!';
header('Location: ../panel.php?a=pracownicy&action=add');
elseif ($pass != $_POST['pass2'])
$_SESSION['danger'] = 'Podane hasła nie zgadzają się!';
header('Location: ../panel.php?a=pracownicy&action=add');
$_SESSION['danger'] = 'Login zawiera niedozwolone znaki!';
header('Location: ../panel.php?a=pracownicy&action=add');
elseif (filter_var($email, FILTER_VALIDATE_EMAIL
) == false)
$_SESSION['danger'] = 'To nie jest poprawny adres email!';
header('Location: ../panel.php?a=pracownicy&action=add');
else {
$istnieje = row("SELECT id FROM users WHERE login = '".$login."' OR email = '".$email."'");
if ($istnieje) {
$_SESSION['danger'] = 'Istnieje już gracz o takim samym loginie lub adresie email!';
header('Location: ../panel.php?a=pracownicy&action=add');
} else {
call("INSERT INTO users (login, password, email, stanowisko) VALUES ('".$login."', '".$pass."', '".$email."', '".$stanowisko."')");
throwInfo('success', '', true);
$_SESSION['success'] = 'Dodano nowego pracownika!';
header('Location: ../panel.php?a=pracownicy&action=add');
}
}
}
}
?>
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}