Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- include('database_1.php');
- if(isset($_POST['submit']))
- {
- if(preg_match("/^([a-zA-Z0-9])+([a-zA-Z0-9._-])*@([a-zA-Z0-9_-])+([a-zA-Z0-9._-]+)+$/", $_POST['email']))
- {
- $email= $_POST['email'];
- $sql1 = "SELECT * FROM users WHERE email = '$email'";
- $result1 = mysqli_query($mysqli,$sql1) or die(mysqli_error());
- if (mysqli_num_rows($result1) > 0)
- {
- echo "This email has already been used";
- }
- elseif($_POST['username'])
- {
- $username= $_POST['username'];
- $sql2 = "SELECT * FROM users WHERE username = '$username'";
- $result2 = mysqli_query($mysqli,$sql2) or die(mysqli_error());
- if (mysqli_num_rows($result2) > 0)
- {
- echo "This username has already been used";
- }
- else
- {
- $username = $_POST['username'];
- $email = $_POST['email'];
- $passwords = $_POST['password'];
- $password = md5($passwords);
- $activation = md5(uniqid(rand()));
- $sql3 = "INSERT INTO users (username, email, password, activation) VALUES ('$username', '$email', '$password', '$activation')";
- $result3 = mysqli_query($mysqli,$sql3) or die('Error: ' . mysqli_error($mysqli));
- mkdir("FilesUploading/$username");
- if($result3)
- {
- $to = $email;
- $subject = "Confirmation from CloudStockpile to $username";
- $header = "CloudStockpile: Confirmation from CloudStockpile";
- $message = "http://www.cloudstockpile.hostoi.com/Confirm.php?passkey=$activation";
- $sentmail = mail($to,$subject,$message,$header);
- if($sentmail)
- {
- echo "<b/>Hello: $username";
- echo "<br/> Your email is: $email";
- echo "<br/>Please copy and paste the link below in your browser to activate your account";
- echo "<br/> $message ";
- echo '<br /><a href="index.html">Return to Cloudstockpile login page</a>';
- }
- else
- {
- echo "Cannot send Confirmation link to your e-mail address";
- }
- }
- }
- }
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement