<?php 
include('dbconnect.php');

$page = "message" ;

	if(!isset($_SESSION['Username'])){

		 header("location:ccb_login.php?wrong=failed");
		}
		 if(isset($_SESSION['Username'])){

			 $user = $_SESSION['Username'];
			 $userid = $_SESSION['userid'];
			 }
			  $rowx = mysql_fetch_assoc(mysql_query("SELECT * FROM  message where user_id='$user'"));

			  $row = mysql_fetch_assoc(mysql_query("SELECT * FROM cleintuser where Username='$user' AND user_id = '$userid' "));
                                        
                                $Currency = $row['Currency'];
     if ($Currency == "CNY"){ $currencyx = "¥"; } 
     else if ($Currency == "GBP"){  $currencyx = "£"; }  
     else if ($Currency == "USD"){  $currencyx = "$";  } 
     else if ($Currency == "EURO"){ $currencyx = "€";  }                  
                        
                        	$input = array("A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9");
$xcoded = $input[rand(0,25)].$input[rand(2,35)].$input[rand(25,35)].$input[rand(0,35)].$input[rand(0,35)].$input[rand(0,25)].$input[rand(0,25)].$input[rand(0,35)].$input[rand(0,35)].$input[rand(0,35)].$input[rand(26,35)].$input[rand(0,25)].$input[rand(0,35)].$input[rand(0,25)].$input[rand(0,25)] ;
$xcodedx = $input[rand(0,25)].$input[rand(2,35)].$input[rand(25,35)].$input[rand(0,35)].$input[rand(0,35)].$input[rand(0,25)].$input[rand(0,25)].$input[rand(0,35)].$input[rand(0,35)].$input[rand(0,35)].$input[rand(26,35)].$input[rand(0,25)].$input[rand(0,35)].$input[rand(0,25)].$input[rand(0,25)] ;
$codex = $xcoded.$xcodedx.$xcoded.$xcodedx.$xcoded.$xcodedx;
                        
    $userid=$row['user_id'];
    
     $messaagenum = $row['messaagenum'];
     
     
     if(isset($_POST['Change'])){
				if(empty($_POST['pin'])){
					$error="Type new password";
				}
				if(empty($error)){
					$nepin=$_POST['pin'];
					$up="UPDATE cleintuser SET Pin='$nepin'";
					mysql_query($up) or die (mysql_error());
				$suc="Password Changed";
				}
             }
             
             	  $row = mysql_fetch_assoc(mysql_query("SELECT * FROM cleintuser where Username='$user'"));
     

			  ?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <meta charset="utf-8">
  <!-- Title and other stuffs -->
  <title>Message</title>
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta name="description" content="">
  <meta name="keywords" content="">
  <meta name="author" content="">


  <!-- Stylesheets -->
  <link href="account/style/bootstrap.css" rel="stylesheet">
  <!-- Font awesome icon -->
  <link rel="stylesheet" href="account/style/font-awesome.css"> 
  <!-- jQuery UI -->
  <link rel="stylesheet" href="account/style/jquery-ui-1.9.2.custom.min.css"> 
  <!-- Calendar -->
  <link rel="stylesheet" href="account/style/fullcalendar.css">
  <!-- prettyPhoto -->
  <link rel="stylesheet" href="account/style/prettyPhoto.css">  
  <!-- Star rating -->
  <link rel="stylesheet" href="account/style/rateit.css">
  <!-- Date picker -->
  <link rel="stylesheet" href="account/style/bootstrap-datetimepicker.min.css">
  <!-- CLEditor -->
  <link rel="stylesheet" href="account/style/jquery.cleditor.css"> 
  <!-- Uniform -->
  <link rel="stylesheet" href="account/style/uniform.default.html"> 
  <!-- Uniform -->
  <link rel="stylesheet" href="account/style/daterangepicker-bs3.css" />
  <!-- Bootstrap toggle -->
  <link rel="stylesheet" href="account/style/bootstrap-switch.css">
    <!-- Bootstrap toggle -->
  <link rel="stylesheet" href="account/js/datatables/css/dataTables.bootstrap.css">
  <!-- Main stylesheet -->
  <link href="account/style/style.css" rel="stylesheet">
  <!-- Widgets stylesheet -->
  <link href="account/style/widgets.css" rel="stylesheet">   
    <!-- Gritter Notifications stylesheet -->
  <link href="account/style/jquery.gritter.css" rel="stylesheet">   
  
  <!-- HTML5 Support for IE -->
  <!--[if lt IE 9]>
  <script src="js/html5shim.js"></script>
  <![endif]-->

  <!-- Favicon -->
  <link rel="shortcut icon" href="assets/img/favicon.ico">
</head>

<body>
<?php include_once("menu.php");  ?>

  	  	<!-- Main bar -->
  
  <?php include_once("header.php");  ?>
  
  
  
   
 </div>
	    <!-- Matter class="matter" -->

	    <div >
        <div class="container">

          <!-- Table -->

            <div class="row">

              <div class="col-md-12">

  
              </div>

            </div>


            <div class="row">

              <div class="col-md-12">
                <div class="widget">

    <table id="AutoNumber2" border="1" cellspacing="0"bordercolorlight="#7b98e1" bordercolordark="#7b98e1" cellpadding="3" width="100%" height="233">
          <tbody>
            <tr>
              <td height="22" width="21%"><strong>From</strong></td>
              <td height="22" colspan="5">Message</td>
            </tr>
            
            <?php  $userid=$row['user_id']; 
            $getdata="SELECT * from  message  where user_id='$userid'ORDER BY messageid DESC"; 
              $query=mysql_query($getdata) or die (mysql_error());
                	while($datas=mysql_fetch_array($query)){
?> 
  <tr>
    <td> Account Office</td>
    <td><?php echo $datas[message]; ?></td>
  </tr>

<?php 	}   ?>
          </tbody>
        </table>
                

                </div>
              </div>

             

            </div>

        </div>
		  </div>

		<!-- Matter ends -->

    </div>

   <!-- Mainbar ends -->	    	
   <div class="clearfix"></div>

</div>
<!-- Content ends -->

<!-- Footer starts -->
<footer>
  <div class="container">
    <div class="row">
      <div class="col-md-12">
            <!-- Copyright info -->
            <p class="copy">Copyright © 2020 WesBanco, Inc. All Rights Reserved.</p>
      </div>
    </div>
  </div>
</footer> 	

<!-- Footer ends -->

<!-- Scroll to top -->
<span class="totop"><a href="#"><i class="fa fa-chevron-up"></i></a></span> 

<!-- JS -->
<script src="account/js/jquery.js"></script> <!-- jQuery -->
<script src="account/js/bootstrap.js"></script> <!-- Bootstrap -->
<script src="account/js/jquery-ui-1.9.2.custom.min.js"></script> <!-- jQuery UI -->
<script src="account/js/fullcalendar.min.js"></script> <!-- Full Google Calendar - Calendar -->
<script src="account/js/jquery.rateit.min.js"></script> <!-- RateIt - Star rating -->
<script src="account/js/jquery.prettyPhoto.js"></script> <!-- prettyPhoto -->

<!-- jQuery Flot -->
<script src="account/js/excanvas.min.js"></script>
<script src="account/js/jquery.flot.js"></script>
<script src="account/js/jquery.flot.resize.js"></script>
<script src="account/js/jquery.flot.pie.js"></script>
<script src="account/js/jquery.flot.stack.js"></script>

<!-- jQuery Notification - Noty -->
<script src="account/js/jquery.noty.js"></script> <!-- jQuery Notify -->
<script src="account/js/themes/default.js"></script> <!-- jQuery Notify -->
<script src="account/js/layouts/bottom.js"></script> <!-- jQuery Notify -->
<script src="account/js/layouts/topRight.js"></script> <!-- jQuery Notify -->
<script src="account/js/layouts/top.js"></script> <!-- jQuery Notify -->
<!-- jQuery Notification ends -->

<script src="js/datatables/js/jquery.dataTables.js"></script>

<script src="account/js/sparklines.js"></script> <!-- Sparklines -->
<script src="account/js/jquery.cleditor.min.js"></script> <!-- CLEditor -->
<script src="account/js/bootstrap-datetimepicker.min.js"></script> <!-- Date picker -->
<script src="account/js/jquery.uniform.min.html"></script> <!-- jQuery Uniform -->
<script src="account/js/jquery.slimscroll.min.js"></script> <!-- jQuery SlimScroll -->
<script src="account/js/bootstrap-switch.min.js"></script> <!-- Bootstrap Toggle -->
<script src="account/js/filter.js"></script> <!-- Filter for support page -->
<script src="account/js/custom.js"></script> <!-- Custom codes -->
<script src="account/js/charts.js"></script> <!-- Charts & Graphs -->

<script>
    $(document).ready(function() {
			$('#datatable').dataTable({"sPaginationType": "full_numbers"});
		});
</script>
</body>
</html>