Advertisement
Guest User

Untitled

a guest
Oct 20th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.61 KB | None | 0 0
  1. <?php
  2.  
  3.     require ('module/connect.php');
  4.     if(isset($_POST['username'])){
  5.         $username = mysqli_real_escape_string($conn,$_POST['username']);
  6.     }
  7.     if(isset($_POST['username'])){
  8.         $email = mysqli_real_escape_string($conn,$_POST['email']);
  9.     }
  10.     if(isset($_POST['username'])){
  11.         $password = mysqli_real_escape_string($conn,$_POST['password']);
  12.     }
  13.     if(isset($_POST['username'])){
  14.         $password2 = mysqli_real_escape_string($conn,$_POST['password2']);
  15.     }
  16.     if($_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest')
  17.     {  
  18.         $query = "SELECT username FROM account WHERE username = '$username'";
  19.         if(!$result = mysqli_query($conn, $query))
  20.         {
  21.             exit(mysqli_error($conn));
  22.         }
  23.         if(mysqli_num_rows($result) > 0)
  24.         {
  25.             echo 'username_already_used';
  26.         }
  27.         else
  28.         {
  29.             $query2 = "SELECT email FROM account WHERE email = '$email'";
  30.             if(!$result2 = mysqli_query($conn, $query2))
  31.             {
  32.                 exit(mysqli_error($conn));
  33.             }
  34.  
  35.             if(mysqli_num_rows($result2) > 0)
  36.             {
  37.                 echo 'email_aready_used';
  38.             }
  39.             else
  40.             {
  41.                 if ($password == $password2)
  42.                 {
  43.  
  44.                         $hashedpw = md5($password);
  45.                         $hash = md5(rand(1,100000));
  46.                         $query="INSERT INTO account (username,password,email,hash,state) VALUES ('$username','$hashedpw','$email','$hash',1)";
  47.                         $squery = mysqli_query($conn,$query);
  48.                         if ($query)
  49.                         {
  50.                             /////////////////////////6
  51.                             $to      = $email; // Send email to our user
  52.                             $subject = 'SeeMTA V2 | E-mail aktiválás'; // Give the email a subject
  53.                             $message = '
  54.                              
  55.                             Köszönjük, hogy regisztráltál!
  56.                             Első lépésként kérjük aktiváld az e-mail címedet!
  57.                             Csak utána tudjuk folytatni a regisztráció többi részét!
  58.                              
  59.                             ------------------------
  60.                             Felhasználónév: '.$username.'
  61.                             Jelszó: Ezt csak te tudhatod!
  62.                             ------------------------
  63.                              
  64.                             Kérlek kattints az alábbi linkre:
  65.                             http://www.csedwik.hu/verify.php?email='.$email.'&hash='.$hash.'
  66.                              
  67.                             '; // Our message above including the link
  68.                                                  
  69.                             $headers = 'From:noreply@seemod.tk' . "\r\n"; // Set from headers
  70.                             mail($to, $subject, $message, $headers); // Send our email
  71.                             /////////////////////////6
  72.                             echo '<div class="alert alert-success" role="alert"><button type="button" class="close" data-dismiss="alert" aria-label="Close">
  73.                                     <span aria-hidden="true">&times;</span></button>
  74.                                     <strong>Sikeres regisztráció!</strong> Kiküldtünk egy aktiváló e-mailt. Kérlek aktiváld a regisztrált felhasználódat!</a>.
  75.                                 </div>';
  76.                        
  77.                         }
  78.                 }              
  79.             }
  80.         }
  81.     }
  82.  
  83.  
  84. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement