Greenguy's Board


Go Back   Greenguy's Board > Programming & Scripting
Register FAQ Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
Old 2006-07-20, 04:45 PM   #1
Useless
Certified Nice Person
 
Useless's Avatar
 
Join Date: Oct 2003
Location: Dirty Undies, NY
Posts: 11,268
Send a message via ICQ to Useless
Ownership/Permission issues

Is there a PHP function that allows one to create directories with a script that doesn't make them owned by the server? Or, is there a function that can successfuly delete directories that have been created by a PHP script instead of giving me the "Fuck You - You Suck/Don't Have Permission" error like rmdir?
__________________
Click here to purchase a bridge I'm selling.
Useless is offline   Reply With Quote
Old 2006-07-20, 05:27 PM   #2
HC-Majick
You can now put whatever you want in this space :)
 
HC-Majick's Avatar
 
Join Date: Oct 2004
Location: Upstate NY
Posts: 541
Send a message via ICQ to HC-Majick
edit: just noticed the rmdir part...

Code:
<?php
// Sets All Permissions
chmod("mydirectory", 0777);
?>
before your rmdir fuction??
__________________
Submit Your Freesites:

Last edited by HC-Majick; 2006-07-20 at 05:32 PM..
HC-Majick is offline   Reply With Quote
Old 2006-07-25, 03:24 AM   #3
Beaver Bob
Porn Blog Addict
 
Beaver Bob's Avatar
 
Join Date: Oct 2005
Location: Las Vegas, Nevada
Posts: 715
Send a message via ICQ to Beaver Bob
Thumbs up

useless, I've always found it easier to have PHP use FTP. I've never had much luck any other way. If FTP extensions aren't installed with the version of PHP on your server, have your system admin do that first.

This function can be used to make a directory, the values you need to replace in this are $server, $user, and $pass. The first argument needs to be the absolute path of where you want to create your directory, the second is the name of the new directory.

PHP Code:
// create directory through FTP connection
function FtpMkdir($path$newDir) {
  
       
$server='255.255.255.255'// ftp server
       
$connection ftp_connect($server); // connection
 
       // login to ftp server
       
$user "USERNAME";
       
$pass "PASSWORD";
       
$result ftp_login($connection$user$pass);

   
// check if connection was made
     
if ((!$connection) || (!$result)) {
       return 
false;
       exit();
       } else {
         
ftp_chdir($connection$path); // go to destination dir
       
if(ftp_mkdir($connection,$newDir)) { // create directory
           
return $newDir;
       } else {
           return 
false;       
       }
   
ftp_close($connection); // close connection
   
}


Beaver Bob is offline   Reply With Quote
Old 2006-07-25, 11:02 AM   #4
Useless
Certified Nice Person
 
Useless's Avatar
 
Join Date: Oct 2003
Location: Dirty Undies, NY
Posts: 11,268
Send a message via ICQ to Useless
Thank you Beaver Bob. I'll give that try. Now all I have to do is remember what I was trying to do when I asked the question.
__________________
Click here to purchase a bridge I'm selling.
Useless is offline   Reply With Quote
Old 2006-07-25, 09:31 PM   #5
Beaver Bob
Porn Blog Addict
 
Beaver Bob's Avatar
 
Join Date: Oct 2005
Location: Las Vegas, Nevada
Posts: 715
Send a message via ICQ to Beaver Bob
hope it helps you out The reason for using FTP is so the directories you create will belong to you and you should have no problems removing them or modifying stuff.
Beaver Bob is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 07:33 PM.


Mark Read
Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
© Greenguy Marketing Inc