ChrisMartino Posted November 27, 2009 Share Posted November 27, 2009 Hey there, Thanks for taking the time to read my problem, The problem is i get the following error: "Warning: mkdir() [function.mkdir]: No such file or directory in /home/christop/public_html/websites/file/register.php on line 88" This is how i am using mkdir: "mkdir("/home/userarea/$username", 0777);" The directory /home/userarea dose exist so is there any reason for this error?. Quote Link to comment https://forums.phpfreaks.com/topic/183070-mkdir-problem/ Share on other sites More sharing options...
ChrisMartino Posted November 27, 2009 Author Share Posted November 27, 2009 Ok i seem to have fixed the error, But it dose not create the file?. Quote Link to comment https://forums.phpfreaks.com/topic/183070-mkdir-problem/#findComment-966198 Share on other sites More sharing options...
premiso Posted November 27, 2009 Share Posted November 27, 2009 Post the code to show us where it attempts to create the file. As if it does create the DIR, the file should be created as well...or are you saying it is executing but the DIR is not being put on the server. Quote Link to comment https://forums.phpfreaks.com/topic/183070-mkdir-problem/#findComment-966265 Share on other sites More sharing options...
ChrisMartino Posted November 27, 2009 Author Share Posted November 27, 2009 This is the full page were the file is created, <?php include "base.php"; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta name="Description" content="Information architecture, Web Design, Web Standards." /> <meta name="Keywords" content="your, keywords" /> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <meta name="Distribution" content="Global" /> <meta name="Author" content="Erwin Aligam - ealigam@gmail.com" /> <meta name="Robots" content="index,follow" /> <link rel="stylesheet" href="images/CoolWater.css" type="text/css" /> <title>FreeFile :: Register</title> </head> <body> <!-- wrap starts here --> <div id="wrap"> <!--header --> <div id="header"> <div id="header-links"> </div> </div> <!-- navigation --> <div id="menu"> <ul> <?php if(!empty($_SESSION['LoggedIn']) && !empty($_SESSION['Username'])) { ?> <li><a href="home.php">Home</a></li> <li><a href="contact.php">Contact</a></li> <li><a href="cp.php">Control Panel</a></li> <li><a href="logout.php">Logout</a></li> <?php } else { ?> <li><a href="index.html">Home</a></li> <li><a href="login.php">Login</a></li> <li id="current"><a href="index.html">Register</a></li> <li><a href="contact.php">Contact</a></li> <?php } ?> </ul> </div> <!-- content-wrap starts here --> <div id="content-wrap"> <div id="main"> <a name="TemplateInfo"></a> <h2><a href="index.html">Register a account.</a></h2> <p><?php if(!empty($_POST['username']) && !empty($_POST['password'])) { $username = mysql_real_escape_string($_POST['username']); $password = md5(mysql_real_escape_string($_POST['password'])); $email = mysql_real_escape_string($_POST['email']); $checkusername = mysql_query("SELECT * FROM users WHERE Username = '".$username."'"); if(mysql_num_rows($checkusername) == 1) { echo "<h1>Error</h1>"; echo "<p>Sorry, that username is taken. Please go back and try again.</p>"; } else { $registerquery = mysql_query("INSERT INTO users (Username, Password, EmailAddress) VALUES('".$username."', '".$password."', '".$email."')"); if($registerquery) { echo "<h1>Success</h1>"; echo "<p>Your account was successfully created. Please <a href=\"index.php\">click here to login</a>.</p>"; mkdir("home/userarea/$username", 0777); } else { echo "<h1>Error</h1>"; echo "<p>Sorry, your registration failed. Please go back and try again.</p>"; } } } ?> <h1>Register</h1> <p>Please enter your details below to register.</p> <form method="post" action="register.php" name="registerform" id="registerform"> <fieldset> <label for="username">Username:</label><input type="text" name="username" id="username" /><br /> <label for="password">Password:</label><input type="password" name="password" id="password" /><br /> <label for="email">Email Address:</label><input type="text" name="email" id="email" /><br /> <input type="submit" name="register" id="register" value="Register" /> </fieldset> </form> </div> <div id="sidebar"> <h2>Search Box</h2> <form action="#" class="searchform"> <p> <input name="search_query" class="textbox" type="text" /> <input name="search" class="button" value="Search" type="submit" /> </p> </form> <h2>Sidebar Menu</h2> <ul class="sidemenu"> <li><a href="index.html">Home</a></li> <li><a href="#TemplateInfo">Template Info</a></li> <li><a href="#SampleTags">Sample Tags</a></li> <li><a href="http://www.styleshout.com/">More Free Templates</a></li> <li><a href="http://www.4templates.com/?aff=ealigam">Premium Templates</a></li> </ul> <h2>Links</h2> <ul class="sidemenu"> <li><a href="http://www.pdphoto.org/">PDPhoto.org</a></li> <li><a href="http://www.squidfingers.com/patterns/">Squidfingers</a></li> <li><a href="http://www.alistapart.com">Alistapart</a></li> <li><a href="http://www.cssremix.com">CSS Remix</a></li> <li><a href="http://www.cssmania/">CSS Mania</a></li> </ul> <h2>Sponsors</h2> <ul class="sidemenu"> <li><a href="http://themeforest.net?ref=ealigam"><strong>ThemeForest</strong></a> <br /> Your Choice for Site Templates & Wordpress Themes</li> <li><a href="http://www.4templates.com/?aff=ealigam"><strong>4templates</strong></a> <br /> Low Cost Hi-Quality Templates</li> <li><a href="http://store.templatemonster.com?aff=ealigam"><strong>TemplateMonster</strong></a> <br /> Delivering the Best Templates on the Net!</li> <li><a href="http://tinyurl.com/3cgv2m"><strong>Text Link Ads</strong></a> <br /> Monetized your website</li> <li><a href="http://www.fotolia.com/partner/114283"><strong>Fotolia</strong></a> <br /> Free stock images or from $1</li> <li><a href="http://www.dreamstime.com/res338619"><strong>Dreamstime</strong></a> <br /> Lowest Price for High Quality Stock Photos</li> <li><a href="http://www.dreamhost.com/r.cgi?287326"><strong>Dreamhost</strong></a> <br /> Premium webhosting</li> </ul> <h2>Wise Words</h2> <p>"To have a quiet mind is to possess one's mind wholly; to have a calm spirit is to possess one's self." </p> <p class="align-right">- Hamilton Mabie</p> <h2>Support Styleshout</h2> <p>If you are interested in supporting my work and would like to contribute, you are welcome to make a small donation through the <a href="http://www.styleshout.com/">donate link</a> on my website - it will be a great help and will surely be appreciated.</p> </div> <!-- content-wrap ends here --> </div> <!--footer starts here--> <div id="footer"> <p> © 2006 <strong>Your Company</strong> | Design by: <a href="http://www.styleshout.com/">styleshout</a> | Valid <a href="http://validator.w3.org/check?uri=referer">XHTML</a> | <a href="http://jigsaw.w3.org/css-validator/check/referer">CSS</a> </p> </div> <!-- wrap ends here --> </div> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/183070-mkdir-problem/#findComment-966453 Share on other sites More sharing options...
JonnoTheDev Posted November 27, 2009 Share Posted November 27, 2009 Ok i seem to have fixed the error, But it dose not create the file?. mkdir() does not create files. It creates a directory! However, if that is what you mean't then you must also be aware that the webserver must have the appropriate permissions to create a directory in the specified path. Read the manual for examples: http://uk.php.net/mkdir Quote Link to comment https://forums.phpfreaks.com/topic/183070-mkdir-problem/#findComment-966478 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.