RE: [PHP] Please assist - been on this for hours - Permissions onserver

2003-07-11 Thread Steve Jackson
 
 Writing and moving require the same permissions. Also, there is a big
 difference between root and webroot. Which one are you talking about?

Web root.
Sorry not the root directory of the server but the webroot. 1 directory
back in fact is all I need so the structure would be:

Web Cms generator.php
Web generated.php

So I can protect the CMS directory which currently needs to be chmod 777
in order to write the page (at least that was the only way I could get
the write function to work) and then just have the written files drop
back into the web root so that if someone typed:

http://www.mysite.com/generated.php

They would get the page.

Not (as I can currently do) http://www.mysite.com/cms/generated.php

Thanks.


Steve Jackson
Web Development and Marketing Manager
Viola Systems Ltd.
http://www.violasystems.com
[EMAIL PROTECTED]
Mobile +358 50 343 5159


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Please assist - been on this for hours - Permissions onserver

2003-07-11 Thread Jason Wong
On Friday 11 July 2003 15:20, Steve Jackson wrote:
  Writing and moving require the same permissions. Also, there is a big
  difference between root and webroot. Which one are you talking about?

 Web root.
 Sorry not the root directory of the server but the webroot. 1 directory
 back in fact is all I need so the structure would be:

 Web Cms generator.php
 Web generated.php

 So I can protect the CMS directory which currently needs to be chmod 777
 in order to write the page (at least that was the only way I could get
 the write function to work) and then just have the written files drop
 back into the web root so that if someone typed:

 http://www.mysite.com/generated.php

 They would get the page.

 Not (as I can currently do) http://www.mysite.com/cms/generated.php

You can use php's ftp functions to write the file into your webroot directory.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
One enemy soldier is never enough, but two is entirely too many
-- Murphy's Military Laws n68
*/


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Please assist - been on this for hours - Permissions onserver

2003-07-11 Thread Steve Jackson
Interesting.

Do I need to open an FTP connection do you think or use wrappers?

I tried this: 
// Define the filename to write to.
$filename = 'test.txt';
// Open the file for overwriting.
$fp = fopen($filename, w);
// Write the string to the file
$write = fputs($fp, $string);
// Close the file
fclose($fp);
// rename the filename in the root directory to the pagename
rename($filename, $pagename.php);
$url = 172.16.2.4/~stephenj/misc/webpage;
$final_url = ftp://$url/$pagename.php;;
$fp2 = fopen(ftp://$url/cms/$pagename.php;, r);  Line 59.
$move = fputs($fp2, $final_url);
fclose($fp2);
// end of function.

and get a really odd error:
Warning:
fopen(ftp://172.16.2.4/~stephenj/misc/webpage/cms/this_wont_work.php,;
r) - Inappropriate ioctl for device on line 59  

Any ideas people?

Steve Jackson
Web Development and Marketing Manager
Viola Systems Ltd.
http://www.violasystems.com
[EMAIL PROTECTED]
Mobile +358 50 343 5159





 -Original Message-
 From: Jason Wong [mailto:[EMAIL PROTECTED] 
 Sent: 11. heinäkuuta 2003 11:47
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP] Please assist - been on this for hours - 
 Permissions onserver
 
 
 On Friday 11 July 2003 15:20, Steve Jackson wrote:
   Writing and moving require the same permissions. Also, there is a 
   big difference between root and webroot. Which one are 
 you talking 
   about?
 
  Web root.
  Sorry not the root directory of the server but the webroot. 1 
  directory back in fact is all I need so the structure would be:
 
  Web Cms generator.php
  Web generated.php
 
  So I can protect the CMS directory which currently needs to 
 be chmod 
  777 in order to write the page (at least that was the only 
 way I could 
  get the write function to work) and then just have the 
 written files 
  drop back into the web root so that if someone typed:
 
  http://www.mysite.com/generated.php
 
  They would get the page.
 
  Not (as I can currently do) http://www.mysite.com/cms/generated.php
 
 You can use php's ftp functions to write the file into your 
 webroot directory.
 
 -- 
 Jason Wong - Gremlins Associates - www.gremlins.biz
 Open Source Software Systems Integrators
 * Web Design  Hosting * Internet  Intranet Applications 
 Development *
 --
 Search the list archives before you post 
 http://marc.theaimsgroup.com/?l=php-general
 
 --
 /*
 One enemy soldier is never enough, but two is entirely too many
   -- Murphy's Military Laws n68
 */
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Please assist - been on this for hours - Permissions onserver

2003-07-11 Thread Marek Kilimajer
Write the file with ftp right away:

// Define the filename to write to.
$filename = 'ftp://username:[EMAIL PROTECTED]/your_webdir/test.txt';
// Open the file for overwriting.
$fp = fopen($filename, w);
// Write the string to the file
$write = fputs($fp, $string);
// Close the file
fclose($fp);


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Please assist - been on this for hours - Permissions onserver

2003-07-11 Thread Steve Jackson
Same error.
Warning: fopen(ftp://[EMAIL PROTECTED]/misc/webpage/cms/test.txt,w) -
Inappropriate ioctl for device in
/home/stephenj/public_html/misc/webpage/cms/generator.php on line 51

Think this is going to get too complicated for a user interface as well
so I might have to abandon this idea. I think I'll just try uploading a
template file with it's unique ID rather than writing one directly to
the server. I don't want to have to have users put their ftp username
and password into the CMS for it to work.

Unless you think I am not far from success with this method? All I
wanted was for a file to be written into a safe directory and then moved
automatically to the webroot.

Steve Jackson
Web Development and Marketing Manager
Viola Systems Ltd.
http://www.violasystems.com
[EMAIL PROTECTED]
Mobile +358 50 343 5159





 -Original Message-
 From: Marek Kilimajer [mailto:[EMAIL PROTECTED] 
 Sent: 11. heinäkuuta 2003 13:32
 To: Steve Jackson
 Cc: [EMAIL PROTECTED]
 Subject: Re: [PHP] Please assist - been on this for hours - 
 Permissions onserver
 
 
 Write the file with ftp right away:
 
 // Define the filename to write to.
 $filename = 'ftp://username:[EMAIL PROTECTED]/your_webdir/test.txt';
 // Open the file for overwriting.
 $fp = fopen($filename, w);
 // Write the string to the file
 $write = fputs($fp, $string);
 // Close the file
 fclose($fp);
 
 


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Please assist - been on this for hours - Permissions onserver

2003-07-11 Thread Jason Wong
On Friday 11 July 2003 18:54, Steve Jackson wrote:
 Same error.
 Warning: fopen(ftp://[EMAIL PROTECTED]/misc/webpage/cms/test.txt,w) -
 Inappropriate ioctl for device in
 /home/stephenj/public_html/misc/webpage/cms/generator.php on line 51

You *are* using the correct user/pass? It should be the same as what you use 
to upload files to your webroot.

If you can't get this to work then try the ftp functions.

 Think this is going to get too complicated for a user interface as well
 so I might have to abandon this idea. I think I'll just try uploading a
 template file with it's unique ID rather than writing one directly to
 the server. I don't want to have to have users put their ftp username
 and password into the CMS for it to work.

Alternatively, you could consider storing them in a DB.

 Unless you think I am not far from success with this method? All I
 wanted was for a file to be written into a safe directory and then moved
 automatically to the webroot.

I still don't understand (ie you still haven't explained) why you're creating 
the file somewhere then move it elsewhere. Why can you not use it where it's 
created, or create it where it's to be used?

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
On the Internet, nobody knows you're a dog.
-- Cartoon caption
*/


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Please assist - been on this for hours - Permissions onserver

2003-07-11 Thread Marek Kilimajer
You are not that far away. It seems to me you have allow_url_fopen off. 
Then you need to store your file in a temporary location, use ftp 
functions to upload it (the example in the manual is all you need), and 
then remove the temporary file. But this again needs the ftp extenssion 
enabled.

Steve Jackson wrote:

Same error.
Warning: fopen(ftp://[EMAIL PROTECTED]/misc/webpage/cms/test.txt,w) -
Inappropriate ioctl for device in
/home/stephenj/public_html/misc/webpage/cms/generator.php on line 51
Think this is going to get too complicated for a user interface as well
so I might have to abandon this idea. I think I'll just try uploading a
template file with it's unique ID rather than writing one directly to
the server. I don't want to have to have users put their ftp username
and password into the CMS for it to work.
Unless you think I am not far from success with this method? All I
wanted was for a file to be written into a safe directory and then moved
automatically to the webroot.
Steve Jackson
Web Development and Marketing Manager
Viola Systems Ltd.
http://www.violasystems.com
[EMAIL PROTECTED]
Mobile +358 50 343 5159





-Original Message-
From: Marek Kilimajer [mailto:[EMAIL PROTECTED] 
Sent: 11. heinäkuuta 2003 13:32
To: Steve Jackson
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Please assist - been on this for hours - 
Permissions onserver

Write the file with ftp right away:

// Define the filename to write to.
$filename = 'ftp://username:[EMAIL PROTECTED]/your_webdir/test.txt';
// Open the file for overwriting.
$fp = fopen($filename, w);
// Write the string to the file
$write = fputs($fp, $string);
// Close the file
fclose($fp);






--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Please assist - been on this for hours - Permissions onserver

2003-07-11 Thread Steve Jackson
 You *are* using the correct user/pass? It should be the same 
 as what you use to upload files to your webroot.
 
 If you can't get this to work then try the ftp functions.

Yes I am. 
 
 
 Alternatively, you could consider storing them in a DB.

Yes that's what I was thinking they only need put the username password
in once so it might not be such a bad idea. But more I think about this
I'm doing this in a strange way. If I upload the file directly to root
rather than write it then I won't have any problems. Doesn't matter who
owns the file then.

 I still don't understand (ie you still haven't explained) why 
 you're creating 
 the file somewhere then move it elsewhere. Why can you not 
 use it where it's 
 created, or create it where it's to be used?

I can't create it where it's meant to be used by writing the file
because it would mean changing the permissions of the web root directory
to chmod 777. That was the only way I could get the generator file to
write the php page by 'chmodding' the directory that the files were
being created in to 777.  If I do that to the web root it's a security
risk. My idea and it's turned out to be a bad one was to put the
generator file: ie the file writing the page on the fly in a safe
directory IE outside the webroot or in a protected directory. Then move
the file to the web root from the safe directory. 

If there is a way to do what you suggest without a security risk I'd buy
you a beer and send it to you via ASDL if you'd tell me how ;o).

Cheers,
Steve.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Please assist - been on this for hours - Permissions onserver

2003-07-11 Thread Marek Kilimajer


Steve Jackson wrote:

You *are* using the correct user/pass? It should be the same 
as what you use to upload files to your webroot.

If you can't get this to work then try the ftp functions.


Yes I am. 
 

Alternatively, you could consider storing them in a DB.


Yes that's what I was thinking they only need put the username password
in once so it might not be such a bad idea. But more I think about this
I'm doing this in a strange way. If I upload the file directly to root
rather than write it then I won't have any problems. Doesn't matter who
owns the file then.
It does matter in safe mode, unless safe_mode_include_dir is properly 
set up.



I still don't understand (ie you still haven't explained) why 
you're creating 
the file somewhere then move it elsewhere. Why can you not 
use it where it's 
created, or create it where it's to be used?


I can't create it where it's meant to be used by writing the file
because it would mean changing the permissions of the web root directory
to chmod 777. That was the only way I could get the generator file to
write the php page by 'chmodding' the directory that the files were
being created in to 777.  If I do that to the web root it's a security
risk. My idea and it's turned out to be a bad one was to put the
generator file: ie the file writing the page on the fly in a safe
directory IE outside the webroot or in a protected directory. Then move
the file to the web root from the safe directory. 
Still this would not work for the same reason you cannot write it there 
directly, the permissions cannot be circumvented.

If there is a way to do what you suggest without a security risk I'd buy
you a beer and send it to you via ASDL if you'd tell me how ;o).
Cheers,
Steve.



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Please assist - been on this for hours - Permissions onserver

2003-07-10 Thread Brad Pauly
Steve Jackson wrote:
I don't particularly need to *write* to the root directory. I do need to move the file to the root directory though as it's part of a CMS system. I can write the file to a directory which is adequately protected, but there has to be a way to move the file after it is written (to the root from said protected directory). The file is designed to be generated by another user. There are easier ways to design a CMS system I realise but this is my goal, to allow a user to simply generate a file which then is placed in the webroot after it has been written. I thought that this would be the easy part. Any more ideas? Thanks for your help Jason I appreciate it.  
Writing and moving require the same permissions. Also, there is a big 
difference between root and webroot. Which one are you talking about?

- Brad



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php