<?php include("db_connection.php");

$curpage=basename($_SERVER['PHP_SELF']);

//echo'<pre>';print_r($_SESSION);
?>
<!DOCTYPE html>
<html lang="en">

<!-- Mirrored from templatecycle.com/demo/bootclassified-v1.2/index.html by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 30 Mar 2016 12:16:01 GMT -->
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
 
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="<?php echo $actual_link;?>assets/ico/apple-touch-icon-144-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="<?php echo $actual_link;?>assets/ico/apple-touch-icon-114-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="<?php echo $actual_link;?>assets/ico/apple-touch-icon-72-precomposed.png">
<link rel="apple-touch-icon-precomposed" href="<?php echo $actual_link;?>ico/apple-touch-icon-57-precomposed.html">
<link rel="shortcut icon" href="<?php echo $actual_link;?>assets/ico/favicon.png">
<title>exchangekarde.com</title>
 
<link href="<?php echo $actual_link;?>assets/bootstrap/css/bootstrap.min.css" rel="stylesheet">

<link href="<?php echo $actual_link;?>assets/bootstrap/css/bootstrap.css" rel="stylesheet">
 
<link href="<?php echo $actual_link;?>assets/css/style.css" rel="stylesheet">


<link href="<?php echo $actual_link;?>assets/css/fileinput.min.css" media="all" rel="stylesheet" type="text/css"/>
 
<link href="<?php echo $actual_link;?>assets/css/owl.carousel.css" rel="stylesheet">
<link href="<?php echo $actual_link;?>assets/css/owl.theme.css" rel="stylesheet">

<link href="<?php echo $actual_link;?>assets/plugins/bxslider/jquery.bxslider.css" rel="stylesheet"/>
 
 
<!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
      <script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
<![endif]-->
 

<script src="<?php echo $actual_link;?>assets/js/pace.min.js"></script>
<script>
    paceOptions = {
      elements: true
    };
</script>
<style>.themeControll{background:#2d3e50;height:auto;width:170px;position:fixed;left:0;padding:20px 0;top:100px;z-index:999999;-webkit-transform:translateX(0);-moz-transform:translateX(0);-o-transform:translateX(0);-ms-transform:translateX(0);transform:translateX(0);opacity:1;-ms-filter:none;filter:none;-webkit-transition:opacity .5s linear,-webkit-transform .7s cubic-bezier(.56,.48,0,.99);-moz-transition:opacity .5s linear,-moz-transform .7s cubic-bezier(.56,.48,0,.99);-o-transition:opacity .5s linear,-o-transform .7s cubic-bezier(.56,.48,0,.99);-ms-transition:opacity .5s linear,-ms-transform .7s cubic-bezier(.56,.48,0,.99);transition:opacity .5s linear,transform .7s cubic-bezier(.56,.48,0,.99);}.themeControll.active{display:block;-webkit-transform:translateX(-170px);-moz-transform:translateX(-170px);-o-transform:translateX(-170px);-ms-transform:translateX(-170px);transform:translateX(-170px);-webkit-transition:opacity .5s linear,-webkit-transform .7s cubic-bezier(.56,.48,0,.99);-moz-transition:opacity .5s linear,-moz-transform .7s cubic-bezier(.56,.48,0,.99);-o-transition:opacity .5s linear,-o-transform .7s cubic-bezier(.56,.48,0,.99);-ms-transition:opacity .5s linear,-ms-transform .7s cubic-bezier(.56,.48,0,.99);transition:opacity .5s linear,transform .7s cubic-bezier(.56,.48,0,.99);}.themeControll a{border-bottom:1px solid rgba(255,255,255,0.1);border-radius:0;clear:both;color:#fff;display:block;height:auto;line-height:16px;margin-bottom:5px;padding-bottom:8px;text-transform:capitalize;width:auto;}.tbtn{background:#2D3E50;color:#FFFFFF!important;font-size:30px;height:auto;padding:10px;position:absolute;right:-40px;top:0;width:40px;cursor:pointer;}.linkinner{display:block;height:400px;}.linkScroll .scroller-bar{width:17px;}.linkScroll .scroller-bar,.linkScroll .scroller-track{background:#1d2e40!important;border-color:#1d2e40!important;}@media (max-width: 780px) {.themeControll{display:none;}}




 
.col-md-2, .col-md-10{
    padding:0;
}
.panel{
    margin-bottom: 0px;
}
.chat-window{
    bottom:0;
    position:fixed;
    
    margin-left:10px;
}
.chat-window > div > .panel{
    border-radius: 5px 5px 0 0;
}
.icon_minim{
    padding:2px 10px;
}
.msg_container_base{
  background: #e5e5e5;
  margin: 0;
  padding: 0 10px 10px;
  max-height:300px;
  overflow-x:hidden;
}
.top-bar {
  background: #666;
  color: white;
  padding: 10px;
  position: relative;
  overflow: hidden;
}
.msg_receive{
    padding-left:0;
    margin-left:0;
}
.msg_sent{
    padding-bottom:20px !important;
    margin-right:0;
}
.messages {
  background: white;
  padding: 10px;
  border-radius: 2px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  max-width:100%;
}
.messages > p {
    font-size: 13px;
    margin: 0 0 0.2rem 0;
  }
.messages > time {
    font-size: 11px;
    color: #ccc;
}
.msg_container {
    padding: 10px;
    overflow: hidden;
    display: flex;
}
img {
    display: block;
    width: 100%;
}
.avatar {
    position: relative;
}
.base_receive > .avatar:after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    width: 0;
    height: 0;
    border: 5px solid #FFF;
    border-left-color: rgba(0, 0, 0, 0);
    border-bottom-color: rgba(0, 0, 0, 0);
}

.base_sent {
  justify-content: flex-end;
  align-items: flex-end;
}
.base_sent > .avatar:after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 0;
    border: 5px solid white;
    border-right-color: transparent;
    border-top-color: transparent;
    box-shadow: 1px 1px 2px rgba(black, 0.2); // not quite perfect but close
}

.msg_sent > time{
    float: right;
}



.msg_container_base::-webkit-scrollbar-track
{
    -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
    background-color: #F5F5F5;
}

.msg_container_base::-webkit-scrollbar
{
    width: 12px;
    background-color: #F5F5F5;
}

.msg_container_base::-webkit-scrollbar-thumb
{
    -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,.3);
    background-color: #555;
}

.btn-group.dropup{
    position:fixed;
    left:0px;
    bottom:0;
}
 
 
 

</style>



</head>
<body>
<?php 
if($curpage=="index.php" || $curpage=="posting-success.php" || $curpage=="account-archived-ads.php" || $curpage=="post_ads.php" || $curpage=="products.php")
{
	include("slidebar.php");
}
?> 
<div id="wrapper">
<div class="header">
<nav class="navbar   navbar-site navbar-default" role="navigation">
<div class="container">
<div class="navbar-header">
<button data-target=".navbar-collapse" data-toggle="collapse" class="navbar-toggle" type="button"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button>
<a href="<?php echo $actual_link;?>index" class="navbar-brand logo logo-title">
 
<span class="logo-icon"><i class="icon icon-search-1 ln-shadow-logo shape-0"></i> </span> Exchangekarde.com </a> </div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-right">
<?php 
if(isset($_SESSION['cid']))
{
	?>
		
        <li><a href="<?php echo $actual_link;?>signout">Signout <i class="glyphicon glyphicon-off"></i></a></li>
        
       <li class="dropdown"><a class="dropdown-toggle" data-toggle="dropdown"> <span><?php echo $_SESSION['cname'];?></span> <i class="icon-user fa"></i> <i class=" icon-down-open-big fa"></i></a>
       <ul class="dropdown-menu user-menu">
<li class="active"><a href="account-home.html"><i class="icon-home"></i> <?php echo $_SESSION['cname'];?> </a></li>
<li><a href="<?php echo $actual_link;?>myads"><i class="icon-th-thumb"></i> My ads </a></li>
<li><a href="<?php echo $actual_link;?>favourite_ads"><i class="icon-heart"></i> Favourite ads </a></li>
<!--<li><a href="account-saved-search.html"><i class="icon-star-circled"></i> Saved search </a></li>-->
<li><a href="<?php echo $actual_link;?>archived_ads"><i class="icon-folder-close"></i> Archived ads </a></li>
<li><a href="<?php echo $actual_link;?>pending_ads"><i class="icon-hourglass"></i> Pending approval </a></li>
<!--<li><a href="statements.html"><i class=" icon-money "></i> Payment history </a></li>-->
</ul>
       </li>
       
       
        <li class="dropdown"><a class="dropdown-toggle" data-toggle="dropdown"> <i class="fa fa-bell"></i>&nbsp; 
        <?php 
		$sqlnoti=mysql_query("select * from tbl_notification where user_id='".$_SESSION['cid']."' order by datetime asc");
		$resnoti=mysql_num_rows($sqlnoti);
		
		echo $resnoti;
		?>
        </a>
        <ul class="dropdown-menu user-menu">
        <?php while($resnotis=mysql_fetch_assoc($sqlnoti))
		{?>
        
            
            <?php 
				/*if($resnotis['query_id']!=="")
			{
				
				
			$sqlqr=mysql_query("select * from tbl_queries where queryid='".$resnotis['query_id']."'");
				while($resqr=mysql_fetch_assoc($sqlqr))
				{
					
					$sqlgru=mysql_query("select * from tbl_users where userid='".$resqr['querybyid']."'");
					$resgru=mysql_fetch_assoc($sqlgru);
					
					$sqladd=mysql_query("select * from tbl_ads where ads_id='".$resqr['for_adid']."'");
					$resadd=mysql_fetch_assoc($sqladd);
					
					?>
                    <li class="media">
                   
                    
						<a>
                     
                        <img  src="<?php echo $actual_link."postedfile/".$resadd['file1'];?>" class="img-responsive" height="50" width="50">                  
                       
                     	 
                    	<div class="media-body">
                        	<div class="margin-none"><?php echo "You have received a request by ".$resgru['fullname']; ?></div>
                        	<span class="label label-default pull-right"><?php echo date('d M Y',strtotime($resqr['datetime']));?></span>
                    	</div>
                       
                        
                        </a>
                    </li>
					<?php 
                   
				}
			}
			else
			{*/
				if($resnotis['ads_id']!=="")
				{
					
					$sqladd=mysql_query("select * from tbl_ads where ads_id='".$resnotis['ads_id']."'");
					$resadd=mysql_fetch_assoc($sqladd);
					
					?>
						<li class="media">
                            <a href="">
                            <div class="pull-left img-left">
                            	<img src="<?php echo $actual_link."postedfile/".$resadd['file1'] ?>" height="50" width="50" class="img-rounded">              </div>
                            
                            <div class="media-body">
                        	<div class="margin-none"><?php echo "New Listing Added"; ?></div>
                            <h5 class="margin-none"><?php echo $resadd['title'];?></h5>
                        	<span class="label label-default pull-right"><?php echo date('d M Y',strtotime($resadd['postdate']));?></span>
                    		</div>
                            </a>
                       </li>
					<?php
				}
			//}
			?>
            
           
		<?php
        }
		?>
</ul>
        </li>
       
       <li class="dropdown"><a title="Ads Queries" class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-comments"></i>&nbsp;<b style="bottom:10px;">
       <?php 
	      $i=0;
		 
		  $sqladss=mysql_query("select  * from tbl_ads where posted_userid='".$_SESSION['cid']."'");
		  while($resadss=mysql_fetch_assoc($sqladss))
		  {
			   //echo'<pre>';print_r($resadss);
			  $ads_id =$resadss['ads_id'];
			   
			   $sqlquery=mysql_query("select * from tbl_queries where for_adid='$ads_id'");
			   $resquery=mysql_num_rows($sqlquery);
			   if($resquery>0)
			   {
			   	$i++;
			   }
			   
			   
		  }
		  echo $i;
		
	   ?>
       </b></a>
       <ul class="dropdown-menu user-menu">
			<?php
			
		  $sqladss1=mysql_query("select  * from tbl_ads where posted_userid='".$_SESSION['cid']."'");
		  while($resadss1=mysql_fetch_assoc($sqladss1))
		  {
				
				$sqlqr=mysql_query("select * from tbl_queries where for_adid='".$resadss1['ads_id']."'");
				while($resqr=mysql_fetch_assoc($sqlqr))
				{
					
					$sqlgru=mysql_query("select * from tbl_users where userid='".$resqr['querybyid']."'");
					$resgru=mysql_fetch_assoc($sqlgru);
					
					$sqladd=mysql_query("select * from tbl_ads where ads_id='".$resqr['for_adid']."'");
					$resadd=mysql_fetch_assoc($sqladd);
					
					?>
                    <li class="media">
                   
                    
						<a href="<?php echo $actual_link?>request/<?php echo $resqr['queryid'];?>">
                     
                        <img  src="<?php echo $actual_link."postedfile/".$resadd['file1'];?>" class="img-responsive" height="50" width="50">                  
                       
                     	 
                    	<div class="media-body">
                        	<div class="margin-none"><?php echo "You have received a request by ".$resgru['fullname']; ?></div>
                        	<span class="label label-default pull-right"><?php echo date('d M Y',strtotime($resqr['datetime']));?></span>
                    	</div>
                       
                        
                        </a>
                    </li>
					<?php 
                   
				}
		  }
			?>
	   </ul>
       </li>
	<?php
}
else
{
?>

<li><a href="<?php echo $actual_link;?>login">Login</a></li>
<li><a href="<?php echo $actual_link;?>signup">Signup</a></li>
<?php } ?>



<li class="postadd"><a class="btn btn-block   btn-border btn-post btn-danger" href="<?php echo $actual_link;?>post_ads">Post Free Add</a></li>
</ul>
</div>
 
</div>
 
</nav>
</div>

<div class="container chatBox" style="display:none;">
    <div class="row chat-window col-xs-5 col-md-3" id="chat_window_1" style="margin-left:57%; z-index: 1000;">
        <div class="col-xs-12 col-md-12">
        	<div class="panel panel-default">
                <div class="panel-heading top-bar">
                    <div class="col-md-8 col-xs-8">
                        <h3 class="panel-title"><span class="glyphicon glyphicon-comment"></span> Chat - Miguel</h3>
                    </div>
                    <div class="col-md-4 col-xs-4" style="text-align: right;">
                        <a href="#"><span id="minim_chat_window" class="glyphicon glyphicon-minus icon_minim"></span></a>
                        <a href="#"><span class="glyphicon glyphicon-remove icon_close" data-id="chat_window_1"></span></a>
                    </div>
                </div>
                <div class="panel-body msg_container_base">
                   
                </div>
                <div class="panel-footer">
                    <div class="input-group">
                        <input id="btn-input" type="text" class="form-control input-sm chat_input" required placeholder="Write your message here..." />
                        <span class="input-group-btn">
                        <button class="btn btn-primary btn-sm" id="btn-chat">Send</button>
                        </span>
                    </div>
                </div>
    		</div>
        </div>
    </div>
    
    <div class="btn-group dropup">
        <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
            <span class="glyphicon glyphicon-cog"></span>
            <span class="sr-only">Toggle Dropdown</span>
        </button>
        <ul class="dropdown-menu" role="menu">
            <li><a href="#" id="new_chat"><span class="glyphicon glyphicon-plus"></span> Novo</a></li>
            <li><a href="#"><span class="glyphicon glyphicon-list"></span> Ver outras</a></li>
            <li><a href="#"><span class="glyphicon glyphicon-remove"></span> Fechar Tudo</a></li>
            <li class="divider"></li>
            <li><a href="#"><span class="glyphicon glyphicon-eye-close"></span> Invisivel</a></li>
        </ul>
    </div>
</div>