Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <form action="includes/register.php" class="form__signup" id="register-form" method="POST">
- <a href="" class="reg-close"></a>
- <div class="form__header">
- <h2 class="form__title">Регистрация</h2>
- </div> <!-- ====== form__header ====== -->
- <div class="form__msg" class="msgs"></div>
- <div class="form__group">
- <input type="text" class="form__control" placeholder="Ваше имя" name="full_name" id="full_name" />
- </div>
- <div class="form__group">
- <input type="email" class="form__control" placeholder="Ваш Email" name="email" id="email">
- </div>
- <div class="form__group">
- <input type="text" class="form__control" placeholder="Ваш логин" name="username" id="username">
- </div>
- <div class="form__group">
- <input type="password" class="form__control" placeholder="Ваш пароль" name="password" id="password" />
- </div>
- <div class="form__group">
- <input type="password" class="form__control" placeholder="Подтвердите пароль" name="cpassword" id="cpassword" />
- </div>
- <div class="form__group">
- <button type="submit" class="form__btn" name="do-signup" id="btn-submit">Регистрация</button>
- </div>
- </form>
- require_once 'connection.php';
- if(isset($_POST["do-signup"])){
- if(!empty($_POST['full_name']) && !empty($_POST['email']) && !empty($_POST['username']) && !empty($_POST['password']) &&(!empty($_POST['cpassword'])) && $_POST['password'] == $_POST['cpassword'] ) {
- $full_name=$_POST['full_name'];
- $email=$_POST['email'];
- $username=$_POST['username'];
- $password=$_POST['password'];
- $query=mysql_query("SELECT * FROM users WHERE username='".$username."'");
- $numrows=mysql_num_rows($query);
- if($numrows==0)
- {
- $sql="INSERT INTO users
- (full_name, email, username,password)
- VALUES('$full_name','$email', '$username', '$password')";
- $result=mysql_query($sql);
- if($result){
- $messages = "Account Successfully Created";
- } else {
- $messages = "Failed to insert data information!";
- }
- } else {
- $messages = "That username already exists! Please try another one!";
- }
- } else {
- $messages = "All fields are required!";
- }
- function submitForm()
- {
- var data = $("#register-form").serialize();
- var formNm=$("#refister-form");
- var message=$(formNm).find(".msgs");
- var formTitle=$(formNm).find(".formTitle");
- $.ajax({
- type : 'POST',
- url : '../includes/register.php',
- data : data,
- beforeSend: function()
- {
- $("#btn-submit").html('<span></span> sending ...');
- },
- success : function(data)
- {
- message.html('');
- formTitle.css("display","none");
- setTimeout(function(){
- $('.formTitle').css("display","block");
- $('.msgs').html(data);
- $('input').not(':input[type=submit], :input[type=hidden]').val('');
- }
- ,3000);
- }
- });
- return false;
- }
Add Comment
Please, Sign In to add comment