25 lines
971 B
PHP
25 lines
971 B
PHP
<?php
|
|
|
|
require_once($_SERVER['DOCUMENT_ROOT'] . "/config.php");
|
|
|
|
if ($_SESSION['id'] && $_POST['schedule_date'] && $_POST['client_id'] && is_numeric($_POST['client_id'])) {
|
|
$post = clearInputData($_POST);
|
|
|
|
$scheduleDate = DateTime::createFromFormat('d.m.Y H:i', $post['schedule_date']);
|
|
$scheduleDate = "'".date("Y-m-d H:i:s", $scheduleDate->getTimestamp())."'";
|
|
|
|
$sql="SELECT * FROM clients_jw WHERE id=$post[client_id]";
|
|
$rez=mysql_query($sql);
|
|
$client = mysql_fetch_assoc($rez);
|
|
|
|
$idUser = $_SESSION['id'];
|
|
if ($client['who_work'] > 0) {
|
|
// тому событие, чей клиент
|
|
$idUser = $client['who_work'];
|
|
}
|
|
|
|
$from_id = $_SESSION['id'];
|
|
$sql = "INSERT INTO user_client_jw_events(user_id, client_id, type, comment, address, schedule_date, from_id) ";
|
|
$sql .= " VALUES($idUser, $post[client_id], 'show', '$post[comment]', '$post[address]', $scheduleDate, $from_id)";
|
|
mysql_query($sql);
|
|
} |