22 lines
742 B
PHP
22 lines
742 B
PHP
<?php
|
|
|
|
require_once($_SERVER['DOCUMENT_ROOT']."/config.php");
|
|
|
|
if($_SESSION['id'] && $_POST['comment'] && $_POST['client_id'] && is_numeric($_POST['client_id'])) {
|
|
$post = clearInputData($_POST);
|
|
|
|
$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, from_id) ";
|
|
$sql .= " VALUES($idUser, $post[client_id], 'comment', '$post[comment]', $from_id)";
|
|
mysql_query($sql);
|
|
} |