Forum Moderators: coopster

Message Too Old, No Replies

PHP & CHMOD

         

jayer

5:19 pm on Dec 5, 2008 (gmt 0)

10+ Year Member



I'm pretty much a PHP and programming novice so the answer to this may be simple...

I have password protected http://www.example.com/Admin/

When I log-in to the /Admin/ directory with Internet Explorer, I want to be able to create a folder and/or file in example.com/Example_Folder/. I am currently using the PHP function mkdir().

Is this possible without setting the CHMOD of Example_Folder to 777?

Thanks in advance for the help.

andrewsmd

6:47 pm on Dec 5, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It depends on where you are making it from. If you want to make it from anywhere on the web then no. Why not create a folder within that folder and set the permission to 777. If you don't want others to access it, you have to create it on the machine locally and access it locally. If that is the case, try www.logmein.com I use it for my job, it has great security and you can access your machine remotely from anywhere on the internet. From what it sounds like, you are using a linux machine and I think logmein is compatible with linux now.

jayer

7:17 pm on Dec 5, 2008 (gmt 0)

10+ Year Member



I'm not using linux... and I do want to be able to do this from anywhere on the web.

"Why not create a folder within that folder and set the permission to 777."

Why would I want to do that? The whole point is that I just want the person that is logged into the example.com/Admin/ folder to be able to create other folders in example.com/.

andrewsmd

8:46 pm on Dec 5, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



How are you using the mkdir function. Is it a web based form that they create the folder with or do you mean manually coding the mkdir() function. If you are using a web form, then check to see if they are logged in as Admin however you verify that. If so, allow them to create the folder, otherwise don't display that option. A little code would help here.

jayer

11:38 pm on Dec 8, 2008 (gmt 0)

10+ Year Member



mkdir(dirname(__FILE__) . "/" . $_POST['name'], 0775);

dirname(__FILE__) . "/" . $_POST['name'] is equivalent to:

/hsphere/local/home/Example_Login_Name/Example.com/Admin/Test_40

So http://www.example.com/Admin/ is a password protected directory. I log-in with the Example_Login_Name, which is my web site Owner name and password. The CHMOD for http://www.example.com/Admin/ is 775. Does that provide enough to understand what I am trying to do?

jayer

12:24 am on Dec 9, 2008 (gmt 0)

10+ Year Member



Ultimately, I am asking what is the best way to create a directory using web access (so server side)?