Untitled

mail@pastecode.io avatar
unknown
php
a year ago
3.5 kB
6
Indexable
Never
<form class="login100-form validate-form flex-sb flex-w" method="POST" action="mysql/kayitekle.php" id="login-form">
                    <span class="login100-form-title p-b-3">
						Kayıt Ol
					</span>
					<div class="p-t-31 p-b-9">
						<label for="name" class="txt1">
							İsim
                            						</label>
					</div>
					<div class="wrap-input100 validate-input" data-validate = "İsim alanı gereklidir">
						<input id="name" class="input100" type="text" name="name" >
						<span class="focus-input100"></span>
					</div>

					<div class="p-t-31 p-b-9">
						<label for="email" class="txt1">
							E-posta Adresi
                        	<span class="text-danger" id="email-message"></span>  					</label>
					</div>
					<div class="wrap-input100 validate-input" data-validate = "E-posta adresi gereklidir">
						<input id="email" class="input100" type="email" name="email" >
						<span class="focus-input100"></span>
					</div>

					<div class="p-t-13 p-b-9 d-inline-flex">
						<label for="password" class="txt1">
							Şifre
							<span class="text-danger" id="password-message"></span>  						</label>
					</div>
					<div class="wrap-input100 validate-input" data-validate = "Şifre alanı gereklidir">
						<input id="password" class="input100" type="password" name="password" >
						<span class="focus-input100"></span>
					</div>

					<div class="p-t-13 p-b-9 d-inline-flex">
						<label for="password_confirmation" class="txt1">
							Şifre
						</label>
					</div>
					<div class="wrap-input100 validate-input" data-validate = "Şifre alanı gereklidir">
						<input id="password_confirmation" class="input100" type="password" name="password_confirmation" >
						<span class="focus-input100"></span>
					</div>
                    
					<script src="../www.google.com/recaptcha/api.js" async defer></script>
                                            <div class="g-recaptcha" data-sitekey="6LcJVsYjAAAAAG-5RZ-i2_Xvdv1WLEcB6whpfvIp"></div>
                    
					<div class="container-login100-form-btn m-t-17">
						<button type="submit" class="login100-form-btn" id="submit">
							Kayıt Ol
						</button>
					</div>

					<div class="w-full text-center p-t-55">
						<span class="txt2">
							Zaten üye misin?
						</span>

						<a href="#" class="txt2 bo1">
							Hemen giriş yap!
						</a>
					</div>
				</form>
				<script src="js/main.js"></script>
	            <script src="js/sifrekontrol.js"></script>
	            
	            <script>
		const frm = document.getElementById("login-form");
		frm.addEventListener("submit", function(event) {
		  event.preventDefault();
	  
		  const messageElement = document.getElementById("email-message");
		  const email = document.getElementById("email").value;

	  
		  const xhr = new XMLHttpRequest();
		  xhr.onreadystatechange = function() {
			if (xhr.readyState === 4 && xhr.status === 200) {
			  const response = JSON.parse(xhr.responseText);
			  const exists = response.exists;
	  
			  if (exists) {
				messageElement.innerHTML = "Mail kayıtlı, farklı bir mail kullanın";
			  } else {
				// Kayıt işlemi devam edebilir
				frm.submit();
			  }
			}
		  };
	  
		  xhr.open("POST", "kontrol.php", true);
		  xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		  xhr.send("email=" + encodeURIComponent(email));
		});
	  </script>