<?php
session_start();
include ("includes/security.php");
include ("includes/database.php");
include ("includes/setting.php");

//retrieved logged's user data
$username=$_SESSION["username"];
$dataUser=mysqli_query($con,"SELECT * from tbl_user where username='$username'");
$bil_rekod=mysqli_num_rows($dataUser);
$showData=mysqli_fetch_array($dataUser);



?>

<!DOCTYPE html>
<html lang="en">

<head>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">

    <title><?php echo $tajuk; ?></title>

    <!-- Bootstrap core CSS -->
    <link href="vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">

    <!-- Custom styles for this template -->
    <link href="css/heroic-features.css" rel="stylesheet">


    <!-- Page Content -->
    <div class="container">
  <link rel="stylesheet" type="text/css" href="styleall.css">


</head>

<body>

 <style>
ul {
  list-style-type: none;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: url(images/pinkk.png);
}

li {
  float: left;
}

li a {
  display: block;
  font-family: verdana;
  color: white;
  text-align: center;
  padding: 14px 16px;
  text-decoration: none;
}

li a:hover {
  background-color: #fff2e6;
}
</style>

        <!-- Navigation -->
   <ul>
  <li><a class="active" href="main.php">Home</a></li>
  <li><a href="about.php">About</a></li>
  <li><a href="pilih.php">Choose Shop</a></li>
  <li><a href="profile.php">Profile</a></li>
  <li><a href="feedback.php">Feedback</a></li>
  <li><a href="logout.php">Logout</a></li>
        
</ul>

        <!-- Page Content -->
        <div id="page-wrapper">
            <div class="container-fluid">
                <div class="row">
                    <div class="col-lg-12">
                      <h1 class="page-header">Updating Profile Picture</h1>
<?php






if ($_FILES["picture"]["size"] <= 0) {
    echo "Failed to update the profile picture. Click <a 

href='main.php'>here</a> for dashboard";
}
elseif ($_FILES["picture"]["type"]!="image/jpeg"&&$_FILES

["picture"]["type"]!="image/png")

{
    
echo $_FILES["picture"]["type"];
echo "<br>Invalid Picture.Failed to update the profile 

picture. Click <a href='main.php'>here</a> for dashboard";
}



else
{

$namaFile=$username.$_FILES["picture"]["name"];

//upload picture
move_uploaded_file($_FILES["picture"]["tmp_name"],"user/".

$namaFile);

//update database
mysqli_query($con,"UPDATE tbl_user set user_photo='$namaFile' 

where username='$username'")or die(mysqli_error($con));

echo "Successfully updated the profile picture. Click <a 

href='main.php'>here</a> for dashboard";

}





?>  
                       
  
  
  
                    </div>
                    <!-- /.col-lg-12 -->
                </div>
                <!-- /.row -->
            </div>
            <!-- /.container-fluid -->
        </div>
        <!-- /#page-wrapper -->

    </div>
    <!-- /#wrapper -->

    <!-- jQuery -->
    <script src="vendor/jquery/jquery.min.js"></script>

    <!-- Bootstrap Core JavaScript -->
    <script src="vendor/bootstrap/js/bootstrap.min.js"></script>

    <!-- Metis Menu Plugin JavaScript -->
    <script src="vendor/metisMenu/metisMenu.min.js"></script>

    <!-- Custom Theme JavaScript -->
    <script src="dist/js/sb-admin-2.js"></script>

</body>

</html>
