Files
code-cegled/_ajax/update_presence.php
Tóth Richárd 330f403244 permissions
2018-05-03 20:43:37 +02:00

23 lines
941 B
PHP

<?php
ini_set('include_path', '../_class/');
include('class_sql.php');
include('class_log.php');
/*
foreach ($_POST as $key => $value) {
trigger_error($_SERVER['HTTP_HOST'], E_USER_NOTICE);
}
*/
if ($_SERVER['HTTP_HOST'] == 'badmintoncoach.hu') $sql = new sql('bc_mysql','root','','badminton_coach');
else $sql = new sql('localhost','tollashodos','uprRscU8bGpJ','tollashodos');
if ($_POST['checked'] == "true") {
$sql->insert_into('presence', array('pr_user_kid_uk_id' => $_POST['user_id'], 'pr_training_tr_id' => $_POST['tr_id']));
log::register('new_presence', 'Edzés: ' . $_POST['tr_id'] . ', gyerek: ' . $_POST['user_id'], null, $_POST['admin_id']);
}
else {
$sql->execute_query('delete from presence where pr_user_kid_uk_id = ' . $_POST['user_id'] . ' AND pr_training_tr_id = ' . $_POST['tr_id']);
log::register('delete_presence', 'Edzés: ' . $_POST['tr_id'] . ', gyerek: ' . $_POST['user_id'], null, $_POST['admin_id']);
}
?>