%PDF- %GIF98; %PNG; .
Cyber Programmer
Logo of a company Server : Apache
System : Linux sh00666.bluehost.com 5.14.0-687.26.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Jul 14 16:32:02 EDT 2026 x86_64
User : ndkhermy ( 1200)
PHP Version : 8.5.12
Disable Function : NONE
Directory :  /home1/ndkhermy/public_html/website_93b53270/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home1/ndkhermy/public_html/website_93b53270/registration.php
<?php include('header.php'); 
$phone =0;
if (isset($_SESSION['user_id'])) {
    echo "<script>window.location='user-profile.php'</script>";
    exit;
}
?>

<style type="text/css">
	.eye-icon {
    float: right;
    margin-right: 10px;
    margin-top: -45px;
    position: relative;
    z-index: 99999;
    }
</style>

<!-- Include Select2 CSS and JS -->
<link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-beta.1/dist/css/select2.min.css" rel="stylesheet" />
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-beta.1/dist/js/select2.min.js"></script>

<style>
    .select2-container .select2-selection--single{ height:40px !important; }
    .select2-container--default .select2-selection--single .select2-selection__rendered{ line-height:40px !important; }
    .select2-container--default .select2-selection--single .select2-selection__arrow{ height:40px !important; }
    .select2-container--default .select2-selection--single{ border:none; background:#f6f5f5 !important; }
	.select2.select2-container.select2-container--default.select2-container--above.select2-container--focus{ width: 100px !important; }
</style>

<section id="login"class="my-100">
	<div class="container">
	    <div class="col-md-12">
                <div class="login-bg" style="background-image:url('img/login-bg.svg');background-position: center;background-size: cover;">
            		<div class="row">
            			<div class="col-md-6 offset-md-6">
            				<div class="bg-red-opc p-5">
            
            					<?php if(isset($_SESSION['message'])): ?>
                                    <div class="alert alert-success alert-dismissible fade show" role="alert">
                                        <strong class="text-dark"><?php echo $_SESSION['message']; ?> &nbsp;<i class="feather icon-thumbs-up text-danger"></i></strong>
                                        <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
                                    </div>
                                    <?php unset($_SESSION['message']); ?>
                                <?php endif; ?>
            
                                <?php if(isset($_SESSION['error'])): ?>
                                    <div class="alert alert-warning alert-dismissible fade show" role="alert">
                                        <strong class="text-danger"><?php echo $_SESSION['error']; ?> &nbsp;<i class="feather icon-thumbs-up text-dark"></i></strong>
                                        <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
                                    </div>
                                    <?php unset($_SESSION['error']); ?>
                                <?php endif; ?>
            
                                 <div class="login-account text-white">
                                    <h5 class="fs-20">Create your</h5>
                                    <h1 class="fs-30">Account</h1>
                                </div>
            					<form class="p-4" method="post" enctype="multipart/form-data">
            					    <div class="bg-white-form">
                						<label>Name</label>
                						<input type="text" name="name" class="form-control" placeholder="Enter Full Name" required>
                						<label>Email</label>
                						<input type="email" name="email" class="form-control" placeholder="Enter your Email" required>
                						<label>Password</label>
                						<input id="password-field" type="password" name="password" class="form-control" required>
                						<span toggle="#password-field" class="ri-eye-off-line eye-icon" id="togglePassword"></span>
										<label>Confirm Password</label>
										<input id="password-confirm" type="password" name="cpassword" class="form-control" required>
										<span toggle="#password-confirm" class="ri-eye-off-line eye-icon" id="togglePassword_confrim"></span>
                						<label>Mobile Number</label>
										<div class="flex-country pro">
											<div>
                                                <select class="form-control select2" name="phonecode" required style="width:90px;">
													<?php 
														$mycont = mysqli_query($conn, "SELECT * FROM `countries`");
														while ($fet_cont = mysqli_fetch_array($mycont)) {
															// Use ternary operator to handle selected logic
															$selected = ($fet_cont['id'] == '229') ? 'selected' : '';
													?>
														<option value="<?= $fet_cont['id'] ?>" <?= $selected ?>>+<?= $fet_cont['phonecode'] ?></option>
													<?php 
														} 
													?>
												</select>
											</div>
											<div>
												<input type="number" name="mobile_number" placeholder="Mobile Number" class="form-control mb-3">
											</div>
										</div>
            						</div>
            						<button type="submit" name="register" class="btn-theme w-100 nextBtn mt-2">Submit</button>
									<div class="flex-log mt-2">
                                        <span class="text-white">Already a member? <a class="text-white text-decoration-none" href="<?=$base_url?>login.php" style="font-weight: 800;"> Login</a></span>
                                    </div>
            					</form>
            				</div>
            			</div>
            		</div>
            </div>
        </div>
	</div>
</section>

<?php include('footer.php'); ?>

<script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-beta.1/dist/js/select2.min.js"></script>
<script>
	$(document).ready(function() {
	$('.select2').select2();
	});
</script>

<script type="text/javascript">
		$("#togglePassword, #togglePassword_confrim").click(function() {
		  $(this).toggleClass("ri-eye-off-line ri-eye-line");
		  var input = $($(this).attr("toggle"));
		  if (input.attr("type") == "password") {
		    input.attr("type", "text");
		  } else {
		    input.attr("type", "password");
		  }
		});
</script>

<?php 
	if(isset($_POST['register'])){
		$name = mysqli_real_escape_string($conn,$_POST['name']);
	    $mobile_number = mysqli_real_escape_string($conn,$_POST['mobile_number']);
	    $email = mysqli_real_escape_string($conn,$_POST['email']);
	    $password = mysqli_real_escape_string($conn,$_POST['password']);
	    $cpassword = mysqli_real_escape_string($conn,$_POST['cpassword']);
		$phonecode = mysqli_real_escape_string($conn,$_POST['phonecode']);
    	$date = date('Y-m-d');
		$type = "User";
		$status = 1;

		// Email validation
	    if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
	        $_SESSION['error'] = "Invalid email address.";
	        echo "<script>window.location='registration.php';</script>";
	        exit;
	    }

	    // Password match validation
	    if ($password != $cpassword) {
	        $_SESSION['error'] = "Passwords don't match! Try again.";
	        echo "<script>window.location='registration.php';</script>";
	        exit;
	    }

	    // Check if email already exists
	    $check_result = mysqli_query($conn, "SELECT * FROM `user_tbl` WHERE email='$email' AND `type`='User'");
	    if (mysqli_num_rows($check_result) > 0) {
	        $_SESSION['error'] = "This email already exists! Try another email.";
	        echo "<script>window.location='registration.php';</script>";
	        exit;
	    }

		$sql = mysqli_query($conn,"INSERT `user_tbl` SET 
			`name`='$name',
			`email`='$email',
			`mobile_number`='$mobile_number',
			`password`='$cpassword',
			`type`='$type',
			`phonecode`='$phonecode',
			`recieve_date`='$date',
			`status`='$status'");
		$ido = mysqli_insert_id($conn);
		$sp = sprintf("%04d",$ido);
		$user_id = "User".$sp;
		mysqli_query($conn,"UPDATE `user_tbl` SET `user_id`='$user_id' WHERE id = '$ido'");
		
		if($sql){
				$fet_reg = mysqli_fetch_array(mysqli_query($conn, "SELECT * FROM `user_tbl` WHERE id='$ido'"));
				$_SESSION['user_id'] = $fet_reg['user_id'];
				$_SESSION['message'] = "Successfully Registered! Thanks for Registering " . $name;
				echo "<script>window.location='user-profile.php';</script>";
				exit;
			} else {
				$_SESSION['error'] = "Something went wrong! Sorry.";
				echo "<script>window.location='registration.php';</script>";
				exit;   
		}
	}
?>

VaKeR 2022