<?php
session_start();
include'dbconnection.php';
//Checking session is valid or not
if (strlen($_SESSION['id']==0)) {
  header('location:logout.php');
  } else{

// for updating user info    
if(isset($_POST['Submit']))
{
	$slide1=$_POST['slide1'];
	$slide2=$_POST['slide2'];
	$slide3=$_POST['slide3'];
    $slide4=$_POST['slide4'];
	$slide5=$_POST['slide5'];
	$slide6=$_POST['slide6'];
  $uid=intval($_GET['uid']);
$query=mysqli_query($con,"update site_slide set slide1_text1='$slide1' ,slide1_text2='$slide2' ,slide2_text1='$slide3' ,slide2_text2='$slide4' ,slide3_text1='$slide5' ,slide3_text2='$slide6' where site_slide_ID='$uid'");
if ($query)
{ 
   echo  "<script>alert('Slide text updated succesfully');</script>";
   header('location:slide_settings.php'); 
    
}
else{
    echo "<script>alert('slide text not updated');</script>";   
    
      
}
}
?>

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="Dashboard">
    <meta name="keyword" content="Dashboard, Bootstrap, Admin, Template, Theme, Responsive, Fluid, Retina">
    <link rel="icon" type="image/png"  href="assets/images/favicon.png">
    <title>Admin | Update Homepage Settings</title>
    <link href="assets/css/bootstrap.css" rel="stylesheet">
    <link href="assets/font-awesome/css/font-awesome.css" rel="stylesheet" />
    <link href="assets/css/style.css" rel="stylesheet">
    <link href="assets/css/style-responsive.css" rel="stylesheet">
  </head>

  <body>

  <section id="container" >
      <header class="header black-bg">
              <div class="sidebar-toggle-box">
                  <div class="fa fa-bars tooltips" data-placement="right" data-original-title="Toggle Navigation"></div>
              </div>
            <a href="#" class="logo"><b>Admin Dashboard</b></a>
            <div class="nav notify-row" id="top_menu">
               
                         
                   
                </ul>
            </div>
            <div class="top-menu">
            	<ul class="nav pull-right top-menu">
                    <li><a class="logout" href="logout.php">Logout</a></li>
            	</ul>
            </div>
        </header>
        <?php include 'sidebar.php'?>
      <?php $ret=mysqli_query($con,"select * from site_slide where site_slide_ID='".$_GET['uid']."'");
	  while($row=mysqli_fetch_array($ret))
	  
	  {?>
      <section id="main-content">
          <section class="wrapper">
          
             	
				<div class="row">
				
                  
	                  
                  <div class="col-md-12">
                      <div class="content-panel">
                      <p align="center" style="color:#F00;"><?php echo $_SESSION['msg'];?><?php echo $_SESSION['msg']=""; ?></p>
                           <form class="form-horizontal style-form" name="form1" method="post" action="" onSubmit="return valid();">
                           <p style="color:#F00"><?php echo $_SESSION['msg'];?><?php echo $_SESSION['msg']="";?></p>
                          <div class="form-group">
                              <label class="col-sm-2 col-sm-2 control-label" style="padding-left:40px;">Slide1_text1</label>
                              <div class="col-sm-10">
                                  <input type="text" class="form-control" name="slide1" value="<?php echo $row['slide1_text1'];?>" >
                              </div>
                          </div>
                          
                              <div class="form-group">
                              <label class="col-sm-2 col-sm-2 control-label" style="padding-left:40px;">Slide1_text2</label>
                              <div class="col-sm-10">
                                  <input type="text" class="form-control" name="slide2" value="<?php echo $row['slide1_text2'];?>" >
                              </div>
                          </div>
                          
                              <div class="form-group">
                              <label class="col-sm-2 col-sm-2 control-label" style="padding-left:40px;">Slide2_text1</label>
                              <div class="col-sm-10">
                                  <input type="text" class="form-control" name="slide3" value="<?php echo $row['slide2_text1'];?>" >
                              </div>
                          </div>
                               <div class="form-group">
                              <label class="col-sm-2 col-sm-2 control-label" style="padding-left:40px;">Slide2_text2 </label>
                              <div class="col-sm-10">
                                  <input type="text" class="form-control" name="slide4" value="<?php echo $row['slide2_text2'];?>" >
                              </div>
                          </div>
                            <div class="form-group">
                              <label class="col-sm-2 col-sm-2 control-label" style="padding-left:40px;">Slide3_text1</label>
                              <div class="col-sm-10">
                                  <input type="text" class="form-control" name="slide5" value="<?php echo $row['slide3_text1'];?>" >
                              </div>
                          </div>
                          <div class="form-group">
                              <label class="col-sm-2 col-sm-2 control-label" style="padding-left:40px;">slide3_text2</label>
                              <div class="col-sm-10">
                                  <input type="text" class="form-control" name="slide6" value="<?php echo $row['slide3_text2'];?>" >
                              </div>
                          </div>
                          <div style="margin-left:100px;">
                          <input type="submit" name="Submit" value="Update" class="btn btn-theme"></div>
                          </form>
                      </div>
                  </div>
              </div>
		</section>
        <?php } ?>
      </section></section>
    <script src="assets/js/jquery.js"></script>
    <script src="assets/js/bootstrap.min.js"></script>
    <script class="include" type="text/javascript" src="assets/js/jquery.dcjqaccordion.2.7.js"></script>
    <script src="assets/js/jquery.scrollTo.min.js"></script>
    <script src="assets/js/jquery.nicescroll.js" type="text/javascript"></script>
    <script src="assets/js/common-scripts.js"></script>
  <script>
      $(function(){
          $('select.styled').customSelect();
      });

  </script>

  </body>
</html>
<?php } ?>