<?php 
//error_reporting(0); 
session_start();
$success="";
if(isset($_SESSION['SESS_LOGGEDIN']) == FALSE) {
    header("Location: " . $config_basedir."login.php");
}

require("config.php");
require("db.php");
?>
<?php

$seller= $_SESSION['SESS_USERID']; 
$select=mysqli_query($db,"SELECT * FROM logins WHERE id='$seller'");
$serow=mysqli_fetch_assoc($select);
$forename = $serow['firstname'];

$surname = $serow['lastname'];
$add1 = $serow['country'];
$add3 = $serow['state'];
$city = $serow['city'];
$postcode = $serow['currency'];
$phone = $serow['phone'];
$email = $serow['email'];
if(isset($_POST['submit']))
{

    $forename = mysqli_real_escape_string($_POST['forenameBox']);
    $surname = mysqli_real_escape_string($_POST['surnameBox']);
    $add1 = mysqli_real_escape_string($_POST['country']);
    $add3 = mysqli_real_escape_string($_POST['state']);
    $city = mysqli_real_escape_string($_POST['city']);
    $postcode = mysqli_real_escape_string($_POST['postcodeBox']);
    $phone = mysqli_real_escape_string($_POST['phoneBox']);
    $email = mysqli_real_escape_string($_POST['emailBox']);

    $check = mysqli_query("SELECT username FROM logins WHERE username = '$username'");
    $echeck = mysql_query("SELECT email FROM logins WHERE username = '$email'");
    $cocheck = mysqli_query("SELECT * FROM countries WHERE id = '$add1'");
    $scheck = mysqli_query("SELECT * FROM states WHERE id = '$add3'");
    $ccheck = mysqli_query("SELECT * FROM cities WHERE id = '$city'");
    $corow=mysqli_fetch_assoc($cocheck);
    $srow=mysqli_fetch_assoc($scheck);;
    $crow=mysqli_fetch_assoc($ccheck);
    $add1 = $corow['name'];
    $add3 = $srow['name'];
    $city = $crow['name'];

    $numrows = mysql_num_rows($check);
    $enumrows = mysql_num_rows($echeck);

    if($numrows >= 1)    
        $error= 'username already exist';   
    else if($enumrows >= 1)
        $error2= 'email already exist'; 
    else if(!strlen($phone)>=20)
        $error3= 'invalid phone number'; 
    else{
        echo $_POST['city'];
        $addresssql = mysql_query("INSERT INTO `logins` (`username`, `firstname`, `lastname`, `email`, `password`,`country`, `state`,`city`,  `phone`, `currency`, `verified`) VALUES ('$username','$forename',' $surname', '$email', '$password','$add1', '$add3','$city', '$phone', '$postcode', 0)");

        $sucess= "<br>
    <div class='success' align='center'><img src='images/download.png'>Registration successful please  -  <a href='login.php' style='color:blue'> Login</a></div> Login</a></div>";
    }
}

else
{
}
if (isset($_POST['details'])) {

    $product_name = mysql_real_escape_string($_POST['details']);
    $seller= $_SESSION['SESS_USERID']; 
    $ver=1;
    $sql = mysql_query("UPDATE logins SET verified=$ver WHERE id='$seller'") or die (mysql_error());
    // Place image in the folder 
    $newname = $seller."front.jpg";

    $snewname = $seller."back.jpg";

    move_uploaded_file($_FILES['fileField']['tmp_name'], "productimages/$newname");
    move_uploaded_file($_FILES['fileField2']['tmp_name'], "productimages/$snewname");
    $success="<div class='success' style='margin-bottom:50px;'><img src='images/download.png'>Files Uploaded You will be contacted via email upon verification</div>";
}
?>

<?php

$seller= $_SESSION['SESS_USERID']; 

$sql = mysqli_query($db,"SELECT * FROM logins WHERE id='$seller'");
 
// Place image in the folder 
$numrow=mysqli_fetch_assoc($sql);
$forename = $numrow['firstname'];
$surname = $numrow['lastname'];
$active_no = $numrow['active_no'];
$cashout_no = $numrow['cashout_no'];
$investors_no = $numrow['investors_no'];
$profile = $numrow['profile'];

?>

<!DOCTYPE html>
<html lang="en">
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<head>
  <meta charset="UTF-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <link rel="shortcut icon" href="assets/img/favicon2.png" type="image/x-icon" />
  
  
  		<!-- Stylesheets -->
        <link href="css/bootstrap.css" rel="stylesheet">
<link href="plugins/revolution/css/settings.css" rel="stylesheet" type="text/css"><!-- REVOLUTION SETTINGS STYLES -->
<link href="plugins/revolution/css/layers.css" rel="stylesheet" type="text/css"><!-- REVOLUTION LAYERS STYLES -->
<link href="plugins/revolution/css/navigation.css" rel="stylesheet" type="text/css"><!-- REVOLUTION NAVIGATION STYLES -->
<link href="css/style.css" rel="stylesheet">
<link href="css/responsive.css" rel="stylesheet">

<!--Color Switcher Mockup-->
<link href="css/color-switcher-design.css" rel="stylesheet">

<!--Color Themes-->
<link id="theme-color-file" href="css/color-themes/orange-theme.css" rel="stylesheet">
  
  
  
   <!-- Bootstrap core CSS -->
        <link href="css2/bootstrap.css" rel='stylesheet' type='text/css'>
        <link href="css2/styles.css" rel='stylesheet' type='text/css'>
        <link href="css2/grid.css" rel='stylesheet' type='text/css'>
        <!-- Custom styles for this template -->
        <link href="js2/colorbox/colorbox.css"  rel='stylesheet' type='text/css'>
        <link href="css2/templatemo_style.css"  rel='stylesheet' type='text/css'>
		<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
  
  
  
  
  <link rel="stylesheet" href="assets/css/bootstrap_custom.css" />
  <link rel="stylesheet"
    href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200" />
  <link rel="stylesheet" href="assets/css/nice-select.css" />
  <link rel="stylesheet" href="assets/css/dd.css" />
  <link rel="stylesheet" href="assets/css/styles.css" />
  
  <style>
@media (max-width: 800px) {
  .with1{
   float: left !important;
  }
  
  .with2{
   float: left !important;
  }
   .with3{
   float: left !important;
  }
   .with4{
   float: left !important;
  }
   .with5{
   float: left !important;
  }
   .with6{
   float: left !important;
  }
   .with7{
   float: left !important;
  }
   .with8{
   float: left !important;
  }
}
</style>
  
  
  
  
  <title>Alpha Elite Trade - Deposit</title>
</head>

<body>
  <div class="d-flex wrapper" id="wrapper">
    <!-- Sidebar -->
    <div id="sidebar-wrapper" class="sidebar-wrapper">
      <div class="sidebar-heading">
        <a href="index-2.html">
          <img id="logo" src="assets/img/logodash.png" alt="" />
        </a>
      </div>
      <nav class="sidebar mb-4">
        <ul class="nav flex-column" id="nav_accordion">
          <li class="nav-item">
            <a class="nav-link d-flex gap-2 align-items-center" href="trade.php">
              <img src="assets/img/dashboard_icon_inactive.png" alt="" />
              <span class="fw-semibold">Dashboard</span>
            </a>
          </li>
          <li class="nav-item">
            <a class="nav-link d-flex gap-2 align-items-center" href="deposit.php">
              <span class="material-symbols-outlined fw-lighter"> sync </span>
              <span class="fw-semibold">Deposit</span>
            </a>
          </li>
          <li class="nav-item">
            <a class="nav-link d-flex gap-2 align-items-center" href="withdraw.php">
              <span class="material-symbols-outlined fw-lighter">
                payments
              </span>
              <span class="fw-semibold">Withdraw</span>
            </a>
          </li>
         
          <li class="nav-item">
            <a class="nav-link d-flex gap-2 align-items-center" href="pending.php">
              <span class="material-symbols-outlined fw-lighter">
                percent
              </span>
              <span class="fw-semibold">Pending</span>
            </a>
          </li>
          <li class="nav-item">
            <a class="nav-link active d-flex gap-2 align-items-center" href="history.php">
              <span class="material-symbols-outlined fw-lighter">
                insights
              </span>
              <span class="fw-semibold">History</span>
            </a>
          </li>
          <li class="nav-item">
            <a class="nav-link d-flex gap-2 align-items-center" href="notifications.html">
              <span class="material-symbols-outlined fw-lighter">
                notifications_active
              </span>
              <span class="fw-semibold">Notifications</span>
            </a>
          </li>
       

         <li class="nav-item">
            <a class="nav-link d-flex gap-2 align-items-center" href="account-details.php">
              <span class="material-symbols-outlined fw-lighter">
                settings
              </span>
              <span class="fw-semibold">Settings</span>
            </a>
          </li>

         <li class="nav-item">
            <a class="nav-link d-flex gap-2 align-items-center" href="http://localhost/uchz/logout.php">
              <span class="material-symbols-outlined fw-lighter">
                logout
              </span>
              <span class="fw-semibold">Logout</span>
            </a>
          </li>
        
        </ul>
        <div class="lang-select d-flex justify-content-center">
          <select id="select">
            <option value="english">English</option>
            <option value="bangla">Bangla</option>
            <option value="arabic">Arabic</option>
          </select>
        </div>
      </nav>
    </div>

    <!-- Page Content -->
    <div id="page-content-wrapper" class="page-content-wrapper">
            <nav class="navbar navbar-expand-lg py-lg-3 px-2 px-lg-4 d-flex fixed-top justify-content-between">
        <div class="d-flex align-items-center">
          <div class="d-flex align-items-center d-lg-none">
            <span class="material-symbols-outlined menu-toggle" id="menu-toggle">
              menu
            </span>
          </div>
          <div class="d-none d-xl-block"> 
 		  
            
                <a class="dropdown-item d-flex align-items-center gap-2" href="#">
                  <span class="material-symbols-outlined fw-light" style="color: orange !important">
                    email
                  </span>
                  info@alphalitetrade.com</a>
               
          </div>
        </div>

        <div class="d-flex gap-3 p-lg-2 p-lg-0 align-items-center justify-content-end">           
          <div class="nav-item dropdown">
            <a class="d-flex gap-2 align-items-center" href="#" id="navbarDropdown4" role="button"
              data-bs-toggle="dropdown" aria-expanded="false">
              <img height="60" width="60" class="img-fluid" src="assets/img/avatarnow.png" alt="user">
              <div class="d-flex flex-column d-none d-xl-block">
                <p class="mb-0 text-white fw-semibold"><?php echo $forename; ?> <?php echo $surname; ?></p>
                <span class="small text-white">Investor</span>
				
				<?php
                        function display_currency($currency){

                            foreach($currency as $currence){
                                echo $currence;
                            }
                        }
                        $username = $_SESSION['SESS_USERNAME'];
                        $currency = array();
                        $query = mysqli_query($db,"SELECT * FROM logins WHERE username='$username'");
                        $user_data = mysqli_fetch_array($query);
                        if($user_data['currency']==mysqli_real_escape_string($db,'USD')){
                            $currency[]='$';
                        }
                        else if($user_data['currency']==mysqli_real_escape_string($db,'GBP')){
                            $currency[]='£';
                        }
                        else if($user_data['currency']==mysqli_real_escape_string($db,'EUR')){
                            $currency[]='€';
                        }
                        else if($user_data['currency']==mysqli_real_escape_string($db,'AUD')){
                            $currency[]='$';
                        }
                        else if($user_data['currency']==mysqli_real_escape_string($db,'CAD')){
                            $currency[]='$';
                        }
                        $seller= $_SESSION['SESS_USERID']; 
                        $sql = mysqli_query($db,"SELECT * FROM logins WHERE id='$seller'");

                        $numrow=mysqli_fetch_assoc($sql);
                        $balc=$numrow['balance'];
                        ?>
              </div>
            </a>
            <ul class="dropdown-menu dropdown-menu-end user shadow border-0" aria-labelledby="navbarDropdown4"
              onclick="event.stopPropagation()">
              <li><span class="px-3 d-inline-block">Welcome <?php echo $surname; ?></span></li>
              <li>
                <a class="dropdown-item d-flex align-items-center gap-2" href="#">
                  <span class="material-symbols-outlined fw-light">
                    account_circle
                  </span>
                  Profile</a>
              </li>
              <li>
                <a class="dropdown-item d-flex align-items-center gap-2" href="#">
                  <span class="material-symbols-outlined fw-light"> chat </span>
                  Message</a>
              </li>
            
            
              <li>
                <a class="dropdown-item d-flex align-items-center gap-2" href="account-details.php">
                  <span class="material-symbols-outlined fw-light"> settings </span>
                  Settings</a>
              </li>
              <li>
                <a class="dropdown-item d-flex align-items-center gap-1" href="http://localhost/uchz/logout.php">
                  <span class="material-symbols-outlined fw-light"> logout </span>
                  Log Out</a>
              </li>
            </ul>
          </div>
        </div>
        <!-- For pc -->
      </nav>
	  
      <div class="container-fluid main-content px-2 px-lg-4">
        <!-- Tables -->
        <div class="row my-2 g-3 g-lg-4 pb-3  ">
          <div class="col-12">
            <div class="mainchart px-3 px-md-4 py-3 py-lg-4">
             
			 <p align="center" style="font-size: 30px">Account Settings</p><br>
 
			  <?php 
echo $success;
?>

    <form action='<?=$_SERVER['PHP_SELF']?>' method='POST' id='myform'><div class="add" align="right">
    
    <div clas="row">
        <div class="col-md-5" align="right"><label for="" class="with1" style="">Firstname</label></div><div class="col-md-7" align="left">
        <input type="text" name="forenameBox" id="username" min="3"  value="<?php echo $forename?>" required></div></div>
    <div clas="row">
        <div class="col-md-5" align="right"><label class="with2" style="">Lastname</label></div><div class="col-md-7" align="left">
        <input type="text" name="surnameBox" id="username" value="<?php echo $surname?>"></div></div>
    <div clas="row">
        <div class="col-md-5" align="right"><label for="" class="with3" style="">Email</label></div><div class="col-md-7" align="left">
        <input type="email" name="emailBox" id="username" value="<?php echo $email?>" required></div></div>
    <div clas="row">
        <div class="col-md-5" align="right"><label class="with4" for="" style="">Country</label></div><div class="col-md-7" align="left">
        <input type="text" name="country" id="username" value="<?php echo $add1?>" required></div></div>
    <div clas="row">
        <div class="col-md-5" align="right"><label for="" class="with5" style="">State</label></div><div class="col-md-7" align="left">
        <input type="text" name="state" id="username" value="<?php echo $add3 ?>" required></div></div>
    
	<div clas="row">
        <div class="col-md-5" align="right"><label for="" class="with6" vstyle="">City</label></div><div class="col-md-7" align="left">
        <input type="text" name="city" id="username" value="<?php echo $city?>" required></div></div>
	
    <div clas="row">
        <div class="col-md-5" align="right"><label for="" class="with7" style="">Currency</label></div><div class="col-md-7" align="left">
        <select name="postcodeBox" class="" id="category" required="required">
            <option value="<?php echo $postcode?>"><?php echo $postcode?></option>
            <option value="USD">USD</option>
            <option value="GBP">GBP</option>
            <option value="EUR">EUR</option>
            <option value="AUD">AUD</option>
            <option value="CAD">CAD</option>
        </select>
        </div>
    </div>
    <div clas="row">
        <div class="col-md-5" align="right"><label class="with8" for="" style="">Phone</label></div>
		<div class="col-md-7" align="left">
        <input type="number" name="phoneBox" id="username" min="999999999" value="<?php echo $phone?>" required>
        </div>
	    </div>



    <div align="center">
        
        <br/><?php if(isset($msg)){?>

        <div class="error" align="center" valign="top"><?php echo $msg;?></div>

        <?php } ?>


        <input type="submit" name="submit" value="Update" id="btn-mlogin" align="center" style="background: orangered !important">

    </div></div>

    </form></div>
	<br>
	<br>
			  
			  

            </div>
          </div>
        </div>

        <!-- Footer -->
        <div class="row py-2 g-3 g-lg-4 top-border footer">
          <div class="col-lg-6">
           <span class="text-center text-lg-start d-block w-100">©2023. All Rights Reserved By <a href="#" class="primary">Alpha Lite Trade.</a></span>
          </div>
          
        </div>
      </div>
    </div>
  </div>
  <!-- JS script links -->
  <script src="../cdn.jsdelivr.net/npm/bootstrap%405.0.0-beta3/dist/js/bootstrap.bundle.min.js"></script>
  <script src="../code.jquery.com/jquery-3.5.1.min.js"></script>
  <script src="assets/js/jquery.nice-select.js"></script>
  <script src="assets/js/dd.min.js"></script>
  <script src="assets/js/main.js"></script>
</body>



</html>