<?php 
include('header.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']);
  $password = mysqli_real_escape_string($conn, $_POST['password']);
  $cpassword = mysqli_real_escape_string($conn, $_POST['cpassword']);

  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($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', '$mobile', 'verified', '', NULL, '', '', 'OPERATER', '0','');";
          $res = mysqli_query($conn,$sql);
          // 
          if($res){
            ?>
            <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 = "index.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 = "user_add.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

  }


}
?>
<style>
/* ===================== PAGE BACKGROUND ===================== */
body{
    background:linear-gradient(135deg,#0f2027,#203a43,#2c5364);
    font-family:"Poppins",sans-serif;
    min-height:100vh;
}

/* ===================== PAYMENT CARD ===================== */
.payment-form{
    max-width:1400px;
    margin:40px auto;
    background:linear-gradient(135deg,#ffffff,#f4f7ff);
    padding:25px 30px;
    border-radius:18px;
    box-shadow:0 20px 50px rgba(0,0,0,.35);
    position:relative;
}

/* TOP BORDER GLOW */
.payment-form::before{
    content:'';
    position:absolute;
    top:0;
    left:0;
    right:0;
    height:6px;
    background:linear-gradient(135deg,#11998e,#38ef7d);
    border-radius:18px 18px 0 0;
}

/* ===================== HEADING ===================== */
.payment-form h1{
    text-align:center;
    font-weight:800;
    color:#1e3c72;
    margin-bottom:25px;
    letter-spacing:1px;
}

/* ===================== LABEL ===================== */
.payment-form label{
    font-weight:600;
    color:#2c3e50;
    margin-bottom:6px;
}

/* ===================== INPUTS (ALL TYPES) ===================== */
.payment-form input[type="text"],
.payment-form input[type="password"],
.payment-form input[type="email"],
.payment-form input[type="number"],
.payment-form select,
.payment-form textarea{
    width:100%;
    padding:14px 16px;
    margin-bottom:15px;
    border-radius:30px;
    border:1px solid #d0d7ff;
    font-size:15px;
    transition:all .3s ease;
    box-shadow:inset 0 2px 6px rgba(0,0,0,.08);
    background:#fff;
}

/* PLACEHOLDER */
.payment-form input::placeholder,
.payment-form textarea::placeholder{
    color:#999;
    font-weight:500;
}

/* ===================== FOCUS EFFECT ===================== */
.payment-form input[type="text"]:focus,
.payment-form input[type="password"]:focus,
.payment-form input[type="email"]:focus,
.payment-form input[type="number"]:focus,
.payment-form select:focus,
.payment-form textarea:focus{
    outline:none;
    border-color:#396afc;
    box-shadow:0 0 0 3px rgba(57,106,252,.25);
}

/* ===================== BUTTON ===================== */
.payment-form button,
.payment-form input[type="submit"]{
    width:100%;
    padding:14px;
    margin-top:10px;
    border-radius:30px;
    font-weight:700;
    font-size:16px;
    border:none;
    cursor:pointer;
    background:linear-gradient(135deg,#11998e,#38ef7d);
    color:#fff;
    box-shadow:0 6px 18px rgba(0,0,0,.35);
    transition:all .25s ease;
}

/* BUTTON HOVER */
.payment-form button:hover,
.payment-form input[type="submit"]:hover{
    transform:translateY(-2px);
    box-shadow:0 10px 28px rgba(0,0,0,.45);
}

/* ===================== CARD BODY / FOOTER ===================== */
.payment-form .card-body{
    padding:0;
}

.payment-form .card-footer{
    background:none;
    border:none;
    padding-top:10px;
}

/* ===================== INFO & ALERT ===================== */
.bg-info{
    background:linear-gradient(135deg,#396afc,#2948ff)!important;
    color:#fff;
    font-weight:700;
    padding:10px;
    border-radius:10px 0 0 10px;
}

.bg-danger{
    background:linear-gradient(135deg,#ff416c,#ff4b2b)!important;
    color:#fff;
    padding:10px;
    border-radius:0 10px 10px 0;
}

/* ===================== MARQUEE ===================== */
.marquee{
    font-weight:600;
    letter-spacing:.5px;
}

/* ===================== TEXT ===================== */
.payment-form p{
    color:#2c3e50;
    font-size:14px;
}

/* ===================== QR POPUP ===================== */
.qr-popup{
    display:none;
    position:fixed;
    top:80px;
    left:50%;
    transform:translateX(-50%);
    width:320px;
    background:#ffffff;
    padding:20px;
    border-radius:18px;
    text-align:center;
    border:4px solid #38ef7d;
    box-shadow:0 15px 40px rgba(0,0,0,.45);
    z-index:9999;
}

.qr-popup img{
    max-width:220px;
    margin:15px auto;
}

.qr-popup button{
    background:linear-gradient(135deg,#ff416c,#ff4b2b);
    border-radius:25px;
}

/* ===================== MOBILE ===================== */
@media(max-width:768px){
    .payment-form{
        margin:20px;
        padding:20px;
    }
}
</style>


        
                   <div class="payment-form">
									<form action="" method="POST">
          <div class="input-group mb-3">
            <input type="text" name="name" class="form-control" placeholder="Full name">
            <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="text" class="form-control" name="mobile" placeholder="Mobile Number">
            <div class="input-group-append">
              <div class="input-group-text">
                <span class="fas fa-phone"></span>
              </div>
            </div>
          </div>
          <div class="input-group mb-3">
            <input type="email" class="form-control" name="email" placeholder="Email">
            <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="password" class="form-control" name="password" placeholder="Password">
            <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">
            <div class="input-group-append">
              <div class="input-group-text">
                <span class="fas fa-lock"></span>
              </div>
            </div>
          </div>
          <div class="row">
            <div class="col-8">
              <div class="icheck-primary">
                <input type="hidden" name="reg" value="ahkweb">
               
                
                
              </div>
            </div>
            <!-- /.col -->
            <div class="col-4">
              <button type="submit" class="btn btn-primary btn-block">Register</button>
            </div>
            <!-- /.col -->
          </div>
        </form>
								</div>
		<?php 
include('userfooter.php');
?>
