Jump to content


Photo

"makdir" not creating for me


  • Please log in to reply
5 replies to this topic

#1 alwaysinit

alwaysinit
  • Members
  • PipPipPip
  • Advanced Member
  • 60 posts

Posted 20 September 2006 - 02:42 AM

could someone tell me why my code does'nt creat a directory. I have a folder named "profiles" in my main directory with permissions set to 777. Look for the "makdir" about midway in my code(that's the code that should create a folder, I think)

<?php

include 'db_connect.php';
  
$artname = $_POST['artname']; 
$password = $_POST['password'];
$confirmpassword = $_POST['confirmpassword'];
$email = $_POST['email'];
$country = $_POST['country'];
$province = $_POST['province'];
$city = $_POST['city'];
$postalcode = $_POST['postalcode'];
$gender = $_POST['gender']; 
$info = $_POST['info'];

    $artname = stripslashes($artname); 
    $password = stripslashes($password); 
    $email = stripslashes($email); 
	$country = stripslashes($country);
	$province = stripslashes($province);
	$postalcode = stripslashes($postalcode);
	$gender = stripslashes($gender);

    if((!$artname) || (!$password) || (!$confirmpassword) || (!$email) || (!$country) || (!$province) || (!$city) || (!$postalcode) || (!$gender)){ 

  echo '<center><font color=red><strong>You did not submit the following required information!</strong></font></center> <br />'; 
    if(!$artname){ 
        echo "<center><font color=red>Artist Name is a required field. Please enter it below.</strong></font></center><br />"; 
    } 
    if(!$password){ 
        echo "<center><font color=red>Create Password is a required field. Please enter it below.</strong></font></center><br />"; 
    }
	if(!$confirmpassword){ 
        echo "<center><font color=red>Confirm Password is a required field. Please enter it below.</strong></font></center><br />"; 
    }
		if(!$email){ 
        echo "<center><font color=red>Your E-mail is a required field. Please enter it below.</strong></font></center><br />"; 
    }
		if(!$country){ 
        echo "<center><font color=red>Country is a required field. Please enter it below.</strong></font></center><br />"; 
    }
		if(!$province){ 
        echo "<center><font color=red>Province(state) is a required field. Please enter it below.</strong></font></center><br />"; 
    }
	    if(!$city){ 
        echo "<center><font color=red>City is a required field. Please enter it below.</strong></font></center><br />"; 
    }
		if(!$postalcode){ 
        echo "<center><font color=red>Postal Code(Zip code) is a required field. Please enter it below.</strong></font></center><br />"; 
    }
		if(!$gender){ 
        echo "<center><font color=red>Gender is a required field. Please enter it below.</strong></font></center><br />"; 
    } 
   include 'join_form.html';  
    exit();  
} 


  if($_POST['password'] != $_POST['confirmpassword']) { 
  	 die('<center><font color=red><strong>Error: The passwords do not match.</strong></font></center>');
	 }
  if(strlen($_POST['password']) < 6 ) {
     die('<center><font color=red>Error: Your password is too short. Must be 6 or more characters in length.</strong></font></center>');
	 } 

$sql_email_check = mysql_query("SELECT email FROM peepsignup  
             WHERE email='$email'"); 
 
  if(($email_check > 0)){ 
     echo "<h2><center><font color=red><strong>Your email address has already been used by another member  
         in our database. Please submit a different Email address!</strong></font></center></h2>";
 if($email_check > 0){ 
          echo "<h2><center><font color=red><strong>Press the back button in your browser to refill the form</strong></font></center></h2> "; 
         unset($email); 
     } 
      
     include 'join_form.html';  
     exit();
		} 

  \\ * HERE IT IS *-------------------	
          
          $userid =$_POST['userid']; 
          mkdir("profiles/$userid"); 
          $uploadpath = "profiles/$userid/";	

  \\ * HERE IT ENDS *-----------------	
	
$db_password = md5($password); 

$info2 = htmlspecialchars($info);
	$sql="INSERT INTO peepsignup 
(artname, email, country, province, city, postalcode, gender, password, info, signupdate)
VALUES
('$artname','$email','$country',
'$province', '$city', '$postalcode','$gender','$db_password','$info2', now())"  
        or die (mysql_error()); 
 


if (!mysql_query($sql,$con))
  {
  die('Error: ' . mysql_error());
  }
	
	
	
	if(!$sql){ 
    echo 'There has been an error creating your account. Please contact the webjedikungfumaster.'; 
} else { 
    $userid = mysql_insert_id();
}




    $subject = "Your Membership at Audiopeeps!"; 
    $message = "Dear $artname, 
    Thank you for registering at AudioPeeps 
     
    To activate your membership,  
    please click here: http://www.audiopeeps.com./activate.php?id=$userid&code=$db_password 
     
    Once you activate your memebership, you will be able to login 
    with the following information: 
    Email Address: $email 
    Password: $password          
     
    Thanks! 
    The Webjedikungfumaster 
     
    This is an auto response, please do not reply!"; 
     
    mail($email, $subject, $message,  
        "From: audiopeeps WebJedikungfumaster<WebJedikungfumaster@audiopeeps.com>\n 
        X-Mailer: PHP/" . phpversion()); 
    echo '<h2><center><font color=red><strong>You must activate your account before you can login.<br>
          Your membership information has been mailed to your email address!<br>
          Go to your Email in-box and follow the directions to activate your account!<br />
You should now close this window.</strong></font></center></h2><br>';
		  
?>


#2 btherl

btherl
  • Staff Alumni
  • Advanced Member
  • 3,893 posts
  • LocationAustralia

Posted 20 September 2006 - 03:19 AM

Can you add the following, just before the mkdir() and after "$user_id = $_POST['userid']" :

print "I am in directory " . getcwd() . "<br>";
print "I am about to make " . getcwd() . "/profiles/$userid<br>";

And check if the output makes sense.

#3 alwaysinit

alwaysinit
  • Members
  • PipPipPip
  • Advanced Member
  • 60 posts

Posted 20 September 2006 - 03:47 AM

Thanks for the reply
I get this output:(with still no folder)

I am in directory /home/content/a/l/w/alwaysinit/html
I am about to make /home/content/a/l/w/alwaysinit/html/profiles/

Warning: mkdir(profiles/): File exists in /home/content/a/l/w/alwaysinit/html/register.php on line 86

#4 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 20 September 2006 - 03:54 AM

The error is because $userid does not exist or is blank - the script message tells you that. I don't see anywhere in your code that $userid is obtained anyhow.  Can you point that out?
Legend has it that reading the manual never killed anyone.
My site

#5 trq

trq
  • Staff Alumni
  • Advanced Member
  • 31,041 posts

Posted 20 September 2006 - 03:55 AM

Are you sure its not there? Your getting a File exists error.

#6 alwaysinit

alwaysinit
  • Members
  • PipPipPip
  • Advanced Member
  • 60 posts

Posted 20 September 2006 - 04:21 AM

HAHA!!!!  got it!    thanks thorpe and andy-b
lemme just say U people are the cream of the crop of humanity for sharing your time and knowledge.
I changed userid to email and it worked(my email is setup to be unique) so it's gonna work
thank you guys so much
(andy-b comment made me realize)





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users