Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- mysql_connect("localhost","username","password");
- mysql_select_db("users");
- function antisql($dirty){ //this is to prevent SQL injection
- if (get_magic_quotes_gpc()) {
- $clean = mysql_real_escape_string(stripslashes($dirty));
- }else{
- $clean = mysql_real_escape_string($dirty);
- }
- return $clean;
- }
- $username = $_POST['username'];
- $username = antisql($username);
- $email = $_POST['email'];
- $email = antisql($email);
- $password1 = "1234567890!@#$%^&*()";
- $password = str_shuffle($password1);
- $subject = 'Registration at system-failur.net!';
- $from = 'admin@system-failur.net';
- $message = "Dear" . " " . $username . ",<br> You have successfully registered at system-failur.net<br> Here is your account information:<br>Username:" . " " . $username . "<br>Password:" . " " . $password;
- mail($to, $subject, $message, "From: $from"); //send email
- mysql_query("INSERT INTO users (username, email, password) VALUES ('$username', '$email', '$password')") or die(mysql_error); //insert the data into database
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement