<?php
include('includes/config.php');
if (isset($_POST['reg']) && $_POST['reg'] == "ahkweb"  ) {
  
  $name = mysqli_real_escape_string($conn, $_POST['name']);
  $mobile = mysqli_real_escape_string($conn, $_POST['mobile']);
  $email = mysqli_real_escape_string($conn, $_POST['email']);
  $userid = mysqli_real_escape_string($conn, $_POST['userid']);
  $password = mysqli_real_escape_string($conn, $_POST['password']);
  $usertype = mysqli_real_escape_string($conn, $_POST['usertype']);
  $cpassword = mysqli_real_escape_string($conn, $_POST['cpassword']);


$order_id = "CSCUCL@".rand(000000,999999);
$amount =1000;
    if($usertype == "OPERATOR"){
        $amount = 1000;
    }else if($usertype == "DISTRIBUTOR"){
        $amount = 1500;
    }else{
        $amount = 1500;
    }
}else if($usertype == "SUPERDISTRIBUTOR"){
        $amount = 2000;
    }else{
        $amount = 2000;
    }
      if($usertype == "ADMIN2"){
        $amount = 1;
      
    
  if (!empty($password) && !empty($cpassword) && $mobile != "ADMIN" && $email != "ADMIN") {
    if ($password == $cpassword) {

      $fpassword = password_hash($cpassword, PASSWORD_DEFAULT);
      $checksql = mysqli_query($conn, "SELECT * FROM usertable WHERE emailid='$email' OR phone='$mobile'");
      if (
        !empty($name) &&
        !empty($mobile) &&
        !empty($email) &&
        !empty($userid) &&
        !empty($password) &&
        !empty($cpassword)
      ) {
        if (mysqli_num_rows($checksql) == 0) {
    
          $sql = "INSERT INTO `usertable` (`phone`, `emailid`, `name`, `password`, `city`, `state`, `userid`, `status`, `profilepic`, `createdby`, `joineddate`, `joinedtime`, `usertype`, `walletamount`,`otp`) VALUES ('$mobile', '$email', '$name', '$fpassword', 'cc', 'sdds', '$userid', 'unverified', 'profile/admin.jpg', 'u729291845_newhacking','','','$usertype', '0','');";
          $res = mysqli_query($conn,$sql);
          // 
          }
          if($res){
                  
                if($_POST['mode'] == "qr"){
                        // QR Code Start Here 
                        date_default_timezone_set("Asia/Kolkata");
                        $date = date("d-m-Y");
                        $ins = mysqli_query($conn,"INSERT INTO `wallet`(`phone`,`amount`,`txn_id`,`email`,`status`,`date`,`PAYMENTMODE`) VALUES ('$phone','$amount','$order_id','$email','pending','$date','REGQR')");
                             ?>
                    <form class="mt-2" method="post" name="f2" action="regpg.php">
                        <input type="hidden" name="frompage" value="reg">
                    <input  type="hidden" name="order_id"  value="<?php echo $order_id; ?>">
                    <input type="hidden"  name="phone" value="<?php echo $phone; ?>">
                    <input type="hidden" name="amount" value="<?php echo $amount; ?>">
                    </form>
                    <script type="text/javascript">
                    document.f2.submit();
                    </script>
                    
            <script>
              // alert('Your Account Register Successfully!, You can Login');
              $(function() {
        Swal.fire(
            'Success',
            'Register Successfully You can Login',
            'success'
        )
    });

  
  window.setTimeout(function() {
  window.location.href = "login.php";
  }, 1500);

    
            </script>
            <?php
          }else{
            ?>
            <script>
              // alert('Account Not Created ,Try Again!!');
              $(function(){
                Swal.fire(
                  'Opps!',
                  'Internet Server Error, Please Try Again Later!',
                  'error'
                )
    
              });
            </script>
            <?php
          }
          // 
        }else{
          ?>
          <script>
            // alert('Your  email or phone  already exist!');
            $(function() {
        Swal.fire(
            'Opps!',
            'Your  email or phone  already exist!',
            'error'
        )
    });
      
  window.setTimeout(function() {
  window.location.href = "login.php";
  }, 1500);
          </script>
          <?php
        }
      }else{
        ?>
        <script>
             $(function() {
        Swal.fire(
            'Opps!',
            'Please Fill All data',
            'error'
        )
    });
        </script>
        <?php
      }
    }else{
      // echo "Confirm Password Not Match";
      ?>
      <script>
           $(function() {
    Swal.fire(
        'Opps!',
        'Confirm Password Not Match!',
        'error'
    )
});
      </script>
      <?php
    }
  }else{
    ?>
      <script>
           $(function() {
    Swal.fire(
        'WOW trying to Cheat!!!',
        'You Are A Cheater  GET OUT!',
        'error'
    )
});
      </script>
        <?php
}
if(isset($_POST['failedmsg']) && $_POST['failedmsg'] == "true"){
    ?>
    <script>
        $(function(){
            Swal.fire(
                'Payment Added Failed',
                'if Payment Deduct Then Contact us!',
                'error'
            )
        })
    </script>
    <?php
}
// UPI message
// UPI Code Success 
if(isset($_POST['success']) && $_POST['success'] == "true"){
    ?>
    <script>
        $(function(){
            Swal.fire(
                'Great',
                'Your Account Created Successfully!',
                'success'
            )
        })
    </script>
    <?php
}
if(isset($_POST['failed']) && $_POST['failed'] == "true"){
    ?>
    <script>
        $(function(){
            Swal.fire(
                'Payment Added Failed',
                'if Payment Deduct Then Contact us!',
                'error'
            )
        })
    </script>
      <?php

  }


}
?>




 <!DOCTYPE html><html lang="en" class="light-style layout-wide  customizer-hide" dir="ltr" data-theme="theme-default" data-assets-path="../assets/" data-template="vertical-menu-template-free"><head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">

    <title>Registration - CSC | CSC Aadhaar Operator</title>

    
    <meta name="description" content="Most Powerful &amp; Comprehensive Bootstrap 5 HTML Admin Dashboard Template built for developers!">
    <meta name="keywords" content="dashboard, bootstrap 5 dashboard, bootstrap 5 design, bootstrap 5">
    <!-- Canonical SEO -->
    <link rel="canonical" href="https://themeselection.com/item/sneat-bootstrap-html-admin-template/">
    
    
    <!-- ? PROD Only: Google Tag Manager (Default ThemeSelection: GTM-5DDHKGP, PixInvent: GTM-5J3LMKC) -->
    <script async="" src="js/gtm.js"></script><script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
      new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
      j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
      'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
      })(window,document,'script','dataLayer','GTM-5DDHKGP');</script>
    <!-- End Google Tag Manager -->
    
    <!-- Favicon -->
    <link rel="icon" type="image/x-icon" href="favicon.ico">

    <!-- Fonts -->
    <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=Public+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;1,300;1,400;1,500;1,600;1,700&amp;display=swap" rel="stylesheet">

    
    <link rel="stylesheet" href="css/boxicons.css">
    

    <!-- Core CSS -->
    <link rel="stylesheet" href="css/core.css" class="template-customizer-core-css">
    <link rel="stylesheet" href="css/theme-default.css" class="template-customizer-theme-css">
    <link rel="stylesheet" href="css/demo.css">
    
    <!-- Vendors CSS -->
    <link rel="stylesheet" href="css/perfect-scrollbar.css"> 
    

    <!-- Page CSS -->
    <!-- Page -->
<link rel="stylesheet" href="css/page-auth.css">

    <!-- Helpers -->
    <script src="js/helpers.js"></script>
    <!--! Template customizer & Theme config files MUST be included after core stylesheets and helpers.js in the <head> section -->
    <!--? Config:  Mandatory theme config file contain global vars & default theme options, Set your preferred theme option in this file.  -->
    <script src="js/config.js"></script>
    <style>
	body{
		background-color: skyblue;
	}
</style>
    
</head>

<body>

  
 
<div class="container-xxl">
  <div class="authentication-wrapper authentication-basic container-p-y">
    <div class="authentication-inner">
      <!-- Register -->
     
          <!-- Logo -->
          <div class="app-brand justify-content-center">
            <a href="reg2.php" class="app-brand-link gap-1">
              <span class="app-brand-logo demo">


</span></head>
<h1 style="color: red;"><u>UCL Registration</u> </h1>
         <h2> </h2>
            </a>
          </div>
         

    
                         <div class="row g-3">
		<div class="col-12">
                                 
                        

    <div class="card">
      <div class="card-body register-card-body">
        <p class="login-box-msg">Update Client Lite.</p>

        <form action="" method="POST">
          <div class="input-group mb-3">
            <input type="text" name="name" class="form-control" placeholder="Full name"  required>
            <div class="input-group-append">
              <div class="input-group-text">
                <span class="fas fa-user"></span>
              </div>
            </div>
          </div>
          <div class="input-group mb-3">
            <input type="number" class="form-control" name="mobile" placeholder="Mobile No"  maxlength="10"  required>
            <div class="input-group-append">
              <div class="input-group-text">
                <span class="fa-anchor"></span>
              </div>
            </div>
          </div>
          <div class="input-group mb-3">
            <input type="email" class="form-control" name="email" placeholder="Email"  required>
            <div class="input-group-append">
              <div class="input-group-text">
                <span class="fas fa-envelope"></span>
              </div>
            </div>
          </div>
          <div class="input-group mb-3">
            <input type="text" class="form-control" name="userid" placeholder="Strong Username"  required>
            <div class="input-group-append">
              <div class="input-group-text">
                <span class="fa-anchor"></span>
              </div>
            </div>
          </div>
          <div class="input-group mb-3">
            <input type="password" class="form-control" name="password" placeholder="Password"  required>
            <div class="input-group-append">
              <div class="input-group-text">
                <span class="fas fa-lock"></span>
              </div>
            </div>
          </div>
          <div class="input-group mb-3">
            <input type="password" class="form-control" name="cpassword" placeholder="Retype password"  required>
            <div class="input-group-append">
              <div class="input-group-text">
                <span class="fas fa-lock"></span>
              </div>
            </div>
          </div>
          <div class="col-12">
												<label for="inputSelectCountry" class="form-label"></label><hr>
												<select  required name="usertype" class="form-select" id="usertype" aria-label="Default select example">
													<option value="">Please Select</option>
													<option value="OPERATOR">Retailer - 1000/- (Lifetime Valid)</option>
													<option value="DISTRIBUTOR">Distributor - 1500/- (Unlimited Retailer)</option>
													<option value="SUPERDISTRIBUTOR">Super Distributor - 2000/- (Unlimited Distributor+Retailer)</option>
													<option value="ADMIN2">MASTER ADMIN - 2500/- (Unlimited +Super+Distributor=Retailer)</option>
													
												</select>
											</div>
											<br>
											<div class="col-12">
												
												<select  required name="mode" class="form-select" id="inputSelectCountry" aria-label="Default select example">
												
											
														
															<option value="qr">Paid Registraion Amount (UPI)</option>
														
													
												</select>
											</div><br>
          <div class="row">
            <div class="col-8">
              <div class="icheck-primary">
                <input type="hidden" name="reg" value="ahkweb">
               
                <input type="checkbox" id="agreeTerms" name="terms" value="agree"  required>
                <label for="agreeTerms">
                  I agree to the <a href="#">terms</a>
                </label>
              </div>
            </div>
            <!-- /.col -->
            <div class="col-4">
              <button type="submit" class="btn btn-primary btn-block">Register</button>
            </div>
            <!-- /.col -->
          </div>
        </form>

        <!-- <div class="social-auth-links text-center">
        <p>- OR -</p>
        <a href="#" class="btn btn-block btn-primary">
          <i class="fab fa-facebook mr-2"></i>
          Sign up using Facebook
        </a>
        <a href="#" class="btn btn-block btn-danger">
          <i class="fab fa-google-plus mr-2"></i>
          Sign up using Google+
        </a>
      </div> -->

        <a href="login.php" class="text-center">I already have a membership</a>
      </div>
      <!-- /.form-box -->
    </div><!-- /.card -->
  </div>
  <!-- /.register-box -->

  <!--          <div class="buy-now">-->
    <!--<a href="https://wa.me/8294102572" target="_blank" class="btn btn-danger btn-buy-now">CALL SUPPORT</a>-->
  <!--</div>-->
  
          
        </div>
      </div>
      <!-- /Register -->
    </div>
  </div>
</div>

<!-- / Content -->

  

  
  -<div class="buy-now">-->
  <!--  <a href="https://wa.me/8294102572" target="_blank" class="btn btn-danger btn-buy-now">CALL SUPPORT</a>-->
  <!--</div>-->
  

  <!-- Core JS -->
  <!-- build:js assets/vendor/js/core.js -->
  
  <script src="js/jquery.js"></script>
  <script src="js/popper.js"></script>
  <script src="js/bootstrap.js"></script>
  <script src="js/perfect-scrollbar.js"></script>
  <script src="js/menu.js"></script>
  
  <!-- endbuild -->

  <!-- Vendors JS -->
  
  

  <!-- Main JS -->
  <script src="js/main.js"></script>
  

  <!-- Page JS -->
  
  
  
  <!-- Place this tag in your head or just before your close body tag. -->
  <script async="" defer="" src="js/buttons.js"></script>
  






</body></html>
