<?php
$path="../../";
include("../../map.php");
$sql=mysqli_query($conn, "select id,t1,i3 from t5 where id=".$_GET["id"].""); $rsu=mysqli_fetch_assoc($sql);
if($_POST["cfile"]<>""){
	$uzanti = explode('.',$_POST["cfile"]);
	$uzanti = $uzanti[count($uzanti)-1];
	if($uzanti=="jpg" or $uzanti=="jpeg" or $uzanti=="png" or $uzanti=="gif"){
		$cfile="<img src=\"../../".$_POST["cfile"]."\" style=\"max-height:100px;\"><br>";
	}else{
		$cfile="<a href=\"../../".$_POST["cfile"]."\" download><i class=\"fa fa-paperclip\" style=\"font-size: 30px; position: absolute; margin-top: -20px;\"></i></a><br>";
	}
}
if($_GET["id"]==""){
	$ct2="all";
}elseif($_GET["id"]<>""){
	$ct2="";
}
$Sql = $conn->query("insert into t2(ne,t1,t2,s1,s2,s3,n1,ts1) values ('chat', '".getRealIpAddr()."', '".$ct2."' , '".$_GET["uid"]."', '".$_GET["id"]."', '0', '".$cfile.$_POST["text"]."', now())");
if($cchat==0){
	$sqlc = mysqli_query($conn, "select id FROM t2 where ne='chat' and (s2=".$_SESSION["user_id"]." and s3=0)"); $cchat = mysqli_num_rows($sqlc);
	nDevice("Team Chat", $_POST["text"], $rsu["i3"], "Crm");
}
?>