Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include('../include/db-connect.php');
- //$ip=$_SERVER['REMOTE_ADDR'];
- $email = $_POST["email"];
- $user = $_POST["username"];
- $pass = $_POST["pass"];
- $pass1 = $_POST["repass"];
- $fav_show = $_POST["favshow"];
- $iphone = $_POST["iphone"];
- //Check for pass matching
- if( $pass == $pass1 )
- {
- $password = md5($pass);
- valid_email();
- }else{
- echo "Passwords dont match try again";
- exit();
- }
- //Need to validate the email address if it isnt display an error with link to retry
- function valid_email()
- {
- global $email, $user;
- if(eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email))
- {
- dupe_check($email,$user);
- }else{
- echo "<center><br /><br />Try again with a valid address<br /><br /><a href=\"register.html\">Retry</a></center>";
- }
- }
- //Check for dupes on email and username then start the account create function
- function dupe_check($email,$user)
- {
- //check for email dupes
- $sql = "SELECT users.email FROM users WHERE users.email = '$email' ";
- $ckemail = mysql_query($sql);
- $num_email = mysql_num_rows($ckemail);
- //check for users dupes
- $sql2 = "SELECT users.username FROM users WHERE users.username = '$user' ";
- $ckuser = mysql_query($sql2);
- $num_user = mysql_num_rows($ckuser);
- if($num_email != 0)
- {
- echo " Someone is already using this email account please use another \n";
- exit();
- }
- if($num_user == 0)
- {
- create_account($email,$user);
- }else{
- echo " Someone is already using this username please use another \n";
- exit();
- }
- }
- //Lets see if the passwords match .. if not this should redirect to another page which will tell the user where they failed and then let them try again.
- function create_account($email,$user)
- {
- global $iphone, $password;
- echo "FUNCTION create_account $email $user $password $iphone $ip";
- $sql = ("INSERT INTO iphone_new.users ( join_date, username, password, email, iphone )
- VALUES ( CURDATE(), '$user', '$password', '$email', '$iphone' )");
- $adduser = mysql_query($sql);
- emailadmin($user,$email);
- }
- function emailadmin($user,$email)
- {
- //global $user, $email;
- $admin = "rob@logicalhosting.ca";
- $subject = "New User - iPhone Videos";
- $body = "New user $user with email address of $email\n Just signed up.\n";
- mail($admin, $subject, $body);
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement