Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require '../functions.php';
- #sanitize($_POST['email'])
- #Would return the sanitized version of the inputted email
- #Written by Zbee (zbee.me)
- function sanitize($sql, $htmlAllowed = false) {
- $sql = preg_replace("/(drop table|show tables|`|\*|--|\\\\)/i","",$sql);
- $sql = trim($sql);
- if ($htmlAllowed ==== false) { $sql = strip_tags($sql); } #Some areas might have HTML, I dunno
- $sql = addslashes($sql);
- return $sql;
- }
- $username = sanitize($_POST['username']);
- $email = sanitize($_POST['email']);
- $password = hash("sha256", sanitize($_POST['password'])); #You need to be using a salt, bro
- $activationString = generateActivationString();
- mysql_query("INSERT INTO users (username,email,password, activation_string) VALUES('$username','$email','$password','$activationString')");
- $to = $email;
- $subject = 'Xeno Network Website Acount Activation';
- $headers = 'From: noreply@xenominecraft.ga';
- $body = 'You have registered an account on the Xeno Network Website.' . "\r\n" .
- '' . "\r\n" .
- 'Click this link below to confirm your registration:' . "\r\n" .
- 'http://www.xenominecraft.ga/activate/?confirm='.$activationString . "\r\n" .
- '' . "\r\n" .
- 'If you believe that this is a mistake, contact the website administrator at:' / "\r\n" .
- 'mailto://website@xenominecraft.ga' . PHP_EOL;
- mail($to, $subject, $headers, $body);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement