Re: [PHP] writing Excel files through PHP
You know, I've been struggling with this probelm fr ages, and wouldn't you know it, I really over complicated things.. using this simple header method, I've done it... Cheers for the heads up... It pays to read eh? ;-) Tris.. Marek Kilimajer [EMAIL PROTECTED] 10/01/2004 13:22 To Binay [EMAIL PROTECTED] cc [EMAIL PROTECTED] Subject Re: [PHP] writing Excel files through PHP Use full uri. But the user needs to be online while viewing the xls file. Other option is to create web archive. It's a mime encoded file, save an excel file with an embeded image and you will see what it is. Binay wrote: Hi all, I m generating an Excel file though PHP by sending the appropriate header and then using HTML TD tags to write data in different cells. Below is my code snippet. It has got 1 problems: 1. Image doesn't come/showup in Excel sheet. ?php header(Content-type: application/vnd.ms-excel); header(Content-disposition: attachment; filename=pareto_combined.xls); ? tr colspan=8 td height=50 img src='../../../extra/images/log.jpg'/td td align=rightimg src='../../../extra/images/mickey_sup.jpg'/td /tr ?php $dateF=$_REQUEST['dateF']; $dateT=$_REQUEST['dateT']; $agentID=$_REQUEST['agentID']; tr td class='graybg'?php echo $agentID/td td class='graybg'?php echo $dateF/td td class='graybg'?php echo $dateT/td /tr ? now after saving the Excel file it displays all alphanumeric data correctly but images do not show up. i think Img tag is not supported by Excel application. So my question is how can i display the images in Excel using PHP? plz help me out Thanks in advance Binay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php * The information contained in this e-mail message is intended only for the personal and confidential use of the recipient(s) named above. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this document in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message. ***
Re: [PHP] writing Excel files through PHP
Binay wrote: + How to create web archvie which will be mime encoded file and then saving as excel file .. plz direct me to the resources where i can find more information about it .. or tell me how can i proceed to it. Thanks + Web archive is a simple textfile (zipped if I remember well) very similar to multipart emails. To see how it looks save a spreadsheet in web archive format, give the file zip extension and unzip it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] writing Excel files through PHP
Hi Marek, Thanks for replying ..I have got few questions based on ur suggestions.. plz find it embedded in your reply. Thanks Binay - Original Message - From: Marek Kilimajer [EMAIL PROTECTED] To: Binay [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Saturday, January 10, 2004 6:52 PM Subject: Re: [PHP] writing Excel files through PHP Use full uri. But the user needs to be online while viewing the xls file. Other option is to create web archive. It's a mime encoded file, save an excel file with an embeded image and you will see what it is. + How to create web archvie which will be mime encoded file and then saving as excel file .. plz direct me to the resources where i can find more information about it .. or tell me how can i proceed to it. Thanks + Binay wrote: Hi all, I m generating an Excel file though PHP by sending the appropriate header and then using HTML TD tags to write data in different cells. Below is my code snippet. It has got 1 problems: 1. Image doesn't come/showup in Excel sheet. ?php header(Content-type: application/vnd.ms-excel); header(Content-disposition: attachment; filename=pareto_combined.xls); ? tr colspan=8 td height=50 img src='../../../extra/images/log.jpg'/td td align=rightimg src='../../../extra/images/mickey_sup.jpg'/td /tr ?php $dateF=$_REQUEST['dateF']; $dateT=$_REQUEST['dateT']; $agentID=$_REQUEST['agentID']; tr td class='graybg'?php echo $agentID/td td class='graybg'?php echo $dateF/td td class='graybg'?php echo $dateT/td /tr ? now after saving the Excel file it displays all alphanumeric data correctly but images do not show up. i think Img tag is not supported by Excel application. So my question is how can i display the images in Excel using PHP? plz help me out Thanks in advance Binay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] writing Excel files through PHP
Hi all, I m generating an Excel file though PHP by sending the appropriate header and then using HTML TD tags to write data in different cells. Below is my code snippet. It has got 1 problems: 1. Image doesn't come/showup in Excel sheet. ?php header(Content-type: application/vnd.ms-excel); header(Content-disposition: attachment; filename=pareto_combined.xls); ? tr colspan=8 td height=50 img src='../../../extra/images/log.jpg'/td td align=rightimg src='../../../extra/images/mickey_sup.jpg'/td /tr ?php $dateF=$_REQUEST['dateF']; $dateT=$_REQUEST['dateT']; $agentID=$_REQUEST['agentID']; tr td class='graybg'?php echo $agentID/td td class='graybg'?php echo $dateF/td td class='graybg'?php echo $dateT/td /tr ? now after saving the Excel file it displays all alphanumeric data correctly but images do not show up. i think Img tag is not supported by Excel application. So my question is how can i display the images in Excel using PHP? plz help me out Thanks in advance Binay
Re: [PHP] writing Excel files through PHP
Use full uri. But the user needs to be online while viewing the xls file. Other option is to create web archive. It's a mime encoded file, save an excel file with an embeded image and you will see what it is. Binay wrote: Hi all, I m generating an Excel file though PHP by sending the appropriate header and then using HTML TD tags to write data in different cells. Below is my code snippet. It has got 1 problems: 1. Image doesn't come/showup in Excel sheet. ?php header(Content-type: application/vnd.ms-excel); header(Content-disposition: attachment; filename=pareto_combined.xls); ? tr colspan=8 td height=50 img src='../../../extra/images/log.jpg'/td td align=rightimg src='../../../extra/images/mickey_sup.jpg'/td /tr ?php $dateF=$_REQUEST['dateF']; $dateT=$_REQUEST['dateT']; $agentID=$_REQUEST['agentID']; tr td class='graybg'?php echo $agentID/td td class='graybg'?php echo $dateF/td td class='graybg'?php echo $dateT/td /tr ? now after saving the Excel file it displays all alphanumeric data correctly but images do not show up. i think Img tag is not supported by Excel application. So my question is how can i display the images in Excel using PHP? plz help me out Thanks in advance Binay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Writing to files
Is there a way to write to a beginning of a file without it overwriting data that's already there or do I have to write to the end of the file in order to preserve data? I ask because it would be much easier to print the lines of the file out in order of last added first if I could add lines at the top of the file. Thanks, Jason Giangrande -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Writing to files
Hello, This is a reply to an e-mail that you wrote on Fri, 11 Jul 2003 at 19:56, lines prefixed by '' were originally written by you. Is there a way to write to a beginning of a file without it overwriting data that's already there or do I have to write to the end of the file in order to preserve data? I ask because it would be much easier to print the lines of the file out in order of last added first if I could add lines at the top of the file. Not without reading the entire file into a variable first then appending that variable to the data you wish to add and saving the entire file again (which will obviously take longer than appending to the end of the file). David. -- phpmachine :: The quick and easy to use service providing you with professionally developed PHP scripts :: http://www.phpmachine.com/ Professional Web Development by David Nicholson http://www.djnicholson.com/ QuizSender.com - How well do your friends actually know you? http://www.quizsender.com/ (developed entirely in PHP) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Writing to files
Any ideas on how I can print the lines of my file in reverse order, then? Does fgets() always process from the beginning of the file even if you open the file with the pointer at the end? I tried to get the line count of the file and go through each line of the file backwards but that doesn't seem to work, so either it's impossible or I'm going about it the wrong way. Here's the code: $fh = fopen(data.txt, a+) or die(Could not open file); $line_num = 0; while (! feof($fh)) { if ($line = fgets($fh, 1048576)) { $line_num++; } } while ($line_num != 0)) { if ($line = fgets($fh, 1048576)) { print $line; $line_num--; } } Thanks, Jason On Fri, 2003-07-11 at 15:04, David Nicholson wrote: Hello, This is a reply to an e-mail that you wrote on Fri, 11 Jul 2003 at 19:56, lines prefixed by '' were originally written by you. Is there a way to write to a beginning of a file without it overwriting data that's already there or do I have to write to the end of the file in order to preserve data? I ask because it would be much easier to print the lines of the file out in order of last added first if I could add lines at the top of the file. Not without reading the entire file into a variable first then appending that variable to the data you wish to add and saving the entire file again (which will obviously take longer than appending to the end of the file). David. -- phpmachine :: The quick and easy to use service providing you with professionally developed PHP scripts :: http://www.phpmachine.com/ Professional Web Development by David Nicholson http://www.djnicholson.com/ QuizSender.com - How well do your friends actually know you? http://www.quizsender.com/ (developed entirely in PHP) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Writing to files
Any ideas on how I can print the lines of my file in reverse order, then? Does fgets() always process from the beginning of the file even if you open the file with the pointer at the end? I tried to get the line count of the file and go through each line of the file backwards but that doesn't seem to work, so either it's impossible or I'm going about it the wrong way. Here's the code: $fh = fopen(data.txt, a+) or die(Could not open file); $line_num = 0; while (! feof($fh)) { if ($line = fgets($fh, 1048576)) { $line_num++; } } while ($line_num != 0)) { if ($line = fgets($fh, 1048576)) { print $line; $line_num--; } } $file = file('data.txt'); $rev_file = array_reverse($file); foreach($rev_file as $line) { echo $line; } ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Writing to files
You could try using the file() function. Then loop backward through the array or use array_reverse. -- Rob Jason Giangrande [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Any ideas on how I can print the lines of my file in reverse order, then? Does fgets() always process from the beginning of the file even if you open the file with the pointer at the end? I tried to get the line count of the file and go through each line of the file backwards but that doesn't seem to work, so either it's impossible or I'm going about it the wrong way. Here's the code: $fh = fopen(data.txt, a+) or die(Could not open file); $line_num = 0; while (! feof($fh)) { if ($line = fgets($fh, 1048576)) { $line_num++; } } while ($line_num != 0)) { if ($line = fgets($fh, 1048576)) { print $line; $line_num--; } } Thanks, Jason On Fri, 2003-07-11 at 15:04, David Nicholson wrote: Hello, This is a reply to an e-mail that you wrote on Fri, 11 Jul 2003 at 19:56, lines prefixed by '' were originally written by you. Is there a way to write to a beginning of a file without it overwriting data that's already there or do I have to write to the end of the file in order to preserve data? I ask because it would be much easier to print the lines of the file out in order of last added first if I could add lines at the top of the file. Not without reading the entire file into a variable first then appending that variable to the data you wish to add and saving the entire file again (which will obviously take longer than appending to the end of the file). David. -- phpmachine :: The quick and easy to use service providing you with professionally developed PHP scripts :: http://www.phpmachine.com/ Professional Web Development by David Nicholson http://www.djnicholson.com/ QuizSender.com - How well do your friends actually know you? http://www.quizsender.com/ (developed entirely in PHP) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Writing to files
Hello, This is a reply to an e-mail that you wrote on Fri, 11 Jul 2003 at 20:37, lines prefixed by '' were originally written by you. Any ideas on how I can print the lines of my file in reverse order, then? How about... $fp = fopen(yourfile.txt,r); $filecontents = ; while(!feof($fp)){ $filecontents.=fgets($fp,1024); // read entire file into $filecontents } $filelines = split(\n,$filecontents); // split file into individual lines for($i=(count($filelines)-1);$i=0;$i--){ // loop through array in reverse order echo $filelines[$i] . \n; } -- phpmachine :: The quick and easy to use service providing you with professionally developed PHP scripts :: http://www.phpmachine.com/ Professional Web Development by David Nicholson http://www.djnicholson.com/ QuizSender.com - How well do your friends actually know you? http://www.quizsender.com/ (developed entirely in PHP) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Writing to files
Thanks for the help guys. Jason On Fri, 2003-07-11 at 15:43, David Nicholson wrote: Hello, This is a reply to an e-mail that you wrote on Fri, 11 Jul 2003 at 20:37, lines prefixed by '' were originally written by you. Any ideas on how I can print the lines of my file in reverse order, then? How about... $fp = fopen(yourfile.txt,r); $filecontents = ; while(!feof($fp)){ $filecontents.=fgets($fp,1024); // read entire file into $filecontents } $filelines = split(\n,$filecontents); // split file into individual lines for($i=(count($filelines)-1);$i=0;$i--){ // loop through array in reverse order echo $filelines[$i] . \n; } -- phpmachine :: The quick and easy to use service providing you with professionally developed PHP scripts :: http://www.phpmachine.com/ Professional Web Development by David Nicholson http://www.djnicholson.com/ QuizSender.com - How well do your friends actually know you? http://www.quizsender.com/ (developed entirely in PHP) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Writing text files in Windows 2k
Hi All, I need to write some data to a text file but when I use $this-ao_file_handle = fopen($this-ao_file_name,ab); $str_txt.= \n; fwrite($this-ao_file_handle,$str_txt); It does not display the new line. I saw somwhere that for DOS files you need to use ASCII LF and CR. Which I did. It still does not display the new line. Thanks in advance Joe Njeru -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Writing text files in Windows 2k
I need to write some data to a text file but when I use $this-ao_file_handle = fopen($this-ao_file_name,ab); $str_txt.= \n; fwrite($this-ao_file_handle,$str_txt); It does not display the new line. I saw somwhere that for DOS files you need to use ASCII LF and CR. Which I did. It still does not display the new line. LF CR = \r\n What did you view the file with? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Writing text files in Windows 2k
Thanks for the tip I want to export a report to excell and a legacy system that allow csv file import for incorporation into the financial system. Joe Njeru Nairobi, Kenya. Where else can you flyfish for trout on the Equator! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Writing text files in Windows 2k
Precisely where did you get the b in your second parameter to fopen? I didn't see it on the fopen manual page at: http://www.php.net/fopen If you just want to write to the file and not read it, try changing the second parameter to just w. On Mon, 2003-02-10 at 03:34, Joe Njeru wrote: Hi All, I need to write some data to a text file but when I use $this-ao_file_handle = fopen($this-ao_file_name,ab); $str_txt.= \n; fwrite($this-ao_file_handle,$str_txt); It does not display the new line. I saw somwhere that for DOS files you need to use ASCII LF and CR. Which I did. It still does not display the new line. Thanks in advance Joe Njeru -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Adam Voigt ([EMAIL PROTECTED]) The Cryptocomm Group My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc signature.asc Description: This is a digitally signed message part
Re: [PHP] Writing text files in Windows 2k
Doh, doh, doh! Just saw b was allowed for binary on the fopen page. Never mind. On Mon, 2003-02-10 at 09:13, Adam Voigt wrote: Precisely where did you get the b in your second parameter to fopen? I didn't see it on the fopen manual page at: http://www.php.net/fopen If you just want to write to the file and not read it, try changing the second parameter to just w. On Mon, 2003-02-10 at 03:34, Joe Njeru wrote: Hi All, I need to write some data to a text file but when I use $this-ao_file_handle = fopen($this-ao_file_name,ab); $str_txt.= \n; fwrite($this-ao_file_handle,$str_txt); It does not display the new line. I saw somwhere that for DOS files you need to use ASCII LF and CR. Which I did. It still does not display the new line. Thanks in advance Joe Njeru -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Adam Voigt ([EMAIL PROTECTED]) The Cryptocomm Group My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc -- Adam Voigt ([EMAIL PROTECTED]) The Cryptocomm Group My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc signature.asc Description: This is a digitally signed message part
RE: [PHP] Writing text files in Windows 2k
-Original Message- From: Adam Voigt [mailto:[EMAIL PROTECTED]] Sent: 10 February 2003 14:13 Precisely where did you get the b in your second parameter to fopen? I didn't see it on the fopen manual page at: http://www.php.net/fopen http://www.php.net/fopen Er -- quoting from that very page: Note: The mode may contain the letter 'b'. This is useful only on systems which differentiate between binary and text files (i.e. Windows. It's useless on Unix). If not needed, this will be ignored. You are encouraged to include the 'b' flag in order to make your scripts more portable Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Writing text files in Windows 2k
Hi All The following is the text file generated. I'm runing on Windows 2k spack 3, When I open it in Excell it gives me the data but not seperated into lines. Do you have any suggestions. Joe Njeru, Nairobi, Kenya. begin 666 veh_fuel_iss_hist_rpt.csv M,C P,BTQ,2TP,CM!,C R,3DV.U!%5%)/3 M(%-54$52.S(Y.S$U-S[.#Q M-CD[34%.1U5253M'14]21T4-C(P,#(M,3$M,#([03(P,C$Y-CM015123TP@ M+2!355!%4CLR.3LQ-3W.S@W,38Y.TU!3D=54E4[1T5/4D=%,C P,BTQ,2TQ M,3M!,C R.#W.U!%5%)/3 M(%-54$52.S,Q.S$W-C0[.#T-3 [3U5-03M M3T]+15(-C(P,#(M,3$M,#([03(P,C$Y-CM015123TP@+2!355!%4CLR.3LQ M-3W.S@W,38Y.TU!3D=54E4[1T5/4D=%,C P,BTQ,2TQ,3M!,C R.#W.U!% M5%)/3 M(%-54$52.S,Q.S$W-C0[.#T-3 [3U5-03M3T]+15(R,# R+3$Q M+3$W.T$R,#,S-#D[4$544D],(T@4U5015([,S,[,3@T-SLX-SY.3M/54U! M.T)/3TM%4@T*,C P,BTQ,2TP,CM!,C R,3DV.U!%5%)/3 M(%-54$52.S(Y M.S$U-S[.#Q-CD[34%.1U5253M'14]21T4R,# R+3$Q+3$Q.T$R,#(X-S[ M4$544D],(T@4U5015([,S$[,3V-#LX-S0U,#M/54U!.T)/3TM%4C(P,#(M M,3$M,3[03(P,S,T.3M015123TP@+2!355!%4CLS,SLQ.#[EMAIL PROTECTED]]5 M34$[0D]/2T52,C P,BTQ,2TQ.3M!,C S-34Q.U!%5%)/3 M(%-54$52.S,Q M.S$W,C8[.#@Q,#4[3U5-03M3T]+15(-C(P,#(M,3$M,#([03(P,C$Y-CM0 M15123TP@+2!355!%4CLR.3LQ-3W.S@W,38Y.TU!3D=54E4[1T5/4D=%,C P M,BTQ,2TQ,3M!,C R.#W.U!%5%)/3 M(%-54$52.S,Q.S$W-C0[.#T-3 [ M3U5-03M3T]+15(R,# R+3$Q+3$W.T$R,#,S-#D[4$544D],(T@4U5015([ M,S,[,3@T-SLX-SY.3M/54U!.T)/3TM%4C(P,#(M,3$M,3D[03(P,S4U,3M0 M15123TP@+2!355!%4CLS,3LQ-S(V.S@X,3 U.T]534$[0D]/2T52,C P,BTQ M,BTP-SM!,C U,#$T.U!%5%)/3 M(%-54$52.S,S.S$X-SD[.#@V.#$[34%. M1U5253M'14]21T4-C(P,#(M,3$M,#([03(P,C$Y-CM015123TP@+2!355!% M4CLR.3LQ-3W.S@W,38Y.TU!3D=54E4[1T5/4D=%,C P,BTQ,2TQ,3M!,C R M.#W.U!%5%)/3 M(%-54$52.S,Q.S$W-C0[.#T-3 [3U5-03M3T]+15(R M,# R+3$Q+3$W.T$R,#,S-#D[4$544D],(T@4U5015([,S,[,3@T-SLX-SY M.3M/54U!.T)/3TM%4C(P,#(M,3$M,3D[03(P,S4U,3M015123TP@+2!355!% M4CLS,3LQ-S(V.S@X,3 U.T]534$[0D]/2T52,C P,BTQ,BTP-SM!,C U,#$T M.U!%5%)/3 M(%-54$52.S,S.S$X-SD[.#@V.#$[34%.1U5253M'14]21T4R M,# R+3$R+3$V.T$R,#4V.3 [4$544D],(T@4U5015([,S([,3W,SLX.#DV M-CM/54U!.T)/3TM%4@T*,C P,BTQ,2TP,CM!,C R,3DV.U!%5%)/3 M(%-5 M4$52.S(Y.S$U-S[.#Q-CD[34%.1U5253M'14]21T4R,# R+3$Q+3$Q.T$R M,#(X-S[4$544D],(T@4U5015([,S$[,3V-#LX-S0U,#M/54U!.T)/3TM% M4C(P,#(M,3$M,3[03(P,S,T.3M015123TP@+2!355!%4CLS,SLQ.#0W.S@W M-SDY.T]534$[0D]/2T52,C P,BTQ,2TQ.3M!,C S-34Q.U!%5%)/3 M(%-5 M4$52.S,Q.S$W,C8[.#@Q,#4[3U5-03M3T]+15(R,# R+3$R+3 W.T$R,#4P M,30[4$544D],(T@4U5015([,S,[,[EMAIL PROTECTED]#8X,3M-04Y'55)5.T=%3U)' M13(P,#(M,3(M,38[03(P-38Y,#M015123TP@+2!355!%4CLS,CLQ-SS.S@X M.38V.T]534$[0D]/2T52,C P,BTQ,BTR-SM!,C V-#X.U!%5%)/3 M(%-5 M4$52.S,T.S$Y-S,[.#DV,#8[34%.1U5253M'14]21T4-C(P,#(M,3$M,#([ M03(P,C$Y-CM015123TP@+2!355!%4CLR.3LQ-3W.S@W,38Y.TU!3D=54E4[ M1T5/4D=%,C P,BTQ,2TQ,3M!,C R.#W.U!%5%)/3 M(%-54$52.S,Q.S$W M-C0[.#T-3 [3U5-03M3T]+15(R,# R+3$Q+3$W.T$R,#,S-#D[4$544D], M(T@4U5015([,S,[,3@T-SLX-SY.3M/54U!.T)/3TM%4C(P,#(M,3$M,3D[ M03(P,S4U,3M015123TP@+2!355!%4CLS,3LQ-S(V.S@X,3 U.T]534$[0D]/ M2T52,C P,BTQ,BTP-SM!,C U,#$T.U!%5%)/3 M(%-54$52.S,S.S$X-SD[ M.#@V.#$[34%.1U5253M'14]21T4R,# R+3$R+3$V.T$R,#4V.3 [4$544D], M(T@4U5015([,S([,3W,SLX.#DV-CM/54U!.T)/3TM%4C(P,#(M,3(M,C[ M03(P-C0W.#M015123TP@+2!355!%4CLS-#LQ.3S.S@Y-C V.TU!3D=54E4[ M1T5/4D=%,C P,BTQ,BTS,#M!,C V-34S.U!%5%)/3 M(%-54$52.S,P.S$W M-3D[.#DY,C,[3U5-03M3T]+15(-C(P,#(M,3$M,#([03(P,C$Y-CM01512 M3TP@+2!355!%4CLR.3LQ-3W.S@W,38Y.TU!3D=54E4[1T5/4D=%,C P,BTQ M,2TQ,3M!,C R.#W.U!%5%)/3 M(%-54$52.S,Q.S$W-C0[.#T-3 [3U5- M03M3T]+15(R,# R+3$Q+3$W.T$R,#,S-#D[4$544D],(T@4U5015([,S,[ M,3@T-SLX-SY.3M/54U!.T)/3TM%4C(P,#(M,3$M,3D[03(P,S4U,3M01512 M3TP@+2!355!%4CLS,3LQ-S(V.S@X,3 U.T]534$[0D]/2T52,C P,BTQ,BTP M-SM!,C U,#$T.U!%5%)/3 M(%-54$52.S,S.S$X-SD[.#@V.#$[34%.1U52 M53M'14]21T4R,# R+3$R+3$V.T$R,#4V.3 [4$544D],(T@4U5015([,S([ M,3W,SLX.#DV-CM/54U!.T)/3TM%4C(P,#(M,3(M,C[03(P-C0W.#M01512 M3TP@+2!355!%4CLS-#LQ.3S.S@Y-C V.TU!3D=54E4[1T5/4D=%,C P,BTQ M,BTS,#M!,C V-34S.U!%5%)/3 M(%-54$52.S,P.S$W-3D[.#DY,C,[3U5- M03M3T]+15(R,# S+3 Q+3 U.T$R,#8X,C@[4$544D],(T@4U5015([,C4[ M,30V-3LY,#$X,#M-04Y'55)5.T=%3U)'10T*,C P,BTQ,2TP,CM!,C R,3DV M.U!%5%)/3 M(%-54$52.S(Y.S$U-S[.#Q-CD[34%.1U5253M'14]21T4R M,# R+3$Q+3$Q.T$R,#(X-S[4$544D],(T@4U5015([,S$[,3V-#LX-S0U M,#M/54U!.T)/3TM%4C(P,#(M,3$M,3[03(P,S,T.3M015123TP@+2!355!% M4CLS,SLQ.#[EMAIL PROTECTED]]534$[0D]/2T52,C P,BTQ,2TQ.3M!,C S-34Q M.U!%5%)/3 M(%-54$52.S,Q.S$W,C8[.#@Q,#4[3U5-03M3T]+15(R,# R M+3$R+3 W.T$R,#4P,30[4$544D],(T@4U5015([,S,[,[EMAIL PROTECTED]#8X,3M- M04Y'55)5.T=%3U)'13(P,#(M,3(M,38[03(P-38Y,#M015123TP@+2!355!% M4CLS,CLQ-S[EMAIL PROTECTED]]534$[0D]/2T52,C P,BTQ,BTR-SM!,C V-#X M.U!%5%)/3 M(%-54$52.S,T.S$Y-S,[.#DV,#8[34%.1U5253M'14]21T4R M,# R+3$R+3,P.T$R,#8U-3,[4$544D],(T@4U5015([,S [,3U.3LX.3DR M,SM/54U!.T)/3TM%4C(P,#,M,#$M,#4[03(P-C@R.#M015123TP@+2!355!% M4CLR-3LQ-#8U.SDP,[EMAIL PROTECTED]!3D=54E4[1T5/4D=%,C P,RTP,2TQ,CM!,C W M-# X.U!%5%)/3 M(%-54$52.S,R.S$Y-C,[.3 T.#([34%.1U5253M'14]2 M1T4-C(P,#(M,3$M,#([03(P,C$Y-CM015123TP@+2!355!%4CLR.3LQ-3W M.S@W,38Y.TU!3D=54E4[1T5/4D=%,C P,BTQ,2TQ,3M!,C R.#W.U!%5%)/ M3 M(%-54$52.S,Q.S$W-C0[.#T-3 [3U5-03M3T]+15(R,# R+3$Q+3$W
Re: [PHP] Writing text files in Windows 2k
Joe Njeru wrote: Hi All The following is the text file generated. I'm runing on Windows 2k spack 3, When I open it in Excell it gives me the data but not seperated into lines. Do you have any suggestions. It does for me in Excle 97 SP2, but I suspect there should be more lines than there are (I get 13 lines). Some lines look as though they should be split up. Assuming each line should begin with a date, then they are not on separate lines because there is no end-of-line there. HTH Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Writing text files in Windows 2k
Yes, I'm aware of that, if you would have read my reply 10 seconds after I sent the first one, I corrected myself. On Mon, 2003-02-10 at 09:25, Ford, Mike [LSS] wrote: -Original Message- From: Adam Voigt [mailto:[EMAIL PROTECTED]] Sent: 10 February 2003 14:13 Precisely where did you get the b in your second parameter to fopen? I didn't see it on the fopen manual page at: http://www.php.net/fopen http://www.php.net/fopen Er -- quoting from that very page: Note: The mode may contain the letter 'b'. This is useful only on systems which differentiate between binary and text files (i.e. Windows. It's useless on Unix). If not needed, this will be ignored. You are encouraged to include the 'b' flag in order to make your scripts more portable Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- Adam Voigt ([EMAIL PROTECTED]) The Cryptocomm Group My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc signature.asc Description: This is a digitally signed message part
[PHP] writing pdf files to physical files...
I presently generate pdf files as required... I use FPDF for writing PDF... I require to save these to file... is it a simple case of: where the script: generate_stats_view_table_pdf.php generates the PDF... ? $fcontents= file ('http://www.domain.com/autoreport/generate_stats_view_table_pdf.php'); while (list ($line_num, $line) = each ($fcontents)) { $display .= $line; } $fp=fopen(/usr/local/psa/home/vhosts/domain.com/httpdocs/admin/hourly/stats _detailed.pdf,w); fputs($fp,$display); fclose($fp); ? TIA... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] writing to files
Looks like you're using fopen() incorrectly. Try: fopen($file_name,r+); How about just fopen($file_name, r+); instead. No need for the surrounding s. -- JR -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Writing to Files
Hey All, I have recently been trying to create some logs for the install script I have been making (to make it easier for me to diagnose problems) but I am wondering how to create and write to text files. I know about the fopen() and fwrite() functions, which theoretically should enable me to do this however I am not exactly sure how I should go about this. Also, I realize that there is limited formatting I can have with text, however I would like to know if its possible to control the line spacing between the entries, and whether or not its possible to indent lines. Lastly, are text files a good idea for logs? Do any of you use anything else I should be aware of? Thanks for all your help! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Writing to Files
http://www.php.net/manual/en/function.printf.php try sprintf to format the string and then fwrite I use text files to log debug msgs in my programs as they are not too heavy duty applications. - Original Message - From: Sebastian A. [EMAIL PROTECTED] To: PHP General List (PHP.NET) [EMAIL PROTECTED] Sent: Friday, April 05, 2002 11:29 AM Subject: [PHP] Writing to Files Hey All, I have recently been trying to create some logs for the install script I have been making (to make it easier for me to diagnose problems) but I am wondering how to create and write to text files. I know about the fopen() and fwrite() functions, which theoretically should enable me to do this however I am not exactly sure how I should go about this. Also, I realize that there is limited formatting I can have with text, however I would like to know if its possible to control the line spacing between the entries, and whether or not its possible to indent lines. Lastly, are text files a good idea for logs? Do any of you use anything else I should be aware of? Thanks for all your help! -- 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 to Files
try creating a script with fopen(), fwrite(), etc. When you run into problems, ask here. $filex = fopen(myfile,w); fwrite( $filex, write this here); fclose($filex); -Original Message- From: Sebastian A. [mailto:[EMAIL PROTECTED]] Sent: Friday, April 05, 2002 10:29 AM To: PHP General List (PHP.NET) Subject: [PHP] Writing to Files Hey All, I have recently been trying to create some logs for the install script I have been making (to make it easier for me to diagnose problems) but I am wondering how to create and write to text files. I know about the fopen() and fwrite() functions, which theoretically should enable me to do this however I am not exactly sure how I should go about this. Also, I realize that there is limited formatting I can have with text, however I would like to know if its possible to control the line spacing between the entries, and whether or not its possible to indent lines. Lastly, are text files a good idea for logs? Do any of you use anything else I should be aware of? Thanks for all your help! -- 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 to files
There is no need to use cookies, sessions, write to a file or somethings like that... just pass the vars from a page to another through hidden fields in the next page form. Eg. input type=hidden name=myHiddenVar value=?= $myHiddenVar ? William El mié, 27-02-2002 a las 02:18, Chris Kay escribió: Question I have is, Anyway know of a better way to store temp information? I have a problem that a script I use, uses many pages and after each page the information from the form Is stored and the next page is shown ect It uses more than 20 variables so I can not store the data in cookies. I could store the data in a temp file created but problem is that the webserver would need to create The file which is a security risk (I would like to find another way other than this). I don't really want to use sessions but if it's the last resort I guess I will have to. Other than the above any one have a better soluition? Running php 4.1.1 on RH7.2 --- Chris Kay, Eleet Internet Services [EMAIL PROTECTED] --- _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Writing to files
I know I can do this with sessions, reason I am asking is webserver should not be able to create file (for security reasons), I would of maybe thought php could create a file as a different user. php is not always used by the box owner. I find it strange that such a option Is only available if you run the box or the webserver is run as that user. Sessions and such need configurations that need to be configured by the server admin Ect I was hoping there was a way that didn't rely on a special configuration And stayed in the users directory --- Chris Kay, Eleet Internet Services [EMAIL PROTECTED] --- -Original Message- From: Warren Vail [mailto:[EMAIL PROTECTED]] Sent: Wednesday, 27 February 2002 6:51 PM To: Chris Kay Subject: RE: [PHP] Writing to files Suggest you understand how session management works. Whether you store in a file or database, the entries are removed if the user fails to return after a limit amount of time, and are kept in a separate table in the database. You can post the results to your actual data tables when you are completed. If you don't want to store the data in files, or in a database, what did you have in mind? There is no rule that says you can only store permanent data in a data base. -Original Message- From: Chris Kay [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 26, 2002 11:43 PM To: 'Warren Vail'; [EMAIL PROTECTED] Subject:RE: [PHP] Writing to files The data will be stored in mysql, but I don't wish to store in sql untill its completed. In case a user leave the application before completing it. --- Chris Kay, Eleet Internet Services [EMAIL PROTECTED] --- -Original Message- From: Warren Vail [mailto:[EMAIL PROTECTED]] Sent: Wednesday, 27 February 2002 6:37 PM To: Chris Kay; [EMAIL PROTECTED] Subject: RE: [PHP] Writing to files What you are describing is exactly how session management works, storing things in a file in the /tmp directory. Perhaps you could consider using the session save handler functions to store the session data in your protected database (MySQL?). Warren Vail -Original Message- From: Chris Kay [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 26, 2002 11:19 PM To: [EMAIL PROTECTED] Subject:[PHP] Writing to files Question I have is, Anyway know of a better way to store temp information? I have a problem that a script I use, uses many pages and after each page the information from the form Is stored and the next page is shown ect It uses more than 20 variables so I can not store the data in cookies. I could store the data in a temp file created but problem is that the webserver would need to create The file which is a security risk (I would like to find another way other than this). I don't really want to use sessions but if it's the last resort I guess I will have to. Other than the above any one have a better soluition? Running php 4.1.1 on RH7.2 --- Chris Kay, Eleet Internet Services [EMAIL PROTECTED] --- -- 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 to files
Not sure I understand how you concluded that web server should not create files, it certainly should not be able to create files on client machines without permission of user (which it cannot do). Users should not be able to upload files to the server without the permission of the web application, but if a web application performs the upload and controls where the file goes and what is in the file, that would be safe. If the web application completely controls where temporary files go and what goes in them (variables) then how is that unsafe? On the subject of using the database, check out which environment variables that actually control session management (you can do this by running the phpinfo() function. There are two major configuration options which you have full control over; 1. If the sys admin controls the default configuration of where to write the session data (usually points to /tmp directory), then the session_set_save_handler function is your way to override those parameters. 2. In fact if you read the routine that performs garbage collection (deletes expired session data) session management will pass to that routine the parameter that controls the default lifetime from the sysadmin's setup data, which you as the writer of the routine are free to ignore and use your own. Only caveat is you need to include these routines in every page that records data to a session (no big deal). I wish you luck on this, you seem to have been advised on some rules, by people who didn't know what they were talking about, or perhaps you understood their recommendations out of context, and that makes it hard for you. I really think session management is the way to resolve your problem. It would be interesting for you to get a couple of opinions on the subject of creating files on a server. You could create routines that would write to physical files in these save_handler functions and put them in your user directory if you like, but I would not mix these files in the same directory as your application code, perhaps a sub directory. I would be willing to bet there are log files that are updated on your server every time someone accesses one of your web pages. Good luck, Warren Vail -Original Message- From: Chris Kay [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 27, 2002 12:36 AM To: 'Warren Vail' Cc: [EMAIL PROTECTED] Subject:RE: [PHP] Writing to files I know I can do this with sessions, reason I am asking is webserver should not be able to create file (for security reasons), I would of maybe thought php could create a file as a different user. php is not always used by the box owner. I find it strange that such a option Is only available if you run the box or the webserver is run as that user. Sessions and such need configurations that need to be configured by the server admin Ect I was hoping there was a way that didn't rely on a special configuration And stayed in the users directory --- Chris Kay, Eleet Internet Services [EMAIL PROTECTED] --- -Original Message- From: Warren Vail [mailto:[EMAIL PROTECTED]] Sent: Wednesday, 27 February 2002 6:51 PM To: Chris Kay Subject: RE: [PHP] Writing to files Suggest you understand how session management works. Whether you store in a file or database, the entries are removed if the user fails to return after a limit amount of time, and are kept in a separate table in the database. You can post the results to your actual data tables when you are completed. If you don't want to store the data in files, or in a database, what did you have in mind? There is no rule that says you can only store permanent data in a data base. -Original Message- From: Chris Kay [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 26, 2002 11:43 PM To: 'Warren Vail'; [EMAIL PROTECTED] Subject:RE: [PHP] Writing to files The data will be stored in mysql, but I don't wish to store in sql untill its completed. In case a user leave the application before completing it. --- Chris Kay, Eleet Internet Services [EMAIL PROTECTED] --- -Original Message- From: Warren Vail [mailto:[EMAIL PROTECTED]] Sent: Wednesday, 27 February 2002 6:37 PM To: Chris Kay; [EMAIL PROTECTED] Subject: RE: [PHP] Writing to files What you are describing is exactly how session management works, storing things in a file in the /tmp directory. Perhaps you could consider using the session save handler functions to store the session data in your protected database (MySQL?). Warren Vail -Original Message- From: Chris Kay [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 26, 2002 11:19 PM To: [EMAIL PROTECTED] Subject:[PHP] Writing to files Question I have is, Anyway know of a better way to store temp information? I have a problem that a script I use, uses many pages and after each page the information from the form Is stored and the next page is shown ect It uses more than 20
[PHP] Writing to files
Question I have is, Anyway know of a better way to store temp information? I have a problem that a script I use, uses many pages and after each page the information from the form Is stored and the next page is shown ect It uses more than 20 variables so I can not store the data in cookies. I could store the data in a temp file created but problem is that the webserver would need to create The file which is a security risk (I would like to find another way other than this). I don't really want to use sessions but if it's the last resort I guess I will have to. Other than the above any one have a better soluition? Running php 4.1.1 on RH7.2 --- Chris Kay, Eleet Internet Services [EMAIL PROTECTED] --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Writing to files
What you are describing is exactly how session management works, storing things in a file in the /tmp directory. Perhaps you could consider using the session save handler functions to store the session data in your protected database (MySQL?). Warren Vail -Original Message- From: Chris Kay [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 26, 2002 11:19 PM To: [EMAIL PROTECTED] Subject:[PHP] Writing to files Question I have is, Anyway know of a better way to store temp information? I have a problem that a script I use, uses many pages and after each page the information from the form Is stored and the next page is shown ect It uses more than 20 variables so I can not store the data in cookies. I could store the data in a temp file created but problem is that the webserver would need to create The file which is a security risk (I would like to find another way other than this). I don't really want to use sessions but if it's the last resort I guess I will have to. Other than the above any one have a better soluition? Running php 4.1.1 on RH7.2 --- Chris Kay, Eleet Internet Services [EMAIL PROTECTED] --- -- 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 to files
The data will be stored in mysql, but I don't wish to store in sql untill its completed. In case a user leave the application before completing it. --- Chris Kay, Eleet Internet Services [EMAIL PROTECTED] --- -Original Message- From: Warren Vail [mailto:[EMAIL PROTECTED]] Sent: Wednesday, 27 February 2002 6:37 PM To: Chris Kay; [EMAIL PROTECTED] Subject: RE: [PHP] Writing to files What you are describing is exactly how session management works, storing things in a file in the /tmp directory. Perhaps you could consider using the session save handler functions to store the session data in your protected database (MySQL?). Warren Vail -Original Message- From: Chris Kay [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 26, 2002 11:19 PM To: [EMAIL PROTECTED] Subject:[PHP] Writing to files Question I have is, Anyway know of a better way to store temp information? I have a problem that a script I use, uses many pages and after each page the information from the form Is stored and the next page is shown ect It uses more than 20 variables so I can not store the data in cookies. I could store the data in a temp file created but problem is that the webserver would need to create The file which is a security risk (I would like to find another way other than this). I don't really want to use sessions but if it's the last resort I guess I will have to. Other than the above any one have a better soluition? Running php 4.1.1 on RH7.2 --- Chris Kay, Eleet Internet Services [EMAIL PROTECTED] --- -- 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
[PHP] Writing PHP files from inside a PHP file
I want to extract information from a database table and create a half-static, half-dynamic PHP page from the info. I want to store the template for the new page in an external file with tags in the places where I want variables to be printed. What;s the best of achieving this?? I tried fread but that just printed ? echo $variable; ? to the static page instead of replacing it with the value. Any suggestions? -- Regards, Georgie Casey [EMAIL PROTECTED] *** http://www.filmfind.tv Ireland's Online Film Production Directory *** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Writing PHP files from inside a PHP file
Use include(); or require(); Brandon Orther WebIntellects Design/Development Manager [EMAIL PROTECTED] 800-994-6364 www.webintellects.com -Original Message- From: Georgie Casey [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 06, 2002 3:32 PM To: [EMAIL PROTECTED] Subject: [PHP] Writing PHP files from inside a PHP file I want to extract information from a database table and create a half-static, half-dynamic PHP page from the info. I want to store the template for the new page in an external file with tags in the places where I want variables to be printed. What;s the best of achieving this?? I tried fread but that just printed ? echo $variable; ? to the static page instead of replacing it with the value. Any suggestions? -- Regards, Georgie Casey [EMAIL PROTECTED] *** http://www.filmfind.tv Ireland's Online Film Production Directory *** -- 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
[PHP] Writing to files
What's the most basic syntax for writing to a text file using PHP. I would like to store some variables in one and then retrieve them a later stage...? Taz -- 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 files
On Mon, May 14, 2001 at 03:05:30PM +0100, Tarrant Costelloe wrote: What's the most basic syntax for writing to a text file using PHP. I would like to store some variables in one and then retrieve them a later stage...? This will append This is pretty basic to the end of the file instead of overwriting the file. ?php $basic = fopen(basic.txt, a+); fputs($basic, This is pretty basic\n); fclose($basic); ? It is really easy to read in the entire file into an array. Probably not very efficient, but will get you started quickly. ?php $prettyBasic = file(basic.txt); for($i = 0; $i sizeof($prettyBasic); $i++) { echo $prettyBasic[$i]br; } ? Search the online manual for more information on these functions. Taz -- 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] -- Jason Stechschulte [EMAIL PROTECTED] -- If I don't document something, it's usually either for a good reason, or a bad reason. In this case it's a good reason. :-) -- Larry Wall in [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]