Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require ('module/connect.php');
- if(isset($_POST['username'])){
- $username = mysqli_real_escape_string($conn,$_POST['username']);
- }
- if(isset($_POST['username'])){
- $email = mysqli_real_escape_string($conn,$_POST['email']);
- }
- if(isset($_POST['username'])){
- $password = mysqli_real_escape_string($conn,$_POST['password']);
- }
- if(isset($_POST['username'])){
- $password2 = mysqli_real_escape_string($conn,$_POST['password2']);
- }
- if($_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest')
- {
- $query = "SELECT username FROM account WHERE username = '$username'";
- if(!$result = mysqli_query($conn, $query))
- {
- exit(mysqli_error($conn));
- }
- if(mysqli_num_rows($result) > 0)
- {
- echo 'username_already_used';
- }
- else
- {
- $query2 = "SELECT email FROM account WHERE email = '$email'";
- if(!$result2 = mysqli_query($conn, $query2))
- {
- exit(mysqli_error($conn));
- }
- if(mysqli_num_rows($result2) > 0)
- {
- echo 'email_aready_used';
- }
- else
- {
- if ($password == $password2)
- {
- $hashedpw = md5($password);
- $hash = md5(rand(1,100000));
- $query="INSERT INTO account (username,password,email,hash,state) VALUES ('$username','$hashedpw','$email','$hash',1)";
- $squery = mysqli_query($conn,$query);
- if ($query)
- {
- /////////////////////////6
- $to = $email; // Send email to our user
- $subject = 'SeeMTA V2 | E-mail aktiválás'; // Give the email a subject
- $message = '
- Köszönjük, hogy regisztráltál!
- Első lépésként kérjük aktiváld az e-mail címedet!
- Csak utána tudjuk folytatni a regisztráció többi részét!
- ------------------------
- Felhasználónév: '.$username.'
- Jelszó: Ezt csak te tudhatod!
- ------------------------
- Kérlek kattints az alábbi linkre:
- http://www.csedwik.hu/verify.php?email='.$email.'&hash='.$hash.'
- '; // Our message above including the link
- $headers = 'From:noreply@seemod.tk' . "\r\n"; // Set from headers
- mail($to, $subject, $message, $headers); // Send our email
- /////////////////////////6
- echo '<div class="alert alert-success" role="alert"><button type="button" class="close" data-dismiss="alert" aria-label="Close">
- <span aria-hidden="true">×</span></button>
- <strong>Sikeres regisztráció!</strong> Kiküldtünk egy aktiváló e-mailt. Kérlek aktiváld a regisztrált felhasználódat!</a>.
- </div>';
- }
- }
- }
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement