php-general Digest 25 Sep 2005 16:21:23 -0000 Issue 3702
php-general Digest 25 Sep 2005 16:21:23 - Issue 3702 Topics (messages 223136 through 223153): Re: How to Looking at Raw Binary Data with PHP and curl 223136 by: Graham Anderson Re: OT - database and indexes... but anyone please? 223137 by: Gustav Wiberg Re: Is PHP the language for me??? 223138 by: Gustav Wiberg Re: serialize 223139 by: Gustav Wiberg 223140 by: Murray . PlanetThoughtful Passing non GET/POST request methods to php script do not work on RH based linux 223141 by: Yedidia Klein Re: selfreferencing script with output 223142 by: Silvio Porcellana 223143 by: Gustav Wiberg 223148 by: Silvio Porcellana 223149 by: Sabine 223150 by: Sabine Installation problem with PHP% 223144 by: Tony Prodger 223145 by: Rory Browne 223146 by: Raz imap + secure connection problems 223147 by: Joachim Person new ways to add an html body? 223151 by: Ross New ocurrance of old problem. (FTP_PUT: 'STOR' not understood) 223152 by: Andy Pieters Cache/Form Problem 223153 by: Peter Justus Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: php-general@lists.php.net -- ---BeginMessage--- Is this good enough encryption for daily use ? FYI, I need to keep the first part of the file unencrypted so the file will progressively load Functions were taken from the mycrypt php page :) $chunkSize = 32768; $key = 6q9nKLg5 if( $fd = fopen($filepath, 'rb')){ while(!feof($fd)) { if($gotFastStartHeaders != true){ echo fread($fd, $chunkSize/30); $gotFastStartHeaders = true; }else{ echo encrypt(fread($fd, $chunkSize)); } } fclose ($fd); exit; } / /--- --- // Encrypt function encrypt($encrypt) { global $key; //$key = 6q9nEUg5; srand((double) microtime() * 100); //for sake of MCRYPT_RAND $iv = mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_RAND); $passcrypt = mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $key, $encrypt, MCRYPT_MODE_ECB, $iv); $encode = base64_encode($passcrypt); return $encode; } / /--- --- // Decrypt function decrypt($decrypt) { global $key; $decoded = base64_decode($decrypt); $iv = mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_RAND); $decrypted = mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $key, $decoded, MCRYPT_MODE_ECB, $iv); return $decrypted; many thanks g On Sep 24, 2005, at 2:25 PM, Jasper Bryant-Greene wrote: Graham Anderson wrote: How do you display raw binary data of a file sent from a server with curl ? You can probably just use file_get_contents() if allow_url_fopen is enabled (it is by default). For binary data, base64_encode and it's friend base64_decode allow you to encode and decode binary data in a normal ASCII string. http://php.net/file_get_contents http://php.net/base64_encode I want to encrypt the file with something akin to str_replace and decode it on the other side with a custom data handler Just want to make sure that I am str_replace'ing the actual data and not a representation of it :) str_replace is not for encryption. You might want to look at mcrypt, as using str_replace is probably just as bad as sending the unencrypted string. It's not going to be secure. http://php.net/mcrypt -- Jasper Bryant-Greene Freelance web developer http://jasper.bryant-greene.name/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ---End Message--- ---BeginMessage--- - Original Message - From: Rory Browne [EMAIL PROTECTED] To: Gustav Wiberg [EMAIL PROTECTED] Cc: PHP General php-general@lists.php.net Sent: Sunday, September 25, 2005 1:26 AM Subject: Re: [PHP] OT - database and indexes... but anyone please? I'm not an expert on databases, and I haven't a notion of mailing you off-list, with information that could potentially benifit others as well, but from my understanding, deleting an index(a good index that is) would slow the db down in certain cases. Deleting a bad index would speed certain operations up. On 9/24/05, Gustav Wiberg [EMAIL PROTECTED] wrote: Hi there! This is not strictly PHP... but if there's anyone out there with good knowledge of indexes, please mail me off-list. My question: If I delete an index, what is the WORST thing that can happen? /G http://www.varupiraten.se/ -- PHP General Mailing List
RE: [PHP] serialize
I have an app that stores evaluation scores so I have 30+ values all within a certain range, currently in the db, each of these values has it's own column: Table test id user_id motivation caring personal_characteristics creativity, ...etc. If the client decides they want to trap more characteristics, it requires changes to the table structure and the table quickly gets large with 30+ columns. I was thinking of just compacting all of these down to one column and then using serialize/unserialize and storing an array of the test scoresis this the best way?? Hi, This has less to do with PHP (though it will impact on your code) and more to do with database design principles. From what you describe, you have a denormalized table. Ie, every score value has its own field for each thing being scored: Id, score1, score2, score3, score4..., score30 , 23, 18, 12, 36, 38 1112, 45, 12, 62, 25, 73 A more normalized representation of that table would be: Id, scoretype, score , 'score1', 23 , 'score2', 18 , 'score3', 12 , 'score4', 36 , 'score30', 38 1112, 'score1', 45 1112, 'score2', 12 1112, 'score3', 62 1112, 'score4', 25 1112, 'score30', 73 Adding a new score type for each id is then as simple as inserting rows for the ids with a new 'scoretype' value, meaning that no change of the actual table structure is required. To retrieve the scores for any given id in your PHP code, you'd do something like: $sql = SELECT scoretype, score FROM scores WHERE id=; $rs = mysql_query($sql); while ($row = mysql_fetch_object($rs)){ $scores[$row-scoretype] = $row-score; } mysql_free_result($rs); print_r($scores); It might be helpful to you to Google on the topic of database normalization. Here's a link from the MySQL site that gives a brief introduction to the topic. http://dev.mysql.com/tech-resources/articles/intro-to-normalization.html Hope this helps. Much warmth, Murray --- Lost in thought... http://www.planetthoughtful.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Passing non GET/POST request methods to php script do not work on RH based linux
I've a simple php script (see below) that write to a file the REQUEST METHOD that was used while calling this script. means that when I use a browser to access this script, it write to the file GET. The problem starts while I try for example to send an OPTIONS request to this script (using a simple perl script that I wrote and is attached) while trying on RH based linuxes the request get to the apache logs but not to the php script (means my script do not write anything to its file but while trying on Debian based linuxes - the script *do* get all requests... I tried to compare the apache conf files and php.ini files w/o success... any idea how to set php (or apache) to pass these requests to my script ?? tnx, --Y the scripts: req.pl #!/usr/bin/perl use HTTP::Headers; use LWP::UserAgent; my $request = new HTTP::Request( 'OPTIONS'=http://cc.jct.ac.il/method/; ); my $ua = new LWP::UserAgent; my $response = $ua-request($request) || return ERROR\t$!; print $response-server; --- method.php ?php $filename = '/var/www/html/method/method.log'; $somecontent = $_SERVER[REQUEST_METHOD].\n; // Let's make sure the file exists and is writable first. #if (is_writable($filename)) { // In our example we're opening $filename in append mode. // The file pointer is at the bottom of the file hence // that's where $somecontent will go when we fwrite() it. if (!$handle = fopen($filename, 'a')) { echo Cannot open file ($filename); exit; } // Write $somecontent to our opened file. if (fwrite($handle, $somecontent) === FALSE) { echo Cannot write to file ($filename); exit; } echo Success, wrote ($somecontent) to file ($filename); fclose($handle); ?
Re: [PHP] selfreferencing script with output
Sabine wrote: Thanks for your answer, Gustav, now I see I didn't explain good enough what my problem is. My problem is not how to construct a status bar, but not it is possible to provide any output before the headering (*Warning*: Cannot modify header information - headers already sent by). Neither after it. Best regards Sabine P.S.: I played around with PEARs HTML_Progress. It's really worth trying. The user doc on Laurent Lavilles page provides a lot of explanation and examples. (http://pear.laurent-laville.org/HTML_Progress/). Hi Sabine why don't you try an AJAX approach? (Kinda like GMail and stuff like that?) You can create a DIV in your page that contains the *output* (maybe an image with the width set to the percentage of mails sent): the content of this DIV is updated by another script (the one that sends the email) that gets called (via JavaScript) at specific intervals with a specific query (in your case, the messages to send). This way your main page never gets reloaded and you see a nice progress bar in your DIV. I know it sounds a bit difficult, but it's a cool technology and after the initial difficulties it can be really useful. As a start, have a read here: http://en.wikipedia.org/wiki/AJAX HTH, cheers! Silvio -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] selfreferencing script with output
- Original Message - From: Silvio Porcellana [EMAIL PROTECTED] To: PHP general php-general@lists.php.net Sent: Sunday, September 25, 2005 12:13 AM Subject: Re: [PHP] selfreferencing script with output Sabine wrote: Thanks for your answer, Gustav, now I see I didn't explain good enough what my problem is. My problem is not how to construct a status bar, but not it is possible to provide any output before the headering (*Warning*: Cannot modify header information - headers already sent by). Neither after it. Best regards Sabine P.S.: I played around with PEARs HTML_Progress. It's really worth trying. The user doc on Laurent Lavilles page provides a lot of explanation and examples. (http://pear.laurent-laville.org/HTML_Progress/). Hi Sabine why don't you try an AJAX approach? (Kinda like GMail and stuff like that?) You can create a DIV in your page that contains the *output* (maybe an image with the width set to the percentage of mails sent): the content of this DIV is updated by another script (the one that sends the email) that gets called (via JavaScript) at specific intervals with a specific query (in your case, the messages to send). This way your main page never gets reloaded and you see a nice progress bar in your DIV. I know it sounds a bit difficult, but it's a cool technology and after the initial difficulties it can be really useful. As a start, have a read here: http://en.wikipedia.org/wiki/AJAX HTH, cheers! Silvio -- 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.344 / Virus Database: 267.11.6/111 - Release Date: 2005-09-23 Look at the functions ob_start() and ob_flush().. Something like: ?php ob_start(); HEADER(Location: test.php); ob_flush(); ? /G http://www.varupiraten.se/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Installation problem with PHP%
Dear Sir, I wonder if you can help me with the following probem?? I am using: Windows XP Professional Apache HTTP Server 2.054 PHP 5.0.4 MySQL 4.1 Apache and MySQL are running I have installed PHP, but when I use my browser to view the following test file: html head titleMy PHP Test/title /head body hello html world ?PHP phpinfo(); ? /body /html I can see hello html world When I do a 'view source' in the web browser I can see the source code of my PHP script. I presume that this means that the web server did not send the script to PHP for interpretation. Something is wrong with the server configuration . My Apache is set up in C:\Program Files\Apache Group\Apache2 with the files stored in the htdocs folder PHP is set up in C:\PHP I have edited the httpd file anmd looked at the php.ini file that is stored in C:\windows Where am I going wrong regards Tony Prodger www.tonyprodger.com www.thegartercompany.com www.ujoinus.co.uk http://newbieclub.com/?hands_on
Re: [PHP] Installation problem with PHP%
On 9/25/05, Tony Prodger [EMAIL PROTECTED] wrote: Dear Sir, I wonder if you can help me with the following probem?? I am using: Windows XP Professional Yes. Upgrade to Unix. Apache HTTP Server 2.054 PHP 5.0.4 MySQL 4.1 Apache and MySQL are running I have installed PHP, but when I use my browser to view the following test file: html head titleMy PHP Test/title /head body hello html world ?PHP phpinfo(); ? /body /html I can see hello html world When I do a 'view source' in the web browser I can see the source code of my PHP script. I presume that this means that the web server did not send the script to PHP for interpretation. Something is wrong with the server configuration . My Apache is set up in C:\Program Files\Apache Group\Apache2 with the files stored in the htdocs folder PHP is set up in C:\PHP I have edited the httpd file anmd looked at the php.ini file that is stored in C:\windows What edits did you make? Did you restart apache? Where am I going wrong regards Tony Prodger www.tonyprodger.com www.thegartercompany.com www.ujoinus.co.uk http://newbieclub.com/?hands_on -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Installation problem with PHP%
[snip] http://newbieclub.com/?hands_on [/snip] Great site that, never need that php list ever again! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] imap + secure connection problems
I tried to make the simple program ?php $mbox = imap_open({imap.liu.se:993}, gurka222, nada); echo h1Mailboxes/h1\n; $folders = imap_listmailbox($mbox, {imap.liu.se:993}, *); if ($folders == false) { echo Call failedbr /\n; } else { foreach ($folders as $val) { echo $val . br /\n; } } echo h1Headers in INBOX/h1\n; $headers = imap_headers($mbox); if ($headers == false) { echo Call failedbr /\n; } else { foreach ($headers as $val) { echo $val . br /\n; } } imap_close($mbox); ? given at http://se2.php.net/manual/sv/function.imap-open.php. I'm running PHP 4.3.10 and have enabled imap. But I can't connect to the server (even though it works using, for instance Outlook). When changing the imap_open line in the script to $mbox = imap_open({imap.liu.se:993/imap/ssl}, gurka222, nada); (I added the /imap/ssl part) I immediately got the following response: Warning: imap_open(): Couldn't open stream {imap.liu.se:993/imap/ssl} in c:\inetpub\wwwroot\TestGetMail.php on line 2 Mailboxes Warning: imap_listmailbox(): supplied argument is not a valid imap resource in c:\inetpub\wwwroot\TestGetMail.php on line 5 Call failed Headers in INBOX Warning: imap_headers(): supplied argument is not a valid imap resource in c:\inetpub\wwwroot\TestGetMail.php on line 16 Call failed Warning: imap_close(): supplied argument is not a valid imap resource in c:\inetpub\wwwroot\TestGetMail.php on line 26 Notice: (null)(): Can't open mailbox {imap.liu.se:993/imap/ssl}: invalid remote specification (errflg=2) in Unknown on line 0 When not having the /imap/ssl part I only get Warning: imap_open(): Couldn't open stream {imap.liu.se:993} in c:\inetpub\wwwroot\TestGetMail.php on line 2 Fatal error: Maximum execution time of 30 seconds exceeded in c:\inetpub\wwwroot\TestGetMail.php on line 2 Notice: (null)(): [CLOSED] IMAP connection broken (server response) (errflg=2) in Unknown on line 0 as a response after 30 seconds. Does this mean I have to include a certifcate of some kind in some way? If I need, how to do it? What could be wrong? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] selfreferencing script with output
Sabine wrote: Thanks you very much Silvio, for your answer. Yes, it seems to be complicated. Especially regarding the time I have to do the programming for this part of my work. Now I reduced the time the preparing of the mailtext needs and hope for the moment that the servers time my script gets will be sufficient for the task. I have to check out the circumstances of the productive machine. But I will surely have a closer look on the AJAX approach later. Well yeah it sounds difficult at the beginning, but if you have time to study it a little bit this approach can be quite useful in your future projects (no_flames_pleasein some cases, in my opinion, it could be a much better solution than Flash.../no_flames_please) Anyway, thinking about your current approach I guess it would be better of you let a background process (triggered by the user input or scheduled with cron - you can use free ones on the net, like http://hostedcron.com (never used it, thou)) do the mailing: what if your user hits 'Reload' while the script is sending the emails? All the emails get re-sent? Or if it hits the 'Stop' button? Thanks again and have a nice sunday Sabine You too! ;-) Cheers Silvio -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] selfreferencing script with output
Thanks again,Gustav, I tried, but it won't work. The moment of the second headering there had been an output. So you get the error message just an iteration later. Now I reduced the time my script needs. I will check out if it has sufficient time on the productive machine. If so, it won't be necessary to do a selfreferencing script. Have a nice sunday Sabine Gustav Wiberg schrieb: - Original Message - From: Silvio Porcellana [EMAIL PROTECTED] To: PHP general php-general@lists.php.net Sent: Sunday, September 25, 2005 12:13 AM Subject: Re: [PHP] selfreferencing script with output Sabine wrote: Thanks for your answer, Gustav, now I see I didn't explain good enough what my problem is. My problem is not how to construct a status bar, but not it is possible to provide any output before the headering (*Warning*: Cannot modify header information - headers already sent by). Neither after it. Best regards Sabine P.S.: I played around with PEARs HTML_Progress. It's really worth trying. The user doc on Laurent Lavilles page provides a lot of explanation and examples. (http://pear.laurent-laville.org/HTML_Progress/). Hi Sabine why don't you try an AJAX approach? (Kinda like GMail and stuff like that?) You can create a DIV in your page that contains the *output* (maybe an image with the width set to the percentage of mails sent): the content of this DIV is updated by another script (the one that sends the email) that gets called (via JavaScript) at specific intervals with a specific query (in your case, the messages to send). This way your main page never gets reloaded and you see a nice progress bar in your DIV. I know it sounds a bit difficult, but it's a cool technology and after the initial difficulties it can be really useful. As a start, have a read here: http://en.wikipedia.org/wiki/AJAX HTH, cheers! Silvio -- 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.344 / Virus Database: 267.11.6/111 - Release Date: 2005-09-23 Look at the functions ob_start() and ob_flush().. Something like: ?php ob_start(); HEADER(Location: test.php); ob_flush(); ? /G http://www.varupiraten.se/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] selfreferencing script with output
Thanks you very much Silvio, for your answer. Yes, it seems to be complicated. Especially regarding the time I have to do the programming for this part of my work. Now I reduced the time the preparing of the mailtext needs and hope for the moment that the servers time my script gets will be sufficient for the task. I have to check out the circumstances of the productive machine. But I will surely have a closer look on the AJAX approach later. Thanks again and have a nice sunday Sabine Silvio Porcellana schrieb: Sabine wrote: Thanks for your answer, Gustav, now I see I didn't explain good enough what my problem is. My problem is not how to construct a status bar, but not it is possible to provide any output before the headering (*Warning*: Cannot modify header information - headers already sent by). Neither after it. Best regards Sabine P.S.: I played around with PEARs HTML_Progress. It's really worth trying. The user doc on Laurent Lavilles page provides a lot of explanation and examples. (http://pear.laurent-laville.org/HTML_Progress/). Hi Sabine why don't you try an AJAX approach? (Kinda like GMail and stuff like that?) You can create a DIV in your page that contains the *output* (maybe an image with the width set to the percentage of mails sent): the content of this DIV is updated by another script (the one that sends the email) that gets called (via JavaScript) at specific intervals with a specific query (in your case, the messages to send). This way your main page never gets reloaded and you see a nice progress bar in your DIV. I know it sounds a bit difficult, but it's a cool technology and after the initial difficulties it can be really useful. As a start, have a read here: http://en.wikipedia.org/wiki/AJAX HTH, cheers! Silvio -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] new ways to add an html body?
Hi, I am using php mailer and am trying to find a new way to make the html email body instead of the old $mail_body = trtd width=\314\div align=\center\img src=\my_logo3.gif\ width=\100\ height=\139\/div/td/tr; $mail_body .= BRBRBRBR; $mail_body .= font size=\2\ face=\Verdana, Arial, Helvetica, sans-serif\$mail_text /font; $mail_body .= BRBRBRBRBR; $mail_body .= tr etc etc. Could I link/ attach a style sheet? How would this work?? Can I make a whole html mage and just link it?? Or include ('mypage.htm') Any good/innovative suggestions are welcome. R. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] New ocurrance of old problem. (FTP_PUT: 'STOR' not understood)
Hi all Having looked at the archives, they mention that the cause for this problem might be that the FTP_BINARY constant isn't transmitted to the the FTP module. I therefore adjusted my code to this: return ftp_put($this-ftphandle, $localfile, $remotefile,FTP_BINARY); Seeing as this fails also, I prepended this with a pasv command, and even went as far as doing this ftp_raw($this-ftphandle,'quote pasv'); //put ftp in passive mode ftp_raw($this-ftphandle,'quote type i'); //put ftp in binary mode return ftp_put($this-ftphandle, $localfile, $remotefile,FTP_BINARY); Alas, to no avail! The server keeps telling me STOR not understood, so I connected manually to the server, and quote stor 500 'STOR' not understood But I can upload files with PUT nonetheless. So is there a way to tell PHP to use the PUT command instead of the STORE command? With kind regards Andy -- Registered Linux User Number 379093 Now listening to [silence] amaroK::the Coolest Media Player in the known Universe! Cockroaches and socialites are the only things that can stay up all night and eat anything. Herb Caen -- -- --BEGIN GEEK CODE BLOCK- Version: 3.1 GAT/O/E$ d-(---)+ s:(+): a--(-)? C$(+++) UL$ P-(+)++ L+++$ E---(-)@ W++$ !N@ o? !K? W--(---) !O !M- V-- PS++(+++) PE--(-) Y+ PGP++(+++) t+(++) 5-- X++ R*(+)@ !tv b-() DI(+) D+(+++) G(+) e$@ h++(*) r--++ y--() -- ---END GEEK CODE BLOCK-- -- Check out these few php utilities that I released under the GPL2 and that are meant for use with a php cli binary: http://www.vlaamse-kern.com/sas/ -- pgpvHfRu8vCcO.pgp Description: PGP signature
[PHP] Cache/Form Problem
Hi List Not too sure if this is the right list to send to so forgive me for my ignorance if it is incorrect. My Question I have a form which users need to fill out, (quite a lengthy one) it consists of 5 or so pages with various questions on each!, the last page submits the information and writes it to the MYSQL database. My problem is that when they have say completed the first three or so pages and they have to click on the browsers back button to check if they have filled in all the right info and then click on forward again to go to the original page from where they came, the information is lost and they basically have to start from scratch. This is obviously most annoying for them, is there a simple solution to this... Is there something I need to change in my php.ini file the site is hosted on a linux server running php-4.3.2-19 mysql-3.23.58-2.3 httpd-2.0.46-44 Regards thanks in advance Peter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Cache/Form Problem
Peter Justus wrote: Hi List Not too sure if this is the right list to send to so forgive me for my ignorance if it is incorrect. My Question I have a form which users need to fill out, (quite a lengthy one) it consists of 5 or so pages with various questions on each!, the last page submits the information and writes it to the MYSQL database. My problem is that when they have say completed the first three or so pages and they have to click on the browsers back button to check if they have filled in all the right info and then click on forward again to go to the original page from where they came, the information is lost and they basically have to start from scratch. This is obviously most annoying for them, is there a simple solution to this... Is there something I need to change in my php.ini file the site is hosted on a linux server running php-4.3.2-19 mysql-3.23.58-2.3 httpd-2.0.46-44 Regards thanks in advance Peter Store the form information is session vars, and pre-fill the forms with those session vars when the page loads. e.g: input type=text name=foo value=? if (isset ($_SESSION['foo'])) echo $_SESSION['foo']; ? HTH, Mikey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] new ways to add an html body?
Ross wrote: Hi, I am using php mailer and am trying to find a new way to make the html email body instead of the old $mail_body = trtd width=\314\div align=\center\img src=\my_logo3.gif\ width=\100\ height=\139\/div/td/tr; $mail_body .= BRBRBRBR; $mail_body .= font size=\2\ face=\Verdana, Arial, Helvetica, sans-serif\$mail_text /font; $mail_body .= BRBRBRBRBR; $mail_body .= tr Any good/innovative suggestions are welcome. Not really innovative, but what about heredoc? $mail_body = EOT trtd width=314div align=centerimg src=my_logo3.gif width=100 height=139/div/td/tr ... font size=2 face=\Verdana, Arial, Helvetica, sans-serif$mail_text /font ... EOT; http://php.net/types.string HTH, cheers! Silvio -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] new ways to add an html body?
Hello Ross, Sunday, September 25, 2005, 2:27:42 PM, you wrote: I am using php mailer and am trying to find a new way to make the html email body instead of the old Can I make a whole html mage and just link it?? Or include ('mypage.htm') $mail_body = file_get_contents('path/to/your/html/email.html'); Will save embedding all that HTML into your PHP scripts. You could then do simply variable replacement on $mail_body to customise the messages if you so wish. -- Best regards, Richard Davey Zend Certified Engineer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] cgi chmod problem
I've got a php script that checks certain file permissions and if not OK for writing, chmods as required. I can use ftp_site(); but, prefer not to because the code is not readily transportable. Requires ftp login. I'd like a simple cgi file that can be called by my script as needed. My cgi file works OK if I call directly in my cgi-bin directory. e.g., $file= '/EditPage/test2.php'; $perms= 0746; if(!file_exists($pfile)) echo div style=\color:red; font-weight:bold\$pfile does not exist./div; chmod($pfile, $perms); echo New file permissions for $pfile: . substr(sprintf('%o', fileperms($pfile)), -3); But, I can't get the cgi file to execute when using include /path/perm.cgi. in the php test function. I guess it is because the cgi assumes it is running in the directory with the php that called it. Linux php3.9.11 virtual host Anyone have a suggestion. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] cgi chmod problem
Al wrote: I've got a php script that checks certain file permissions and if not OK for writing, chmods as required. I can use ftp_site(); but, prefer not to because the code is not readily transportable. Requires ftp login. I'd like a simple cgi file that can be called by my script as needed. My cgi file works OK if I call directly in my cgi-bin directory. e.g., $file= '/EditPage/test2.php'; $perms= 0746; if(!file_exists($pfile)) echo div style=\color:red; font-weight:bold\$pfile does not exist./div; chmod($pfile, $perms); echo New file permissions for $pfile: . substr(sprintf('%o', fileperms($pfile)), -3); But, I can't get the cgi file to execute when using include /path/perm.cgi. in the php test function. I guess it is because the cgi assumes it is running in the directory with the php that called it. Linux php3.9.11 virtual host Anyone have a suggestion. My guess would be that your webserver isn't running as the same user as your shell account - for details on how to fix this, please have go at STFA, Mikey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] cgi chmod problem
Mikey wrote: Al wrote: I've got a php script that checks certain file permissions and if not OK for writing, chmods as required. I can use ftp_site(); but, prefer not to because the code is not readily transportable. Requires ftp login. I'd like a simple cgi file that can be called by my script as needed. My cgi file works OK if I call directly in my cgi-bin directory. e.g., $file= '/EditPage/test2.php'; $perms= 0746; if(!file_exists($pfile)) echo div style=\color:red; font-weight:bold\$pfile does not exist./div; chmod($pfile, $perms); echo New file permissions for $pfile: . substr(sprintf('%o', fileperms($pfile)), -3); But, I can't get the cgi file to execute when using include /path/perm.cgi. in the php test function. I guess it is because the cgi assumes it is running in the directory with the php that called it. Linux php3.9.11 virtual host Anyone have a suggestion. My guess would be that your webserver isn't running as the same user as your shell account - for details on how to fix this, please have go at STFA, Mikey They are the same. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PDF Thumbnails
I give my users an option to upload pdf files to my site and would like them to see a thumbnail view of the file once uploaded. Has anyone heard of a way how to do this?