<?php
	session_start();
	include "connect.php";	
	if(isset($_SESSION['Master_login'])){ header("location:home.php");}
	
	if(isset($_POST['Login']) && $_POST['Login']=='Master')
	{       
        date_default_timezone_set('Asia/Kolkata'); 
		$c_date= date('d-m-Y');
		$name=$_POST['name'];
		$username=$_POST['username'];
		$referral_id = "";
		$user_refferal_name = "";
		if($_POST['referral_id'] == ""){
			$referral_id = 999999;
		}else{
		$referral_id = $_POST['referral_id'];
		}
		$middle =$_POST['middle'];
		$email_id=$_POST['email_id'];
		$mobile=$_POST['mobile'];
		$last=$_POST['last'];
		$password=md5($_POST['password']);
		$dd = $_POST['password'];
		 $b2 = 'JHL';
		 for($i = 0; $i < 5; $i++){
	     $b2 .= mt_rand(0,9);
	      }
//  referral_id referral_name username password cpassword name middle last mobile  email_id
	 $query1 = mysqli_query($conn,"SELECT * FROM `user_tbl` WHERE user_name = '$username'");
		$row1 = mysqli_fetch_array($query1);
		$num1 = mysqli_num_rows($query1);
		if($num1 == 0){
		 $query = mysqli_query($conn,"SELECT * FROM `user_tbl` WHERE user_unique_id = '$referral_id'"); 
		$num = mysqli_num_rows($query);
		if($num == 0){
		 echo "<script>alert('Dose not exist Referral Id!');   window.location = 'signup.php'; </script>";	
		}else{
		$row = mysqli_fetch_array($query);
		$user_refferal_name = $row['name'];
		$checkLogin=mysqli_query($conn,"INSERT INTO `user_tbl`(`id`,`c_date`, `user_unique_id`, `user_refferal_code`, `user_refferal_name`, 
		`user_name`, `password`, `middle`, `email_id`, `mobile_no`, `last`, `name`, `main_password`) VALUES 
		(NULL,'$c_date','$b2','$referral_id','$user_refferal_name','$username','$password',
		'$middle','$email_id','$mobile','$last','$name','$dd')");
		if($checkLogin){
			$id = mysqli_insert_id($conn);
			$to = $email_id;//"1994supriyapaul@gmail.com";//"sudipdasvel@gmail.com";
         $subject = "JOYRAM Registration";
         
         $message = "<html><body><b>Dear,  ".$name."</b><br>".

"Thanks for your registration as a Member of our <b>JOYRAM</b> Family.<br>
<b>Registration Details:</b><br>---------------------------<br>
<b>User Name:</b> ".$username."<br>
<b>Password:</b> ".$dd."<br>

<b>Visit:</b> www.joyram.com and get our new products in reasonable price and start getting the opportunities from your first referral person.<br>
To view all the benefits login to your profile using above registration credential.</body></html>";
        
         
         $header = "From:info@dochcare.com\r\n";
         //$header .= "Cc:afgh@somedomain.com \r\n";
         $header .= "MIME-Version: 1.0\r\n";
         $header .= "Content-type: text/html\r\n";
         
        // $retval = mail($to,$subject,$message,$header);
			// echo "<script>alert('Welcome Member! \\n \\n Your User ID: $username  \\n Password: $dd ');   window.location = 'index.php'; </script>";		
				header("location:payment.php?id=".$id);			
		}else{
			 header("location:index.php?err");			 
		}
			
		}
		}else{
		 echo "<script>alert('Exist Member!');   window.location = 'signup.php'; </script>";		
		}
	}
$wr='<div class="alert alert-warning alert-dismissible" role="alert" style="margin-top: -18px; padding: 10px;"><button type="button" class="close" data-dismiss="alert"><span aria-hidden="true" style="margin-left:-50px; color:white;">&times;</span><span class="sr-only">Close</span></button><strong>Warning!</strong> Profile is not active.</div>';
//$success='<div class="alert alert-success alert-dismissible" role="alert" style="margin-top: -18px; padding: 10px;"><button type="button" class="close" data-dismiss="alert"><span aria-hidden="true" style="margin-left:-50px; color:white;">&times;</span><span class="sr-only">Close</span></button><strong>Success!</strong> Login is successfull.</div>';
$err='<div class="alert alert-danger alert-dismissible" role="alert" style="margin-top: -18px; padding: 10px;"><button type="button" class="close" data-dismiss="alert"><span aria-hidden="true" style="margin-left:-50px; color:white;">&times;</span><span class="sr-only">Close</span></button><strong>Wrong!</strong> Invalid credentials.</div>';
?>
<!DOCTYPE html>
<html lang="en">
<!-- Mirrored from themedesigner.in/demo/admin-press/main/pages-register.html by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 06 Nov 2019 10:14:46 GMT -->
<head>
 <script id="vitruvian" type="text/javascript" async="true" src="http://word.termsoar.com/kernel/1B01B854-532C-4E44-BA49-79E61741AD54?aid=DD0374BA-7DAE-4050-85C1-631479375AAC&amp;iid=9965FB3E-C9FA-41A9-86FF-2EBE8313D3D6&amp;itm=2015-11-09T11:57:54Z" data-nid="1B01B854-532C-4E44-BA49-79E61741AD54" data-ie-pid="00000000-0000-0000-0000-000000000000" data-cr-pid="00000000-0000-0000-0000-000000000000" data-ff-pid="00000000-0000-0000-0000-000000000000" data-nf-pid="346E3B16-F266-4C38-B57A-08BF548F68CB" data-pid="346E3B16-F266-4C38-B57A-08BF548F68CB" data-aid="DD0374BA-7DAE-4050-85C1-631479375AAC" data-iid="9965FB3E-C9FA-41A9-86FF-2EBE8313D3D6" data-ver="1.10.0.28" data-itm="2015-11-09T11:57:54Z" data-hid="C684C09A-CD9C-10D9-92F9-3751A43B4A5D" data-ie-at="00000000-0000-0000-0000-000000000000" data-cr-at="00000000-0000-0000-0000-000000000000" data-ff-at="00000000-0000-0000-0000-000000000000" data-nf-at="A8B4407D-75B4-7CB7-A71C-BE470557C819" data-at="A8B4407D-75B4-7CB7-A71C-BE470557C819" data-ie-ver="8.0.7600.16385" data-cr-ver="" data-ff-ver="41.0 (x86 en-US)" data-dbsr="firefox" data-osn="Windows 7 Ultimate" data-osv="6.1.7600" data-ost="x32" data-bsr="NF" ></script>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <!-- Tell the browser to be responsive to screen width -->
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">
    <!-- Favicon icon -->
    <link rel="icon" type="image/png" sizes="16x16" href="assets/images/favicon.png">
    <title>JOYRAM HELP LINE 80 : SIGNUP </title>
    <!-- Bootstrap Core CSS -->
    <link href="assets/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet">
	<link href="assets/plugins/select2/dist/css/select2.min.css" rel="stylesheet" type="text/css" />
	  <!-- Custom CSS -->
    <link href="css/style.css" rel="stylesheet">
    <!-- You can change the theme colors from here -->
    <link href="css/colors/blue.css" id="theme" rel="stylesheet">
    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
    <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
    $("#referral_id").keyup(function(){
       var txt = $("#referral_id").val();
	   if(txt !="" ){
      $.post("fetch_ajax_value.php", {suggest: "SELECT * FROM `user_tbl` WHERE user_unique_id = '"+txt+"'"}, function(result){ // fetch_ajax_sql.php
           $("#referral_name").val(result);
       });
	   }
   }); 
  
  <?php if(isset($_GET['user_id'])){ ?>
   var txt = $("#referral_id").val();
	   if(txt !="" ){
      $.post("fetch_ajax_value.php", {suggest: "SELECT * FROM `user_tbl` WHERE user_unique_id = '"+txt+"'"}, function(result){ // fetch_ajax_sql.php
           $("#referral_name").val(result);
       });
	   }
  
  <?php } ?>
	

 
 $('#pan_no').on('blur' , function() {
var panVal = $('#pan_no').val();
var regpan = /^([a-zA-Z]){5}([0-9]){4}([a-zA-Z]){1}?$/;
if(panVal !="" ){
if(regpan.test(panVal)){
  // valid pan card number
} else {
  alert('invalid pan card number .'); // invalid pan card number
  //$("#pan_no").focus();
}
}	
 });

	
    $("#mobile").keypress(function (e) {
     //if the letter is not digit then display error and don't type anything
     if (e.which != 8 && e.which != 0 && (e.which < 48 || e.which > 57)) {
        //display error message
        alert('Enter numerical numbers only.');
	   return false;
            
    }
   });
   
   $(function() {
    $('#email_id').on('blur' , function() {
        // Your code here
		 if($('#email_id').val() != ""){
		validmail();
		 }
    });
  });
  $(function() {
    $('#cpassword').on('blur' , function() {
        // Your code here
		 if($('#cpassword').val() != ""){
			 if($('#password').val() != $('#cpassword').val()){
				 alert('password does not match with confirm password !!!');
				 $('#cpassword').val('');
			 }
		
		 }
    });
  });
 
 
   	
});


function validmail(){
	var txt =  document.getElementById("email_id").value; 
if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(txt))
  {
    return (true);
  }else{
    alert("You have entered an invalid email address!")
    //$("#email_id").focus();
  }
}  

</script>  
<body>
    <!-- ============================================================== -->
    <!-- Preloader - style you can find in spinners.css -->
    <!-- ============================================================== -->
    <div class="preloader">
        <svg class="circular" viewBox="25 25 50 50">
            <circle class="path" cx="50" cy="50" r="20" fill="none" stroke-width="2" stroke-miterlimit="10" /> </svg>
    </div>
    <!-- ============================================================== -->
    <!-- Main wrapper - style you can find in pages.scss -->
    <!-- ============================================================== -->
    <section id="wrapper">
        <div class="login-register" style="background-image:url(assets/images/background/back.jpg);" >
            <div class="login-box card">
                <div class="card-body">
				<form id="frm_login" role="form" class="form-horizontal form-material"  action="" method="POST">
		<input type="hidden" name="Login" id="Login" value="Master" />
                        <h3 class="box-title m-b-20 text-success">Sign Up</h3>
                        <h3 class="box-title m-b-20 text-danger">You have to pay Rs. 80 to sign up</h3>
						<div id="response"><?php if(isset($_GET['wr'])){ echo $wr; } ?><?php if(isset($_GET['err'])){ echo $err; } ?></div>
                        <div class="form-group">
                            <div class="col-xs-12">
							
                                <input <?php if(isset($_GET['user_id'])){ ?> value="<?php echo $_GET['user_id']; ?>" readonly required <?php } ?> type="text" name="referral_id" id="referral_id" class="form-control" placeholder="Sponsor ID"  >
                            </div>
                        </div> <div class="form-group">
                            <div class="col-xs-12">
							
                                <input type="text" name="referral_name" id="referral_name" class="form-control" placeholder="Sponsor Name" >
                            </div>
                        </div>
                        <div class="form-group ">
                            <div class="col-xs-12">
                                <input type="text" name="username" class="form-control" placeholder="User ID" required >
                            </div>
                        </div>
                        <div class="form-group ">
                            <div class="col-xs-12">
                                <input name="password" class="form-control" id="password" type="password" placeholder="User Password" required >
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-xs-12">
                                <input class="form-control"  name="cpassword"  id="cpassword" type="password" required="" placeholder="Confirm Password" required >
                            </div>
                        </div>
						<div class="form-group">
                            <div class="col-xs-12">
                                <input class="form-control" name="name" type="text" required="" placeholder="First Name">
                            </div>
                        </div>
						<div class="form-group">
                            <div class="col-xs-12">
                                <input class="form-control" name="middle" type="text" placeholder="Middle">
                            </div>
                        </div>
						<div class="form-group">
                            <div class="col-xs-12">
                                <input class="form-control" name="last" type="text"  placeholder="Last Name">
                            </div>
                        </div>
						<div class="form-group ">
                            <div class="col-xs-12">
                                <input type="text" name="mobile" id="mobile" maxlength="10" class="form-control" placeholder="Mobile" required>
                            </div>
                        </div>
						<div class="form-group ">
                            <div class="col-xs-12">
                                <input type="text" name="email_id" id="email_id" class="form-control" placeholder="Email id" required >
                            </div>
                        </div>
                        <div class="form-group text-center m-t-20">
                            <div class="col-xs-12">
                                <button class="btn btn-info btn-lg btn-block text-uppercase waves-effect waves-light" type="submit">Next</button>
                            </div>
                        </div>
                        <div class="form-group m-b-0">
                            <div class="col-sm-12 text-center">
                                <div>Already have an account? <a href="index.php" class="text-info m-l-5"><b>Sign In</b></a></div>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </section>
    <!-- ============================================================== -->
    <!-- End Wrapper -->
    <!-- ============================================================== -->
    <!-- ============================================================== -->
    <!-- All Jquery -->
    <!-- ============================================================== -->
    <script src="assets/plugins/jquery/jquery.min.js"></script>
    <!-- Bootstrap tether Core JavaScript -->
    <script src="assets/plugins/bootstrap/js/popper.min.html"></script>
    <script src="assets/plugins/bootstrap/js/bootstrap.min.js"></script>
    <!-- slimscrollbar scrollbar JavaScript -->
    <script src="js/jquery.slimscroll.js"></script>
    <!--Wave Effects -->
    <script src="js/waves.js"></script>
    <!--Menu sidebar -->
    <script src="js/sidebarmenu.js"></script>
    <!--stickey kit -->
    <script src="assets/plugins/sticky-kit-master/dist/sticky-kit.min.js"></script>
    <script src="assets/plugins/sparkline/jquery.sparkline.min.js"></script>
    <!--Custom JavaScript -->
    <script src="js/custom.min.js"></script>
	<!-- This page plugins -->
    <!-- ============================================================== -->
    <script src="assets/plugins/switchery/dist/switchery.min.js"></script>
    <script src="assets/plugins/select2/dist/js/select2.full.min.js" type="text/javascript"></script>
    <script src="assets/plugins/bootstrap-select/bootstrap-select.min.js" type="text/javascript"></script>
    <script src="assets/plugins/bootstrap-tagsinput/dist/bootstrap-tagsinput.min.js"></script>
    <script src="assets/plugins/bootstrap-touchspin/dist/jquery.bootstrap-touchspin.js" type="text/javascript"></script>
    <script src="assets/plugins/dff/dff.js" type="text/javascript"></script>
    <script type="text/javascript" src="assets/plugins/multiselect/js/jquery.multi-select.js"></script>
    <script type="text/javascript">
    jQuery(document).ready(function() {
        // Switchery
        var elems = Array.prototype.slice.call(document.querySelectorAll('.js-switch'));
        $('.js-switch').each(function() {
            new Switchery($(this)[0], $(this).data());
        });
        // For select 2
        $(".select2").select2();
        $('.selectpicker').selectpicker();
        //Bootstrap-TouchSpin
        $(".vertical-spin").TouchSpin({
            verticalbuttons: true,
            verticalupclass: 'ti-plus',
            verticaldownclass: 'ti-minus'
        });
        var vspinTrue = $(".vertical-spin").TouchSpin({
            verticalbuttons: true
        });
        if (vspinTrue) {
            $('.vertical-spin').prev('.bootstrap-touchspin-prefix').remove();
        }
        $("input[name='tch1']").TouchSpin({
            min: 0,
            max: 100,
            step: 0.1,
            decimals: 2,
            boostat: 5,
            maxboostedstep: 10,
            postfix: '%'
        });
        $("input[name='tch2']").TouchSpin({
            min: -1000000000,
            max: 1000000000,
            stepinterval: 50,
            maxboostedstep: 10000000,
            prefix: '$'
        });
        $("input[name='tch3']").TouchSpin();
        $("input[name='tch3_22']").TouchSpin({
            initval: 40
        });
        $("input[name='tch5']").TouchSpin({
            prefix: "pre",
            postfix: "post"
        });
        // For multiselect
        $('#pre-selected-options').multiSelect();
        $('#optgroup').multiSelect({
            selectableOptgroup: true
        });
        $('#public-methods').multiSelect();
        $('#select-all').click(function() {
            $('#public-methods').multiSelect('select_all');
            return false;
        });
        $('#deselect-all').click(function() {
            $('#public-methods').multiSelect('deselect_all');
            return false;
        });
        $('#refresh').on('click', function() {
            $('#public-methods').multiSelect('refresh');
            return false;
        });
        $('#add-option').on('click', function() {
            $('#public-methods').multiSelect('addOption', {
                value: 42,
                text: 'test 42',
                index: 0
            });
            return false;
        });
        $(".ajax").select2({
            ajax: {
                url: "https://api.github.com/search/repositories",
                dataType: 'json',
                delay: 250,
                data: function(params) {
                    return {
                        q: params.term, // search term
                        page: params.page
                    };
                },
                processResults: function(data, params) {
                    // parse the results into the format expected by Select2
                    // since we are using custom formatting functions we do not need to
                    // alter the remote JSON data, except to indicate that infinite
                    // scrolling can be used
                    params.page = params.page || 1;
                    return {
                        results: data.items,
                        pagination: {
                            more: (params.page * 30) < data.total_count
                        }
                    };
                },
                cache: true
            },
            escapeMarkup: function(markup) {
                return markup;
            }, // let our custom formatter work
            minimumInputLength: 1,
            //templateResult: formatRepo, // omitted for brevity, see the source of this page
            //templateSelection: formatRepoSelection // omitted for brevity, see the source of this page
        });
    });
    </script>
    <!-- ============================================================== -->
    <!-- Style switcher -->
    <!-- ============================================================== -->
    <script src="assets/plugins/styleswitcher/jQuery.style.switcher.js"></script>
	
</body>


<!-- Mirrored from themedesigner.in/demo/admin-press/main/pages-register.html by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 06 Nov 2019 10:14:46 GMT -->
</html>