<?php
session_start();
$user = "educateb_bof-engla";
$pass = "bof-engla.com";
$dbname = "educateb_bof-engla";
$conn = mysqli_connect("localhost", $user, $pass, $dbname);
$sql = "SELECT * FROM site_details";
$result = mysqli_query($conn, $sql);

if (mysqli_num_rows($result) > 0) {
        while($row = mysqli_fetch_assoc($result)) {
            $email = $row["email"];
            $sitename = $row["site_name"];
            $location = $row["location"];
            $phone = $row["phone"];
            $routing = $row["routing"];
            $swift = $row["swift"];
        }
}
if (!isset($_SESSION["adminuser"])){
    header("Location: login.php");
}
else{
    
    $conn = mysqli_connect("localhost", $user, $pass, $dbname);
    if (!$conn) {
        die("Connection failed: " . mysqli_connect_error());
    }
    
    $content = "<table  class='w3-table-all'>
    				
    					<tr>
    						<!-- <th>S/no</th> -->
    						<th>Online ID</th>
    						<th colspan='3'>Actions</th>
    						
    					</tr>";
    $sql = "SELECT * FROM accounts WHERE status='Pending' ORDER BY acc_id DESC";
    $result = mysqli_query($conn, $sql);
    if (mysqli_num_rows($result) > 0) {
        
        while($row = mysqli_fetch_assoc($result)) {
            $online_id = $row['online_id'];
            
	        $content .= "<tr>
	         
            <td> $online_id </td>
			<td> <a href='profile-details.php?online_id=$online_id'>View Profile</a> </td>
			<td> <a href='activate.php?online_id=$online_id'>Activate</a> </td>
			<td> <a href='delete.php?online_id=$online_id'>Delete</a> </td>
            <td> <a href='suspend.php?online_id=$online_id'>Suspend</a> </td>
            <td> <a href='view.php?online_id=$online_id'>Activities</a> </td>
    		</tr>";
	    }
	    $content .= "</table>";
	}
	else{
		$content .= "<h3 style='color:red;text-anlign:center'>Sorry, There are no users yet. </h3></table> ";
	}
}

?>

<!DOCTYPE html>
<html>
<head>
<title><?php echo $sitename; ?> | Admin Panel</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Lato">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Montserrat">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<script src='https://kit.fontawesome.com/a076d05399.js'></script>
<style>
body,h1,h2,h3,h4,h5,h6 {font-family: "Lato", sans-serif}
.w3-bar,h1,button {font-family: "Montserrat", sans-serif}
.w3-theme-l5 {color:#000 !important; background-color:#efefff !important}
.w3-theme-l4 {color:#000 !important; background-color:#cacaff !important}
.w3-theme-l3 {color:#fff !important; background-color:#9595ff !important}
.w3-theme-l2 {color:#fff !important; background-color:#6060ff !important}
.w3-theme-l1 {color:#fff !important; background-color:#2b2bff !important}
.w3-theme-d1 {color:#fff !important; background-color:#0000dc !important}
.w3-theme-d2 {color:#fff !important; background-color:#0000c4 !important}
.w3-theme-d3 {color:#fff !important; background-color:#0000ab !important}
.w3-theme-d4 {color:#fff !important; background-color:#000093 !important}
.w3-theme-d5 {color:#fff !important; background-color:#00007a !important}

.w3-theme-light {color:#000 !important; background-color:#efefff !important}
.w3-theme-dark {color:#fff !important; background-color:#00007a !important}
.w3-theme-action {color:#fff !important; background-color:#00007a !important}

.w3-theme {color:#fff !important; background-color:#0000f4 !important}
.w3-text-theme {color:#0000f4 !important}
.w3-border-theme {border-color:#0000f4 !important}

.w3-hover-theme:hover {color:#fff !important; background-color:#0000f4 !important}
.w3-hover-text-theme:hover {color:#0000f4 !important}
.w3-hover-border-theme:hover {border-color:#0000f4 !important}
.bhead{font-weight:bold;border-top-right-radius: 5px; border-top-left-radius: 5px;background-image: linear-gradient(#f12a2a, #4b0505)}
.button1{background-image: linear-gradient(#f12a2a, #4b0505);color:lightgray;}
.button2{background-image: linear-gradient(#f12a2a, #3e0404);color:lightgray;}
</style>
</head>
<body>
    <div class="w3-container w3-theme-d2">
        <div class="w3-bar w3-theme-d2">
            <a class="w3-bar-item w3-xlarge w3-hide-small" href="/"><img src="/images/logo.png" style="height:50px;"></a>
            <a class="w3-bar-item w3-button w3-hover-none w3-margin-left w3-hide-small w3-text-white w3-small" style="margin-top:20px" href="#"><i class='fa fa-map-marker-alt w3-large'></i> &nbsp; <?php echo $location;?></a>
            <a class="w3-bar-item w3-button w3-hover-none w3-margin-left w3-hide-small w3-text-white w3-small" style="margin-top:20px" href="mailto:<?php echo $email;?>"><i class='fa fa-envelope-open w3-large'></i> &nbsp; <?php echo $email;?></a>
            <a class="w3-bar-item w3-button w3-hover-none w3-margin-left w3-hide-small w3-text-white w3-small" style="margin-top:20px" href="whatsapp://send/?phone=<?php echo $phone;?>"><i class='fa fa-phone w3-large'></i>&nbsp;<?php echo $phone;?></a>
        </div>
        <div class="w3-container w3-center w3-theme-d2 w3-hide-medium w3-hide-large">
            <h3 class="w3-left" ><a href="/"><img src="/images/logo.png" style="height:50px;"></a></h3>
            <p class="w3-right w3-margin-top">Admin Panel</p>
        </div>
        <div class="w3-cotainer w3-center w3-theme-d2 w3-hide-medium w3-hide-large">
            <a class="w3-button w3-hover-none w3-margin-left w3-text-yellow w3-small" href="#"><i class='fa fa-map-marker-alt w3-large'></i></a>
            <a class="w3-button w3-hover-none w3-margin-left w3-text-yellow w3-small" href="#"><i class='fa fa-envelope-open w3-large'></i></a>
            <a class="w3-button w3-hover-none w3-margin-left w3-text-yellow w3-small" href="#"><i class='fa fa-phone w3-large'></i></a>
        </div>
    </div>
    
    <div class="w3-container  w3-theme-l1 w3-card-4">    
        <div class="w3-bar w3-theme-l1 w3-left-align w3-large">
            <a class="w3-bar-item w3-button w3-hide-medium w3-hide-large w3-left w3-padding-large w3-hover-white w3-large" href="javascript:void(0);" onclick="myFunction()" title="Toggle Navigation Menu"><i class="fa fa-bars"></i>Menu</a>
            <a href="/index.php" class="w3-bar-item w3-button w3-padding-large w3-hide-small">Home</a>
            <a href="/business.php" class="w3-bar-item w3-button w3-hide-small w3-padding-large w3-hover-none">Business</a>
            <div class="w3-dropdown-hover">
                <a class="w3-button w3-hide-small w3-padding-large w3-hover-none">Services <i class='fa fa-caret-down'></i></a>
                <div class="w3-dropdown-content w3-bar-block w3-border">
                  <a href="/loans.php" class="w3-bar-item w3-button">Loans</a>
                  <a href="/career.php" class="w3-bar-item w3-button">Career</a>
                  <a href="/investments.php" class="w3-bar-item w3-button">Investments</a>
                  <a href="/community.php" class="w3-bar-item w3-button">Community</a>
                  <a href="/personal.php" class="w3-bar-item w3-button">Personal</a>
                </div>
            </div>
            <a href="/investments.php" class="w3-bar-item w3-button w3-hide-small w3-padding-large w3-hover-none">Investments</a>
            <a href="/loans.php" class="w3-bar-item w3-button w3-hide-small w3-padding-large w3-hover-none">Loan</a>
            <a href="/signup.php" class="w3-bar-item w3-button w3-hide-small w3-padding-large w3-hover-none">Register</a>
            <a href="/contact.php" class="w3-bar-item w3-button w3-hide-small w3-padding-large w3-hover-none">Contact</a>
            <form action='sign_out.php' method='post'><button type="submit" class="w3-bar-item w3-button w3-padding-large w3-hover-none w3-right">Logout <i class='fa fa-sign-out-alt w3-text-red'></i></button></form>
        </div>
        <!-- Navbar on small screens -->
        <div id="navDemo" class="w3-bar-block w3-white w3-hide w3-hide-large w3-hide-medium w3-large">
            
                <a href="admin-dash.php" class="w3-bar-item w3-button">Active Accounts</a>
                
                  <a href="pending.php" class="w3-bar-item w3-button">Pending Aprovals</a>
                  <a href="password-change.php" class="w3-bar-item w3-button">Change Password</a>
                  <a href="suspended.php" class="w3-bar-item w3-button">supended</a>
                  <a class="w3-bar-item w3-button" href="addtransfer.php">Add Transaction</a>
                  
                  <a class="w3-bar-item w3-button" href="sendemail.php">Send Mail</a>
                  
            
            
            
        </div>
    </div>
    
<div class="w3-cell-row w3-hide-small">
    <div class="w3-cell w3-hide-small w3-theme-d4 " style="width:25%">
        <div class="w3-bar-block">
        
            <a class="w3-bar-item w3-button w3-large w3-margin-bottom" href="admin-dash.php">Active Accounts</a>
        
            <a class="w3-bar-item w3-button w3-large w3-margin-bottom" href="pending.php">Pending Aprovals</a>
        
            <a class="w3-bar-item w3-button w3-large w3-margin-bottom" href="password-change.php">Change Password</a>
            <a class="w3-bar-item w3-button w3-large w3-margin-bottom" href="suspended.php">Suspended</a>
            <a class="w3-bar-item w3-button" href="addtransfer.php">Add Transaction</a>
            
            <a class="w3-bar-item w3-button" href="sendemail.php">Send Mail</a>
        
            
        </div>
        
        
    </div>
    
    <div class="w3-cell w3-theme-l5">
        
        
        <div class="w3-container w3-responsive w3-text-theme" style="margin-bottom:200px;">
            <h3>Admin Panel</h3>
			

			
            <?php echo $content; ?>
        </div>
    </div>
</div>
<div class="w3-conatiner w3-hide-large w3-hide-medium w3-responsive w3-text-theme" style="margin-bottom:200px;">
    <h3>Admin Panel</h3>
			

			
            <?php echo $content; ?>
</div>

<?php include 'footer.php';?>

<script>
// Used to toggle the menu on small screens when clicking on the menu button
function myFunction() {
  var x = document.getElementById("navDemo");
  if (x.className.indexOf("w3-show") == -1) {
    x.className += " w3-show";
  } else { 
    x.className = x.className.replace(" w3-show", "");
  }
}

function myFunc() {
  var x = document.getElementById("navDemo1");
  if (x.className.indexOf("w3-show") == -1) {
    x.className += " w3-show";
  } else { 
    x.className = x.className.replace(" w3-show", "");
  }
}
</script>
</body>
</html>