
<?php include("conn.php"); 
$page='Registration'
?>
<!DOCTYPE html>
<html lang="en">
   <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
            <!-- Latest compiled and minified CSS -->
        <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/css/bootstrap.min.css">

        <!--Table cdn-->
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
        <!-- Bootstrap DataTable CSS -->
        <link rel="stylesheet" href="https://cdn.datatables.net/1.10.21/css/dataTables.bootstrap4.min.css">
        <link rel="stylesheet" href="https://cdn.datatables.net/2.0.5/css/dataTables.dataTables.css">
        <link rel="stylesheet" href="https://cdn.datatables.net/buttons/3.0.2/css/buttons.dataTables.css">
    
        <!---Fontawesome CDN-->
        <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
        <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
        <!-- jQuery library -->
        <script src="https://cdn.jsdelivr.net/npm/jquery@3.7.1/dist/jquery.slim.min.js"></script>
    
        <!-- Popper JS -->
        <script defer src="https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js"></script>
    
        <!-- Latest compiled JavaScript -->
        <script defer src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/js/bootstrap.bundle.min.js"></script>
       


        <link rel="preconnect" href="https://fonts.googleapis.com">
        <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
        <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@500&display=swap" rel="stylesheet">
        <link href='https://fonts.googleapis.com/css?family=Convergence' rel='stylesheet'>


        <!--JS AOS-->
        <link rel="stylesheet" href="https://unpkg.com/aos@next/dist/aos.css" />
    
    
          <!-- owl carousel css link -->
        <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/2.3.4/assets/owl.carousel.min.css">
      
       <!-- owl carousel theme.css link -->
       <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/2.3.4/assets/owl.theme.default.min.css">  
    
       <!-- owl carousel js file -->
        <script src="https://cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/2.3.4/owl.carousel.min.js"></script>
    

        <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>  
          
           <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script>  
        <!--video play button cdn-->
          <!-- Icon Font Stylesheet -->
    <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.10.0/css/all.min.css" rel="stylesheet">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.4.1/font/bootstrap-icons.css" rel="stylesheet">
        <!--graph cdn-->
        <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.9.4/Chart.js"></script>
        <script src="https://www.gstatic.com/charts/loader.js"></script>
    <!---Fontawesome CDN-->
    <script src='https://kit.fontawesome.com/a076d05399.js' crossorigin='anonymous'></script>
        <!-- google font--->
        <link rel="preconnect" href="https://fonts.gstatic.com">
        <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300&display=swap" rel="stylesheet">
        
        <?php 
$color_mod='';
$color_mod=2; 
    


   

$sql="select * from store_details order by id desc";
$result = mysqli_query($conn,$sql)or die( mysqli_error($conn));
while ($row=mysqli_fetch_array($result)) {
 $data=$row['id'];
   $store_name=$row['name'];
   $c1=$row['first_contact'];
   $c2=$row['second_contact'];
   $store_email=$row['email'];
   $logo=$row['logo'];
   $location=$row['location'];
   $w_H=$row['working_hours'];
   $website=$row['website'];
   $store_image=$row['logo'];

   




}
?>

        <title> <?php echo $store_name ?> <?php echo $page ?></title>
        <link rel="icon" href="image/<?php echo $store_image ?>" type="image/x-icon">
        <?php
        $color=1;
        $color=$color_mod;

        if ($color==1) {
            $body_color='black';
            $body_text='antiquewhite';
            $nav_color=' #1D211C';
            $nav_text='antiquewhite';
            $menu_b_color=' #1C0601';
        }
        elseif($color==2){
            $body_color='#EDF2F1FF';
            $body_text='black';
            $nav_color='#982BAD';
            $nav_text='antiquewhite';
            $menu_color='#982BAD';
            $menu_b_color='#044763';
        }
       
        
        ?>
    
    </head>
<style>
          body {

  background-repeat: no-repeat;
  background-attachment: fixed;
  background-size: 100% 100%;
  font-family: 'Convergence'!important;
}

.login {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width:600px;
   
  }
    @media only screen and (max-width: 425px){
    .login {
     
        width: 100%;
      }
    }
     </style>
     <?php
      
   if (isset($_POST['register'])) {
    $fname=$_POST["fname"];
    $number=$_POST["number"];
    $address=$_POST["address"];
    $date=$_POST["date"];
    $pass=$_POST["password"];
    $Cpass=$_POST["Cpassword"];
    $order_type=1;
 
 //to prevent php injection
 
 
 
 
    if($pass==$Cpass )
    {   
      $sql01 = "SELECT * FROM customers WHERE number='$number' AND password =''";

      $result01=mysqli_query($conn,$sql01);
      
         $row01=mysqli_fetch_array($result01);
      
         if($row01["number"]==$number && $row01['password'] =='' )
         {   
          $sql03 = "UPDATE `customers` SET `password`='1540948579' WHERE number='$number'";
          if(mysqli_query($conn,$sql03)){
      
          
          }
          else{
            echo 'Error: '.mysqli_error($conn);
          }
        }
          $sql = "INSERT INTO `customers`(`fname`, `number`, `password`, `date`, `location`, `orderlocation`) VALUES ('$fname','$number','$pass','$date','$address','$order_type')";
      if(mysqli_query($conn,$sql)){
  
        echo"<script>alert('Registration was successful. You can now login '); window.location.href='online_login'</script>";
      }
      else{
        echo 'Error: '.mysqli_error($conn);
      }
         
        
   
    
 
       
        
        }
        
        else{
         echo"<script>alert('Your password mix march'); </script>";
        }
     
    } 
     ?>
<body>

          <div class="login bg-light">
    
   
 <!--register form--->
 <div id="register" class="register  my-2">
    <div class="text-center">
    <img src="logo/<?php echo $store_image?>" alt="<?php echo $store?>" height=150>
    <h5><?php echo $store_name?></h5>
    </div>
 
     <h4 class="text-center">Register</h4>
              <form method="post">
              <div class=" row no-gutters">
    <div class="col-12">
    <label class="m-1"for="number">Full Name:</label>
                <div class="d-flex col-12 mb-1">
                    <span class="input-group-text  text-success" id="addon-wrapping"><i class="bi bi-person text-success"></i></span>
                    <input  type="text" class="form-control "placeholder="User name" aria-label="fname" name="fname" aria-describedby="addon-wrapping" required>
                  </div>
    </div>
 
                  <div class="col-12">
                  <label class="m-1"for="number">Contact:</label>
                <div class="d-flex flex-nowrap col-12 mb-1">
                    <span class="input-group-text  text-success" id="addon-wrapping"><i class="bi bi-telephone"></i></span>
                    <input type="text" class="form-control "placeholder="Phone number" aria-label="Username"   name="number" aria-describedby="addon-wrapping" required>

                    <input type="hidden" name="date" value="<?php echo date("F j, Y") ?>">
                  </div>
                  </div>
                  
                 
    <div class="col-sm-12">
    <label class="m-1"for="address">Address:</label>
                <div class="d-flex col-12 mb-1">
                    <span class="input-group-text  text-success" id="addon-wrapping"><i class="bi bi-geo-alt"></i></span>
                    <input  type="text" class="form-control " placeholder="Describe location" aria-label="location" name="address" aria-describedby="addon-wrapping">
                  </div>
    </div>

    <div class="col-12">
    <label class="m-1"for="number">Password:</label>
                <div class=" col-12 mb-1">
                   
                    <input  type="password" class="form-control "placeholder="Set password" aria-label="fname" name="password" aria-describedby="addon-wrapping" required>
                  </div>
    </div>
 
                  <div class="col-12">
                  <label class="m-1"for="number"> Confirm Password:</label>
                <div class=" flex-nowrap col-12 mb-1">
                  
                    <input type="text" class="form-control "placeholder="Confirm password" aria-label="Username"   name="Cpassword" aria-describedby="addon-wrapping">
                  </div>
                  </div>

                  <div class="col-12 text-center mt-2">
                  <button type="submit"  name="register" class="btn btn-primary m-1 ">Submit</button>
                  </div>
               
                  <p class="text-center m-4"> have account? <a  href="online_login"class="text-primary   ">Login</a></p>

             
  </div>
              </form>
             
                </div>
                <!--register form end-->    






    </div>
    
    <!--  isotope plugin cdn  -->
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.isotope/3.0.6/isotope.pkgd.min.js" integrity="sha256-CBrpuqrMhXwcLLUd5tvQ4euBHCdh7wGlDfNz8vbu/iI=" crossorigin="anonymous"></script>
    <script src="js/script.js"></script>

</body>

</html>