Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $host="localhost"; // Host name
- $db_username="cameron_cameron"; // Mysql username
- $db_password="**********"; // Mysql password
- $db_name="cameron_portfolio"; // Database name
- $tbl_name="members"; // Table name
- // Connect to server and select database.
- mysql_connect("$host", "$db_username", "$db_password")or die("cannot connect");
- mysql_select_db("$db_name")or die("cannot select DB");
- if(isset($_POST['submit'])){
- $username = $_POST['username'];
- $password = $_POST['password'];
- $email = $_POST['email'];
- $repeatpass = $_POST['repeatpassword'];
- $about = $_POST['about'];
- if($password != $repeatpass){
- die("Your passwords don't match!");
- }
- else
- {
- if(strlen($username) >= 50){
- die("Username is too long! Maximum length is 50 characters.");
- }
- else
- {
- if(strlen($username) <= 2){
- die("Username is too short! Minimum length is 3 characters.");
- }
- else
- {
- if(strlen($password) <=5){
- die("Password is too short! Minimum length is 6 characters");
- }
- else
- {
- if(strlen($email) >=50 || strlen($email) == 0){
- die("Email length must be between 1 and 50 characters!");
- }
- else
- {
- $password = md5($password);
- $insert = "INSERT INTO `cameron_portfolio`.`members` (`id`, `username`, `password`, `email`, `about`, `admin`, `approved`, `date`) VALUES (NULL, '$username', '$password', '$email', '$about', '0', '0', CURRENT_TIMESTAMP);";
- //add a ; ?
- $query = mysql_query($insert);
- $mail = "
- Hey there $username!
- Thanks for applying at my site.
- I've recieved your request and will most likely approve it within a day or two.
- Thanks!
- ";
- mail($email, "Registration at Cameron's Portfolio", $mail, "From: me@scamron.co.cc");
- mail("me@scamron.co.cc", "New Member: $username", "Check signup requests, $username has joined!", "From: me@scamron.co.cc");
- header("location: index.php?r=s");
- }
- }
- }
- }
- }
- //}
- else
- {
- echo "Nothing submitted!";
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement