Member Avatar for OldDeveloper01

I have followed some tutorials to create a registration form with some javascript.

I have table to register new members to the website. then a parse_register to handle the php and then custom_js for the javscript.

Well what is happening at the moment is that having filled in the registration form, and then pressing the button to register nothing happens.

I have looked over and over at the code but can't spot the mistake(s).

The connect file is working as it is echoing out connected successfully, so no problem with connecting to the database it seems.

My header looks like this, connecting to the database.

<?php
require_once("scripts/connect.php");
session_start();
$username = $_SESSION['username'];
$userid = $_SESSION['userid'];

?>

<html>
<head>
     <title><?php echo $page_title; ?></title>
     <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
     <meta name="keywords" content="<?php echo $page_keywords; ?>" />
     <meta name="description" content="<?php echo $page_description; ?>" />
     <link rel="stylesheet" type="text/css" href="css/green.css" />
     <link rel="stylesheet" type="text/css" href="css/custom.css" />
     <script type="text/javascript" src="js/jquery_1.6.2.js"></script>
     <script type="text/javascript" src="js/custom_js.js"></script>
     <?php require("scripts/functions.php"); ?>
</head>

<body>

<div id="wrapper">

The register.php is next As you can see i have commented
out verify password for now, id like to add that however.

<?php
// page properties that are used by header.php to use within this page
$page_title = 'whoknowsyet';
$page_keywords = ', registation';
$page_description = 'reg, Sign up/register ';
?>
<?php include 'header.php'; ?>
<div style="float:left;" align="center">
     <table id="registration">
          <tr>
          <td>First Name: </td>
          <td><input type="text" size="30" name="firstname" id="firstname"></td>
          </tr>
          <tr>
          <td>Last Name: </td>
          <td><input type="text" size="30" name="lastname" id="lastname"></td>
          </tr>
          <tr>
          <td>Email Address: </td>
          <td><input type="text" size="30" name="email" id="email"></td>
          </tr>
          <tr>
          <td>Verify Email: </td>
          <td><input type="text" size="30" name="verifyemail" id="verifyemail"></td>
          </tr>
          <tr>
          <td>Username: </td>
          <td><input type="text" size="30" maxlength="15" name="username" id="username"></td>
          </tr>
          <tr>
          <td>Password: </td>
          <td><input type="password" size="30" name="password" id="password"></td>
          </tr>
          <!--<tr>
          <td> Verify Password: </td>
          <td><input type="password" size="30" name="repassword" id="repassword"></td>
          </tr>--->
          <tr><td colspan="2" align="right"><span id="reg_span" style="padding-right: 10px;"></span><button name="reg_submit" id="reg_submit">Register
          </button></td></tr>
     </table>
</div>

<div align="center" class="hidden" id="reg_success">
Success

</div>

<div align="center" class="hidden" id="reg_failed">
Sorry

</div>

<div style="clear:both;"></div>


<?php include 'footer.php'; ?>

Next is my parse_register.php code, just to repeat what i said at the top of this post
i removed the email activation side of things for now as i am using localhost.

<?php
include_once("connect.php");
if (isset($_POST['action'])&& $_POST['action']== "check"){
$email = mysql_real_escape_string(strip_tags($_POST['email']));
$username = mysql_real_escape_string(strip_tags($_POST['username']));

     if(strpos($email,"@")!==false){
          $check_email = explode("@", $email);
          if(strpos($check_email[1], ".")===false){
          echo 3;
          exit();
          }
     }else{
          echo 3;
          exit();
     }
     $email_query = mysql_query("SELECT id FROM users WHERE email='$email' LIMIT 1");     
     if(mysql_num_rows($email_query)== 1){
          echo 1;
          exit();
     }else{
          $username_query = mysql_query("SELECT username FROM users WHERE username='$username' LIMIT 1");     
          if(mysql_num_rows($username_query)== 1){
               echo 2;
               exit();
          }else{
               echo 0;
               exit();
               }
          }
     }
     
     if( isset($_POST['action']) && $_POST['action']=="register"){

               $firstname = mysql_real_escape_string(strip_tags($_POST['firstname']));
               $lastname = mysql_real_escape_string(strip_tags($_POST['lastname']));
               $email = mysql_real_escape_string(strip_tags($_POST['email']));
               $username = mysql_real_escape_string(strip_tags($_POST['username']));
               $password = mysql_real_escape_string(strip_tags($_POST['password']));
               //$repassword = mysql_real_escape_string(strip_tags($_POST['repassword']));
               //$pass = md5(md5($password));
               $date_activated = date("F d, Y"); //March 07, 2011
                                        
                                        $reg_query = mysql_query("INSERT INTO users VALUES (firstname, lastname, email, username, password) VALUES
                                        ('''ucfirst(strolower($firstname)).''', '''ucfirst(strolower($lastname)).''', '$email', '$username', '''.md5($password).''', '$date_activated')");
                                        
                                        if($reg_query){
                                        
                                        $new_userid = mysql_insert_id();
                                        
                                        mkdir("users/$new_userid",0755);
                                        mkdir("users/$new_userid/images",0755);
                                        mkdir("users/$new_userid/media",0755);
                                        }
                                        
          echo 1;
          exit();                                        
     } else {
          echo 0;
          exit();
     }
}
?>

finally the custom_js script:

$(document).ready(function(){
     $("#reg_submit").click(function(){
     var process = true;
     $("#registration input").each(function(){
          if($.trim()this.value)== ""){
          process = false;
          }
     });
     if(process == true){
     var firstname = $.trim($("#firstname").val());
     var lastname = $.trim($("#lastname").val());
     var username = $.trim($("#username").val());
     var password= $.trim($("#password").val());
     var email = $.trim($("#email").val());
     var verifyemail = $.trim($("#verifyemail").val());
     if(username.length >=4){
          if(email==verifyemail){
          
          //$(#reg_span).html("img src='image/loading.gif' height='20' align='absmiddle'/>");
          $(#reg_span).html("loading");
          $.post("scripts/parse_register.php",{action: "check", email:email, usename:username }, function(check_data){
          if(check_data == 0){
          $(#registration input, #registration button").each(function(){
               $("#"+this.id).attr("disabled", "disabled");
               });
               $.post("scripts/parse_register.php",{action: "register", firstname:firstname, lastname:lastname, email:email, 
                    username:username, password:password }, function(reg_data){
                    if(reg_data == 1){
                    
                    $("#reg_span").empty();
                    $("#reg_success").fadeIn(500);
                    
                    }else if(reg_data ==0){
                    
                    $("#reg_span").empty();
                    $("#reg_failed").fadeIn(500);
                    }
               });
               }else if (check_data == 1){
                    $("#reg_span").html("<font color='#ff0000' size='-1'>Email has already been used.</font>");
               }else if (check_data == 2){
                    $("#reg_span").html("<font color='#ff0000' size='-1'>Username taken</font>");
               }else if (check_data == 3){
                    $("#reg_span").html("<font color='#ff0000' size='-1'>Email invalid</font>");
               }else{
                    alert(check_data);
               }
          });
          else{
          $("#reg_span").html("<font color='#ff0000' size='-1'>Email fields do not match</font>");
     }
     }else{
$("#reg_span").html("<font color='#ff0000' size='-1'>Username is to short.</font>");
}
}else{
$("#reg_span").html("<font color='#ff0000' size='-1'>All fields required</font>");
} 
});
});

Sorry for chucking all the code on here at once. Just thought it may save time in the long run.

If anyone can help solve the problem it will be most appreciated.

Thanks

Just taking a quick look at it I see these:


Line 21 of custom_js

$(#reg_span).html("loading");

Missing the " " in your selector

$("#reg_span").html("loading");

Line 24

$(#registration input, #registration button").each(function(){

Missing the opening " in the selector

$("#registration input, #registration button").each(function(){

Is the script tossing any JS errors?

Member Avatar for OldDeveloper01

I added the " you pointed out that were missing.

However i am getting no response whatsoever still. There are no error messages, well none that are appearing on the screen once i press register anyway.

line 49 closes a function then attempts to do an else missing the }
48 }
49 });
50 else{

i would properly tab it out, indent every open bracket and move back in on every close and errors become more obvious

Like so

$(document).ready(function(){
	$("#reg_submit").click(function(){
		var process = true;
		$("#registration input").each(function(){
			if($.trim()this.value)== ""){
				process = false;
			}
		});
		if(process == true){
			var firstname = $.trim($("#firstname").val());
			var lastname = $.trim($("#lastname").val());
			var username = $.trim($("#username").val());
			var password= $.trim($("#password").val());
			var email = $.trim($("#email").val());
			var verifyemail = $.trim($("#verifyemail").val());
			if(username.length >=4){
				if(email==verifyemail){
					//$(#reg_span).html("img src='image/loading.gif' height='20' align='absmiddle'/>");
					$("#reg_span").html("loading");
					$.post("scripts/parse_register.php",{action: "check", email:email, usename:username }, function(check_data){
						if(check_data == 0){
							$("#registration input, #registration button").each(function(){
								$("#"+this.id).attr("disabled", "disabled");
							});
							$.post("scripts/parse_register.php",{action: "register", firstname:firstname, lastname:lastname, email:email, username:username, password:password }, function(reg_data){
								if(reg_data == 1){
									$("#reg_span").empty();
									$("#reg_success").fadeIn(500);
								}else if(reg_data ==0){
									$("#reg_span").empty();
									$("#reg_failed").fadeIn(500);
								}
							});
						}else if (check_data == 1){
							$("#reg_span").html("<font color='#ff0000' size='-1'>Email has already been used.</font>");
						}else if (check_data == 2){
							$("#reg_span").html("<font color='#ff0000' size='-1'>Username taken</font>");
						}else if (check_data == 3){
							$("#reg_span").html("<font color='#ff0000' size='-1'>Email invalid</font>");
						}else{
							alert(check_data);
						}
					});
				}else{
					$("#reg_span").html("<font color='#ff0000' size='-1'>Email fields do not match</font>");
				}
			}else{
				$("#reg_span").html("<font color='#ff0000' size='-1'>Username is to short.</font>");
			}
		}else{
			$("#reg_span").html("<font color='#ff0000' size='-1'>All fields required</font>");
		}
	});
});
Member Avatar for OldDeveloper01

again ive added the { still nothing is happening. Thanks for spotting that anyway.

get the javascript console up on whatever browser you're using, in chrome you press ctrl+shift+j

If there are no errors or you cba getting a javascript console put alerts out at every section to see what its doing

$(document).ready(function(){
	alert('js fired');
	$("#reg_submit").click(function(){
		var process = true;
		alert('submit clicked');
		$("#registration input").each(function(){
			if($.trim()this.value)== ""){
				process = false;
			}
		});
		alert('process: '+process);
		if(process == true){
			var firstname = $.trim($("#firstname").val());
			var lastname = $.trim($("#lastname").val());
			var username = $.trim($("#username").val());
			var password= $.trim($("#password").val());
			var email = $.trim($("#email").val());
			var verifyemail = $.trim($("#verifyemail").val());
			if(username.length >=4){
				alert('username >= 4');
				if(email==verifyemail){
					alert(email+' == '+ verifyemail);
					//$(#reg_span).html("img src='image/loading.gif' height='20' align='absmiddle'/>");
					$("#reg_span").html("loading");
					$.post("scripts/parse_register.php",{action: "check", email:email, usename:username }, function(check_data){
						alert('check_data: '+ check_data);
						if(check_data == 0){
							$("#registration input, #registration button").each(function(){
								$("#"+this.id).attr("disabled", "disabled");
							});
							$.post("scripts/parse_register.php",{action: "register", firstname:firstname, lastname:lastname, email:email, username:username, password:password }, function(reg_data){
								if(reg_data == 1){
									$("#reg_span").empty();
									$("#reg_success").fadeIn(500);
								}else if(reg_data ==0){
									$("#reg_span").empty();
									$("#reg_failed").fadeIn(500);
								}
							});
						}else if (check_data == 1){
							$("#reg_span").html("<font color='#ff0000' size='-1'>Email has already been used.</font>");
						}else if (check_data == 2){
							$("#reg_span").html("<font color='#ff0000' size='-1'>Username taken</font>");
						}else if (check_data == 3){
							$("#reg_span").html("<font color='#ff0000' size='-1'>Email invalid</font>");
						}else{
							alert(check_data);
						}
					});
				}else{
					alert('email doesnt match');
					$("#reg_span").html("<font color='#ff0000' size='-1'>Email fields do not match</font>");
				}
			}else{
				alert('username too short');
				$("#reg_span").html("<font color='#ff0000' size='-1'>Username is to short.</font>");
			}
		}else{
			alert('all fields required');
			$("#reg_span").html("<font color='#ff0000' size='-1'>All fields required</font>");
		}
	});
});

if the alerts don't fire there's a fatal javascript compile error that needs to be checked

Member Avatar for OldDeveloper01

Hey well i now seems like i have fixed the custom_js.

working code is here

$(document).ready(function(){
	$("#reg_submit").click(function(){
	var process = true;
	$("#registration input").each(function(){
		if($.trim(this.value)== ""){
		process = false;
		}
	});
	if(process == true){
	var firstname = $.trim($("#firstname").val());
	var lastname = $.trim($("#lastname").val());
	var username = $.trim($("#username").val());
	var password= $.trim($("#password").val());
	var email = $.trim($("#email").val());
	var verifyemail = $.trim($("#verifyemail").val());
	if(username.length >=4){
		if(email==verifyemail){
		
		//$(#reg_span).html("img src='image/loading.gif' height='20' align='absmiddle'/>");
		$("#reg_span").html("loading");
		$.post("scripts/parse_register.php",{action: "check", email:email, usename:username }, function(check_data){
		if(check_data == 0){
		$("#registration input, #registration button").each(function(){
			$("#"+this.id).attr("disabled", "disabled");
			});
			$.post("scripts/parse_register.php",{action: "register", firstname:firstname, lastname:lastname, email:email, 
				username:username, password:password }, function(reg_data){
				if(reg_data == 1){
				
				$("#reg_span").empty();
				$("#reg_success").fadeIn(500);
				
				}else if(reg_data ==0){
				
				$("#reg_span").empty();
				$("#reg_failed").fadeIn(500);
				}
			});
			}else if (check_data == 1){
				$("#reg_span").html("<font color='#ff0000' size='-1'>Email has already been used.</font>");
			}else if (check_data == 2){
				$("#reg_span").html("<font color='#ff0000' size='-1'>Username taken</font>");
			}else if (check_data == 3){
				$("#reg_span").html("<font color='#ff0000' size='-1'>Email invalid</font>");
			}else{
				alert(check_data);
			}
		});
		}else{
		$("#reg_span").html("<font color='#ff0000' size='-1'>Email fields do not match</font>");
	}
	}else{
$("#reg_span").html("<font color='#ff0000' size='-1'>Username is to short.</font>");
}
}else{
$("#reg_span").html("<font color='#ff0000' size='-1'>All fields required</font>");
} 
});
});

I have added error_reporting (E_ALL ^ E_NOTICE); at the top of the register parse code.

Currently i can fill in the the form, hit register the reg_success message appears, however the new user is not added to the database. From my novice view i can only assume that the parse_register is broken in some way. bad terminology.

Heres your parse_register.php formatted right, it had an extra close bracket at the end and the $reg_query was done wrong

<?php
include_once("connect.php");
if(isset($_POST['action'])&& $_POST['action']== "check"){
	$email = mysql_real_escape_string(strip_tags($_POST['email']));
	$username = mysql_real_escape_string(strip_tags($_POST['username']));
	if(strpos($email,"@")!==false){
		$check_email = explode("@", $email);
		if(strpos($check_email[1], ".")===false){
			echo 3;
			exit();
		}
	}else{
		echo 3;
		exit();
	}
	$email_query = mysql_query("SELECT id FROM users WHERE email='$email' LIMIT 1");
	if(mysql_num_rows($email_query)== 1){
		echo 1;
		exit();
	}else{
		$username_query = mysql_query("SELECT username FROM users WHERE username='$username' LIMIT 1");
		if(mysql_num_rows($username_query)== 1){
			echo 2;
			exit();
		}else{
			echo 0;
			exit();
		}
	}
}

if(isset($_POST['action']) && $_POST['action']=="register"){
	$firstname = mysql_real_escape_string(strip_tags($_POST['firstname']));
	$lastname = mysql_real_escape_string(strip_tags($_POST['lastname']));
	$email = mysql_real_escape_string(strip_tags($_POST['email']));
	$username = mysql_real_escape_string(strip_tags($_POST['username']));
	$password = mysql_real_escape_string(strip_tags($_POST['password']));
	//$repassword = mysql_real_escape_string(strip_tags($_POST['repassword']));
	//$pass = md5(md5($password));
	$date_activated = date("F d, Y"); //March 07, 2011
	$reg_query = mysql_query("INSERT INTO users VALUES (firstname, lastname, email, username, password) VALUES "
							."('".ucfirst(strolower($firstname))."', '".ucfirst(strolower($lastname))."', '$email', '$username', ".md5($password)."', '$date_activated')");
	if($reg_query){
		$new_userid = mysql_insert_id();
		mkdir("users/$new_userid",0755);
		mkdir("users/$new_userid/images",0755);
		mkdir("users/$new_userid/media",0755);
	}
	echo 1;
	exit();
}else{
	echo 0;
	exit();
}
?>
Member Avatar for OldDeveloper01

Sorry I had removed the }and still nothing seems to happen. No record is added to the database.

In your MySQL query you try to make the first name and last name lower case but you misspelled the function as

strolower()

Should be

strtolower()

Member Avatar for OldDeveloper01

Again im sorry I did spot that too. Still nothing seems to happen though.

Can you repost your parse_registration code with all the corrections

Member Avatar for OldDeveloper01

Here it is with all corrections so far.

<?php
error_reporting (E_ALL ^ E_NOTICE);
include_once("connect.php");
if (isset($_POST['action'])&& $_POST['action']== "check"){
$email = mysql_real_escape_string(strip_tags($_POST['email']));
$username = mysql_real_escape_string(strip_tags($_POST['username']));

	if(strpos($email,"@")!==false){
		$check_email = explode("@", $email);
		if(strpos($check_email[1], ".")===false){
		echo 3;
		exit();
		}
	}else{
		echo 3;
		exit();
	}
	$email_query = mysql_query("SELECT id FROM users WHERE email='$email' LIMIT 1");	
	if(mysql_num_rows($email_query)== 1){
		echo 1;
		exit();
	}else{
		$username_query = mysql_query("SELECT username FROM users WHERE username='$username' LIMIT 1");	
		if(mysql_num_rows($username_query)== 1){
			echo 2;
			exit();
		}else{
			echo 0;
			exit();
			}
		}
	}
	
	if(isset($_POST['action'])&& $_POST['action']=="register"){

			$firstname = mysql_real_escape_string(strip_tags($_POST['firstname']));
			$lastname = mysql_real_escape_string(strip_tags($_POST['lastname']));
 			$email = mysql_real_escape_string(strip_tags($_POST['email']));
 			$username = mysql_real_escape_string(strip_tags($_POST['username']));
			$password = mysql_real_escape_string(strip_tags($_POST['password']));
			//$repassword = mysql_real_escape_string(strip_tags($_POST['repassword']));
			//$pass = md5(md5($password));
			$date_activated = date("F d, Y"); //March 07, 2011
								
								$reg_query = mysql_query("INSERT INTO users VALUES (firstname, lastname, email, username, password) VALUES
								('''.ucfirst(strtolower($firstname)).''', '''.ucfirst(strtolower($lastname)).''', '$email', '$username', '''.md5($password).''', '$date_activated')");
								
								if($reg_query){
								
								$new_userid = mysql_insert_id();
								
								mkdir("users/$new_userid",0755);
								mkdir("users/$new_userid/images",0755);
								mkdir("users/$new_userid/media",0755);
								}
								
		echo 1;
		exit();								
	} else {
		echo 0;
		exit();
	}
?>

You missed one modification. Your registration code is within the check code so when you send the registration ($_POST == "register") it never gets run as it's within the $_POST == "check" if statement.

Simply make them two seperate IF statements and you should be good to go:

<?php
error_reporting (E_ALL ^ E_NOTICE);
include_once("connect.php");
if (isset($_POST['action'])&& $_POST['action']== "check"){
  	$email = mysql_real_escape_string(strip_tags($_POST['email']));
  	$username = mysql_real_escape_string(strip_tags($_POST['username']));

	if(strpos($email,"@")!==false){
		$check_email = explode("@", $email);
		if(strpos($check_email[1], ".")===false){
		echo 3;
		exit();
		}
	}else{
		echo 3;
		exit();
	}
	$email_query = mysql_query("SELECT id FROM users WHERE email='$email' LIMIT 1");	
	if(mysql_num_rows($email_query)== 1){
		echo 1;
		exit();
	}else{
		$username_query = mysql_query("SELECT username FROM users WHERE username='$username' LIMIT 1");	
		if(mysql_num_rows($username_query)== 1){
			echo 2;
			exit();
		}else{
			echo 0;
			exit();
			}
		}
	}

}
	
if(isset($_POST['action'])&& $_POST['action']=="register"){

			$firstname = mysql_real_escape_string(strip_tags($_POST['firstname']));
			$lastname = mysql_real_escape_string(strip_tags($_POST['lastname']));
 			$email = mysql_real_escape_string(strip_tags($_POST['email']));
 			$username = mysql_real_escape_string(strip_tags($_POST['username']));
			$password = mysql_real_escape_string(strip_tags($_POST['password']));
			//$repassword = mysql_real_escape_string(strip_tags($_POST['repassword']));
			//$pass = md5(md5($password));
			$date_activated = date("F d, Y"); //March 07, 2011
								
								$reg_query = mysql_query("INSERT INTO users VALUES (firstname, lastname, email, username, password) VALUES
								('''.ucfirst(strtolower($firstname)).''', '''.ucfirst(strtolower($lastname)).''', '$email', '$username', '''.md5($password).''', '$date_activated')");
								
								if($reg_query){
								
								$new_userid = mysql_insert_id();
								
								mkdir("users/$new_userid",0755);
								mkdir("users/$new_userid/images",0755);
								mkdir("users/$new_userid/media",0755);
								}
								
		echo 1;
		exit();								
	} else {
		echo 0;
		exit();
	}
}

?>
Member Avatar for OldDeveloper01

Thanks for your help its really appreciated.

i changed the code and get told the the } is unexpected at line 34.

i have made a small change to the custom_js

$.post("scripts/parse_register.php",{action: "register", firstname:firstname, lastname:lastname, email:email, usename:username, password:password }, function(reg_data){

TO

$.post("scripts/parse_register.php",{action: "register", firstname:firstname, lastname:lastname, email:email, username:username, password:password }, function(reg_data){

an r was missing in username. other than that everything is the same, and nothing seems to happen.

Member Avatar for OldDeveloper01

I solved the problem now, there was a few errors in the mysql query in the parse_register form

<?php
error_reporting (E_ALL ^ E_NOTICE);
include_once("connect.php");
if (isset($_POST['action'])&& $_POST['action']== "check"){
$email = mysql_real_escape_string(strip_tags($_POST['email']));
$username = mysql_real_escape_string(strip_tags($_POST['username']));

	if(strpos($email,"@")!==false){
		$check_email = explode("@", $email);
		if(strpos($check_email[1], ".")===false){
		echo 3;
		exit();
		}
	}else{
		echo 3;
		exit();
	}
	$email_query = mysql_query("SELECT id FROM users WHERE email='$email' LIMIT 1");	
	if(mysql_num_rows($email_query)== 1){
		echo 1;
		exit();
	}else{
		$username_query = mysql_query("SELECT username FROM users WHERE username='$username' LIMIT 1");	
		if(mysql_num_rows($username_query)== 1){
			echo 2;
			exit();
		}else{
			echo 0;
			exit();
			}
		}
	}
	if(isset($_POST['action'])&& $_POST['action']=="register"){
			$firstname = mysql_real_escape_string(strip_tags($_POST['firstname']));
			$lastname = mysql_real_escape_string(strip_tags($_POST['lastname']));
 			$email = mysql_real_escape_string(strip_tags($_POST['email']));
 			$username = mysql_real_escape_string(strip_tags($_POST['username']));
			$password = mysql_real_escape_string(strip_tags($_POST['password']));
			
			//$repassword = mysql_real_escape_string(strip_tags($_POST['repassword']));
			//$pass = md5(md5($password));
			//$date_activated = date("F d, Y"); //March 07, 2011					
			//$reg_query = mysql_query("INSERT INTO users(firstname, lastname, email, username, password) VALUES ('''.ucfirst(strtolower($firstname)).''', '''.ucfirst(strtolower($lastname)).''', '$email', '$username', '''.md5($password).''', '$date_activated')");
								
								$pass = md5(md5($password));
								$date_activated = date("F d, Y"); //March 07, 2011

								$reg_query = mysql_query("INSERT INTO users VALUES ('', '$firstname', '$lastname', '$email', '$username', '$pass', '$date_activated')");

								if($reg_query){
								
								$new_userid = mysql_insert_id();
								
								mkdir("../users/$new_userid",0755);
								mkdir("../users/$new_userid/images",0755);
								mkdir("../users/$new_userid/media",0755);
								}
								
		echo 1;
		exit();								
	} else {
		echo 0;
		exit();
	}
?>

out of interest, how would i go about adding captcha?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.