[PHP] PHP in Kenya
I'm currently serving in Peace Corps in Kenya and I was looking for other PHP web developers that are doing e-commerce that I could ping about what requirements/paperwork etc is involved in setting up e-commerce accounts in Kenya. Thanks, Mark
[PHP] date(n/Y) strtotime
I've always been really amazed at how well strtotime works, but recently ran into an issue where it couldn't figure out the date if it was a cc exp date in long format, e.g. 1/2009. I was curious if anyone else has run into this and how did they get around it, here was my solution: function expDate2str( $date ) { if( !($sDate = strtotime( $date ) ) ) { // exploded date $eDate = explode( '/', $date ); // string date we hard code the day to 1 $sDate = strtotime( date( Y-m-d, mktime( 0, 0, 0, $eDate[0], 1, $eDate[1] ) ) ); } return $sDate; } Thanks, Mark -- Mark Steudel Web Applications Developer 555 Dayton St Suite A Edmonds, WA 98020 p: 425.741.7014 e: [EMAIL PROTECTED] w: http://www.netriver.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] date(n/Y) strtotime
Ok so actually I didn't solve it. Php5, this works, but php 4.4.1 and 4.4.0 don't handle this correctly. Here's my code I'm running on each box: function expDate2str( $date ) { if( !($sDate = strtotime( $date ) ) ) { echo Invalid, blowing up datebr /; // exploded date $eDate = explode( '/', $date ); // string date $sDate = strtotime( date( Y-m-d, mktime( 0, 0, 0, $eDate[0], 1, $eDate[1] ) ) ); } else { echo validbr/; } echo In: .$date .br /Out: . date( Y-m-d, $sDate ) .br /br /; } expDate2str('1/2009'); expDate2str( date( n/Y)); Here are the results: Php 5.1.2 Invalid, blowing up date In: 1/2009 Out: 2009-01-01 Invalid, blowing up date In: 8/2006 Out: 2006-08-01 PHP 4.4.1 Valid In: 1/2009 Out: 2011-07-02 Valid In: 8/2006 Out: 2012-01-27 PHP 4.4.0 Valid In: 1/2009 Out: 2011-07-02 Valid In: 8/2006 Out: 2012-01-27 Any work around with these types of dates on php4? Mark -Original Message- From: Mark Steudel Sent: Wednesday, August 02, 2006 9:46 AM To: PHP Mailing Lists Subject: [PHP] date(n/Y) strtotime I've always been really amazed at how well strtotime works, but recently ran into an issue where it couldn't figure out the date if it was a cc exp date in long format, e.g. 1/2009. I was curious if anyone else has run into this and how did they get around it, here was my solution: function expDate2str( $date ) { if( !($sDate = strtotime( $date ) ) ) { // exploded date $eDate = explode( '/', $date ); // string date we hard code the day to 1 $sDate = strtotime( date( Y-m-d, mktime( 0, 0, 0, $eDate[0], 1, $eDate[1] ) ) ); } return $sDate; } Thanks, Mark -- Mark Steudel Web Applications Developer 555 Dayton St Suite A Edmonds, WA 98020 p: 425.741.7014 e: [EMAIL PROTECTED] w: http://www.netriver.net -- 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] date(n/Y) strtotime
In the strtotime notes, it says that strtotime returns -1 previous to php5, but if I do: If( strtotime( '1/2009') == -1 ) { Echo 'false'; } Else { Echo 'true'; } If( strtotime( '1/2009') === -1 ) { Echo 'false'; } Else { Echo 'true'; } If( strtotime( '1/2009') == '-1' ) { Echo 'false'; } Else { Echo 'true'; } All of those echo true, how do I determine if strtotime has failed or not? Mark -Original Message- From: Mark Steudel Sent: Wednesday, August 02, 2006 9:55 AM To: Mark Steudel; PHP Mailing Lists Subject: RE: [PHP] date(n/Y) strtotime Ok so actually I didn't solve it. Php5, this works, but php 4.4.1 and 4.4.0 don't handle this correctly. Here's my code I'm running on each box: function expDate2str( $date ) { if( !($sDate = strtotime( $date ) ) ) { echo Invalid, blowing up datebr /; // exploded date $eDate = explode( '/', $date ); // string date $sDate = strtotime( date( Y-m-d, mktime( 0, 0, 0, $eDate[0], 1, $eDate[1] ) ) ); } else { echo validbr/; } echo In: .$date .br /Out: . date( Y-m-d, $sDate ) .br /br /; } expDate2str('1/2009'); expDate2str( date( n/Y)); Here are the results: Php 5.1.2 Invalid, blowing up date In: 1/2009 Out: 2009-01-01 Invalid, blowing up date In: 8/2006 Out: 2006-08-01 PHP 4.4.1 Valid In: 1/2009 Out: 2011-07-02 Valid In: 8/2006 Out: 2012-01-27 PHP 4.4.0 Valid In: 1/2009 Out: 2011-07-02 Valid In: 8/2006 Out: 2012-01-27 Any work around with these types of dates on php4? Mark -Original Message- From: Mark Steudel Sent: Wednesday, August 02, 2006 9:46 AM To: PHP Mailing Lists Subject: [PHP] date(n/Y) strtotime I've always been really amazed at how well strtotime works, but recently ran into an issue where it couldn't figure out the date if it was a cc exp date in long format, e.g. 1/2009. I was curious if anyone else has run into this and how did they get around it, here was my solution: function expDate2str( $date ) { if( !($sDate = strtotime( $date ) ) ) { // exploded date $eDate = explode( '/', $date ); // string date we hard code the day to 1 $sDate = strtotime( date( Y-m-d, mktime( 0, 0, 0, $eDate[0], 1, $eDate[1] ) ) ); } return $sDate; } Thanks, Mark -- Mark Steudel Web Applications Developer 555 Dayton St Suite A Edmonds, WA 98020 p: 425.741.7014 e: [EMAIL PROTECTED] w: http://www.netriver.net -- 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] date(n/Y) strtotime
Thanks Adam, I had sent out my second email before I had read yours. I'll give yours a go, thanks again. Mark -Original Message- From: Adam Zey [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 02, 2006 11:15 AM To: Mark Steudel Cc: PHP Mailing Lists Subject: Re: [PHP] date(n/Y) strtotime Mark Steudel wrote: In the strtotime notes, it says that strtotime returns -1 previous to php5, but if I do: If( strtotime( '1/2009') == -1 ) { Echo 'false'; } Else { Echo 'true'; } If( strtotime( '1/2009') === -1 ) { Echo 'false'; } Else { Echo 'true'; } If( strtotime( '1/2009') == '-1' ) { Echo 'false'; } Else { Echo 'true'; } All of those echo true, how do I determine if strtotime has failed or not? Mark -Original Message- From: Mark Steudel Sent: Wednesday, August 02, 2006 9:55 AM To: Mark Steudel; PHP Mailing Lists Subject: RE: [PHP] date(n/Y) strtotime Ok so actually I didn't solve it. Php5, this works, but php 4.4.1 and 4.4.0 don't handle this correctly. Here's my code I'm running on each box: function expDate2str( $date ) { if( !($sDate = strtotime( $date ) ) ) { echo Invalid, blowing up datebr /; // exploded date $eDate = explode( '/', $date ); // string date $sDate = strtotime( date( Y-m-d, mktime( 0, 0, 0, $eDate[0], 1, $eDate[1] ) ) ); } else { echo validbr/; } echo In: .$date .br /Out: . date( Y-m-d, $sDate ) .br /br /; } expDate2str('1/2009'); expDate2str( date( n/Y)); Here are the results: Php 5.1.2 Invalid, blowing up date In: 1/2009 Out: 2009-01-01 Invalid, blowing up date In: 8/2006 Out: 2006-08-01 PHP 4.4.1 Valid In: 1/2009 Out: 2011-07-02 Valid In: 8/2006 Out: 2012-01-27 PHP 4.4.0 Valid In: 1/2009 Out: 2011-07-02 Valid In: 8/2006 Out: 2012-01-27 Any work around with these types of dates on php4? Mark -Original Message- From: Mark Steudel Sent: Wednesday, August 02, 2006 9:46 AM To: PHP Mailing Lists Subject: [PHP] date(n/Y) strtotime I've always been really amazed at how well strtotime works, but recently ran into an issue where it couldn't figure out the date if it was a cc exp date in long format, e.g. 1/2009. I was curious if anyone else has run into this and how did they get around it, here was my solution: function expDate2str( $date ) { if( !($sDate = strtotime( $date ) ) ) { // exploded date $eDate = explode( '/', $date ); // string date we hard code the day to 1 $sDate = strtotime( date( Y-m-d, mktime( 0, 0, 0, $eDate[0], 1, $eDate[1] ) ) ); } return $sDate; } Thanks, Mark -- Mark Steudel Web Applications Developer 555 Dayton St Suite A Edmonds, WA 98020 p: 425.741.7014 e: [EMAIL PROTECTED] w: http://www.netriver.net Did you try my code? It's a lot simpler than yours, faster too. And I just tried executing it to confirm that it works. The problem with your comparison is that strtotime thinks the date is invalid, but misinterprets it. But since once you decide the date is invalid you assume it's in a given format, it is enough to simply check that it's in the certain format to begin with. I don't know how complex you want to get with this, here's a relatively simple if statement to do the check: if ( 6 = strlen($date) = 7 substr_count($date, /) == 1 ) Which checks that the length is from our credit card strings, and that it looks somewhat valid (You could go more in depth in checking, but this'll do for now). Now, that new comparison would be needed for your code, but I'll rewrite your function to use my simpler method of conversion: ?php function expDate2str($date) { $datelen = strlen($date); if ( ($datelen == 6 || $datelen == 7) substr_count($date, /) == 1 ) { echo Invalid, blowing up datebr/; $sDate = strtotime(str_replace(/, /01/, strlen($date) == 6 ? 0$date : $date)); } else { echo validbr/; } echo In: $datebr/Out: . date( Y-m-d, $sDate ) .br/br/; } expDate2str('1/2009'); expDate2str( date( n/Y)); ? Which when I run it (in PHP 4 though) prints out this: Invalid, blowing up date In: 1/2009 Out: 2009-01-01 Invalid, blowing up date In: 8/2006 Out: 2006-08-01 For the heck of it, here's a more production-oriented version of the function/test script: ?php function expDate2str($date) { $datelen = strlen($date); if ( ($datelen == 6 || $datelen == 7) substr_count($date, /) == 1 ) return date(Y-m-d, strtotime(str_replace(/, /01/, strlen($date) == 6 ? 0$date : $date))); else
RE: [PHP] Basic PHP knowledge test
Here's one companies quiz that they gave: With each question, please keep the code short and simple. Make notes on possible caveats and fixes rather than adding a lot of error-checking to your code. 1. Write a PHP script to remove duplicate lines from a file. Do not worry about efficiency. Ex. input: Tree Donut Fish Food Tree Tree Doctor Fish Food Ex. output: Tree Donut Fish Food Doctor 2. Write a PHP script that retrieves the Word of the Day from http://dictionary.com/. 3. Write a PHP web page script which redirects visitors to google.com if their IP address is not of the form 10.x.x.x nor 192.168.x.x. Users who do not get redirected should be shown a top secret message. 4. Write a PHP script which inserts the contents of a TAB-delimited text file into a MySQL table. You must create the table. The columns are named in the file. Here is the data format with some example data: idTABnameTABageTABemailTABactive 1TABBerthaTAB93TAB[EMAIL PROTECTED]TAB1 2TABSammyTAB40TAB[EMAIL PROTECTED]TAB1 3TABErinTAB15TAB[EMAIL PROTECTED]TAB0 4TABRupertTAB29TAB[EMAIL PROTECTED]TAB1 5. Write a PHP function to determine if two strings are close enough, such as to find misspelt words. o Extra letters are OK. close_enough( 'apartment', 'appartmeant' ); returns true o Missing letters are OK. close_enough( 'apartment', 'aprmnt' ); returns true o Substitutions are OK. close_enough( 'apartment', 'apardmint' ); returns true o Only allow up to 1 error per 3 letters in the correct word, rounding up. For example, a 10-letter word can have up to 4 errors. They can be anywhere in the word. -Original Message- From: John Nichel [mailto:[EMAIL PROTECTED] Sent: Thursday, July 20, 2006 5:31 AM To: PHP Mailing Lists Subject: Re: [PHP] Basic PHP knowledge test Finner, Doug wrote: My advice, give the candidates problems and see how they solve them. Even if they don't finish, you get an idea of how they think. tedd I like this idea! Do you expect them to be able to work with code written by others? If so, hand them some of your existing code (good examples and not so good) and ask them to figure out what it does and recommend changes. Most definitely. This position isn't going to really require the person to write their own apps. Most of the stuff he/she will be doing is maintaining code already in place. Plenty of it will be my code, but prior to me starting here three years ago, they used to just get people on a contract basis, and there's some pretty messed up code. They even contracted a job out to a couple of Russian programmers; code's pretty clean, but all the comments are in Russian. ;) I like the idea of giving them a piece of our existing code and getting them to do something with it...I'll just have to get HR to accept my word on how they did on it (they really want a question and answer sheet that they can 'grade'). I really really like the 'give them a problem and have them solve it' idea... Yeah, one of my earliest thoughts on this was to have them write something simple like connecting to a db, selecting multiple rows, parsing our the result, and displaying it in some fashion. -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [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] Recurs Directory Delete
I was hoping someone could give me a hand, I'm trying to create a delete folders function that recursively deletes folders and files from a given directory. Here's what I have so far, but its not working I keep getting Warning: rmdir(wwwroot/resources/applications/44/series/25/modules/29) [function.rmdir]: Directory not empty in wwwroot\common\class.directories.php on line 28 function deleteFolders( $resource ) { if( is_dir( $resource ) ) { if( $dir = opendir( $resource ) ) { while( false !== ( $file == readdir( $dir ) ) ) { if( $file != '.' $file != '..' ) { $this-deleteFolders($resource.'/'.$file ); } } closedir($dir); rmdir($resource); } else { $this-LOG .= __LINE__ . : Unable to open directory\r\n; } } else { if( is_file( $resource ) ) { unlink( $resource ); } else { $this-LOG .= __LINE__ . : Unknown path: $resource\r\n; } } } TIA, mark -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Recurs Directory Delete
I wish, I'm on an IIS box. Mark -Original Message- From: Richard Lynch [mailto:[EMAIL PROTECTED] Sent: Friday, July 14, 2006 2:09 PM To: tedd Cc: Mark Steudel; php-general@lists.php.net Subject: Re: [PHP] Recurs Directory Delete On Fri, July 14, 2006 2:07 pm, tedd wrote: At 11:55 AM -0700 7/14/06, Mark Steudel wrote: I was hoping someone could give me a hand, I'm trying to create a delete folders function that recursively deletes folders and files from a given directory. If you want to delete EVERYTHING, an exec(rm -r $path) could potentially be much more efficient. You'd be trading the cost of opening up a mini-shell against PHP iteration, so it would depend on the number of directories, but if there are LOTS of files, the rm -r will probably win. -- 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] Recurs Directory Delete
Thanks all for the help, I figured it out: This line was giving me grief :) doh! while( false !== ( $file == readdir( $dir ) ) ) Mark -Original Message- From: Jochem Maas [mailto:[EMAIL PROTECTED] Sent: Friday, July 14, 2006 12:12 PM To: Mark Steudel Cc: php-general@lists.php.net Subject: Re: [PHP] Recurs Directory Delete Mark Steudel wrote: I was hoping someone could give me a hand, I'm trying to create a delete folders function that recursively deletes folders and files from a given directory. Here's what I have so far, but its not working I keep getting Warning: rmdir(wwwroot/resources/applications/44/series/25/modules/29) [function.rmdir]: Directory not empty in wwwroot\common\class.directories.php on line 28 do you have the relevant permissions to unlink() the files in question? try dumping/collecting some debugging infomation a bit like this function does: /* delete everything in the $dir */ function recursiveDelete($dir) { $msgs = array( \n.\n.'deleting everthing in: '.$dir, \n.'---' ); if ($handle = /[EMAIL PROTECTED]/opendir($dir)) { while (($file = readdir($handle)) !== false) { if (($file == .) || ($file == ..)) { continue; } if (is_dir($dir.'/'.$file)) { // call self for this directory $msgs = array_merge($msgs, recursiveDelete($dir.'/'.$file)); $r = rmdir ($dir.'/'.$file); $msgs[] = \n.'deleting dir.: '.$dir.'/'.$file.($r?' SUCCESSFUL':' FAILED'); } else { $r = unlink($dir.'/'.$file); // remove this file $msgs[] = \n.'deleting file: '.$dir.'/'.$file.($r?' SUCCESSFUL':' FAILED'); } } /[EMAIL PROTECTED]/closedir($handle); return $msgs; } /* return an array of messages always - for the call array_merge() */ return array(); } function deleteFolders( $resource ) { if( is_dir( $resource ) ) { if( $dir = opendir( $resource ) ) { while( false !== ( $file == readdir( $dir ) ) ) { if( $file != '.' $file != '..' ) { $this-deleteFolders($resource.'/'.$file ); } } closedir($dir); rmdir($resource); } else { $this-LOG .= __LINE__ . : Unable to open directory\r\n; } } else { if( is_file( $resource ) ) { unlink( $resource ); } else { $this-LOG .= __LINE__ . : Unknown path: $resource\r\n; } } } TIA, mark -- 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: Fwd: [PHP] Recurs Directory Delete
Oooh, that's pretty neat. I was under the same impression as Andrew, that DEL didn't do the same thing as rm -rf ... Thanks, Mark -Original Message- From: Adam Zey [mailto:[EMAIL PROTECTED] Sent: Friday, July 14, 2006 4:35 PM To: Andrew Kreps Cc: PHP General Mail List Subject: Re: Fwd: [PHP] Recurs Directory Delete Andrew Kreps wrote: [forwarding my response to the list, as the reply function didn't quite work] Actually, that's not true. 'rm -rf' removes all files, directories and subdirectories. Microsoft's del has no analogy to that (although there was a deltree command in older versions of DOS). You still have to manually (or programmatically) iterate through the directory structure and run 'del *.*' and then 'rd directory' in every single subdirectory to achieve the same result that the single command 'rm -rf' gives you on UNIX-like systems. On 7/14/06, Adam Zey [EMAIL PROTECTED] wrote: So? Windows has this thing called the del command that does the same thing as rm. Regards, Adam. Sure it does. I logged into a Win2K box and got help for rmdir/rd: C:\rmdir /? Removes (deletes) a directory. RMDIR [/S] [/Q] [drive:]path RD [/S] [/Q] [drive:]path /S Removes all directories and files in the specified directory in addition to the directory itself. Used to remove a directory tree. /Q Quiet mode, do not ask if ok to remove a directory tree with /S It seems like rmdir /S /Q directory is exactly identical to rm -rf directory. It deletes a directory tree (the -r), and doesn't prompt or display anything (the -f). So, yes, this *CAN* be done on Windows. Sorry if I was wrong about del originally, but my point stands, Windows is not entirely crippled when it comes to the shell :) Regards, Adam. -- 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] running system()
I'm trying to use gpgp to encrypt and decrypt files. I can get it to work if it's a scheduled task, as the user that's running the task isn't the web user, but I was just wondering if there was a way to safely enable system for a shared environment. -Original Message- From: Chris [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 28, 2006 8:01 PM To: Mark Steudel Cc: php-general@lists.php.net Subject: Re: [PHP] running system() Mark Steudel wrote: So I'm trying to run some system commands on the windows box I am working on. And I am getting Unable to fork errors. So after some googling I see that its because the internet guest user needs access to cmd.exe, my question is how safe is it to enable this on a production/shared environment? Anyways pointers to securely setting this up? If it's enabled, it's enabled for everyone. If you're calling system, make sure you use escapeshellarg and escapeshellcmd in the relevant places. That's not going to protect you from other peoples bad code though.. What are you trying to use system() for? Maybe there's a built in function or another way to do what you need. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] running system()
So I'm trying to run some system commands on the windows box I am working on. And I am getting Unable to fork errors. So after some googling I see that its because the internet guest user needs access to cmd.exe, my question is how safe is it to enable this on a production/shared environment? Anyways pointers to securely setting this up? Thanks Mark -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Better way of doing this? (menu and submenus)
You could use a recursive function and keep it all in one table. My Table is similar to the one below: ID NAMEPID DISPLAY_ORDER Here's crude recursive function to display this in a list typical of what you used to style a menu. The great thing about this is that you could have unlimited submenus if you wanted ... function displayMenu( $pid ) { global $db; $res = $db-query( SELECT * FROM tblmenu WHERE pid = '.$pid.' ORDER BY display_order ); mysqlErrorCheck( $res ); while( $res-fetchInto( $objData ) ) { $html .= li.$objData['name']; $html .= ul.displayMenu( $objData['id'] )./ul; $html .= /li; } return $html; } echo ul.displayMenu('0')./ul; -Original Message- From: Ryan A [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 21, 2006 10:51 AM To: Philip Thompson; php-general@lists.php.net Subject: Re: [PHP] Better way of doing this? (menu and submenus) Ryan, I have run into a similar problem with one of the sites I'm designing. Here's the approach I took. You can see if it fits your needs. Here's an example of what I have: MID NAMEPARENT_ID LOCATION 1Homenull index.php 2Productsnull products.php 3Information null info.php 10 Profile 1 profile.php 11 Account 1 account.php 20 Hardware2 hardware.php 21 Software2 software.php 210 M$ Word 21 msword.php 211 iLife 21 ilife.php And I think you get the drift. You can keep getting deeper in the tree structure and not have to worry about adding more tables. Notice that the menu_item_id (MID) actually has some organization to it, but this is completely optional. As the menu items grow, this will probably be more difficult to keep track of. Anyway, hope that helps! @Phillip, Thanks for replying. Because (like you pointed out) the MID can get a little crazy I was thinking of using two tables, one for parent and the other for the children. Also, I forgot to mention in my first post, I am using a p_position (parent position) and c_position (child) for each of the menu items, that way I can do a ORDER BY in my query and it should still look good and changing positions shouldnt be a problem (ask anyone who's married, being flexable in changing positions is VERY important :-D ) Doing an ORDER BY on two tables in also a bit more simple than one (IMHO, feel free to correct me) I really appreciate your input on this as I am in the theory stage while you have actually made something like this, thanks again. @K. Bear - Thanks for the link, I'll check it out as soon as i get a little time. Cheers! Ryan -- - The faulty interface lies between the chair and the keyboard. - Creativity is great, but plagiarism is faster! - Smile, everyone loves a moron. :-) __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- 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] mime.magic adding more types
Hi there, I'm writing some code that looks at a video file given to it and writes up the correct embed html and outputs it to the browser. I though that I would use mime_content_type() function to detect the type of each video, but after enabling it, I found that it doesn't have the mime type for windows media player. After some researching I had some following questions: 1. Can someone explain what each column means in the magic.mime file: 0 short 0143561 application/x-bcpio 2. Does anyone have any windows media, realplayer mime types they'd like to share for the magic.mime file 3. I saw that the mime_type extension have been deprecated in favor of pecl fileinfo, is installing and using the pecl extension as easy as pear install fileinfo? Does it detect windows media, real player, and quicktime videos? 4. Any other suggestions on detecting what type of video file is being processed? I suppose looking at file extensions is another method, though I like the idea of mime type detection over file extension examination. Thanks, Mark -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Creating EPS files with PHP
Is it possible to create EPS or TIFF files with a image libraries like GD or ImageMagik? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Creating EPS files with PHP
I did, that link didn't seem to actually talk about the ability to create new TIFF images and didn't mention EPS at all, did I miss something on that page? Thanks, Mark -Original Message- From: Jay Blanchard [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 09, 2006 2:14 PM To: Mark Steudel; php-general@lists.php.net Subject: RE: [PHP] Creating EPS files with PHP [snip] Is it possible to create EPS or TIFF files with a image libraries like GD or ImageMagik? [/snip] You Googled, right? http://www.mcs.vuw.ac.nz/technical/software/PHP/ref.image.html -- 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] mccabes complexity parser
I was wondering if anyone knew of a program that I could run my scripts through and it would return mccabes complexity metric on it ... Thanks, Mark -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] ojbect substitute for array map?
Is there a substitute function for arraymap that one can use on ojbects? Mark
[PHP] phpmailer subject line wierdness
I know that there is a phpmailer list, but it's pretty low volume, so I hoped you all might have some ideas on this. If I set the subject line for a mail like: $mail-Subject = 'Jconnect Passover Registration Confirmation'; The email never send, but if I stick a letter between O and N it goes out: $mail-Subject = 'Jconnect Passover Registration Confirmatioan'; Any ideas? Does the 'on' translate to some weird line end character? Can I try and re-encode it or something? Mark
[PHP] mktime month
Im a little confused on the number I should use for the month: Take the following: echo date('Ymd', mktime(0, 0, 0, 3, 0, date(Y)) ); I expected it to output: 20060331 But instead it outputs 20060228. In the examples for january in the php manual I get december instead of january. Is there a server config or any ideas what I am doing wrong? Thanks, Mark
[PHP] Understanding system multiple steps
So I am using system() to try and access sftp from my php scripts. How do I do multiple steps once I've initiated my command e.g. $file = 'filname.txt'; system( C:\sftp\sftp.exe login flags | put .$file ); Im on a windows box, so I don't know if I can do something like this ... anyway any help would be ppreciated THanks
[PHP] Coding Practice: Use global $var or pass in by refernce
I was wondering what the general rule on using the global driective versus passing in a variable by reference, why you should or shouldn't, etc. e.g. function () { global $db; $res = $db-query( SQL); } or function ( $db ) { $res = $db-query( SQL); } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] array_map help
I've got the following code and I am not doing something right. Either my function is wrong, or the way Im using array_map is wrong, as slashes are still making it into the data, and the asdf iosn't getting appended to each value. Thanks, Mark // function to remove stripped slashes function detectMGQ($value) { // Stripslashes if (get_magic_quotes_gpc()) { $value = stripslashes($value); } // added in to detect if this function is working $value .= $value.'asdf'; return $value; } // construct field and value pairs into array $field_values = array( 'name' = $clean[name], 'email' = $clean[email], 'username' = $clean[username], 'accesslevel' = $clean[accesslevel], 'status'= $clean[status], 'password' = base64_encode(rc4($clean[password1])) ); // walk through the values and strip out the slashses $field_values = array_map( detectMGQ, $field_values ); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] array_map help
Thank you I will give it a try. -Original Message- From: Jochem Maas [mailto:[EMAIL PROTECTED] Sent: Friday, February 17, 2006 9:24 AM To: Mark Steudel Cc: php-general@lists.php.net Subject: Re: [PHP] array_map help Mark Steudel wrote: I've got the following code and I am not doing something right. Either my function is wrong, or the way Im using array_map is wrong, as slashes are still making it into the data, and the asdf iosn't getting appended to each value. I rewrote what you had like so: ?php function detectMGQ($value) { //return get_magic_quotes_gpc() ? stripslashes($value): $value; return $value.-TEST; } $clean = array( name = name, email = email, username = username, accesslevel = accesslevel, status= status, ); $field_values = array_map( detectMGQ, $clean ); var_dump($field_values); ? and it adds '-TEST' to every value as expected. not sure whats going wrong with your code exactly by I have got some general comments... (maybe the code I rewrote helps you to figure otu what was/is going wrong.) Thanks, Mark // function to remove stripped slashes function detectMGQ($value) { // Stripslashes if (get_magic_quotes_gpc()) { $value = stripslashes($value); } // added in to detect if this function is working $value .= $value.'asdf'; if $value equals ABC then it would equal ABCABCasdf aftyer that last line of code was run. return $value; } // construct field and value pairs into array $field_values = array( 'name' = $clean[name], 'email' = $clean[email], yuou don't need to wrap $clean[email] in quotes - it's waste of time+cpu BUT you should always delimit the array key with quotes because it is a string not a constant (or does you code actually define a constant named 'email'?) i.e. $clean[email] is better off being $clean['email'] 'username' = $clean[username], 'accesslevel' = $clean[accesslevel], 'status'= $clean[status], 'password' = base64_encode(rc4($clean[password1])) ); // walk through the values and strip out the slashses $field_values = array_map( detectMGQ, $field_values ); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] array_map help
I figured out that nothing was wrong with this (other than the other things you pointed out) and that I was just uploading the wrong file to the wrong place ... oops Thanks again, Mark -Original Message- From: Jochem Maas [mailto:[EMAIL PROTECTED] Sent: Friday, February 17, 2006 9:24 AM To: Mark Steudel Cc: php-general@lists.php.net Subject: Re: [PHP] array_map help Mark Steudel wrote: I've got the following code and I am not doing something right. Either my function is wrong, or the way Im using array_map is wrong, as slashes are still making it into the data, and the asdf iosn't getting appended to each value. I rewrote what you had like so: ?php function detectMGQ($value) { //return get_magic_quotes_gpc() ? stripslashes($value): $value; return $value.-TEST; } $clean = array( name = name, email = email, username = username, accesslevel = accesslevel, status= status, ); $field_values = array_map( detectMGQ, $clean ); var_dump($field_values); ? and it adds '-TEST' to every value as expected. not sure whats going wrong with your code exactly by I have got some general comments... (maybe the code I rewrote helps you to figure otu what was/is going wrong.) Thanks, Mark // function to remove stripped slashes function detectMGQ($value) { // Stripslashes if (get_magic_quotes_gpc()) { $value = stripslashes($value); } // added in to detect if this function is working $value .= $value.'asdf'; if $value equals ABC then it would equal ABCABCasdf aftyer that last line of code was run. return $value; } // construct field and value pairs into array $field_values = array( 'name' = $clean[name], 'email' = $clean[email], yuou don't need to wrap $clean[email] in quotes - it's waste of time+cpu BUT you should always delimit the array key with quotes because it is a string not a constant (or does you code actually define a constant named 'email'?) i.e. $clean[email] is better off being $clean['email'] 'username' = $clean[username], 'accesslevel' = $clean[accesslevel], 'status'= $clean[status], 'password' = base64_encode(rc4($clean[password1])) ); // walk through the values and strip out the slashses $field_values = array_map( detectMGQ, $field_values ); -- 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] unsupported binary characters in database,
I found another way to deal with this. And that's to run the encrypted string through base64_encode before inserting into database and running base64_decode when pulling it out of the database. Mark -Original Message- From: Mark Steudel [mailto:[EMAIL PROTECTED] Sent: Sunday, February 12, 2006 11:18 AM To: 'Webmaster'; php-general@lists.php.net Subject: RE: [PHP] unsupported binary characters in database, Hmmm ... I guess that's an idea. Any other ways of dealing with this? -Original Message- From: Webmaster [mailto:[EMAIL PROTECTED] Sent: Saturday, February 11, 2006 6:06 PM To: Mark Steudel Subject: Re: [PHP] unsupported binary characters in database, Mark Steudel wrote: I have the following encryption function: function RC4( $data) { //ecncrypt $data with the key in $keyfile with an rc4 algorithm $pwd = implode('', file(/key.php')); $pwd_length = strlen($pwd); for ($i = 0; $i 255; $i++) { $key[$i] = ord(substr($pwd, ($i % $pwd_length)+1, 1)); $counter[$i] = $i; } for ($i = 0; $i 255; $i++) { $x = ($x + $counter[$i] + $key[$i]) % 256; $temp_swap = $counter[$i]; $counter[$i] = $counter[$x]; $counter[$x] = $temp_swap; } for ($i = 0; $i strlen($data); $i++) { $a = ($a + 1) % 256; $j = ($j + $counter[$a]) % 256; $temp = $counter[$a]; $counter[$a] = $counter[$j]; $counter[$j] = $temp; $k = $counter[(($counter[$a] + $counter[$j]) % 256)]; $Zcipher = ord(substr($data, $i, 1)) ^ $k; $Zcrypt .= chr($Zcipher); } return $Zcrypt; } source: zend code gallery When I encrypt a string that ends in e it shows up as a space in the database, when I pull it back out of the database, the string is missing the e. I tried converting the field in the database to a blob and that didn't work either. My next idea is to add a bin2hex and then a hex2bin: function hex2bin($hexdata) { $bindata=; for ($i=0;$istrlen($hexdata);$i+=2) { $bindata.=chr(hexdec(substr($hexdata,$i,2))); } return $bindata; } source: phil at internetprojectmanagers dot com I was hoping to get some feedback if this is a good way to go about this. Thanks, Mark Just add a different letter to the end of the string. So long as it isn't e it should be ok yeah? -- 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] testing text body emails
Im using phpmailer to send emails, with htmlbody and an alternate textbody. Any suggestions on how to test the text only body? Thanks, Mark
RE: [PHP] unsupported binary characters in database,
Hmmm ... I guess that's an idea. Any other ways of dealing with this? -Original Message- From: Webmaster [mailto:[EMAIL PROTECTED] Sent: Saturday, February 11, 2006 6:06 PM To: Mark Steudel Subject: Re: [PHP] unsupported binary characters in database, Mark Steudel wrote: I have the following encryption function: function RC4( $data) { //ecncrypt $data with the key in $keyfile with an rc4 algorithm $pwd = implode('', file(/key.php')); $pwd_length = strlen($pwd); for ($i = 0; $i 255; $i++) { $key[$i] = ord(substr($pwd, ($i % $pwd_length)+1, 1)); $counter[$i] = $i; } for ($i = 0; $i 255; $i++) { $x = ($x + $counter[$i] + $key[$i]) % 256; $temp_swap = $counter[$i]; $counter[$i] = $counter[$x]; $counter[$x] = $temp_swap; } for ($i = 0; $i strlen($data); $i++) { $a = ($a + 1) % 256; $j = ($j + $counter[$a]) % 256; $temp = $counter[$a]; $counter[$a] = $counter[$j]; $counter[$j] = $temp; $k = $counter[(($counter[$a] + $counter[$j]) % 256)]; $Zcipher = ord(substr($data, $i, 1)) ^ $k; $Zcrypt .= chr($Zcipher); } return $Zcrypt; } source: zend code gallery When I encrypt a string that ends in e it shows up as a space in the database, when I pull it back out of the database, the string is missing the e. I tried converting the field in the database to a blob and that didn't work either. My next idea is to add a bin2hex and then a hex2bin: function hex2bin($hexdata) { $bindata=; for ($i=0;$istrlen($hexdata);$i+=2) { $bindata.=chr(hexdec(substr($hexdata,$i,2))); } return $bindata; } source: phil at internetprojectmanagers dot com I was hoping to get some feedback if this is a good way to go about this. Thanks, Mark Just add a different letter to the end of the string. So long as it isn't e it should be ok yeah? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] unsupported binary characters in database,
I have the following encryption function: function RC4( $data) { //ecncrypt $data with the key in $keyfile with an rc4 algorithm $pwd = implode('', file(/key.php')); $pwd_length = strlen($pwd); for ($i = 0; $i 255; $i++) { $key[$i] = ord(substr($pwd, ($i % $pwd_length)+1, 1)); $counter[$i] = $i; } for ($i = 0; $i 255; $i++) { $x = ($x + $counter[$i] + $key[$i]) % 256; $temp_swap = $counter[$i]; $counter[$i] = $counter[$x]; $counter[$x] = $temp_swap; } for ($i = 0; $i strlen($data); $i++) { $a = ($a + 1) % 256; $j = ($j + $counter[$a]) % 256; $temp = $counter[$a]; $counter[$a] = $counter[$j]; $counter[$j] = $temp; $k = $counter[(($counter[$a] + $counter[$j]) % 256)]; $Zcipher = ord(substr($data, $i, 1)) ^ $k; $Zcrypt .= chr($Zcipher); } return $Zcrypt; } source: zend code gallery When I encrypt a string that ends in e it shows up as a space in the database, when I pull it back out of the database, the string is missing the e. I tried converting the field in the database to a blob and that didn't work either. My next idea is to add a bin2hex and then a hex2bin: function hex2bin($hexdata) { $bindata=; for ($i=0;$istrlen($hexdata);$i+=2) { $bindata.=chr(hexdec(substr($hexdata,$i,2))); } return $bindata; } source: phil at internetprojectmanagers dot com I was hoping to get some feedback if this is a good way to go about this. Thanks, Mark -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Wysiwyg editors?
Doesn't look like SPAW is XHTML complient, just doing a 10 second glance at the html it generates. -Original Message- From: Angelo Zanetti [mailto:[EMAIL PROTECTED] Sent: Friday, February 03, 2006 4:21 AM To: John Nichel Cc: php-general@lists.php.net Subject: Re: [PHP] Wysiwyg editors? also www.solmetra.com check it out,the product is called SPAW.ciao John Nichel wrote: William Stokes wrote: Hello, Once again no PHP question... snip Well, at least you warned me so that I could stop reading now. -- 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] Time estimating for PM's/Clients
I am interested in finding out what standards/formulas other PHP programmers/departments out there are using to accurately provide time estimates on modules to their PM's/Clients. Any suggested reading books or sites? Do time estimate theories in other langauges apply to web and php programming or are they out dated? THanks in advance.
RE: [PHP] Use VAR string value AS VAR Name
Either try: $sid_pro = p.$sid_pro; or try: input name='.$p{$sid_pro}.' type= 'radio' value='SOLVE_ME'/ -Original Message- From: Fernando Anchorena [mailto:[EMAIL PROTECTED] Sent: Wednesday, January 25, 2006 4:12 PM To: php-general@lists.php.net Subject: [PHP] Use VAR string value AS VAR Name I'm stuck trying to get work this : This is an example page1.php === form action=/page2.php?form=yes method=post $sql_pro =SELECT Sid FROM table; $res_pro = @mysql_query( $sql_pro); while ($campo_pro = @mysql_fetch_array($res_pro)) { $sid_pro = $campo_pro[Sid]; // *sid_pro = 4* $sid_pro = 'p'.$sid_pro; // I'm trying to use de value of $sid_pro as a VAR name *$sid_pro = p4* print td *input name='$sid_pro' type= 'radio' value='SOLVE_ME'/* /td; // *name=p4 * BLA BLA BLA } SUBMIT FORM === page2.php === $sqlname = SELECT Sid FROM Table; $res = mysql_query ($sqlname) ; while ($campo_pro = mysql_fetch_array($res)) { $name1 = $campo_pro[Sid]; // *$name1 = 4* $radio = '$'.'p'.$name1 ; // *$radio = $p4 -- Now the Problem **How can I get the Value SOLVE_ME from the submited form ?* } == Thanks in Advance. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Use VAR string value AS VAR Name
Sorry I totally didn't read the question fully -Original Message- From: Mark Steudel [mailto:[EMAIL PROTECTED] Sent: Wednesday, January 25, 2006 4:28 PM To: php-general@lists.php.net Subject: RE: [PHP] Use VAR string value AS VAR Name Either try: $sid_pro = p.$sid_pro; or try: input name='.$p{$sid_pro}.' type= 'radio' value='SOLVE_ME'/ -Original Message- From: Fernando Anchorena [mailto:[EMAIL PROTECTED] Sent: Wednesday, January 25, 2006 4:12 PM To: php-general@lists.php.net Subject: [PHP] Use VAR string value AS VAR Name I'm stuck trying to get work this : This is an example page1.php === form action=/page2.php?form=yes method=post $sql_pro =SELECT Sid FROM table; $res_pro = @mysql_query( $sql_pro); while ($campo_pro = @mysql_fetch_array($res_pro)) { $sid_pro = $campo_pro[Sid]; // *sid_pro = 4* $sid_pro = 'p'.$sid_pro; // I'm trying to use de value of $sid_pro as a VAR name *$sid_pro = p4* print td *input name='$sid_pro' type= 'radio' value='SOLVE_ME'/* /td; // *name=p4 * BLA BLA BLA } SUBMIT FORM === page2.php === $sqlname = SELECT Sid FROM Table; $res = mysql_query ($sqlname) ; while ($campo_pro = mysql_fetch_array($res)) { $name1 = $campo_pro[Sid]; // *$name1 = 4* $radio = '$'.'p'.$name1 ; // *$radio = $p4 -- Now the Problem **How can I get the Value SOLVE_ME from the submited form ?* } == Thanks in Advance. -- 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] Variable variables
I was wondering if you could create variable variables for objects, please see examples below, Im having problems getting it to work. $data['fieldname'] = foo; // without variable variables $res = $db-query( SELECT foo FROM table ); while( $res-fetchInto( $db_data ) ) { echo $db_data-foo; // pretend this echos bar } // with variable variables $varVar = '$db_data-'.$data['fieldname']; // should be $db_data-foo $res = $db-query( SELECT foo FROM table ); while( $res-fetchInto( $db_data ) ) { echo ${$varVar}; // would like this to echo bar } Thanks, Mark
RE: [PHP] Floating numbers truncating to two digits without rounding
Thanks for the info -Original Message- From: tedd [mailto:[EMAIL PROTECTED] Sent: Monday, January 09, 2006 3:26 PM To: php-general@lists.php.net; Mark Steudel Subject: Re: [PHP] Floating numbers truncating to two digits without rounding I am calculating things like tax and want to format them so they only have 2 digits past the decimal point. I've been using sprintf but just noticed that it tends to round up. I want the same functionlity without rounding. Mark: Rounding? You can try round(), such as: ?php echo round(3.4); // 3 echo round(3.5); // 4 echo round(3.6); // 4 echo round(3.6, 0); // 4 echo round(1.95583, 2); // 1.96 echo round(1241757, -3); // 1242000 echo round(5.045, 2);// 5.05 echo round(5.055, 2);// 5.06 ? But, as you can see, this rounds up (not the best). You may want to consider that there is more than one way to round a number. For example, there is no completely accurate solution for rounding any real number. If you want absolute precision, then you must use absolute numbers to whatever precision they are. However, this may not be obtainable because of continuos numbers like pi. As such, you may be forced to round. There are several different algorithms for rounding, such as truncation, floor (rounding down), ceiling (round up), common, and statistical. None are perfect, but some are more prone to errors than others. The least prone to error is the statistical, please review: Statisticians method of rounding: http://en.wikipedia.org/wiki/Rounding And, if you ignore rounding, please review: http://www.ima.umn.edu/~arnold/disasters/disasters.html http://catless.ncl.ac.uk/php/risks/search.php?query=rounding tedd -- http://sperling.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] [QF] I would like to change the javascript validation function
I want to add a few lines to the javascript validation function and I was wondering if anyone had any easy ideas on the easiest way to do it. Should I dig into the classes and edit there, or is there a way to replace it by extending the class or something. Thanks, Mark
RE: [PHP] [QF] I would like to change the javascript validation function
Sorry wrong list. -Original Message- From: Mark Steudel [mailto:[EMAIL PROTECTED] Sent: Tuesday, January 10, 2006 10:27 AM To: php-general@lists.php.net Subject: [PHP] [QF] I would like to change the javascript validation function I want to add a few lines to the javascript validation function and I was wondering if anyone had any easy ideas on the easiest way to do it. Should I dig into the classes and edit there, or is there a way to replace it by extending the class or something. Thanks, Mark -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Floating numbers truncating to two digits without rounding
I am calculating things like tax and want to format them so they only have 2 digits past the decimal point. I've been using sprintf but just noticed that it tends to round up. I want the same functionlity without rounding. Thanks
[PHP] Timezone and DST
Hi All, I've got a little problem where our servers are in PST but the customer operates in Hawaii (-10 GMT). I believe I can just get the time for them by doing something like date(d H i, strtotime('now -2 hours') ); But here's the catch, how should I deal with day light savings ( DST) . In hawaii they don't observer DST, but in Washington State we do. We're on php 4.x so I can't use the date_default_timezone_set http://us2.php.net/manual/en/function.date-default-timezone-set.php that was added in PHP 5 Thanks, Mark -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Timezone and DST
Im just using it to set defaults on a QuickForm date element. -Original Message- From: Mike Tuller [mailto:[EMAIL PROTECTED] Sent: Thursday, January 05, 2006 11:02 AM To: Mark Steudel Cc: php-general@lists.php.net Subject: Re: [PHP] Timezone and DST Are you just displaying the time, or is this for submission in a database? On Jan 5, 2006, at 12:50 PM, Mark Steudel wrote: Hi All, I've got a little problem where our servers are in PST but the customer operates in Hawaii (-10 GMT). I believe I can just get the time for them by doing something like date(d H i, strtotime('now -2 hours') ); But here's the catch, how should I deal with day light savings ( DST) . In hawaii they don't observer DST, but in Washington State we do. We're on php 4.x so I can't use the date_default_timezone_set http://us2.php.net/manual/en/function.date-default-timezone- set.php that was added in PHP 5 Thanks, Mark -- 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] Storing encrypted data into mysql: blob vs bin2hex
I have the following encryption function. And what I wanted to know is, Do I need to convert this to hex before storing this in a mysql database? Or could I store it into a blob and be fine? // from zend code gallery function RC4($keyfile, $data) { //ecncrypt $data with the key in $keyfile with an rc4 algorithm $pwd = implode('', file($keyfile)); $pwd_length = strlen($pwd); for ($i = 0; $i 255; $i++) { $key[$i] = ord(substr($pwd, ($i % $pwd_length)+1, 1)); $counter[$i] = $i; } for ($i = 0; $i 255; $i++) { $x = ($x + $counter[$i] + $key[$i]) % 256; $temp_swap = $counter[$i]; $counter[$i] = $counter[$x]; $counter[$x] = $temp_swap; } for ($i = 0; $i strlen($data); $i++) { $a = ($a + 1) % 256; $j = ($j + $counter[$a]) % 256; $temp = $counter[$a]; $counter[$a] = $counter[$j]; $counter[$j] = $temp; $k = $counter[(($counter[$a] + $counter[$j]) % 256)]; $Zcipher = ord(substr($data, $i, 1)) ^ $k; $Zcrypt .= chr($Zcipher); } return $Zcrypt; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] http curl to https is that a secure connection?
I was curious, if have a page at http and it initiates a curl session to a https, is the information sent secure or open because the the curl session is from a unecrypted page? Mark
RE: [PHP] Re: Invalid argument supplied for foreach()
Something that I use to make sure I don't give the user a nicer error If ( is_array( $array ) ) { foreach ( $array as $key = $value ) { echo } } Else { exit('Expecting array') } -Original Message- From: David Robley [mailto:[EMAIL PROTECTED] Sent: Monday, December 19, 2005 5:21 PM To: php-general@lists.php.net Subject: [PHP] Re: Invalid argument supplied for foreach() Jose Borquez wrote: I am getting the following errors when accessing a php page: /usr/local/www/groupoffice-com-2.14-FINAL-4/configuration/index.php(29 9) : Warni ng - Invalid argument supplied for foreach() [Mon Dec 19 15:10:52 2005] [error] PHP Warning: Invalid argument supplied for f oreach() in /usr/local/www/groupoffice-com-2.14-FINAL-4/configuration/index.php on line 299 I solved previous php error problem by installing the php5-extensions, but now I am getting the following errors in my log files and I have no idea what it could be. Any help would be greatly appreciated. Thanks in advance, Jose foreach expects to have an array passed as its argument; the error message suggests that what it is receiving is not an array. Without seeing your code, the only suggestion we could make (well, me anyway) is to check what is actually being passed, with print_r or var_dump. Cheers -- David Robley Support bacteria - it's the only culture some people have! -- 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] broken code....
What did you do to fix it? -Original Message- From: Eternity Records Webmaster [mailto:[EMAIL PROTECTED] Sent: Saturday, December 10, 2005 7:10 PM To: php-general@lists.php.net Subject: RE: [PHP] broken code Got it fixed now... tnx... -Original Message- From: Ben Blay [mailto:[EMAIL PROTECTED] Sent: Friday, December 09, 2005 9:46 AM To: Mark Steudel Cc: php-general@lists.php.net Subject: Re: [PHP] broken code I believe the difference between using = and = is that the former passes the value by reference, though I've never been clear about the benefits of using one over the other when it comes to PEAR:DB (the PEAR:DB documentation uses = extensively, so presumably it is the better method). Ben On 12/8/05, Mark Steudel [EMAIL PROTECTED] wrote: Good catch: So I normally do $results = $db-query ( SELECT * FROM table ); What is the difference between using the and not using the . -Original Message- From: Ben Blay [mailto:[EMAIL PROTECTED] Sent: Thursday, December 08, 2005 10:27 AM To: php-general@lists.php.net Subject: Re: [PHP] broken code $results-query('select * from eternityrecords.journal'); Should this not be: $results = $db-query('select * from eternityrecords.journal'); See: http://pear.php.net/manual/en/package.database.db.db-result.fetchinto. php Ben -- 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 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 General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] broken code....
What happens when you print out journal?: print_r( $journal ); Are your keys the exact case as your table fields? ID vs id or Date vs date -Original Message- From: Eternity Records Webmaster [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 07, 2005 11:31 PM To: php-general@lists.php.net Subject: [PHP] broken code I have this code that doesnt print the db results like they should... it uses pear::db package for the database. Was wondering if anybody can figure out how come it doesnt work... ?php require_once 'DB.php'; error_reporting('E_ALL'); $db = DB::connect('mysql://root:[EMAIL PROTECTED]/eternityrecords'); if (PEAR::isError($db)) { die($db-getMessage()); } $results-query('select * from eternityrecords.journal'); if (PEAR::isError($results)) { die($db-getMessage()); } //test the results out.. ? table ?php while($results-fetchInto($journal, DB_FETCHMODE_ASSOC)){ ? tr td?php echo $journal['ID']; ?/td td ?php echo $journal['Date']; ? /td td ?php echo $journal['Subject']; ? /td td ?php echo $journal['Entry']; ? /td /tr ?php }? /table ?php $db-disconnect(); ? -- 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] broken code....
Good catch: So I normally do $results = $db-query ( SELECT * FROM table ); What is the difference between using the and not using the . -Original Message- From: Ben Blay [mailto:[EMAIL PROTECTED] Sent: Thursday, December 08, 2005 10:27 AM To: php-general@lists.php.net Subject: Re: [PHP] broken code $results-query('select * from eternityrecords.journal'); Should this not be: $results = $db-query('select * from eternityrecords.journal'); See: http://pear.php.net/manual/en/package.database.db.db-result.fetchinto.php Ben -- 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] What software do you use for writing PHP?
It's not a full FTP client, you can't set permissions in it. I think that's a major minus in DW's favor. Especially if you don't have access to ssh into your machine ... -Original Message- From: Michael Hulse [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 06, 2005 10:09 PM To: 'php' Subject: Re: [PHP] What software do you use for writing PHP? On Dec 6, 2005, at 9:25 AM, Mark Steudel wrote: I primarily code in Dreamweaver 8. Two of my favorite features that were added from MX are as follows: 1. Code folding, basically you can collapse blocks of code. If you have to work with other peoples code, matching braces and code folding is an awesome way of just seeing the logical flow of the code, and hide all the details. DW 8 code folding is great because you can select any amount of code and collapse it. The bummer about dreamweaver is that it doesn't detect functions and add a collapse handle to it like Zend Studio, or have the default to automatically collapse functions when you open a page like Zend Studio. Sah-wt! I have yet to upgrade. Waiting to get a new puter. :) Code-folding sound fricken cool! I am pretty stoked that they finally fixed the crappy built-in ftp. But, can you set permissions? I wonder if there is a plugin for DW8 that will detect functions? Me = googling. M -- 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] What software do you use for writing PHP?
I primarily code in Dreamweaver 8. Two of my favorite features that were added from MX are as follows: 1. Code folding, basically you can collapse blocks of code. If you have to work with other peoples code, matching braces and code folding is an awesome way of just seeing the logical flow of the code, and hide all the details. DW 8 code folding is great because you can select any amount of code and collapse it. The bummer about dreamweaver is that it doesn't detect functions and add a collapse handle to it like Zend Studio, or have the default to automatically collapse functions when you open a page like Zend Studio. 2. The built in FTP client. You can set it so that when you save it auto uploads the file to the site. They also put the upload/download process into a separate process. This means that you can download or upload a bunch of files and still continue to work on files. One thing that bugs me is that the dialogue box always comes up and you have to click around or minimize it to hide it, why isn't there an option to just keep it hidden on upload? I used Zend Studio for a month, in hopes that I would be able to figure out how to install the whole IDE with server on my machine. I wanted to use the debugging features in it, but I have never been able to get all the pieces installed correctly AND gotten a work flow down where I could use the debugger effectively. ZS has code folding too, but just for functions. Someone else mentioned support for phpDoc, this is an awesome time saver if you want to provide clear documentation in phpdoc format. One big bummer on ZS was that it didn't have a built in FTP client. A work around is to work directly off the server. I tried Magumas Workbench product for a little bit, but it seemed very mickey mouse compared to ZS and DW. But I'm sure it's really a good product and I just didn't' give it a chance. I have a soft spot for CoffeeCup editor as it was my first editor beyond notepad. I still download each update and install it, though I never use it anymore Mark -Original Message- From: Jeff McKeon [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 06, 2005 6:15 AM To: php Subject: [PHP] What software do you use for writing PHP? Hey all, Forever now I've been using Frontpage for all my web work including php. I'm sure there's better software out there that is more suited to writing and editing PHP pages. What do you all use? Thanks, Jeff -- 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] What software do you use for writing PHP?
When you say SlickEdit has a ftp client built in, is it a separate window that gets launched, or is it more integrated, like you can just right click on your list of files and say put these files up on the server. For me just being able to save and have the file get uploaded saves me a lot of extra clicks. DW's synchornization features are also handy if you are trying to get just the lastest files instead of the whole site. -Original Message- From: Chris Boget [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 06, 2005 10:11 AM To: Mark Steudel; 'Jeff McKeon'; 'php' Subject: Re: [PHP] What software do you use for writing PHP? I primarily code in Dreamweaver 8. Two of my favorite features that were added from MX are as follows: 1. Code folding, basically you can collapse blocks of code. SlickEdit has this feature. 2. The built in FTP client. This one as well. I used Dreamweaver a while back (admittedly an older version) but I couldn't stand it. But that's IMO. thnx, Chris -- 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] Redirects Safari vs Others
Sorry it took me so long, I wasn't sure where the problem lay and couldn't get you the exact code, but I figured out why (sorta) this was happening. // Causes only Safiri to bomb header(location: .$_SERVER['PHP_SELF'].?action=listentriescategoryid=.$id.page=.$pagei d); exit; Headers: http://www.domain.org/page.php?action=subcategoryid=7page=33 GET /page.php?action=subcategoryid=7page=33 HTTP/1.1 Host: www.domain.org User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.12) Gecko/20050915 Firefox/1.0.7 Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q= 0.8,image/png,*/*;q=0.5 Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive Referer: http://www.domain.org/page.php?page=33 Cookie: PHPSESSID=cff99c9147d0741d6e48368f72951ef4 HTTP/1.x 302 OK Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma: no-cache Content-Length: 188 Content-Type: text/html Expires: Thu, 19 Nov 1981 08:52:00 GMT // NOTE HERE NO PAGE REFERENCED Location: ?action=listentriescategoryid=10page=33 Server: Microsoft-IIS/6.0 X-Powered-By: PHP/4.4.0, ASP.NET Date: Tue, 06 Dec 2005 19:01:00 GMT // Doesn't cause Safari to bomb header(location: page.php?action=listentriescategoryid=.$id.page=.$pageid); exit; Headers: http://www.domain.org/page.php?action=subcategoryid=7page=33 GET /page.php?action=subcategoryid=7page=33 HTTP/1.1 Host: www.domain.org User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.12) Gecko/20050915 Firefox/1.0.7 Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q= 0.8,image/png,*/*;q=0.5 Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive Referer: http://www.domain.org/page.php?page=33 Cookie: PHPSESSID=cff99c9147d0741d6e48368f72951ef4 HTTP/1.x 302 OK Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma: no-cache Content-Length: 188 Content-Type: text/html Expires: Thu, 19 Nov 1981 08:52:00 GMT // NOW ITS FINE Location: page.php?action=listentriescategoryid=10page=33 Server: Microsoft-IIS/6.0 X-Powered-By: PHP/4.4.0, ASP.NET Date: Tue, 06 Dec 2005 19:01:00 GMT Firefox and IE, I guess, assume where they are supposed to go, where as Safari was just like no idea BOOM. So it seems to me that the browser or the script has no idea what PHPSELF is untill the script finishes executing... Input would be welcome. -Original Message- From: Brent Baisley [mailto:[EMAIL PROTECTED] Sent: Monday, December 05, 2005 12:15 PM To: Mark Steudel Cc: php-general@lists.php.net Subject: Re: [PHP] Redirects Safari vs Others Probably not a PHP problem. And probably can't help without seeing your redirect code. I've never had a problem with redirects in any browser Safari or otherwise, but I always make sure I redirect with a full URL rather than a relative URL. On Dec 5, 2005, at 1:29 PM, Mark Steudel wrote: I was wondering if folks have experienced infinite redirection loops with Safari where other browsers don't encounter the same problems. This is what safari spits out http://www.domain.com/microlibrary.php?action=subcategoryid=7top=% 2Fpage.p hp%3Fpage%3D33page=33?action=listentriescategoryid=7top=/ page.php?page=33 page=33?action=listentriescategoryid=7top=/page.php? page=33page=33?actio n=listentriescategoryid=7top=/page.php?page=33page=33? action=listentries categoryid=7top=/page.php?page=33page=33? action=listentriescategoryid=7t op=/page.php?page=33page=33?action=listentriescategoryid=7top=/ page.php?p age=33page=33?action=listentriescategoryid=7top=/page.php? page=33page=33 ?action=listentriescategoryid=7top=/page.php?page=33page=33? action=listen triescategoryid=7top=/page.php?page=33page=33? action=listentriescategory id=7top=/page.php?page=33page=33? action=listentriescategoryid=7top=/page .php?page=33page=33?action=listentriescategoryid=7top=/page.php? page=33p age=33?action=listentriescategoryid=7top=/page.php? page=33page=33?action= listentriescategoryid=7top=/page.php?page=33page=33? action=listentriesca tegoryid=7top=/page.php?page=33page=33? action=listentriescategoryid=7top =/page.php?page=33page=33 I'm sure this is a coding problem on my part but it's interesting that it doesn't happen in firefox or IE. Thanks, Mark -- Brent Baisley Systems Architect Landover Associates, Inc. Search Advisory Services for Advanced Technology Environments p: 212.759.6400/800.759.0577 -- 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] Urlencode vs htmlentities
Lets say I have the following: Current URL: http://www.domain.com/page.php?action=list http://www.domain.com/page.php?action=listtop=/page.php?action=listid=3 top=/page.php?action=listid=3 $top = $_SERVER['PHP_SELF'].'?'.$_SERVER['argv']['0'] Now I want to create a URL with a return link in it a href='.$_SERVER['PHP_SELF'].'?action=addamp;return='.$top.' Add Something /a Should I use htmlentites on $top first? Second let's say instead of constructing a link I want to use a header and redirect someone header(location: page.php?action=addreturn=.$top ); So do I use urlencode here? Lets say I have something that has been htmlentitied, and I want to use a header command, do I htmlentitydecode and then urlencode?
RE: [PHP] Redirects Safari vs Others
You are right, thank you for trying it out and letting me know. I went back and tested this again and it all worked. I then checked out my code where it didn't work and I had moved a single quote outside of the brackets, $_SERVER['PHP_SELF]' ... Oops. -Original Message- From: Dan Lowe [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 06, 2005 12:17 PM To: Mark Steudel Cc: PHP General List Subject: Re: [PHP] Redirects Safari vs Others On Dec 6, 2005, at 2:55 PM, Mark Steudel wrote: Sorry it took me so long, I wasn't sure where the problem lay and couldn't get you the exact code, but I figured out why (sorta) this was happening. // Causes only Safiri to bomb header(location: .$_SERVER['PHP_SELF'].?action=listentriescategoryid=. $id.page=.$pagei d); exit; FWIW, I tried to duplicate this and wasn't able to. Here's a short test script: ?php if ($_GET['action']) echo ok; else header(Location:.$_SERVER['PHP_SELF'].?action=listcat=id); ? When I hit that page, it behaves as expected, redirects to the same page with ?action.. and then it responds by printing 'ok'. This is using PHP 4.3.10 and Safari v2.0.2 (416.13). [EMAIL PROTECTED]:~{0}% telnet dev.tangledhelix.com 80 Trying 205.196.219.129... Connected to dev.tangledhelix.com. Escape character is '^]'. GET /php_self/ HTTP/1.1 Host: dev.tangledhelix.com HTTP/1.1 302 Date: Tue, 06 Dec 2005 20:15:53 GMT Server: Apache/1.3.33 (Unix) DAV/1.0.3 mod_fastcgi/2.4.2 mod_gzip/ 1.3.26.1a PHP/4.3.10 mod_ssl/2.8.22 OpenSSL/0.9.7e X-Powered-By: PHP/4.3.10 Location: /php_self/index.php?action=listcat=id Transfer-Encoding: chunked Content-Type: text/html 0 GET /php_self/index.php?action=listcat=id HTTP/1.1 Host: dev.tangledhelix.com HTTP/1.1 200 OK Date: Tue, 06 Dec 2005 20:16:10 GMT Server: Apache/1.3.33 (Unix) DAV/1.0.3 mod_fastcgi/2.4.2 mod_gzip/ 1.3.26.1a PHP/4.3.10 mod_ssl/2.8.22 OpenSSL/0.9.7e X-Powered-By: PHP/4.3.10 Transfer-Encoding: chunked Content-Type: text/html X-Pad: avoid browser bug 2 ok 0 -- To announce that there must be no criticism of the President, or that we are to stand by the President, right or wrong, is not only unpatriotic and servile, but is morally treasonable to the American public. -Theodore Roosevelt, 1918 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] What software do you use for writing PHP?
Neat, I'll have to check it out. -Original Message- From: Chris Boget [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 06, 2005 12:14 PM To: Mark Steudel; 'php' Subject: Re: [PHP] What software do you use for writing PHP? When you say SlickEdit has a ftp client built in, is it a separate window that gets launched, or is it more integrated, like you can just right click on your list of files and say put these files up on the server. It's integrated. thnx, Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Debuggers on Windows Servers
Anyone out there running debuggers and profilers on your windows boxes? I'd like to start profiling some of my code and use some debuggers. Since we have dev sites on the same box with product sites, I wanted to make sure that before I ask our Sysadmin to install anything that they are stable and easy to install. Any suggetsions out there? Ones that I have run across, xdebug, DBG, Advanced PHP Debugger. Thanks, Mark
RE: [PHP] Classes/Objects - Books/Links?
I took a look at a lot of books at Barnes and Noble and this I thought was the best intro to classes. I think it does a good job of letting you know both how to do things in HP4 and 5. Professional PHP 5 Publisher: Wrox -Original Message- From: Michael Hulse [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 06, 2005 6:37 PM To: php-general@lists.php.net Subject: [PHP] Classes/Objects - Books/Links? Hello, I want to learn about classes and objects in PHP. (IMHO) I would say that my understanding of functions is very good. Any books that you could suggest that specifically address just classes/objects? How-a-bout sites/links/tutorials on the web? I am hoping that by learning how to use classes/objects in PHP I can streamline how I code. Thanks in advance! Cheers, Micky -- ¸.·´¯`·.¸¸(((º`·.¸¸.·´¯`·.¸¸º ·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸º `·.¸¸º¸.·´¯`·.¸¸º -- 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] Mail SMTP settings
Also look at PEAR::Mail. If you search back through this list there was a discussion on peoples preferences. -Original Message- From: Brent Baisley [mailto:[EMAIL PROTECTED] Sent: Monday, December 05, 2005 7:04 AM To: Dan Cc: php-general@lists.php.net Subject: Re: [PHP] Mail SMTP settings There are a lot of limitations in the built-in PHP mail function. If you want more control over how your email is sent, try using phpmailer. It's all php code, so you can customize it to your needs, not that you need to. http://phpmailer.sourceforge.net/ On Dec 3, 2005, at 2:45 AM, Dan wrote: I have a PHP 4.x install on an Apache server. I have a PHP application and a call to the mail function. I have 2 static IP's on the server and I have one web server and one instance of postfix for each IP to basically separate the two sites. The only issue I have right now is sending mail via PHP. I have tried to set the SMTP server and reply address via a php_value in my httpd.conf file and via the ini_set function for my site in question. Regardless of these setting mail is sent from the www user at my main site domain: Return-Path: [EMAIL PROTECTED] Received: from mail.wavefront.ca ([unix socket]) by mail.wavefront.ca (Cyrus v2.2.12-OS X 10.4.0) with LMTPA; Fri, 02 Dec 2005 12:45:07 -0700 I've also tried the IMAP functions but also with no success. I basically want the mail to look as though it was from the other domain. Dan T -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Brent Baisley Systems Architect Landover Associates, Inc. Search Advisory Services for Advanced Technology Environments p: 212.759.6400/800.759.0577 -- 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] Redirects Safari vs Others
I was wondering if folks have experienced infinite redirection loops with Safari where other browsers don't encounter the same problems. This is what safari spits out http://www.domain.com/microlibrary.php?action=subcategoryid=7top=%2Fpage.p hp%3Fpage%3D33page=33?action=listentriescategoryid=7top=/page.php?page=33 page=33?action=listentriescategoryid=7top=/page.php?page=33page=33?actio n=listentriescategoryid=7top=/page.php?page=33page=33?action=listentries categoryid=7top=/page.php?page=33page=33?action=listentriescategoryid=7t op=/page.php?page=33page=33?action=listentriescategoryid=7top=/page.php?p age=33page=33?action=listentriescategoryid=7top=/page.php?page=33page=33 ?action=listentriescategoryid=7top=/page.php?page=33page=33?action=listen triescategoryid=7top=/page.php?page=33page=33?action=listentriescategory id=7top=/page.php?page=33page=33?action=listentriescategoryid=7top=/page .php?page=33page=33?action=listentriescategoryid=7top=/page.php?page=33p age=33?action=listentriescategoryid=7top=/page.php?page=33page=33?action= listentriescategoryid=7top=/page.php?page=33page=33?action=listentriesca tegoryid=7top=/page.php?page=33page=33?action=listentriescategoryid=7top =/page.php?page=33page=33 I'm sure this is a coding problem on my part but it's interesting that it doesn't happen in firefox or IE. Thanks, Mark
Re: [PHP] GD Graph tutorial?
You may have alreayd looked at this class, but this one is great for creating graphs: http://www.aditus.nu/jpgraph/ There are some licensing issues with it so if this is for a company then you probably have to buy a license. Mark -Original Message- From: Ashley M. Kirchner [EMAIL PROTECTED] To: PHP General List php-general@lists.php.net Date: Mon, 05 Dec 2005 19:01:26 -0700 Subject: [PHP] GD Graph tutorial? Does anyone know of a good GD tutorial for creating graphs? I'm looking to create something like the attached one by feeding it the values and have it create the graph. Possibly with multiple lines, different colors, different types of data, etc., etc. -- W | It's not a bug - it's an undocumented feature. + Ashley M. Kirchner mailto:[EMAIL PROTECTED] . 303.442.6410 x130 IT Director / SysAdmin / Websmith . 800.441.3873 x130 Photo Craft Laboratories, Inc. . 3550 Arapahoe Ave. #6 http://www.pcraft.com . . . . Boulder, CO 80303, U.S.A.
Re: [PHP] Writing a mailing list program with php/mysql.
Hi there, There are TONS of tutorials out there on how to store this information into a database instead of just mailing it to your self, just google php and mysql ... First you'll need to create your database using some sort of mysql console (command line, web based like phpMyAdmin, desktop application like navicat or mysql administrator) Your database looks like it only needs a few fields id Email prayer newsletter announce // pulled from php.net // connecto to your database $link = mysql_connect('mysql_host', 'mysql_user', 'mysql_password') or die('Could not connect: ' . mysql_error()); mysql_select_db('my_database') or die('Could not select database'); replace this code = //this is the email message that will be sent $message=$mail. would like to be signed up for the .$list. mailing lists\r\n; //send the email now mail([EMAIL PROTECTED], mailing list request, $message, From: mailing list form[EMAIL PROTECTED]); == End replace code // validate your forms input, could be a function instead if ( $_POST['prayer'] == 'on' ) $prayer = 'yes' else $prayer = 'no'; if ( $_POST['news'] == 'on' ) $news = 'yes' else $news = 'no'; if ( $_POST['announce'] == 'on' ) $announce = 'yes' else $announce= 'no'; // next I'll contruct a query to insert it into my database $query = INSERT INTO newslettertable( id, email, prayer, newsletter, announce) VALUES ( '', '.$mail.', '.$prayer.', '. $news.', '.$announce.' ); // now I'll actually run the query, if there is an error it will spit the error out to the screen $result = mysql_query($query) or die('Query failed: ' . mysql_error()); // How to get the databack out from $query = SELECT * FROM newslettertable WHERE prayer = 'yes'; $result = mysql_query($query) or die('Query failed: ' . mysql_error()); // Now we'll loop through the data while ( $objData = mysql_fetch_object( $result ) ) { mail( $objData-email, 'Prayer Newsletter', 'Prayer newsletter body' ); } Hopefully that gives you a rough idea how little more you need to do to hook it up to a database. Mark -Original Message- From: Eternity Records Webmaster [EMAIL PROTECTED] To: php-general@lists.php.net Date: Sat, 3 Dec 2005 19:24:18 -0500 Subject: [PHP] Writing a mailing list program with php/mysql. Hi. I've written a mailing list form for a website. It currently works by having the subscriber check up to 3 checkboxes depending on the mailing list they want to sign up for (prayer, newsletter and announce). They then type their email address into the email address field and click the subscribe button. After they do that, the php script will check the form for validity and return error if not filled out the right way or it will send an email to me if it worked (in the sence that the form was filled out by the user the right way). What I need to know is: given the code below, are there any examples of php/mysql driven mailing list scripts that I can use as a tutorial on helping me to convert mine to a mysql database driven program? Any ideas/recommendations would be apreciated. Thanks for all the help. The code below if copied and pasted into their own seperate files should work on any apache/php 5.0.5/mysql 3.xx server. mailing_list.html: this file was included in the home page of the website with include(). [code] form action=script/mailinglist.php method=post table border=1 cellspacing=0 cellpadding=2 style=border-color: #600; trth style=background-color: #600; color:#fff; text-align: center; padding: 0 10px;Sign up for the mailing lists!/th/tr trtd input type=checkbox name=prayerE Prayer input type=checkbox name=newsE News input type=checkbox name=announceE Announce /td/tr trtd style=background-color: #fff; text-align: center; padding: 0 10px; p style=margin-bottom: 0; Your email address: input type=text name=emailbr input class=button type=submit value=Sign up now! /br / /p a href=comunity.phpGo to the Online Comunity page to find out more!/abr /td/tr /table /form [end of mailing_list.html code] list_functions.php: the user defined functions created to use in mailinglist.php. [code] ?php //checkemail checks an email address to see if its valid //true if valid and false otherwise function checkemail($email){ if (eregi('[EMAIL PROTECTED]([a-zA-Z]{2,3})$', $email)) { return $email; } else {return false;}} //checklist checks that at least 1 mailing list exists //returns a string containing mailing lists signed up for or null if none checked function checklist($list1, $list2, $list3){ if($list1==on){$final=Prayer\n;} else {$final=;} if($list2==on) {$final.=News\n;} else {$final.=;} if($list3==on) {$final.=announce\n;} else
RE: [PHP] PhpMailer vs Pear:Mail
Would you mind elaborating on why? -Original Message- From: Richard Heyes [mailto:[EMAIL PROTECTED] Sent: Monday, November 28, 2005 12:53 AM To: Cabbar Duzayak Cc: php-general@lists.php.net Subject: Re: [PHP] PhpMailer vs Pear:Mail Cabbar Duzayak wrote: Could you please tell which one you recommend in terms of stability/speed and share your experience in terms of these 2? Ooo, that would have to be PEAR::Mail... -- Richard Heyes http://www.phpguru.org/ -- 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] Adding links to HTML for a CMS
Store each paragraph text in a database Table 1 = tblPage id Name 1 Welcome Page 2 About Page Table 2 = Content id pageid content 1 1 This is some content in a paragraph 2 1 This is some more content 3 1 This is the last content on this page 4 2 Some about content Then when you display your page you pass the page id through the URL like: http://www.domain.com/page.php?pageid=1 // get the page id of course do some validating is_numeric etc $id = $_GET['pageid']; // using pear db package $res = $db-query ( SELECT * FROM tblContent WHERE pageid = '.$id.' ); // loop through data and display it with an edit link while( $res-fetchInto( $objData ) ) { echo p.$objData-content.a href=\edit.php?pageid=.$objData-od.\Edit/a/p; } Your edit page would then have some code that would load the content into a text area or wywsiwig editor or something You would then also have to add functionality where a user could add a paragraph and what order you would want those paragraphs to show up in, delete paragraphs. Hope that helps. Mark -Original Message- From: Shaun [mailto:[EMAIL PROTECTED] Sent: Saturday, November 26, 2005 4:24 AM To: php-general@lists.php.net Subject: [PHP] Adding links to HTML for a CMS Hi, I am trying to create my own CMS. To being with I want to let users edit anything within a p tag. I want to have a menu to the left and display the webpage in the rest of the page, and for each set of p tags I want the user to be able to click on the link to edit that paragraph. My problem is how can I include a webpage in my CMS and for each p tag wrap an a href tag araound it? Thanks for your advice. -- 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] Web based editor
I agree that FCKEditor is kinda slow as well. One of my problems is that it doesn't provide XHTML valid code. But it's a very robust free version. . But it does do some pretty amazing things like allow you to copy and paste from a website directly into the editor, or browse the server etc. Check out: http://www.htmlarea.com/ [http://www.htmlarea.com/] for a large list of free and paid for editors. -Original Message- From: Tom Chubb [EMAIL PROTECTED] To: Todd Cary [EMAIL PROTECTED] Cc: php-general@lists.php.net Date: Sun, 27 Nov 2005 20:44:33 + Subject: Re: [PHP] Web based editor I don't know about TinyMCE - about to look at it, but I have found FCKeditor very slow. HTH On 26/11/05, Todd Cary [EMAIL PROTECTED] wrote: Joe - Thank you. I like how TinyMCE integrates. Todd Joe Wollard wrote: On Nov 26, 2005, at 12:11 PM, Todd Cary wrote: I want to provide the user with an editor like http://209.204.172.137/FCKeditor/_samples/php/sample01.php Is it best to use a JavaScript based editor? Are there some favorites out there or is the FCKeditor about as good as they get? Todd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php I don't know if one is better than the next, but I've used TinyMCE in the past and it has served me well. http://tinymce.moxiecode.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Tom Chubb [EMAIL PROTECTED] 07915 053312
Re: [PHP] Web based editor
Here's one that I haven't used that claims it does XHTML 1.1 strict . It's not free though http://xstandard.com/ -Original Message- From: Curt Zirzow [EMAIL PROTECTED] To: php-general@lists.php.net Date: Sun, 27 Nov 2005 14:54:47 -0800 Subject: Re: [PHP] Web based editor On Sun, Nov 27, 2005 at 12:52:42PM -0800, Mark Steudel wrote: I agree that FCKEditor is kinda slow as well. One of my problems is that it doesn't provide XHTML valid code. But it's a very robust free version. . But it does do some pretty amazing things like allow you to copy and paste from a website directly into the editor, or browse the server etc. I wouldn't expect any wysiwyg editor to comply to any standard. Curt. -- cat .signature: No such file or directory -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Web based editor
Wow cool, looks nice. Our company does a lot of CMS stuff and I'm not a great fan of FCKeditor so far and am always on the look out for something better. -Original Message- From: Greg Donald [EMAIL PROTECTED] To: php-general@lists.php.net Date: Sun, 27 Nov 2005 19:16:47 -0600 Subject: Re: [PHP] Web based editor On Sun, 2005-11-27 at 14:54 -0800, Curt Zirzow wrote: I wouldn't expect any wysiwyg editor to comply to any standard. Tiny MCE seems to make an attempt at XHTML 1.0: http://tinymce.moxiecode.com/tinymce/docs/option_valid_elements.html Having a copy of the 1216 page XHTML Black Book here on my desk makes me think their XHTML validation list is a bit incomplete, but it does look like they have the most common elements in there. I've tried lots of javascript wysiwyg editors. Tiny MCE is my pick. Fast and very customizable. The cleanup functionality works great with non-techies who like to draft stuff in MS Word first. -- Greg Donald Zend Certified Engineer MySQL Core Certification http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php