[PHP] writing to file

2005-08-07 Thread Sebastian
i have this app where a user fills out a form and after submit it 
displays the values they entered. i want to save this info to a file 
after they submit, then allow them to download the file. some other user 
does the same, fills in the form and allow that person to download the 
file... and so on.


i don't know how i should go about doing this.. rather than keep 
creating files i would like to recycle the file each time someone uses 
the system, but that can lead to other problems.. like several users 
using the app at once..


any suggestion/ideas/tips how i should do this? basically, just write 
the info from POST to a file and allow them to download the file. 
obviously i am worried how secure i will be able to make this.



--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.338 / Virus Database: 267.10.2/65 - Release Date: 8/7/2005

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



Re: [PHP] writing to file

2005-08-07 Thread Jochem Maas

Sebastian wrote:
i have this app where a user fills out a form and after submit it 
displays the values they entered. i want to save this info to a file 
after they submit, then allow them to download the file. some other user 
does the same, fills in the form and allow that person to download the 
file... and so on.


i don't know how i should go about doing this.. rather than keep 
creating files i would like to recycle the file each time someone uses 
the system, but that can lead to other problems.. like several users 
using the app at once..


any suggestion/ideas/tips how i should do this? basically, just write 
the info from POST to a file and allow them to download the file. 
obviously i am worried how secure i will be able to make this.


alot depends on whether the user will be allowed to download the file
only in the current session or at any time in the future.

also security has 2 sides - protection on the server (from other
people hosting on the same machine, and protection on the 'outside'
from unauthorized users trying to download other peoples files
(which would require some kind of login mechanism)

note that in order to give a user a file to download when he/she
clicks something does not require an actual file to exist ...
you could store the data ('file contents') in a DB and have a script
which when requested with the correct parameters (GET args) will
extract the data from the DB (or whereever) and output it with the
correct headers (to force a download)

there is lots of info out there on how to create/output headers to
tell a browser that it should download whatever is returned from a
request. have a search - chances are you'll find something

chances are also that you'll get stuck because of the way certain
browsers f*** up when given 'download' headers - I've found it as much
art as science in the past ;-) any way if this turns out to be the case
we'll be seeing you :-)






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



Re: [PHP] Writing static file from dynamic PHP page

2005-01-19 Thread John Hicks
Chris Bruce wrote:
Hi,
I am looking for a way to write to a file what the browser would see 
(raw html) when viewing a dynamic PHP page. I have numerous include 
files, MySQL db queries, loops etc. and I want to generate the static 
result of that file and save it as an html page. I have toyed a little 
with output buffering to no avail.

Is there an easy way to do this?
Thanks,
Chris
Here's a great article on the subject from the Zend website:
http://www.zend.com/zend/art/scriptcaching.php
It's a little more complex than you would hope but is well thought out.
--Separate directories is set up to hold the php source and the cached html.
--The cached html directory is initially empty.
--An Apache ErrorDocument directive is used to intercept the 404 
document not found error when someone is requesting a page and to 
redirect it to a single caching script.
--This caching script uses fopen() to open and then read the php script 
and to write the output to the cached html directory.

Hats off to Zend for publishing this. It competes with their Zend Cache 
product. From the article:

If your site contains a few small scripts, you may not need to bother 
with caching at all. On the other hand, if you rely on complex scripts 
and fresh data, you should use a much more sophisticated solution, such 
as the Zend Cache http://www.zend.com/store/products/zend-cache.php. 
But if you are somewhere in between, I hope this article will be of help 
to you. If you have any comments, please feel free to email me.

(Sorry to take so long to post this. I had remembered reading the 
article but couldn't find it. Finally thought to do a Google for 404 
php cache.)

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


Re: [PHP] Writing static file from dynamic PHP page

2005-01-18 Thread Chris Bruce
sorry for the repost, but my mail server was down from about 11pmEST 
last night to 9:15am this morning and unable to receive responses. Can 
someone forward me responses to this post if any? Thanks. Chris

Hi,
I am looking for a way to write to a file what the browser would see
(raw html) when viewing a dynamic PHP page. I have numerous include
files, MySQL db queries, loops etc. and I want to generate the static
result of that file and save it as an html page. I have toyed a little
with output buffering to no avail.
Is there an easy way to do this?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Writing static file from dynamic PHP page

2005-01-18 Thread Richard Lynch




Chris Bruce wrote:
 sorry for the repost, but my mail server was down from about 11pmEST
 last night to 9:15am this morning and unable to receive responses. Can
 someone forward me responses to this post if any? Thanks. Chris

 Hi,

 I am looking for a way to write to a file what the browser would see
 (raw html) when viewing a dynamic PHP page. I have numerous include
 files, MySQL db queries, loops etc. and I want to generate the static
 result of that file and save it as an html page. I have toyed a little
 with output buffering to no avail.

 Is there an easy way to do this?

Just build the site you want with PHP, and then use wget to suck down the
pages into your static directory.

Output buffering should have worked, but it's too easy for somebody else
to mess up the buffering if they want to use it for something else in
their business logic.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Writing static file from dynamic PHP page

2005-01-18 Thread Christopher Fulton
Just an fyi...this would be VERY easy to get online.  PHP keeps an
archive of all the posts.  Here's the link

http://marc.theaimsgroup.com/?l=php-general

In fact, you may even find other posts similar to yours by searching
(that could answer your question?)

-Chris


On Tue, 18 Jan 2005 09:30:00 -0500, Chris Bruce [EMAIL PROTECTED] wrote:
 sorry for the repost, but my mail server was down from about 11pmEST
 last night to 9:15am this morning and unable to receive responses. Can
 someone forward me responses to this post if any? Thanks. Chris
 
  Hi,
 
  I am looking for a way to write to a file what the browser would see
  (raw html) when viewing a dynamic PHP page. I have numerous include
  files, MySQL db queries, loops etc. and I want to generate the static
  result of that file and save it as an html page. I have toyed a little
  with output buffering to no avail.
 
  Is there an easy way to do this?
 
 --
 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] Writing static file from dynamic PHP page

2005-01-18 Thread Jason Wong
On Tuesday 18 January 2005 22:30, Chris Bruce wrote:
 sorry for the repost, but my mail server was down from about 11pmEST
 last night to 9:15am this morning and unable to receive responses.

Unless your mailserver is seriously buggered then you _will_ receive whatever 
replies there were eventually -- internet mail is pretty robust.

 Can 
 someone forward me responses to this post if any? Thanks. Chris

archives ...

-- 
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
--
New Year Resolution: Ignore top posted posts

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



Re: [PHP] Writing static file from dynamic PHP page

2005-01-18 Thread Chris Bruce
This is a great solution, except I cannot get PHP to exec the file that 
has the 'wget' command in it.

What I have done is to create a file (wget.php) into the directory that 
I want to wget the page into. I then chmod -R the directory to make 
everything in it executable.
here is what is written to the file:
/usr/bin/wget -d http://path/to/file/index.html

Then in the PHP function I make a an exec call on that file
exec(/path/to/file/wget.php,$out,$err);
Everything is cool, except the exec does not happen. The $out array 
looks like this:
Array
{
}
and the $err returns '126'

But the exec doesn't happen. If I run the contents of wget.php on the 
command line, presto, it works.

So, what is the deal? Is it a problem with the apache user not having 
access to wget through PHP??

On Jan 18, 2005, at 11:41 AM, Richard Lynch wrote:


Chris Bruce wrote:
sorry for the repost, but my mail server was down from about 11pmEST
last night to 9:15am this morning and unable to receive responses. Can
someone forward me responses to this post if any? Thanks. Chris
Hi,
I am looking for a way to write to a file what the browser would see
(raw html) when viewing a dynamic PHP page. I have numerous include
files, MySQL db queries, loops etc. and I want to generate the 
static
result of that file and save it as an html page. I have toyed a 
little
with output buffering to no avail.

Is there an easy way to do this?
Just build the site you want with PHP, and then use wget to suck down 
the
pages into your static directory.

Output buffering should have worked, but it's too easy for somebody 
else
to mess up the buffering if they want to use it for something else in
their business logic.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Writing static file from dynamic PHP page

2005-01-18 Thread R'twick Niceorgaw
On Tue, January 18, 2005 2:42 pm, Chris Bruce said:
 This is a great solution, except I cannot get PHP to exec the file that
 has the 'wget' command in it.

 What I have done is to create a file (wget.php) into the directory that
 I want to wget the page into. I then chmod -R the directory to make
 everything in it executable. here is what is written to the file:
 /usr/bin/wget -d http://path/to/file/index.html

put this at the begining of wget.php
#!/bin/sh

HTH
-R'twick

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



Re: [PHP] Writing static file from dynamic PHP page

2005-01-18 Thread Matthew Weier O'Phinney
* Christopher Fulton [EMAIL PROTECTED]:
 Just an fyi...this would be VERY easy to get online.  PHP keeps an
 archive of all the posts.  Here's the link

 http://marc.theaimsgroup.com/?l=php-general

Also, try http://news.php.net/php.general

Though it's not currently searchable -- you can still find all posts.

 On Tue, 18 Jan 2005 09:30:00 -0500, Chris Bruce [EMAIL PROTECTED] wrote:
  sorry for the repost, but my mail server was down from about 11pmEST
  last night to 9:15am this morning and unable to receive responses. Can
  someone forward me responses to this post if any? Thanks. Chris
  
Hi,
   
I am looking for a way to write to a file what the browser would see
(raw html) when viewing a dynamic PHP page. I have numerous include
files, MySQL db queries, loops etc. and I want to generate the static
result of that file and save it as an html page. I have toyed a little
with output buffering to no avail.
   
Is there an easy way to do this?

-- 
Matthew Weier O'Phinney   | mailto:[EMAIL PROTECTED]
Webmaster and IT Specialist   | http://www.garden.org
National Gardening Association| http://www.kidsgardening.com
802-863-5251 x156 | http://nationalgardenmonth.org

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



Re: [PHP] Writing static file from dynamic PHP page

2005-01-18 Thread Richard Lynch
Chris Bruce wrote:
 This is a great solution, except I cannot get PHP to exec the file that
 has the 'wget' command in it.

 What I have done is to create a file (wget.php) into the directory that
 I want to wget the page into. I then chmod -R the directory to make
 everything in it executable.
 here is what is written to the file:
 /usr/bin/wget -d http://path/to/file/index.html

 Then in the PHP function I make a an exec call on that file
 exec(/path/to/file/wget.php,$out,$err);

 Everything is cool, except the exec does not happen. The $out array
 looks like this:
 Array
 {
 }
 and the $err returns '126'

 But the exec doesn't happen. If I run the contents of wget.php on the
 command line, presto, it works.

 So, what is the deal? Is it a problem with the apache user not having
 access to wget through PHP??

Almost for sure, yes.

Though you've now made it even more complex, because maybe the PHP user
doesn't have eXec priveleges for your 'wget.php' file, in addition to not
having eXec priveleges to 'wget' in /usr/bin

Plus, having PHP able to write the file, and PHP able to eXec the file,
wget.php, would be a pretty gaping security hole on a shared server...

You've got to make it possible for the PHP user to:
A) eXec wget
B) Write into the output directory wget will use

Honestly, though, wget is *SO* easy, you may want to bypass PHP for that
part of it anyway -- A cron job to wget the site or a simple shell script
might be easier to work with than running PHP to run wget...

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Writing static file from dynamic PHP page

2005-01-18 Thread Hugh Danaher
Chris,
I've done something like this to update website's static pages.  Basically, 
in a php script I've replaced all of the print statements with $line.=  
statements to accumulate all the items you want printed into one long 
string.  I've then ftp'ed this string, along with the name of the html page, 
to the website where the page is to be viewed.
You could also set up an html page with links to a php page that generates 
the above stuff, and then use a header() command as the last line of the php 
page to go to the .html page you just generated.
Hope this helps.
Hugh

- Original Message - 
From: Chris Bruce [EMAIL PROTECTED]
To: PHP-General php-general@lists.php.net
Sent: Monday, January 17, 2005 7:16 PM
Subject: [PHP] Writing static file from dynamic PHP page


Hi,
I am looking for a way to write to a file what the browser would see (raw 
html) when viewing a dynamic PHP page. I have numerous include files, 
MySQL db queries, loops etc. and I want to generate the static result of 
that file and save it as an html page. I have toyed a little with output 
buffering to no avail.

Is there an easy way to do this?
Thanks,
Chris
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--
No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.6.13 - Release Date: 1/16/2005


--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.6.13 - Release Date: 1/16/2005
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Writing static file from dynamic PHP page

2005-01-17 Thread Chris Bruce
Hi,
I am looking for a way to write to a file what the browser would see 
(raw html) when viewing a dynamic PHP page. I have numerous include 
files, MySQL db queries, loops etc. and I want to generate the static 
result of that file and save it as an html page. I have toyed a little 
with output buffering to no avail.

Is there an easy way to do this?
Thanks,
Chris
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Writing static file from dynamic PHP page

2005-01-17 Thread Bret Hughes
On Mon, 2005-01-17 at 21:16, Chris Bruce wrote:
 Hi,
 
 I am looking for a way to write to a file what the browser would see 
 (raw html) when viewing a dynamic PHP page. I have numerous include 
 files, MySQL db queries, loops etc. and I want to generate the static 
 result of that file and save it as an html page. I have toyed a little 
 with output buffering to no avail.
 
 Is there an easy way to do this?

Interesting requirement.  I suppose something other than view source 
from the browser or wget is needed?

Bret

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



[PHP] Writing to file with function

2003-07-12 Thread Jason Giangrande
I have written this function to rewrite the contents of a text file
after it's been updated.  I store lines of data in an array and then
implode them into one string.  The problem is that I'm getting an extra
line break (in other words a blank line is showing up in my text file)
after I modify a particular line.  I checked the imploded string with
var_dump and don't see any line breaks besides the ones that separate
each line.  Anyone have any ideas as to why I'm getting an extra line
break?  The function is below with the code that calls it below that.

Jason

// Rewrite data file from array of file lines
function rewrite_file($lines) {
$filecontents = implode(\n, $lines);
$fh = fopen(data.txt, w) or die(Could not open file.);
flock($fh, LOCK_EX);
if (fwrite($fh, $filecontents) == -1) {
die(File could not be written to.);
}
ftruncate($fh, ftell($fh)) or die(Error.);
flock($fh, LOCK_UN);
fclose($fh) or die(Error.);
}

-###-

$uid = $_POST['id'];
$title = stripslashes(strip_tags(trim($_POST['title'])));
$name = array_search($username, $full_name);
$email = array_search($username, $user_email);
$date = $_POST['date'];
$category = $_POST['category'];
$article = stripslashes(trim($_POST['article']));

$data_array = array($uid, $title, $name, $email, $date, $category,
$article);
$data_line = implode($separator, $data_array).\n;

$filelines = return_lines(); // Reads file and returns array of it's
lines.
for ($i = 0; $i = count($filelines); $i++) {   // loop through array in
order
  if (strstr($filelines[$i], $uid) != FALSE) {
$data_pos = array_search($filelines[$i], $filelines);
array_splice($filelines, $data_pos, 1, $data_line);
  }
}
rewrite_file($filelines);


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



Re: [PHP] Writing to file with function

2003-07-12 Thread Jason Giangrande
Never mind everyone, I figured it out.  In this line:

$data_line = implode($separator, $data_array).\n;

I was adding a newline when I didn't need too.

Jason

On Sat, 2003-07-12 at 17:03, Jason Giangrande wrote:
 I have written this function to rewrite the contents of a text file
 after it's been updated.  I store lines of data in an array and then
 implode them into one string.  The problem is that I'm getting an extra
 line break (in other words a blank line is showing up in my text file)
 after I modify a particular line.  I checked the imploded string with
 var_dump and don't see any line breaks besides the ones that separate
 each line.  Anyone have any ideas as to why I'm getting an extra line
 break?  The function is below with the code that calls it below that.
 
 Jason
 
 // Rewrite data file from array of file lines
 function rewrite_file($lines) {
   $filecontents = implode(\n, $lines);
   $fh = fopen(data.txt, w) or die(Could not open file.);
   flock($fh, LOCK_EX);
   if (fwrite($fh, $filecontents) == -1) {
   die(File could not be written to.);
   }
   ftruncate($fh, ftell($fh)) or die(Error.);
   flock($fh, LOCK_UN);
   fclose($fh) or die(Error.);
 }
 
 -###-
 
 $uid = $_POST['id'];
 $title = stripslashes(strip_tags(trim($_POST['title'])));
 $name = array_search($username, $full_name);
 $email = array_search($username, $user_email);
 $date = $_POST['date'];
 $category = $_POST['category'];
 $article = stripslashes(trim($_POST['article']));
 
 $data_array = array($uid, $title, $name, $email, $date, $category,
 $article);
 $data_line = implode($separator, $data_array).\n;
 
 $filelines = return_lines(); // Reads file and returns array of it's
 lines.
 for ($i = 0; $i = count($filelines); $i++) { // loop through array in
 order
   if (strstr($filelines[$i], $uid) != FALSE) {
 $data_pos = array_search($filelines[$i], $filelines);
 array_splice($filelines, $data_pos, 1, $data_line);
   }
 }
 rewrite_file($filelines);
 


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



[PHP] writing to file count multiple impression..

2003-03-16 Thread WebDev
Hello all

A frind of mine likes to count the impressions on each of his photgraphy online
and as well he likes to display this number under each image

he dosn't wish to use for each image a new request to the different count script 
..all should be counted with one script and saved in one datafile 

//   Code start 

//  Image ID
$ImageNr=$HTTP_GET_VARS['n'];
if(!$ImageNr){$ImageNr=0;}

// Full sys path to count.txt 
$counter_file = count2.txt; 
 
// Puts the file lines into $counter_file_line array 
$counter_file_line = file($counter_file); 
 
// adds one to the number in the [0] array or the very first line 
$counter_file_line[0]++; 
 
//  I use a+ well I need each line representing an induvitual image ? ??
// opends the file and then writes the new number and then closes it 
$cf = fopen($counter_file, a+); 
fputs($cf, $counter_file_line[0]);   
fclose($cf); 
 
// prints out the full count 

// ??
echo  Views $counter_file_line[0] ; 

//  Code end


[PHP] writing uploaded file to another drive on another network?

2002-12-17 Thread Kenn Murrah
admitting in advance that this may be a REALLY stupid question ..

i've created a page for uploading files using PHP, and it works fine ... is
it possible to write that uploaded file to another drive, on another
network?

for instance, my PHP pages are currently being hosted offsite ... would it
be possible to direct the uploaded pages to a box that's located at the
office? something like 192.168.100.41/home/mydirectory ???

thanks, and feel free to laugh at my question :-)




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




Re: [PHP] writing uploaded file to another drive on another network?

2002-12-17 Thread Jason Wong
On Tuesday 17 December 2002 22:55, Kenn Murrah wrote:
 admitting in advance that this may be a REALLY stupid question ..

 i've created a page for uploading files using PHP, and it works fine ... is
 it possible to write that uploaded file to another drive, on another
 network?

 for instance, my PHP pages are currently being hosted offsite ... would it
 be possible to direct the uploaded pages to a box that's located at the
 office? something like 192.168.100.41/home/mydirectory ???

You can use php's ftp functions to transfer the files over to another machine. 

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *

/*
appears to be a Slow/Narrow SCSI-0 Interface problem
*/


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




[PHP] Writing to file with user as owner

2001-08-28 Thread Anton Stroganov

Hello

A quick question here: is it possible to have your script write to file with
the user's as owner and not as 'nobody' or 'www' as owner (which is what it
usually does). For example in perl one can use cgiwrap to write to file as
the user to whom the script belongs. Any way of doing this in php? Any
advice will be greatly appreciated.

Anton Stroganov
webmaster
www.artwithin.com


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] writing to file quick and easy.

2001-05-23 Thread Christopher Allen

Hello:

Lookin for a little advice here.

I have a series of scripts that dynamically create web pages. The last page
in the series I wish to be able to write out to a file.
Is there a simple/quick way in which I can take the process(ing) script and
write it to a file at the same time that it is displaying?
I need it to both display and be able to be downloaded such that the last
thing that this script would do is create a link to itself in html format.
Something to the effect that whatever was being passed to the browser could
also be passed thru an open file handle thus written to a file


Thanks,
Christopher C. M. Allen


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] writing to file quick and easy.

2001-05-23 Thread Chris Lee

sure this is not complicated, this is easy :)

?php

 $filename = '/dl/filename.txt';

 echo 
 put some font size='+2'HTML/font in here, anything you put here, will
goto the file too.br
 a href='$filename'Download/a
 ;

 $file = fopen($DOCUMENT_ROOT$filename, 'w+');
 fwrite($file, ob_get_contents());

?

is this what you mean ? please get back to me.

--

  Chris Lee
  [EMAIL PROTECTED]



Christopher Allen [EMAIL PROTECTED] wrote in message
004701c0e3a0$5c17a5a0$[EMAIL PROTECTED]">news:004701c0e3a0$5c17a5a0$[EMAIL PROTECTED]...
 Hello:

 Lookin for a little advice here.

 I have a series of scripts that dynamically create web pages. The last
page
 in the series I wish to be able to write out to a file.
 Is there a simple/quick way in which I can take the process(ing) script
and
 write it to a file at the same time that it is displaying?
 I need it to both display and be able to be downloaded such that the last
 thing that this script would do is create a link to itself in html format.
 Something to the effect that whatever was being passed to the browser
could
 also be passed thru an open file handle thus written to a file


 Thanks,
 Christopher C. M. Allen


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Writing a file with break lines

2001-04-30 Thread Augusto Cesar Castoldi

How can I write a file like list.txt, I get a lot of information from
mysql, and I have to put with line of mysql in this txt file. (rewrite).

How can I do that?

I tried to put \n but it didn't worked.

regards,

Augusto Cesar Castoldi


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Writing a file with break lines

2001-04-30 Thread Steve Werby

Augusto Cesar Castoldi [EMAIL PROTECTED] wrote:
 How can I write a file like list.txt, I get a lot of information from
 mysql, and I have to put with line of mysql in this txt file. (rewrite).

 How can I do that?

 I tried to put \n but it didn't worked.

\n works for me.  Perhaps you should post some of your code.  Be sure \n
is within double quotes; if it's in single quotes it won't work.  Here's a
line of code from a script I wrote that works.

fwrite( $fout, Date: $h_date\n );

--
Steve Werby
President, Befriend Internet Services LLC
http://www.befriend.com/


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] writing to file on server

2001-04-22 Thread chris herring

unless that file you're writing to is on a different server, just put the
relative location to the file. ie: ./guestbook.txt

if this doesn't work I have nothing to offer you. :-\
- Original Message -
From: Joeri Vankelst [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Sunday, April 22, 2001 7:43 AM
Subject: [PHP] writing to file on server


 Hi,

 I've just started working with PHP. I've made a guest book using PHP
 (nothing spectacular) that worked just fine when I tested it op my pc, but
 when I uploaded it, it stopped working.
 My specific problem is that I cannot write to a file that already exists
and
 contains data. When I try to I get these warnings:

 Warning: File already exists
 Warning: fopen(ftp:[EMAIL PROTECTED]/guestbook.txt,a;) - File
 exists

 Is this problem related to the FTP fopen? And is there a way to correct
this
 problem?

 Tnx!
 Joeri Vankelst



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] writing to file on server

2001-04-22 Thread Plutarck

When you are using that on your site, what basically happens is that you are
trying to open an FTP session with yourself. Not too efficient.

So just kill off the url and use the path to your file.


--
Plutarck
Should be working on something...
...but forgot what it was.


""Joeri Vankelst"" [EMAIL PROTECTED] wrote in message
9bujcv$gtm$[EMAIL PROTECTED]">news:9bujcv$gtm$[EMAIL PROTECTED]...
 Hi,

 I've just started working with PHP. I've made a guest book using PHP
 (nothing spectacular) that worked just fine when I tested it op my pc, but
 when I uploaded it, it stopped working.
 My specific problem is that I cannot write to a file that already exists
and
 contains data. When I try to I get these warnings:

 Warning: File already exists
 Warning: fopen("ftp:[EMAIL PROTECTED]/guestbook.txt","a") - File
 exists

 Is this problem related to the FTP fopen? And is there a way to correct
this
 problem?

 Tnx!
 Joeri Vankelst



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] writing to file on server

2001-04-22 Thread Joeri Vankelst

But when I try using the path to the file I get denied permission ...
How can I use my password then? Or can I bypass that in some way?

""Plutarck"" [EMAIL PROTECTED] wrote in message
9bupqt$b8s$[EMAIL PROTECTED]">news:9bupqt$b8s$[EMAIL PROTECTED]...
 When you are using that on your site, what basically happens is that you
are
 trying to open an FTP session with yourself. Not too efficient.

 So just kill off the url and use the path to your file.


 --
 Plutarck
 Should be working on something...
 ...but forgot what it was.


 ""Joeri Vankelst"" [EMAIL PROTECTED] wrote in message
 9bujcv$gtm$[EMAIL PROTECTED]">news:9bujcv$gtm$[EMAIL PROTECTED]...
  Hi,
 
  I've just started working with PHP. I've made a guest book using PHP
  (nothing spectacular) that worked just fine when I tested it op my pc,
but
  when I uploaded it, it stopped working.
  My specific problem is that I cannot write to a file that already exists
 and
  contains data. When I try to I get these warnings:
 
  Warning: File already exists
  Warning: fopen("ftp:[EMAIL PROTECTED]/guestbook.txt","a") - File
  exists
 
  Is this problem related to the FTP fopen? And is there a way to correct
 this
  problem?
 
  Tnx!
  Joeri Vankelst
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail: [EMAIL PROTECTED]
 



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] writing to file on server

2001-04-22 Thread Felix Kronlage

On Sun, Apr 22, 2001 at 03:06:04PM -0700, Adam wrote:

 chmod the file to 777, this will allow anyone write permission to the file
 and thus you will be able to append to the file

file-mode 777 is ugo=rwx. You want 'chmod 666', which is ugo=rw.

read is 4
write is 2
execute is 1

If you want rw on the file, it's 6 not 7.

-fkr
-- 
gpg-fingerprint: 076E 1E87 3E05 1C7F B1A0  8A48 0D31 9BD3 D9AC 74D0 
  |http://www.hazardous.org/ | whois -h whois.ripe.de FKR-RIPE  |
  |all your base are belong to us  |  shame on me  | fkr@IRCnet | 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]