<?php
session_start();
include_once ('conn/session.php');
require_once 'conn/controller.php';

 


$reg_user = new USER();
$stmt = $reg_user->runQuery("SELECT * FROM account WHERE uname=:uname");
$stmt->execute(array(":uname" => $_SESSION['uname']));
$row = $stmt->fetch(PDO::FETCH_ASSOC);

$email = $row['email'];
 

?>


 <?php
		

	
		
		
    if(isset($_POST['reset-pass'])){
        
    require_once 'conn/dbconnect.php';
    
    $conn = mysqli_connect($host, $username, $password, $database);
    
    // Check connection
    
    if (!$conn) {
          die("Connection failed: " . mysqli_connect_error());
    }
     
    echo ""; 
    
    $db_select = mysqli_select_db($conn, $database);
    
    
    $upass =$_REQUEST['upass'];
    $upass = md5($upass); 
    $acc_no = $_REQUEST['acc_no'];
    
    
    $sql = "UPDATE `account` SET `upass` = '$upass' WHERE `account`.`acc_no` = $acc_no";
       $insert=mysqli_query($conn, $sql);
       
       if($insert){
                            						       

	                                   						       
                            						       
$timezone = date_default_timezone_get();
date_default_timezone_set($timezone);
$date = date('m/d/Y h:i:s a', time());
$subject = "Password successfully changed!";
$message = "Dear " . $row['fname'] . " your Internet banking password has been changed " . $date . " if you did't do it ,Contact customercare Immediately";
$reg_user->send_mail($row['email'], $message, $subject);
$phone = preg_replace('/[^0-9]/', '', $row['phone']);
$mobile_msg = "Dear " . $row['fname'] . " your Internet banking password has been changed " . $date . " if you did't do it ,Contact customercare Immediately";
//$reg_user->otp($phone,$mobile_msg); 
	       
		  	$msg = "
				<div class='alert alert-success'> 
				<center>	<strong style='color:black;'>Password Modification Was Successful,
                       </strong></center>
                       
                       	<script type='text/javascript'>
							<!--
							function Redirect() {
							window.location='logout.php';
							}
							document.write ('');
							setTimeout('Redirect()', 3000);
							//-->
							</script>
		  		</div>
				";
		   
	   }else{
	       
	       $msg1 = "<h3>Password Modification Failed!</h3>";
	       
	       
	   }
   
    
    }
?>
<?php include 'auth_header.php'; ?>	


<div class="main-panel">        
        <div class="content-wrapper">
                 <?php if (isset($msg)) echo $msg; ?>
                  <?php if (isset($msg1)) echo $msg1; ?>
          <div class="row">
             
            <div class="col-md-6 grid-margin stretch-card">
              <div class="card">
                <div class="card-body">
                  <h4 class="card-title">Reset Your Password</h4>
                  <p class="card-description">
                    Dont get confused, your complaints are welcome via <a href="mailto:<?php echo $site_email; ?>"><?php echo $site_email; ?></a>
                  </p>
                  <form class="forms-sample" autocomplete="off" method="POST" action="">
                      
                       


                    <div class="form-group">
                      <label for="exampleInputUsername1">Old Password</label>
                       <input type="password"  class="form-control" id="email1" name="oldpass" readonly value="<?php echo $row['upass']; ?>" >
                       
                    </div>
                     <div class="form-group">
                      <label for="exampleTextarea1">Enter New Password</label>
                      <input type="password"  class="form-control"  name="upass" placeholder="********"  required >
                    </div>
                 
              
                            <input type="hidden" class="form-control"  name="acc_no" value="<?php echo $row['acc_no']; ?> " />  
                  
                  <input type="submit" name="reset-pass" class="btn btn-primary mr-2" value="CHANGE  →"> 
                  </form>
                </div>
              </div>
            </div>
            <div class="col-md-6 grid-margin stretch-card">
              <div class="card">
                <div class="card-body">
                  <h4 class="card-title">Explore All types of ATM card with ease</h4>
                  <p class="card-description"> 
                  </p>
                  <form class="forms-sample">
                    
                     <script src="js/jssor.slider-28.1.0.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        window.jssor_1_slider_init = function() {

            var jssor_1_SlideshowTransitions = [
              {$Duration:800,x:-0.3,$During:{$Left:[0.3,0.7]},$Easing:{$Left:$Jease$.$InCubic,$Opacity:$Jease$.$Linear},$Opacity:2},
              {$Duration:800,x:0.3,$SlideOut:true,$Easing:{$Left:$Jease$.$InCubic,$Opacity:$Jease$.$Linear},$Opacity:2}
            ];

            var jssor_1_options = {
              $AutoPlay: 1,
              $SlideshowOptions: {
                $Class: $JssorSlideshowRunner$,
                $Transitions: jssor_1_SlideshowTransitions,
                $TransitionsOrder: 1
              },
              $ArrowNavigatorOptions: {
                $Class: $JssorArrowNavigator$
              },
              $ThumbnailNavigatorOptions: {
                $Class: $JssorThumbnailNavigator$,
                $Orientation: 2,
                $NoDrag: true
              }
            };

            var jssor_1_slider = new $JssorSlider$("jssor_1", jssor_1_options);

            /*#region responsive code begin*/

            var MAX_WIDTH = 500;

            function ScaleSlider() {
                var containerElement = jssor_1_slider.$Elmt.parentNode;
                var containerWidth = containerElement.clientWidth;

                if (containerWidth) {

                    var expectedWidth = Math.min(MAX_WIDTH || containerWidth, containerWidth);

                    jssor_1_slider.$ScaleWidth(expectedWidth);
                }
                else {
                    window.setTimeout(ScaleSlider, 30);
                }
            }

            ScaleSlider();

            $Jssor$.$AddEvent(window, "load", ScaleSlider);
            $Jssor$.$AddEvent(window, "resize", ScaleSlider);
            $Jssor$.$AddEvent(window, "orientationchange", ScaleSlider);
            /*#endregion responsive code end*/
        };
    </script>
    <style>
        /*jssor slider loading skin spin css*/
        .jssorl-009-spin img {
            animation-name: jssorl-009-spin;
            animation-duration: 1.6s;
            animation-iteration-count: infinite;
            animation-timing-function: linear;
        }

        @keyframes jssorl-009-spin {
            from { transform: rotate(0deg); }
            to { transform: rotate(360deg); }
        }

        .jssora061 {display:block;position:absolute;cursor:pointer;}
        .jssora061 .a {fill:none;stroke:#fff;stroke-width:360;stroke-linecap:round;}
        .jssora061:hover {opacity:.8;}
        .jssora061.jssora061dn {opacity:.5;}
        .jssora061.jssora061ds {opacity:.3;pointer-events:none;}
    </style>
    <div id="jssor_1" style="position:relative;margin:0 auto;top:0px;left:0px;width:980px;height:540px;overflow:hidden;visibility:hidden;">
        <!-- Loading Screen -->
        <div data-u="loading" class="jssorl-009-spin" style="position:absolute;top:0px;left:0px;width:100%;height:100%;text-align:center;background-color:rgba(0,0,0,0.7);">
            <img style="margin-top:-19px;position:relative;top:50%;width:38px;height:38px;" src="images/spin.svg" />
        </div>
        <div data-u="slides" style="cursor:default;position:relative;top:0px;left:0px;width:980px;height:480px;overflow:hidden;">
            <div>
                <img data-u="image" src="images/cardslide1.jpg" />
                <div u="thumb">ATM Cards at Easy
                </div>
            </div>
            <div>
                <img data-u="image" src="images/cardslide2.jpg" />
                <div u="thumb">Shop Online with your Card
                </div>
            </div>
 
               <div>
                <img data-u="image" src="images/cardslide3.webp" />
                <div u="thumb">Fund your card with ease
                </div>
            </div>
            
               <div>
                <img data-u="image" src="images/cardslide4.jpg" />
                <div u="thumb">POS and Web Transacton made secured
                </div>
            </div>
            
        </div><a data-scale="0" href="https://www.jssor.com" style="display:none;position:absolute;">image gallery</a>
        <!-- Thumbnail Navigator -->
        <div u="thumbnavigator" style="position:absolute;bottom:0px;left:0px;width:980px;height:50px;color:#FFF;overflow:hidden;cursor:default;background-color:rgba(0,0,0,.5);">
            <div u="slides">
                <div u="prototype" style="position:absolute;top:0;left:0;width:980px;height:50px;">
                    <div u="thumbnailtemplate" style="position:absolute;top:0;left:0;width:100%;height:100%;font-family:arial,helvetica,verdana;font-weight:normal;line-height:50px;font-size:16px;padding-left:10px;box-sizing:border-box;"></div>
                </div>
            </div>
        </div>
        <!-- Arrow Navigator -->
        <div data-u="arrowleft" class="jssora061" style="width:55px;height:55px;top:0px;left:25px;" data-autocenter="2" data-scale="0.75" data-scale-left="0.75">
            <svg viewbox="0 0 16000 16000" style="position:absolute;top:0;left:0;width:100%;height:100%;">
                <path class="a" d="M11949,1919L5964.9,7771.7c-127.9,125.5-127.9,329.1,0,454.9L11949,14079"></path>
            </svg>
        </div>
        <div data-u="arrowright" class="jssora061" style="width:55px;height:55px;top:0px;right:25px;" data-autocenter="2" data-scale="0.75" data-scale-right="0.75">
            <svg viewbox="0 0 16000 16000" style="position:absolute;top:0;left:0;width:100%;height:100%;">
                <path class="a" d="M5869,1919l5984.1,5852.7c127.9,125.5,127.9,329.1,0,454.9L5869,14079"></path>
            </svg>
        </div>
    </div>
    <script type="text/javascript">jssor_1_slider_init();
    </script>
    <!-- #endregion Jssor Slider End -->
                    
                    
                    
                    
                  </form>
                </div>
              </div>
            </div>
            
            
            </div>
            </div>
            
            
            <?php include 'auth_footer.php'; ?>	