This commit is contained in:
Ricsi
2016-12-15 23:27:55 +01:00
parent 08627484da
commit d458b996a4
46 changed files with 1138 additions and 386 deletions

View File

@@ -11,30 +11,31 @@ if (isset($_POST['action'])) {
USER TYPES: 1 - coach, 2 - kid, 3 - parent
*/
$login = new login();
/*
$user_coach_id = $login->check_coach_login($_POST['user_name'], $_POST['user_password']);
$user_kid_id = $login->check_kid_login($_POST['user_name'], $_POST['user_password']);
if ($user_coach_id) {
//sikeres bejelentkezés
$login->login_user($user_coach_id, 'badminton_coach_user');
$login->login_user($user_coach_id, 'badminton_coach_user', 1);
header("Location: " . $actual_link);
}
elseif ($user_kid_id) {
//sikeres bejelentkezés
$login->login_user($user_kid_id, 'badminton_parent_user');
$login->login_user($user_kid_id, 'badminton_parent_user', 2);
header("Location: " . $actual_link);
}
else {
die($user_coach_id);
//die($user_coach_id);
//sikertelen bejelentkezés
}
*/
/*
$user_id = $login->check_login($_POST['user_name'], $_POST['user_password']);
if ($user_id) {
//sikeres bejelentkezés
$login->login_user($user_id, $_POST['user_type']);
header("Location: " . $actual_link);
}
*/
break;
case 'user_data_edit':
@@ -116,7 +117,7 @@ if (isset($_POST['action'])) {
break;
case 'training_type_update':
# edzés típus lista updatelése AB-ba
# edzés típus lista updatelése ABí-ba
unset($_POST['action']);
foreach ($_POST as $key => $value) {
$key_parts = explode('_', $key);
@@ -134,10 +135,7 @@ if (isset($_POST['action'])) {
$psw = "null";
}
if (!isset($_POST['ua_helper']) || empty($_POST['ua_helper'])) {
$_POST['ua_helper'] = 0;
}
user::create_user($_POST['ua_name'], $_POST['ua_helper'], $psw);
user::create_user($_POST['ua_name'], $psw);
header("Location: /admin/coaches");
break;
case 'coach_data_edit':
@@ -151,18 +149,14 @@ if (isset($_POST['action'])) {
else {
$psw = "null";
}
if (!isset($_POST['ua_helper']) || empty($_POST['ua_helper'])) {
$_POST['ua_helper'] = 0;
}
user::update_user($_POST['ua_name'], $_POST['ua_helper'], $psw, $_POST['ua_id']);
user::update_user($_POST['ua_name'], $psw, $_POST['ua_id']);
header("Location: /admin/coaches");
break;
case 'shirt_create':
# póló létrehozása
//todo: shirt object
$sql->insert_into('shirt', array(
'shirt_name' => $_POST['shirt_name'],
'shirt_year' => (!empty($_POST['shirt_year'])?$_POST['shirt_year']:'null')
'shirt_name' => $_POST['shirt_name']
)
);
header("Location: /admin/shirts");
@@ -172,7 +166,6 @@ if (isset($_POST['action'])) {
//todo: shirt object
$sql->update_table('shirt', array(
'shirt_name' => $_POST['shirt_name'],
'shirt_year' => (!empty($_POST['shirt_year'])?$_POST['shirt_year']:'null')
),
array(
'shirt_id' => $_POST['shirt_id']
@@ -199,6 +192,25 @@ if (isset($_POST['action'])) {
header("Location: /admin/cities");
}
break;
case 'region_create':
# körzet létrehozása
//todo: körzet object
$sql->insert_into('region', array(
'reg_name' => $_POST['reg_name'],
)
);
header("Location: /admin/regions");
break;
case 'region_update':
# region lista updatelése AB-ba
unset($_POST['action']);
foreach ($_POST as $key => $value) {
$key_parts = explode('_', $key);
$reg_id = $key_parts[1];
$sql->update_table('region', array('reg_name' => $value), array('reg_id' => $reg_id));
header("Location: /admin/regions");
}
break;
default:
# code...
break;