Twentyoneth Posted April 27, 2006 Share Posted April 27, 2006 Ok, I am trying to allow users to create a profile, but I am limmiting the ammount of users allowed to sign up, because it's for my grandmother's business. But, if she is logged in, I would like her to be able to add profiles of some of her employee's. So, she would enter a name into the field, if there is no directory by that name, it will create one. The problem is, that when I create the directory, it sets the permissions correctly, but I cannot modify that directory. No uploading, no file creation, nothing. Not even through my FTP File Manager. The only thing I am allowed to do is delete the dir. Any help would be greatly appreciated.[code]<?php$user = $HTTP_COOKIE_VARS['UserName'];if($user == "******") {if($_POST['Add/Update']) { $euser = $_POST['euser']; $ppic = $HTTP_POST_FILES['ppic']; $esum = stripslashes($_POST['esum']); $ebody = stripslashes($_POST['ebody']); $before = $HTTP_POST_FILES['before']; $after = $HTTP_POST_FILES['after']; $title = stripslashes($_POST['bnatitle']); $occ = $_POST['occ']; $makedir = ("stylists/$euser"); $writedir = ("stylists/$euser/"); if($euser !== null) { if(!is_dir($writedir)) { mkdir($makedir, 0777); echo "User directory made.<br><br>"; } if($occ !== "Select--") { $occfile = ($writedir . "occupation.php"); $occwrite = f open($occfile, 'w')or die("Cannot write '$occ' to $occfile."); f write($occwrite, $occ); f close($occwrite); echo "Your occupation file has been written.<br><br>"; } else { echo "No changes to occupation.<br><br>"; } if($HTTP_POST_FILES['ppic'] == null) { echo "No changes to profile picture.<br><br>"; } else { $ppicbmp = ($writedir . "ppic.bmp"); $ppicjpeg = ($writedir . "ppic.jpeg"); $ppicjpg = ($writedir . "ppic.jpg"); $ppicpng = ($writedir . "ppic.png"); $ppicgif = ($writedir . "ppic.gif"); $ppicstring = $HTTP_POST_FILES['ppic']['type']; if($ppicstring == "image/jpeg") { $ppictype = substr($ppicstring, -4, 4); } else { $ppictype = substr($ppicstring, -3, 3); } $newname = ($writedir . "ppic." . $ppictype); $uploadfile = ($writedir . basename($HTTP_POST_FILES['ppic']['name'])); if (move_uploaded_file($HTTP_POST_FILES['ppic']['tmp_name'], $uploadfile)) { rename("$uploadfile", "$newname"); echo ("Your display picture is valid, and was successfully uploaded.<br><br>"); } else { echo "Could not upload file."; } if($ppictype == "bmp") { unlink($ppicpng); unlink($ppicgif); unlink($ppicjpg); unlink($ppicjpeg); } elseif($ppictype == "png") { unlink($ppicbmp); unlink($ppicgif); unlink($ppicjpg); unlink($ppicjpeg); } elseif($ppictype == "gif") { unlink($ppicpng); unlink($ppicbmp); unlink($ppicjpg); unlink($ppicjpeg); } elseif($ppictype == "jpg") { unlink($ppicpng); unlink($ppicgif); unlink($ppicbmp); unlink($ppicjpeg); } elseif($ppictype == "jpeg") { unlink($ppicpng); unlink($ppicgif); unlink($ppicjpg); unlink($ppicbmp); } } if($esum !== null) { $esumfile = ($writedir . "shortie.php"); $esumwrite = f open($esumfile, 'w') or die("Cannot open $esumfile."); f write($esumwrite, $esum); f close($esumwrite); echo "Your summary has been written.<br><br>"; } else { echo "No changes to summary.<br><br>"; } if($ebody !== null) { $fto = ($writedir . "bio.php"); $file = f open($fto, 'w') or die("Cannot write to $fto."); f write($file, $ebody); echo "Your full bio has been written.<br><br>"; f close($file); } else { echo "No changes to bio.<br><br>"; } if($before !== null && $after !== null && $title !== null) { $beforestring = $HTTP_POST_FILES['before']['type']; if($beforestring == "image/jpeg") { $beforetype = substr($beforestring, -4, 4); } else { $beforetype = substr($beforestring, -3, 3); } $afterstring = $HTTP_POST_FILES['after']['type']; if($afterstring == "image/jpeg") { $aftertype = substr($afterstring, -4, 4); } else { $aftertype = substr($afterstring, -3, 3); } $beforenewname = ($writedir . $title . "-before." . $beforetype); $beforeuploadfile = ($writedir . basename($HTTP_POST_FILES['before']['name'])); if (move_uploaded_file($HTTP_POST_FILES['before']['tmp_name'], $beforeuploadfile)) { rename("$beforeuploadfile", "$beforenewname"); echo ("Before photo is valid, and was successfully uploaded.<br><br>"); } else { echo "Could not upload file."; } $afternewname = ($writedir . $title . "-after." . $aftertype); $afteruploadfile = ($writedir . basename($HTTP_POST_FILES['after']['name'])); if (move_uploaded_file($HTTP_POST_FILES['after']['tmp_name'], $afteruploadfile)) { rename("$afteruploadfile", "$afternewname"); echo ("After photo is valid, and was successfully uploaded.<br><br>"); } else { echo "Could not upload file."; } } else { echo "No before and after images added.<br><br>"; } } else { echo "You must enter the name of the profile you wish to edit."; } } else { echo "<table border='0' width='100%'><tr><td vAlign='top' align='center'> <table border='0' width='100%' cellspacing='0' cellpadding='0' style='border-style: solid; border-width: 1px; border-color: #000000;'><tr><td vAlign='top' align='center' bgColor='#FFFF99'> <b>Enter the name of the profile you wish to create.(To edit a profile visit <a href='?func=editprofile'>Edit Profile</a>.)</b> </td></tr></table><br> <form action='?func=editprofile' enctype='multipart/form-data' method='POST'> <input type='hidden' name='MAX_FILE_SIZE' value='9000000000000' /> <table border='0' width='100%'> <tr><td vAlign='top' align='left' width='50%'> Enter User To Create: </td><td vAlign='top' align='left'> <input type='text' name='euser' /> </td></tr> <tr><td vAlign='top' align='left'> Occupation: </td><td Valign='top' align='left'> <select name='occ'> <option> Select-- </option> <option> Stylist </option> <option> Massage Therapist </option> <option> Electrolysist </option> <option> Manicure/Pedicurist </option> </select> </td></tr> <tr><td vAlign='top' align='left'> Add Profile Picture: </td><td vAlign='top' align='left'> <input type='file' name='ppic' /> </td></tr> <tr><td vAlign='top' align='left'> Enter Summary Text: </td> <td vAlign='top' align='left'> <textarea rows='5' cols='24' name='esum'></textarea> </td></tr> <tr><td vAlign='top' align='left'> Enter Bio Text: </td> <td vAlign='top' align='left'> <textarea rows='5' cols='24' name='ebody'></textarea> </td></tr></table><br> <table border='0' width='100%' cellspacing='0' cellpadding='0' style='border-style: solid; border-width: 1px; border-color: #000000;'><tr><td vAlign='top' align='center' style='border-style: solid; border-bottom-width: 1px; border-top-width: 0px; border-left-width: 0px; border-right-width: 0px; border-color: #000000' bgColor='#800000'> <font color='#ffffff' face='Arial,Helvetica' size='1px'><b>Add before and after pictures of clients.</b></font> </td></tr><tr><td vAlign='top' align='center'> <table border='0' width='100%'> <tr><td vAlign='top' align='left'> Title for Pictures: </td><td vAlign='top' align='left'> <input type='text' name='bnatitle' /> </td></tr> <tr><td vAlign='top' align='left' width='50%'> Before: </td><td vAlign='top' align='left'> <input type='file' name='before' /> </td></tr> <tr><td vAlign='top' align='left'> After: </td><td vAlign='top' align='left'> <input type='file' name='after' /> </td></tr> </table></td></tr></table><br> <table border='0' width='100%'> <tr><td width='50%'></td> <td vAlign='top' align='right'> <input type='submit' value='Add/Update' name='Add/Update' /> </td></tr> </table> </td></tr></table></form>"; }} else {echo "You do not have permission to view this page.";}?>[/code][NOTE: Added spaces to allow post in file functions. And I would also like to point out that it works fine on my laptop, but once files are uploaded onto my server, it wont allow file creations.] Quote Link to comment Share on other sites More sharing options...
Twentyoneth Posted April 27, 2006 Author Share Posted April 27, 2006 [bump] Quote Link to comment Share on other sites More sharing options...
Twentyoneth Posted April 28, 2006 Author Share Posted April 28, 2006 Does no one know the solution? I have needed help for days :( Quote Link to comment Share on other sites More sharing options...
Twentyoneth Posted April 29, 2006 Author Share Posted April 29, 2006 Please help me.... Quote Link to comment 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.