<?php 
session_start();
require('../db.php');
include('inc/access.php');
						
	$user = $_SESSION['user'];
								
	$ins = mysqli_query($conn,"SELECT * FROM users WHERE email='$user' ");
	$data = mysqli_fetch_array($ins);
								
	$email = $data['email'];
	$rowpas = $data['pass'];
	$bal = $data['bal'];
							
	$deps = "SELECT * FROM deposit  ";
	$payment = $conn->query($deps);
	
include('../inc/recaptcha.php');
include('../inc/logo.php');	
							
						?> 

<?php include('inc/header.php');?>

<body class="fixed-nav sticky-footer bg-dark" id="page-top">



  <!-- Navigation-->
 <?php include('inc/nav.php');?>
        
  <!-- Navigation Ends--> 
      </ul>
    </div>
  </nav>
  <div class="content-wrapper">
  
    <div class="container-fluid">
      <!-- Breadcrumbs-->
     
      <div class="row">
        <div class="col-12">
          
     
     <h2 class="w3-xxxlarge w3-text-green" align="center"><b>Dashboard Pop Up Message for Users</b></h2>
       

      <!-- Example Bar Chart Card-->
       
     <?php 
	 
$chek = mysqli_query($conn,"SELECT * FROM settings  ");
 
 $pdata = mysqli_fetch_array($chek);
		  		
		if(isset($_POST['setting'])){
			
$sitename = $_POST['sitename'];


$mgs = $_POST['mgs'];
$mgs2 = $_POST['mgs2'];
$mgs3 = $_POST['mgs3'];

		
			
	if(!empty($mgs)){

$updat = mysqli_query($conn,"UPDATE settings SET message='$mgs',message2='$mgs2',message3='$mgs3' ") or die(mysqli_error()); 

    echo "
	
	<div class='alert alert-success'>
    Dashboard Broadcast Saved
  </div>
  
  <script>
setTimeout(function(){ window.location.href='dashboard-alert.php' }, 1000);</script>
   ";

 }else{
	 
	echo "<div class='alert alert-danger'>No Entry made, Message 1 is compulsary. </div>"; 
	 }
       
    } 

?> 
       
  <form action="" method="post" autocomplete = 'off' > 
  
  <div class="form-group">
        <label><strong>Message 1:</strong></label>
		
		 <input type="text" id="mgs" name="mgs" value="<?php echo $pdata['message'];?>"  class="form-control" >
		
      </div>
      
      <div class="form-group">
        <label><strong>Message 2:</strong></label>
		
		 <input type="text" id="mgs2" name="mgs2" value="<?php echo $pdata['message2'];?>"  class="form-control" >
		
      </div>
      
      <div class="form-group">
        <label><strong>Pop Up Alert Message:</strong></label>
		
		 <input type="text" id="mgs3" name="mgs3" value="<?php echo $pdata['message3'];?>"   class="form-control" >
		
      </div>
  
  <!--<div class="form-group">
        <label><strong>Recaptcha Site Key</strong>   <a href="https://www.google.com/recaptcha/admin/create" target="_blank">Create recaptcha v2 here</a> </label>
		
		 <input type="text" id="sitekey" name="sitekey"  class="form-control" value="<?php echo $pdata['sitekey'];?>" >
		
      </div>
      
      <div class="form-group">
        <label><strong>Recaptcha Secret Key</strong></label>
		
		 <input type="text" id="secretkey" name="secretkey"  class="form-control" value="<?php echo $pdata['secretkey'];?>" >
		
      </div>-->

	  
      <button type="submit" id="submit" name="setting" class="btn btn-info">Save Changes</button>
    </form>  
 


   
   



            
            </div>
            
          </div>
          <!-- Card Columns Example Social Feed-->    
         </p>
        </div>
      </div>
    </div>
    <!-- /.container-fluid-->
    <!-- /.content-wrapper-->
   <?php include('inc/footer.php');?>