Jump to content

REgistration php and MKDIR


renfley

Recommended Posts

irst question is i guess i cant get the mkdir to create a members/001 and i cant figure it out for the life of me any help would be freaking awsome

<?PHP

//Database Information

 

$dbhost = "localhost";

$dbuser = "root";

$dbpass = "";

$dbname = "xxx";

//Connect to database

 

mysql_connect ( $dbhost, $dbuser, $dbpass)or die("Could not connect: ".mysql_error());

mysql_select_db($dbname) or die(mysql_error());

   

$fname = $_POST['fname'];

$lname = $_POST['lname'];

$city = $_POST['city'];

$username = $_POST['username'];

$password = md5($_POST['password']);

$email = $_POST['email'];

$newsletter = $_POST['newsletter'];

$pubdir = $_POST['pubdir'];

// lets check to see if the username already exists

 

$checkuser = mysql_query("SELECT username FROM users WHERE username='$username'");

$username_exist = mysql_num_rows($checkuser);

if($username_exist > 0){

    echo "I'm sorry but the username you specified has already been taken.  Please pick another one.";

    unset($username);

    include 'register.html';

    exit();

}

// lf no errors present with the username

// use a query to insert the data into the database.

 

$query = "INSERT INTO users (fname, lname, city, username, password, email, newsletter, pubdir)

VALUES('$fname', '$lname', '$city', '$username', '$password', '$email', '$newsletter', '$pubdir')";

mysql_query($query) or die(mysql_error());

mysql_close();

//this will create a folder for the customer.

 

//$query1= "Select UID Where username = $username "

//$id =

 

//$id = mysql_insert_id();  // this will get the id that you inserted to your table.

//mkdir("members/$id", 0755);

 

$id = mysql_query("SELECT id FROM users WHERE username='$username'");  // this will get the id that you inserted to your table.

mkdir("$id");

echo "You have successfully Registered";

   

// mail user their information

 

$yoursite = "www.xxx.com";

$webmaster = "Administrator";

$youremail = "info@xxx.com";

   

$subject = "You have successfully registered at $yoursite...";

$message = "Dear $fname, you are now registered at our web site. 

    To login, simply go to our web page and enter in the following details in the login form:

    Username: $username

    Password: $password

   

    Please print this information out and store it for future reference.

   

    Thanks,

    $webmaster";

   

mail($email, $subject, $message, "From: $yoursite <$youremail>\nX-Mailer:PHP/" . phpversion());

   

echo "Your information has been mailed to your email address.";

 

?>

Link to comment
Share on other sites

Warning: mkdir() [function.mkdir]: File exists in C:\wamp\www\renfley\config\register.php on line 47

You have successfully Registered

The members dir is already created i only need to create a folder based on my variable,

 

$id = mysql_query("SELECT id FROM users WHERE username='$username'");  // this will get the id that you inserted to your table.

mkdir("members/$id");

echo "You have successfully Registered";

Link to comment
Share on other sites

Warning: mkdir() [function.mkdir]: File exists in C:\wamp\www\renfley\config\register.php on line 47

You have successfully Registered

 

Still getting error

Safe mode is off ive already ruled that one out but this one is very strange my query is fine i just think there some issue with passing a $ in the mkdir?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.