<?php
$agent = $_SERVER['HTTP_USER_AGENT'];
if(stristr($agent, 'UBrowser')) $agent = 'UBrowser'; //Opera?
elseif(stristr($agent, 'MSIE')) $agent = 'IE'; //Internet exploler?
elseif(stristr($agent, 'Firefox')) $agent = 'Firefox'; //Mozilla?
// elseif(stristr($agent, 'Chrome')) $agent = 'Chrome'; //Mozilla?
?>
<style type="text/css">
#aside1 {
position: fixed;
z-index: 101;
right:20%;
bottom:0;
width:150px;
height:30px;
background
ack;
opacity:0.85;
color:#fff;
cursor:pointer;
padding-top
px;
text-align: center;
display
ock;
}
#mychatbox{
position: fixed;
z-index: 101;
right:16%;
bottom:0;
height:410px;
width:270px;
background
ack;
opacity:0.87;
border-top-right-radius: 10px;
border-top-left-radius: 10px;
display:none;
}
#mychattop{
width:270px;
position: absolute;
top:0;
border-top-right-radius: 10px;
border-top-left-radius: 10px;
background
ack;
font-size:25px;
color:#fff;
text-align: right;
font-weight:bold;
padding-right: 7%;
padding-top:3%;
padding-bottom: 2%;
display
ock;
cursor:pointer;
border-bottom:1px solid #353434;
}
#chattext{
position: absolute;
bottom:15%;
background:#191616;
width:266px;
height:78%;
margin:2px;
overflow-y: scroll;
overflow-x: hidden;
}
.onemessage{
<?php if($agent=='Firefox')
echo 'font-weight:bolder;';
?>
font-size:13px;
background
ack;
color:white;
opacity: 1;
display: table;
width:250px;
margin:1px;
text-align: left;
margin-bottom: 2px;
padding:5px;
}
#avelacnel{
font-weight:bolder;
position: absolute;
bottom:0;
/*background:red;
*/height:18%;
width:266px;
margin:2px;
padding-left: 10px;
}
#chatmes{
float:left;
resize: none;
background:#fbfbfb;
opacity:0.92;
color
ack;
margin-top:20px;
border:none;
border-top-left-radius: 5px;
border-bottom-left-radius: 5px;
}
#chatbut{
margin-top:20px;
<?php if($agent=='Firefox')
echo 'height:47px;';
else
echo 'height:49px;' ?>
color:white;
background: #dc0909;
border:none;
border-top-right-radius: 5px;
border-bottom-right-radius: 5px;
}
</style>
<script type="text/javascript">
function cuctal(){
var cht=document.getElementById("aside1");
cht.style.display='none';
var chtbox=document.getElementById("mychatbox");
chtbox.style.display='block';
}
function taqcnel(){
var cht=document.getElementById("aside1");
cht.style.display='block';
var chtbox=document.getElementById("mychatbox");
chtbox.style.display='none';
}
function getdetails(){
var chatmessage = $('#chatmes').val();
var usrname = $('#usernamme').val();
var usrid = $('#userid').val();
$.ajax({
type: "POST",
url: "chat/send",
data: {chatmes:chatmessage, usname:usrname , usid:usrid},
async: true
});
$('#chatmes').val('');
}
// setInterval(function(){
// $("#chattext").load("chat/view#chattext");
// }, 6000);
</script>
<!-- START CHAT -->
<div onclick="cuctal()" id="aside1">Չատ
</div>
<div id="mychatbox">
<div onclick="taqcnel()" id="mychattop">-</div>
<div id="chattext">
<?php require_once (ROOT.'/view/chat/chat.php');
?>
</div>
<div id="avelacnel">
<?php if(isset($_SESSION['user'])) : ?>
<textarea <?php if($agent=='Firefox') echo 'rows="2" cols="20"';elseif($agent=='UBrowser') echo 'rows="3" cols="24"'; else echo ' rows="3" cols="26"'; ?> type="text" id="chatmes" name="message" /></textarea>
<input type="hidden" name="" id="usernamme" value="<?php echo $user['username']; ?>" />
<input type="hidden" name="" id="userid" value="<?php echo $user['id']; ?>" />
<input type="submit" id="chatbut" onclick="getdetails()" value="OK">
<?php else : ?><br>
<a style="font-size:12px;color:white;" href="/login">Մուտք գործեք կամ գրանցվեք չատից օգտվելու համար </a>
<?php endif ?>
</div>
</div>
<!-- END CHAT -->
Էջանիշներ