Re: [PHP] mutliple select form not passing multiple values
Ah-ha! I missed that, and I always do. Let's hope I don't anymore. While we're on the subject, why is PHP set up this way? Why can't it just add the elements to the array automatically, since adding the square brackets to one's HTML form name is not a standard practice? Richard Davey wrote: Hello Ben, Wednesday, February 11, 2004, 9:22:33 PM, you wrote: BR Am I doing something wrong? Yup :) It needs to be: select name=modules[] ... Note the change in name from modules to modules[] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP License question
I currently developing a project that I wish to release under a, preferably, open-source and copy-left license. So, I'm taking a close look at the GNU GPL for this, and it seems to serve this purpose, well. However, I am aware that the PHP license conflicts with the GNU GPL, and, thus, anything released under the PHP license cannot also be released in software under the GPL. At least, this is my assumption. Now, to my question: if a PEAR package is released under the PHP license, and my product is under the GPL, can I include the PEAR package in my product? Under the above assumption, the answer would be no. So, what license should I release my product under to maintain it's copy-left status and yet still allow the PEAR packages to be included? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: sql query question
This is a SQL question, rather than a PHP question, so I would suggest doing a google search on SQL tutorials, but I think what you are trying to do would work like this: SELECT * FROM table WHERE descript LIKE '%new%' OR descript LIKE '%car%' Tony wrote: hi if i have new car and i want to search each word in description can i do SELECT * FROM table WHERE descript = new OR descript =car?? any help is appreciated -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP License question
I spoke with the good folks over at the FSF, and figured out how to do this. The PHP License itself does not restrict the use code under it. The problem was with the GPL, which restricted the use of code under the GPL being paired with code under certain types of licenses (specifically licenses that are non-copyleft). The PHP license is non-copyleft, and, so, it is not GPL compatible. Thus, an exception must be made by the copyright owner of the GPL'd code. The wording for the exception is found at http://www.gnu.org/licenses/gpl-faq.html#GPLIncompatibleLibs . Specifically, in this case, I chose to use the following wording, and the folks at FSF told me this was fine: snip In addition, as a special exception, Ben Ramsey gives permission to link the code of this program with those files in the PEAR library that are licensed under the PHP License (or with modified versions of those files that use the same license as those files), and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than those files in the PEAR library that are licensed under the PHP License. If you modify this file, you may extend this exception to your version of the file, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. /snip Since certain PEAR packages are licensed under the modified BSD and LGPL licenses, then this exception does not need to be made for those packages; these licenses are already GPL compatible. Thus, I can release my application under the GPL and satisfy its requirements to include the PEAR packages licensed under the PHP license. I hope this helps someone else out there, as well. ;-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP License question
Yup. I believe that's what you have to do in order to satisfy the restrictions in the GPL. Gerard Samuel wrote: So to clarify. If I have a piece of code that utilises PEAR's Tar class (which uses a PHP License). In order for me to distribute my piece of code (under the GPL) along with the Tar class, I have to include this exception along with the normal GPL'ed notice in my code? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: regular expressions
I've always found the PHP manual to be very helpful: http://www.php.net/manual/en/pcre.pattern.syntax.php Pete M wrote: Getting completely confused how this stuff works !!! Anyone recommend a book for a regex newbie ? pete -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: regular expressions
I also forgot to mention this book, which I've never used, but I picked it up once and it seemed very helpful: Regular Expression Pocket Reference published by O'Reilly http://www.amazon.com/exec/obidos/tg/detail/-/059600415X/qid=1077025752/sr=1-2/ref=sr_1_2/102-1251244-5472167?v=glances=books Ben Ramsey wrote: I've always found the PHP manual to be very helpful: http://www.php.net/manual/en/pcre.pattern.syntax.php Pete M wrote: Getting completely confused how this stuff works !!! Anyone recommend a book for a regex newbie ? pete -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: destroy session
Take a look at the manual. There is a session_destroy() function: http://www.php.net/session Natalia Sensini wrote: I want to destroy a session when you click in a sing out link, something like this a href= link onClick=session_destroy() Is ti possible? how? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Ideas on modifying array keys
You might be able to create some function that uses a combination of array_keys(), array_values(), and array_combine() to do what you want. Check the manual at http://www.php.net/array for more information on these functions. Gerard Samuel wrote: Im looking for the fastest way to modify array keys. For example, changing - $foo['hello_world'] = 'HELLO WORLD'; to $foo['hello'] = 'HELLO WORLD'; The only way I can think of is to loop through the array, copying array values to new keys, and unsetting the old key. Thanks for any insight you may provide... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Ideas on modifying array keys
I know that it may be somewhat irrelevant to solving the problem at hand (and, in fact, I think your current method is probably the best method), but I was just wondering why you needed to change the names of your keys at all. Why is it not programmed so that the keys already have the names you want them to have? Gerard Samuel wrote: On Wednesday 18 February 2004 12:03 pm, Ben Ramsey wrote: You might be able to create some function that uses a combination of array_keys(), array_values(), and array_combine() to do what you want. Check the manual at http://www.php.net/array for more information on these functions. True, but I was looking to see if I could avoid running a loop, of which I would still have to loop over the result of array_keys() to modify its content. So for now, Im running - function modify_key($array) { $array = (array)$array; foreach($array as $key = $value) { if (FALSE === ($pos = $strpos($key, '.'))) { continue; } $new_key = substr($key, $pos + 1); $array[ $new_key ] = $value; unset( $array[ $key ] ); } return $array; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: sign not posted to next page
Use the urlencode() function. http://www.php.net/manual/en/function.urlencode.php Piet From South Africa wrote: i have the following problem. when i href like this a href=nextpage.php?name=$name and the name contains a sign, it does not post it to the next page. if the name is bedbreakfast it stops at bed. Can anyone tell me how to do this. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: sign not posted to next page
Use the urlencode() function. http://www.php.net/manual/en/function.urlencode.php Piet From South Africa wrote: i have the following problem. when i href like this a href=nextpage.php?name=$name and the name contains a sign, it does not post it to the next page. if the name is bedbreakfast it stops at bed. Can anyone tell me how to do this. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: sign not posted to next page
Use the urlencode() function. http://www.php.net/manual/en/function.urlencode.php Piet From South Africa wrote: i have the following problem. when i href like this a href=nextpage.php?name=$name and the name contains a sign, it does not post it to the next page. if the name is bedbreakfast it stops at bed. Can anyone tell me how to do this. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Delayed mail()... ?
Probably the best way to do this is the use cron to schedule a script to run at a specified time. The way I'd do it is to create a PHP script that compares the current date with the date they registered (you'd save that date to the database, of course). If the current date is greater than 3 days and less than 4 days older than the date they registered, then you'd use mail() to send them another message. Use cron to schedule the script to run the script once every day. For the PHP script that cron will be running, you'll need to put this line in above the first ?php tag: #!/usr/bin/php -q That way, it'll execute on the system. And you may have the chmod the file 755, though I can't remember if that's necessary. Finally, your system must be Linux (or other unix-type system) for this to work correctly. If it's Windows, you can use the task scheduler, but I don't think it'll execute the PHP script. Tristan Pretty wrote: I've been asked to add a small amount of functionality to a site I've built (It's a techer at home web site) Basically, prospective teachers/students, can sign up for more info etc. Currently, that info is captured, and the site admin people are E-mailed... all good so far.. What they've asked for, is that when they reply to the enquiry, they are reminded to chase up the enqiry a few days later... Now I could give them a message on screen, if they happen to be in the admin area, but what i'd like to do , is simply mail the admin users, after say, 3 days. regardless if they even visit the admin area at all... is this possible at all? I use 12All E-mail software at work, and that has a delayed sending option, but [EMAIL PROTECTED] NO idea how it works... Any suggetions? * The information contained in this e-mail message is intended only for the personal and confidential use of the recipient(s) named above. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this document in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message. *** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Delayed mail()... ?
You'll be hard pressed to learn about cron at php.net. Still, there may be something on it there. Instead, since cron isn't a PHP function, do a google search on cron or cron tutorial to find out how to use it. Tristan Pretty wrote: Right, I'm off to php.net, to learn all about cron jobs... i've never heard ofit ;-) (I'll come out from under my rock now) Cheers everyone Ben Ramsey [EMAIL PROTECTED] 20/02/2004 13:36 To [EMAIL PROTECTED], Tristan Pretty [EMAIL PROTECTED] cc Subject [PHP] Re: Delayed mail()... ? Probably the best way to do this is the use cron to schedule a script to run at a specified time. The way I'd do it is to create a PHP script that compares the current date with the date they registered (you'd save that date to the database, of course). If the current date is greater than 3 days and less than 4 days older than the date they registered, then you'd use mail() to send them another message. Use cron to schedule the script to run the script once every day. For the PHP script that cron will be running, you'll need to put this line in above the first ?php tag: #!/usr/bin/php -q That way, it'll execute on the system. And you may have the chmod the file 755, though I can't remember if that's necessary. Finally, your system must be Linux (or other unix-type system) for this to work correctly. If it's Windows, you can use the task scheduler, but I don't think it'll execute the PHP script. Tristan Pretty wrote: I've been asked to add a small amount of functionality to a site I've built (It's a techer at home web site) Basically, prospective teachers/students, can sign up for more info etc. Currently, that info is captured, and the site admin people are E-mailed... all good so far.. What they've asked for, is that when they reply to the enquiry, they are reminded to chase up the enqiry a few days later... Now I could give them a message on screen, if they happen to be in the admin area, but what i'd like to do , is simply mail the admin users, after say, 3 days. regardless if they even visit the admin area at all... is this possible at all? I use 12All E-mail software at work, and that has a delayed sending option, but [EMAIL PROTECTED] NO idea how it works... Any suggetions? * The information contained in this e-mail message is intended only for the personal and confidential use of the recipient(s) named above. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this document in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message. *** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: hello
I would advise against sending attachments to the list with the message read it immediately. Chances are, it won't be opened or looked at. Please include a description of the problem you are facing, as well as the code you are using in your message body--not in an attachment. [EMAIL PROTECTED] wrote: read it immediately! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Working with MS-SQL
As Jay said, check through the manual. The answers you're looking for may be found right here: http://www.php.net/mssql Jay Blanchard wrote: [snip] How can we connect to MS-SQL Server ? What tools ( where can we download ) must be installed ? Thank a lots. PS : the php programs under Linux / Unix... [/snip] I usually connect to my servers using cables, but YMMV. Might I suggest that you read some manuals and books? The questions that you are asking are way too general in nature and are sure to get you flamed (I am resisting it very much myself). Please visit the php web site, the mysql web site the m$ sql server web site and your local bookstore on online resource. -- Regards, Ben Ramsey http://benramsey.com http://www.phpcommunity.org/wiki/People/BenRamsey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PEAR file??
I'd check with your friend to see if he remembers what PHP software he installed. It's an init.php file in the gallery subfolder? If he doesn't recognize the file as being one he created in the past, then perhaps he installed the gallery software from http://gallery.sf.net at one time? It's just a guess, and maybe I'm way off, but it's worth a try. As others mentioned before, it doesn't sound like a PEAR file. Edward Peloke wrote: Hello, I have a friend who has moved his website to a new host and I am helping him clean up some of the code. In one of his pages, he gets this error. He of course, doesn't have the gallery/init.php file in his directory and it is not on the server. Does anyone recognize this as a pear file that I can simply download? Thanks, Eddie Fatal error: Failed opening required '../gallery/init.php' (include_path='.:/usr/share/pear') in /home/buildingbymatt/public_html/clients/security.php on line 4 -- Regards, Ben Ramsey http://benramsey.com http://www.phpcommunity.org/wiki/People/BenRamsey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PEAR file??
It's not a PEAR file. PEAR files are never included using .. This is not true. I can download a PEAR package and use it as a standalone in my application without specifying a PEAR folder in the include_path in php.ini. I can also use it without using ini_set() to change the include_path. If I use it in this way, there would be files in my application that would need to include it using .. :) -- Regards, Ben Ramsey http://benramsey.com http://www.phpcommunity.org/wiki/People/BenRamsey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP5: Directory DirectoryIterator
using PHP5 Beta 4 I saw some new classes like DirectoryIterator with nice methods like: Where did you see these classes? Is it a PEAR package? I haven't seen these in the PHP manual. -- Regards, Ben Ramsey http://benramsey.com http://www.phpcommunity.org/wiki/People/BenRamsey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP5: Directory DirectoryIterator
That's some pretty helpful information there. I didn't know about that. Thanks! -Ben Vivian Steller wrote: Ben Ramsey wrote: using PHP5 Beta 4 I saw some new classes like DirectoryIterator with nice methods like: Where did you see these classes? Is it a PEAR package? I haven't seen these in the PHP manual. You can find them using the following function: function printDeclaredClasses() { $classes = get_declared_classes(); foreach($classes as $class) { print(\nb . $class . /b\n); $methods = get_class_methods($class); foreach($methods as $method) { print(\t . $method . \n); } } } make a printDeclaredClasses(), search for DirectoryIterator and you can see available methods for that class.. -- Regards, Ben Ramsey http://benramsey.com http://www.phpcommunity.org/wiki/People/BenRamsey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP5: Directory DirectoryIterator
When I was looking for information regarding get_declared_classes(), I came across these links in the manual. I hope they help. http://us4.php.net/manual/en/reserved.classes.php http://us4.php.net/manual/en/class.dir.php Still, I don't think the manual has any documentation yet on directoryIterator, and I didn't see it when I used your function on beta 3 (which is what I'm running at present). So, it must be brand new. -- Regards, Ben Ramsey http://benramsey.com http://www.phpcommunity.org/wiki/People/BenRamsey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: values from string query
You may want to try putting single quotation marks around your values and place your array values within curly braces... VALUES ('{$a_row['p_name']}', '{$a_row['p_company']}', ... and so forth. Also, try echoing $c_query to see if the values are being stored in the variable properly, if you haven't already done so. If the values aren't showing up in the variable, then you definitely need to include the curly braces. If they are showing up, then perhaps MySQL needs the single quotation marks. -- Regards, Ben Ramsey http://benramsey.com http://www.phpcommunity.org/wiki/People/BenRamsey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Obtaing the URL of current page
Take a look here, you may find this documentation useful: http://www.php.net/manual/en/language.variables.predefined.php Shaun wrote: Hi, How can i obtain the URL of the current page including any $_GET variables? Thanks for your help -- Regards, Ben Ramsey http://benramsey.com http://www.phpcommunity.org/wiki/People/BenRamsey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: values from string query
thanx yes i was echoing them and it worked!! Angelo Please remember to include the list on messages. Does this mean that your code now works? Or it still doesn't work but the values are being properly echoed? -- Regards, Ben Ramsey http://benramsey.com http://www.phpcommunity.org/wiki/People/BenRamsey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: strstr
Jakes wrote: I got this out the manual: ?php $email = '[EMAIL PROTECTED]'; $domain = strstr($email, '@'); print $domain; // prints @example.com ? how do I get the user ranther than @example.comThanks I would do something like this: $email = [EMAIL PROTECTED]; if (preg_match(/^(.*)\@(.*)$/, $email, $matches)) { // $matches[0] contains the original $email $user = $matches[1]; $domain = $matches[2]; } echo $user . br / . $domain; Check out the manual for more info on preg_match(): http://www.php.net/manual/en/function.preg-match.php -- Regards, Ben Ramsey http://benramsey.com http://www.phpcommunity.org/wiki/People/BenRamsey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: numeric characters
If you wanted to force them to put in valid numeric characters, you would have to use JavaScript (client-side). However, if you wanted to verify the information from the server side, you could use is_numeric() to check whether the value is a number. http://www.php.net/is-numeric Dominique Anokre wrote: Is there a way with php to force the user to put only numeric character in a text field ? thanks -- Regards, Ben Ramsey http://benramsey.com http://www.phpcommunity.org/wiki/People/BenRamsey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Testing Pear install
David Jackson wrote: How can I test to see if and what portions of Pear are installed on a vhosted website? TX, david I'm not sure how to tell what portions are installed, exactly, but you can test to see whether PEAR itself is installed simply by using require 'PEAR.php'; If it complains, then it can't find it and it's probably not installed. You can download the PEAR packages yourself, though, drop them into a directory in your site (or outside the root of your site), and use ini_set() to set your include_path to the directory where your PEAR classes reside. Then you can use PEAR without having to install it. -- Regards, Ben Ramsey http://benramsey.com http://www.phpcommunity.org/wiki/People/BenRamsey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HELP! printing Arrays
I know that others have already helped you learn out to print out an array, but you can also use print_r($array); to print out the array. It's not useful for the end-user of your application, but it can help you out as you're programming. -- Regards, Ben Ramsey http://benramsey.com http://www.phpcommunity.org/wiki/People/BenRamsey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: server side redirects
guess this is because I have already output html before this php command Exactly right. Why don't you use the header() function at the top of the page before sending any other headers? It will definitely work that way. And if the problem is because you're doing some evaluation down in your page, take that evaluation out and bring it up above the headers, as well. I usually do all my page processing and evaluation at the top of my pages before I write any HTML. As for the meta redirect, I'm not sure of any problems there (others will likely know better than I), but I think it's best to have your application do the redirect from the server-side rather than the client-side. If your evaluation is high enough in the page to know to print the meta redirect tag, then you can probably afford to move it just a few lines higher than the html tag and use header() instead. Doing things on the server-side is always best and more secure; end-users are less likely to be able to screw things up. -- Regards, Ben Ramsey http://benramsey.com http://www.phpcommunity.org/wiki/People/BenRamsey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php/mssql character limit?
Anyone know of any kind of character limit in php or mssql (yes, Microsoft SQL Server) for entering long text into a text column (of around 4,055 characters in length--that's where it's cutting off)? -- Regards, Ben Ramsey http://benramsey.com http://www.phpcommunity.org/wiki/People/BenRamsey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] UK Bank Holidays 2
WTF? isnt this the second time today this has appeared on the list? Dude, other than the people in the UK nobody cares about UK bank holidays...search google for this query and maybe someone from there has written something for it..or read the manual a couple of times and you'll see that the bottom question is a real dumb one. Ryan: Well, that's not a very nice way to treat someone on the list, even if it was the second time you'd seen the question in the same day or even if it was a question that is obviously in the manual. Some people are just at different proficiencies in their learning process and don't yet know to go to the manual for certain questions. If we treated every newbie like this, then we wouldn't have people coding in PHP! Shaun: Consequently, the question was a valid one that the manual could not answer, and the short answer is, no. PHP does not have an intrensic way of telling on what dates UK banking holidays fall (mainly because not everyone coding PHP lives in the UK). You will need to write your own function for this. The easiest way would be to just look at a calendar for several years in advance and just plug all the dates into an array and test the array to see if today's day is in there. If it is, then today is a banking holiday. Hope that helps. -- Regards, Ben Ramsey http://benramsey.com http://www.phpcommunity.org/wiki/People/BenRamsey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: extra breaks in sent out emails
Could you post the code you're using to write your $_POST variable to the e-mail message? I seem to remember coming across a problem like this in the past, and I'd like to see your code to see if it jogs my memory. Thanks. BTW, it shouldn't have anything to do with the fact that you're entering the data into a form from a Windows computer and processing it with a script on a UNIX machine. Scott Taylor wrote: I am entering some text into a webpage, then using $_POST on the next page to recieve it. It then should email the $_POST to an email address. The problem that I am encountering is that I am getting an extra line break on every line. If I enter a b into the textarea (which is the variable through POST) and do a character count it only shows 3 - the a, the \n, the b. Yet in the email address it comes out as: a b Why is this? BTW: I am on a windows computer but the server is a unix server. Best Regards, Scott -- Regards, Ben Ramsey http://benramsey.com http://www.phpcommunity.org/wiki/People/BenRamsey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] UK Bank Holidays 2
Ryan A wrote: Wowee..Now isnt this a nice response with people taking sides and everything. :-) Ryan, I want to officially apologize since it appears that I started this mess. To me, it just appeared that you were flaming someone, and while perhaps for good cause (since he posted two threads to the list about the same topic only a matter of a few hours apart), I just felt it was uncalled for on the list. However, I didn't mean to start a war or to act as a sort of police. So, I'm sorry. -- Regards, Ben Ramsey http://benramsey.com http://www.phpcommunity.org/wiki/People/BenRamsey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: extra breaks in sent out emails
Scott Taylor wrote: What I really don't understand is why there are any line breaks at all, because the trim is supposed to take out all \r \n 's. Is there another type of line break? trim() actually only strips whitespace (including \r and \n) from the beginning and ending of strings. See http://www.php.net/trim for more information. If you want to completely remove line breaks from your string, use str_replace() to do something like: str_replace(\n, , $string); and str_replace(\r, , $string); See http://www.php.net/str-replace Finally, have you tried echoing $body just before the message is sent so that you can see exactly what is being sent to the mail() function? -- Regards, Ben Ramsey http://benramsey.com http://www.phpcommunity.org/wiki/People/BenRamsey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: extra breaks in sent out emails
I cannot believe that the server converts \r's to \n's. \n does not count as two breaks, either. \r stands for carriage return and \n stands for newline. Even if they are placed side-by-side (e.g. \r\n), they should only count as one line. Unless I knew more about your code or your application, I could not determine what was causing the double line break. Scott Taylor wrote: Thank you Ben. Using either str_replace(\n, , $string); or str_replace(\r, , $string); solves the problem. My guess is that when I submit the data there is both the \r and the \n in there (for there showed 2 white space characters in between the broken text lines). My guess is that the server converts all \r's into \n's, and for this reason when a piece of mail goes out it has two breaks instead of one. Best Regards, and thank you for the help, Scott Taylor Ben Ramsey wrote: Scott Taylor wrote: What I really don't understand is why there are any line breaks at all, because the trim is supposed to take out all \r \n 's. Is there another type of line break? trim() actually only strips whitespace (including \r and \n) from the beginning and ending of strings. See http://www.php.net/trim for more information. If you want to completely remove line breaks from your string, use str_replace() to do something like: str_replace(\n, , $string); and str_replace(\r, , $string); See http://www.php.net/str-replace Finally, have you tried echoing $body just before the message is sent so that you can see exactly what is being sent to the mail() function? -- Regards, Ben Ramsey http://benramsey.com http://www.phpcommunity.org/wiki/People/BenRamsey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: RFC: Job listings
Anders, I think this really depends on how we get the word out to employers about this service. I, for one, hope to use the new Atlanta PHP (http://www.atlphp.org) group as a resource not only to educate and network PHP developers, but as a way to bring knowledge of PHP to the business world in the southeastern US. I think that local user groups worldwide will need to take part in promoting such a thing to the local business owners. -Ben Anders Hellström wrote: Hi, I'm one of the volunteers working on PHPCommunity.org. There's been some talk about having a Job Listings section on the site, something along the lines of jobs.perl.org, and We're wondering how much interest there is in such a service. I'm sure all the unemployed PHP developers on the list would like it, if companies actually used it. So the biggest question is probably if companies looking to hire PHP developers would use it. I would really appreciate it if you could reply to this message, off-list, if you're interested in this or have anything to say on the topic. Please mention in what way you're interested, if you're in a position to hire people, looking for work, etc. Anything you feel is relevant. All comments are welcome, both positive and negative. I can be reached at [EMAIL PROTECTED] Looking forward to reading your comments! Thanks in advance, -- Regards, Ben Ramsey http://benramsey.com http://www.phpcommunity.org/wiki/People/BenRamsey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: php/mssql character limit?
I posted this message the other day, and no one has responded. I'm replying to it to refresh it in the list. I guess if no one responds or helps me out this time, then I'll just forget about it and let my client go unhappy. ;-) Seriously, if anyone can help me out, I would be much appreciative. Ben Ramsey wrote: Anyone know of any kind of character limit in php or mssql (yes, Microsoft SQL Server) for entering long text into a text column (of around 4,055 characters in length--that's where it's cutting off)? -- Regards, Ben Ramsey http://benramsey.com http://www.phpcommunity.org/wiki/People/BenRamsey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: php/mssql character limit?
I am using a text column type. I had always though that the max size for varchars was 255. Vincent DUPONT wrote: are you using a 'Text' or a 'varchar' column type? I guess the max size for varchars is 4000; text should be larger -- Regards, Ben Ramsey http://benramsey.com http://www.phpcommunity.org/wiki/People/BenRamsey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: varchar size mssql
The problem is that I want to stick with standard SQL. I would assume that convert() is a MS SQL Server function, and, thus, not standard (will not work in other database formats). Did what you read mention why the data was being truncated? Perhaps if I knew why, then I could fix it. Jason Davidson wrote: I read that the varchar size for ms sql is 8000 limit. i also read that someone having a problem with it getting truncated fixed his problem by using convert(text, $value) in the sql statement.. Jason -- Regards, Ben Ramsey http://benramsey.com http://www.phpcommunity.org/wiki/People/BenRamsey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: varchar size mssql
That's fine. What I was specifically looking for was whether there was some sort of setting I was missing in php.ini, since I know that the database is accepting large text just fine. Thanks for the help, though. I guess I'll scrounge around elsewhere. Jay Blanchard wrote: [snip] The problem is that I want to stick with standard SQL. I would assume that convert() is a MS SQL Server function, and, thus, not standard (will not work in other database formats). Did what you read mention why the data was being truncated? Perhaps if I knew why, then I could fix it. [/snip] Since this is not a PHP issue may I refer you to http://msdn.microsoft.com ? You will find a truckload of information there as well as tons by searching Google for 'Microsoft SQL Server column types' -- Regards, Ben Ramsey http://benramsey.com http://www.phpcommunity.org/wiki/People/BenRamsey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: php/mssql character limit?
That's precisely what I was looking for, Alex! I must have overlooked it when skimming through php.ini. Thanks! Alex Hogan wrote: Hi Ben, The setting in the php.ini is; mssql.textlimit = 4096 Reset that value to what you want. I have mine set to 400. Valid range 0 - 2147483647 alex hogan -- Regards, Ben Ramsey http://benramsey.com http://www.phpcommunity.org/wiki/People/BenRamsey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Why is this happening
This happens because register_globals is turned off in php.ini. In fact, it's best to leave it this way. Read the manual to find out why: http://www.php.net/variables-predefined Bryan Bateman wrote: This does not work: require('languages/' . $language . '/' . basename($PHP_SELF)); This does: require('languages/' . $language . '/' . basename($_SERVER['PHP_SELF']); Why -- Regards, Ben Ramsey http://benramsey.com http://www.phpcommunity.org/wiki/People/BenRamsey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: date() before 1 Jan 1970...
Check out the manual: http://www.php.net/strtotime Theoretically, this should work: $old_date = strtotime(January 1, 1903 18:11 pm); echo date(Y-m-d H:i:s, $old_date); But all that echoes is: 1969-12-31 18:59:59 On that manual page, you'll see the following note: quote Note: The valid range of a timestamp is typically from Fri, 13 Dec 1901 20:45:54 GMT to Tue, 19 Jan 2038 03:14:07 GMT. (These are the dates that correspond to the minimum and maximum values for a 32-bit signed integer.) Additionally, not all platforms support negative timestamps, therefore your date range may be limited to no earlier than the Unix epoch. This means that e.g. dates prior to Jan 1, 1970 will not work on Windows, some Linux distributions, and a few other operating systems. /quote I'm not sure whether there is a good work-around for converting that string to a timestamp; however, this does work and will produce the desired results: $old_date = mktime(0, 11, 18, 1, 1, 1903); echo date(Y-m-d H:i:s, $old_date); Adwinwijaya wrote: Hello php-general, how to display date like Monday, 1 January 1903 18:11 pm in php ? (since the date() function only able to display date before 1970) (and why it only support date after 1 Jan 1970) ? thanks -- Regards, Ben Ramsey http://benramsey.com http://www.phpcommunity.org/wiki/People/BenRamsey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: date() before 1 Jan 1970...
Ben Ramsey wrote: $old_date = mktime(0, 11, 18, 1, 1, 1903); echo date(Y-m-d H:i:s, $old_date); Argh! I had the numbers reversed. It should be: $old_date = mktime(18, 11, 0, 1, 1, 1903); But you get the idea... -- Regards, Ben Ramsey http://benramsey.com http://www.phpcommunity.org/wiki/People/BenRamsey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] use of @ operator to suppress errors
hi. i'm using error_reporting(0) and set_error_handler(MyErrorHandler) to manage my errors but I'm getting situations where a NOTICE error is thrown. For example if I refer to $_GET['this'] when there is no 'this' querystring key then i get the error. I've tried using @$_GET['this'] but it makes no difference. Is this normal? Thanks in advance. Ben p.s. PHP 4.3.4 on Windows 2003 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] use of @ operator to suppress errors
Richard, Tom, and Stuart... thanks for your responses much appreciated. I shall now go and fiddle. Cheers, Ben - Original Message - From: Tom Meinlschmidt [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, March 15, 2004 12:01 PM Subject: Re: [PHP] use of @ operator to suppress errors Yes, it's normal. You've to check if is that variable set if (isset($_GET['this'])) and than you didn't get any NOTICE about that undefined variable. condition if ($_GET['this']) is not sufficient to check whether is variable set or not. /tom On Mon, 15 Mar 2004 11:43:24 - Ben Joyce [EMAIL PROTECTED] wrote: hi. i'm using error_reporting(0) and set_error_handler(MyErrorHandler) to manage my errors but I'm getting situations where a NOTICE error is thrown. For example if I refer to $_GET['this'] when there is no 'this' querystring key then i get the error. I've tried using @$_GET['this'] but it makes no difference. Is this normal? Thanks in advance. Ben p.s. PHP 4.3.4 on Windows 2003 -- 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] use of @ operator to suppress errors
Hmm. I'm confused. This page... http://uk.php.net/manual/en/language.operators.errorcontrol.php ...says that you can prepend the @ operator to a variable. So with @$_GET['this'] it should suppress the NOTICE error if 'this' doesn't exist. I've done some testing: Test #1 error_reporting(E_ALL); echo $_GET['test']; This generates an on-screen error. Test #2 error_reporting(E_ALL); echo @$_GET['test']; The error is suppressed. If I elect to use a custom error handler then i always get an error generated. It makes no difference what the error level is or whether I use the @ operator. set_error_handler(CustomErrorHandler); error_reporting(E_ALL); echo @$_GET['test']; set_error_handler(CustomErrorHandler); error_reporting(0); echo @$_GET['test']; set_error_handler(CustomErrorHandler); error_reporting(E_ALL); echo $_GET['test']; set_error_handler(CustomErrorHandler); error_reporting(0); echo $_GET['test']; They all have the same result. I suppose I could handle this in my error handling function, ignoring any NOTICE errors, but ideally I'd like to leave it as-is and suppress them when referencing. I'm not sure if I'm making much sense. Any help appreciated! Cheers, Ben - Original Message - From: Stuart [EMAIL PROTECTED] To: Ben Joyce [EMAIL PROTECTED] Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Monday, March 15, 2004 12:11 PM Subject: Re: [PHP] use of @ operator to suppress errors Ben Joyce wrote: i'm using error_reporting(0) and set_error_handler(MyErrorHandler) to manage my errors but I'm getting situations where a NOTICE error is thrown. For example if I refer to $_GET['this'] when there is no 'this' querystring key then i get the error. I've tried using @$_GET['this'] but it makes no difference. Is this normal? Yes it is. When you use set_error_handler all errors, warnings and notices cause your handler to be called. To detect the use of the @ prefix check the value of error_reporting in your handler - it will be 0 if @ has been used. Richard Davey wrote: Yes because @ suppresses the errors on function calls, not variables (which is all $_GET['this'] is). On the contrary, the @ prefix suppresses all errors for the block of code it precedes where a block is a function or variable. Essentially it sets error_reporting to 0 while it evaluates that block. -- Stuart -- 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] use of @ operator to suppress errors
Many Thanks Nikolay. It seems then that if I'm to avoid the NOTICE errors then isset() should be used as suggested earlier. Not the greatest solution but a working one. Thanks to all. Ben - Original Message - From: Nikolay Bachiyski [EMAIL PROTECTED] To: Ben Joyce [EMAIL PROTECTED] Sent: Monday, March 15, 2004 2:32 PM Subject: Re: [PHP] use of @ operator to suppress errors - Original Message - From: Ben Joyce [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, March 15, 2004 2:04 PM Subject: Re: [PHP] use of @ operator to suppress errors Hmm. I'm confused. This page... http://uk.php.net/manual/en/language.operators.errorcontrol.php ...says that you can prepend the @ operator to a variable. So with @$_GET['this'] it should suppress the NOTICE error if 'this' doesn't exist. I've done some testing: Test #1 error_reporting(E_ALL); echo $_GET['test']; This generates an on-screen error. Test #2 error_reporting(E_ALL); echo @$_GET['test']; The error is suppressed. If I elect to use a custom error handler then i always get an error generated. It makes no difference what the error level is or whether I use the @ operator. set_error_handler(CustomErrorHandler); error_reporting(E_ALL); echo @$_GET['test']; set_error_handler(CustomErrorHandler); error_reporting(0); echo @$_GET['test']; set_error_handler(CustomErrorHandler); error_reporting(E_ALL); echo $_GET['test']; set_error_handler(CustomErrorHandler); error_reporting(0); echo $_GET['test']; They all have the same result. I suppose I could handle this in my error handling function, ignoring any NOTICE errors, but ideally I'd like to leave it as-is and suppress them when referencing. I'm not sure if I'm making much sense. Any help appreciated! Cheers, Ben - Original Message - From: Stuart [EMAIL PROTECTED] To: Ben Joyce [EMAIL PROTECTED] Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Monday, March 15, 2004 12:11 PM Subject: Re: [PHP] use of @ operator to suppress errors Ben Joyce wrote: i'm using error_reporting(0) and set_error_handler(MyErrorHandler) to manage my errors but I'm getting situations where a NOTICE error is thrown. For example if I refer to $_GET['this'] when there is no 'this' querystring key then i get the error. I've tried using @$_GET['this'] but it makes no difference. Is this normal? Yes it is. When you use set_error_handler all errors, warnings and notices cause your handler to be called. To detect the use of the @ prefix check the value of error_reporting in your handler - it will be 0 if @ has been used. Richard Davey wrote: Yes because @ suppresses the errors on function calls, not variables (which is all $_GET['this'] is). On the contrary, the @ prefix suppresses all errors for the block of code it precedes where a block is a function or variable. Essentially it sets error_reporting to 0 while it evaluates that block. -- Stuart -- 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 When you are using set_error_handler, the standart PHP error handler is completely bypassed. Both the error_reporting value (saved in php.ini and set by the error_reporting() function) and the @ operator will have no effect onto your handler. Actually the @ error-control operator just sets error_reporting to 0 while the expression to which it is prepeneded is interpreted. Of course you still could fit your handler to use the error_reporting value and take the appropriate action. Regards, Nikolay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Switching First Last Names in List
This works rather nicely, too: ?php $list = Firstname1 LastName1 Firstname2 Lastname2; $name_array = array(); $temp_array = explode(\n, $list); foreach ($temp_array as $name) { $name_array[] = explode( , $name); } print_r($name_array); ? $name_array is now a multi-dimensional array with the first and last names separated. print_r should show you the values. Richard Davey wrote: Hello Jeff, Tuesday, March 16, 2004, 3:24:57 PM, you wrote: JO If I have a list like this: JO Firstname1 LastName1 JO Firstname2 Lastname2 JO etc. JO I can split the names by \n to put them into JO an array which will then be output into an option JO list for a form. But how do I reverse the names JO so that the last name is first? Also, how do I JO handle people with three names? Thanks. ? function swap ($name) { $tmp_name = trim($name); $pos = strrpos($tmp_name, ); $first_name = substr($tmp_name, 0, $pos); $surname = substr($tmp_name, $pos); $name = $surname, $first_name; } $raw_names = richard davey susannah davey jeff oien willy three names jack van-der-meet; $names = explode(\n, $raw_names); echo pre; print_r($names); array_walk($names, 'swap'); print_r($names); echo /pre; ? The echo and print_r lines are to show you what it has done. The $raw_names should be your list of names. -- Regards, Ben Ramsey http://benramsey.com http://www.phpcommunity.org/wiki/People/BenRamsey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Switching First Last Names in List
JO so that the last name is first? Also, how do I JO handle people with three names? Thanks. I missed this part, so here's my take with the solution I provided (I'm including the print-out of the option tags): foreach ($name_array as $person) { $lastname_element = count($person) - 1; //index of last element echo option . $person[$lastname_element] . , ; echo $person[0] . /option\n; //zero (0) is the first name } Ben Ramsey wrote: This works rather nicely, too: ?php $list = Firstname1 LastName1 Firstname2 Lastname2; $name_array = array(); $temp_array = explode(\n, $list); foreach ($temp_array as $name) { $name_array[] = explode( , $name); } print_r($name_array); ? $name_array is now a multi-dimensional array with the first and last names separated. print_r should show you the values. -- Regards, Ben Ramsey http://benramsey.com http://www.phpcommunity.org/wiki/People/BenRamsey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: js date picker
This is a wee bit off topic, seeing as how this is a PHP mailing list. We'll be happy to help with PHP-related questions. As for JavaScript stuff, use Google to find a good resource. :-) Luis Mirabal wrote: anyone knows a good javascript date picker, i need it to be compatible with all major browsers thx, luis. -- Regards, Ben Ramsey http://benramsey.com http://www.phpcommunity.org/wiki/People/BenRamsey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Replace space from form field using preg_replace
If you're doing this to pass it through a URL, then use urlencode() http://www.php.net/urlencode Vernon wrote: I want to be able to replace a space that comes from a form field (such as in 123 My Street) with a + sign. Can anyone help me with this? Thanks -- Regards, Ben Ramsey http://benramsey.com http://www.phpcommunity.org/wiki/People/BenRamsey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Stupid question
If you were going to call that function you would use $this-testfunc(); You're on the right track. If you're going to call that function (or method) from within the class, then you use the $this. Also, you can use $this to access member variables from within the class. Outside of the class, you would need to access those methods or variables using the name of the object. Don't be afraid to contribute! It will even help you grow as a programmer to try to help others solve their coding problems. -- Regards, Ben Ramsey http://benramsey.com http://www.phpcommunity.org/wiki/People/BenRamsey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: js date picker
If your question was about using dates in PHP, then by all means, ask it here. But I understood your question to be about dates with Javascript. Be specific with your question so people don't pass it off as being off topic. Luis Mirabal wrote: i am using it from a php program... maybe i was not clear enough... but thanx, i found some at phpclasses.org -- Regards, Ben Ramsey http://benramsey.com http://www.phpcommunity.org/wiki/People/BenRamsey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Stupid question
With PHP 5 looming on the horizon (and even many already using it), it'd be a good idea to go ahead and learn OOP now. ;-) Jeff McKeon wrote: Ewe... OOP Ok, I guess I'll have to learn OOP. Thanks for the info! Jeff -- Regards, Ben Ramsey http://benramsey.com http://www.phpcommunity.org/wiki/People/BenRamsey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] The convension
And if you want the actual text $variable to be displayed, just use the backslash before the dollar symbol (e.g. \$variable). Chris W. Parker wrote: Chris W. Parker on Wednesday, March 17, 2004 1:38 PM said: it's choking on the $variable you've got in your heredoc text. you've probably got error reporting turned up so that it coughs on those kinds of errors. notice it didn't cause your program to fail. i should also say.. if you put something like '$variable = text;' above your heredoc, it'll probably work fine. of course it interpolates variables so it will replace $variable with text when it's displayed. chris. -- Regards, Ben Ramsey http://benramsey.com http://www.phpcommunity.org/wiki/People/BenRamsey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP encounters Access Violation
What does this error mean? PHP has encountered an Access Violation at 0177A8B4 I get it intermittently from pages in phpOpenTracker that call the jpgraph functions. It's just a blank white page with that error, and that doesn't help me out at all. I'm running Windows Server 2003/IIS 6 with PHP 5RC1. -- Regards, Ben Ramsey http://benramsey.com http://www.phpcommunity.org/wiki/People/BenRamsey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP encounters Access Violation
Ben Ramsey wrote: What does this error mean? PHP has encountered an Access Violation at 0177A8B4 I get it intermittently from pages in phpOpenTracker that call the jpgraph functions. It's just a blank white page with that error, and that doesn't help me out at all. I'm running Windows Server 2003/IIS 6 with PHP 5RC1. I just wanted to freshen this post once more since no one's responded. Perhaps it just means that no one knows? I've tried Googling on this, but not much has turned up in the way of help. Also, I forgot to mention, but I'm running PHP 5RC1 as an ISAPI module and not CGI. Not sure if that helps. Again, this problem is intermittent and does not occur all the time (even when calling the same pages--sometimes I the graph generates correctly, sometimes I get this error). I have narrowed down the error to occurring only with the graph script. -- Regards, Ben Ramsey http://benramsey.com http://www.phpcommunity.org/wiki/People/BenRamsey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Scheduling PHP on Windows
I know how to run a PHP script as a cron job on a *nix machine. So, does anyone know how to use the Task Scheduler on Windows to do the same? Or is it even possible? -- Regards, Ben Ramsey http://benramsey.com http://www.phpcommunity.org/wiki/People/BenRamsey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Function to check a valid date
Your likely to find many ways to do this and many functions with many lines of code that do many variations of what you want. Can I use the word many many more times? Such is the way with programming. Here's my take on it. Pull all your values into one long string: $date_string = {$_POST[week_day]}, {$_POST[month]} {$_POST[day]}, {$_POST[year]}; Now, you have a string in the format Saturday, March 20, 2004. Now, use strtotime() to figure out whether it's a valid date: if (($timestamp = strtotime($date_string)) === -1) { // Not a valid date; do some error reporting here } else { // It is a valid date, $timestamp is now a valid Unix // timestamp of $date_string; use it like below: echo date(m/d/Y, $timestamp); } See also http://us4.php.net/strtotime Chris Bruce wrote: Hello all, I was going to build a function to check whether a selected date exists, but thought that I would see if anyone has done this type of thing already which would indeed save me some time. I have a form where the users select the day of the week, month, date and year from 4 pulldowns. (Saturday, March 20, 2004). I need to have a function that will check to see if that is indeed a real date. Does this sound familiar to anyone? Thanks a bunch :) -- Chris Bruce [EMAIL PROTECTED] Idextrus E-Business Architects http://www.idextrus.com 3282 Wilmar Cres. Mississauga, ON L5L4B2 CA 905.828.9189 This e-mail and its contents are privileged, confidential and subject to copyright. If you are not the intended recipient, please delete this e-mail immediately. Any unauthorized use or disclosure of the information herein is prohibited. -- Regards, Ben Ramsey http://benramsey.com http://www.phpcommunity.org/wiki/People/BenRamsey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: CMS Templating with Standards Based HTML Delima...
Adam, The question you ask is an important one. Is there a CMS out there that meets your client's needs that you don't have to write from scratch? In short, the answer is no. I've sifted through mounds and mounds of CMSes, and I haven't found one that I really like. It's really up to your own tastes and the requirements of the project. I've always had to write one from scratch due to project requirements. Though, I hope to eliminate that need in the future with the CMS I am currently developing. So, how can I help you? I can't tell you the name of an end-all-be-all CMS solution. But I can point you to a place to look for open-source solutions. That place is Sourceforge.net. Go there and search Software/Group for Content Management. You'll get tons of results. Sift through those results and try the ones that sound like they fit your needs. There're are a couple of notable ones that may fit your requirements (e.g. phpWebSite boasts compliant XHTML 1.0 output--though I've never tried it). -Ben Adam Reiswig wrote: I have just been to hotscripts.com looking under their php area for good cms software. The sheer number of choices is staggering to say the least. I found Smarty and it seems like it might make a good choice for my needs. I am really looking to fill two needs. One, a robust cms in which I can create standards based web templates (ie, table less layouts using xhtml strict and css) and Two, an easy method in which my clients can still edit their own content with out having to learn anything new, or at least as little as possible. Some sort of wysiwyg would be great if that's possible with out conflicting with existing css styles and as long as it didn't insert font tags and tables all over. Is there a good open source php based cms system out there that can do the above? I'd sure like to know about it. Thanks for any pointers! -Adam R. -- Regards, Ben Ramsey http://benramsey.com http://www.phpcommunity.org/wiki/People/BenRamsey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Comparing values / Regex ?
Please reply to the list so that everyone may benefit from your questions. --- Ben Ramsey [EMAIL PROTECTED] wrote: Here's my take on it. Pull all your values into one long string: (cut) if (($timestamp = strtotime($date_string)) === -1) { // Not a valid date; do some error reporting here } else { // It is a valid date, $timestamp is now a valid Unix // timestamp of $date_string; use it like below: echo date(m/d/Y, $timestamp); } Is that an error - Or propper PHP code ? Ive seen $a == 34 etc - with TWO equals signs. - But havnt seen it with 3 before. Yes, it's proper code. See the manual for more details. http://www.php.net/manual/en/language.operators.comparison.php - Has PHP got 'regex' capability - comparing text case IN-sensitivly ?? IE Cat equals CaT equals cat equals CAT.. Also Cat in the hat is TRUE - if I 'regex' want to see if 'Cat' is in the string (case in-sensitive)... Indeed. PHP does have regex capability. You should take a good look at the manual. It will answer all of your questions. Perl-compatible regular expressions: http://www.php.net/pcre POSIX Extended regular expressions: http://www.php.net/regex I would suggest using PCRE. There is a increased speed performance difference, I believe. You can perform case insensitive and case sensitive searches with PCRE. Just read the manual, and ask here if you have any questions with code after that. Also, note that (cat == cat) but (Cat != CaT). However, I wouldn't do a string comparison like that, though PHP is definately capable of it. I would use strcmp() or strcasecmp(), the latter of which is case insensitive. Check the manual for their usage, and note that they return zero (0) on true. -- Regards, Ben Ramsey http://benramsey.com http://www.phpcommunity.org/wiki/People/BenRamsey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: php and CSS level 2
Why not just make your CSS script end with the .php extension instead of .css? Then, the server will automatically parse it (most likely it will--depending on your server setup, of course). You can link to it from your HTML page like you would your CSS: style type=text/css !-- @import url(/path/to/css.php); -- /style or link href=/path/to/css.php rel=stylesheet type=text/css / Aidan Lister wrote: Your question indicates you have very little understanding of what PHP actually is. PHP will be parsed anywhere in any script, as long as your webserver is set to parse that type of file (ie, .php by default). 1. In your webserver config you need to make .css files parsed by php 2. Like you've done in your code snip? I suggest you a) read the manual b) experiment before asking further questions. Andy B [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] was just wondering if php will work inside a CSS level 2 style sheet?? for example: ?php ? style type=text/css ?php if(!empty($name)){ ? input#name { display: none } ?php } else { ? input#name { font-family: Arial, serif; font-size: 12pt; color: blue; background-color: transparent; . } ?php } ? /*rest of style sheet */ /style if this will work i was wondering 2 things: 1. how would i have to set it up to work right with the style sheet with php in it to work as a seperate file from the html file and 2. how would i set the style sheet up to work inside the original html/php file that contained the original html code... -- Regards, Ben Ramsey http://benramsey.com http://www.phpcommunity.org/wiki/People/BenRamsey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Upload file field not working as a form element
Could you post both your HTML form code and the PHP code you're using to handle the file upload. Also, just to make sure I understand what you're trying to do, you want to insert the uploaded file into a MySQL database? Vernon wrote: As much as I try I cannot get a file field in a form inserted into a MySQL record. I've even tried to get it to echo to the page when the page is submitted to itself and it's not reading the field. What am I missing here? -- Regards, Ben Ramsey http://benramsey.com http://www.phpcommunity.org/wiki/People/BenRamsey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: php and CSS level 2
RD I do wonder if either of the above methods would force the RD browser to never cache the CSS file locally You know, I didn't think about that, as I've never personally used this method. I've never had a need. Thinking about it now, I would also think that you may need to send a content-type header of text/css to the browser, as well, though I'm not positive on this. OT -- Consequently, I've had a lot of trouble with IE caching any CSS file for a site I'm working on. Works perfectly in Mozilla, but IE has all sorts of bugs. It's loading the page before the CSS every time, so you get this flash of unformatted data. The client and most of their site users use IE, so I have to make it work. My boss found an odd work-around, though. If you put script type=text/javascript /script at the very top, just inside the head tag, then it will work just fine and load in the CSS first every time. I don't know the logic behind it, but, if it's IE, does there have to be any logic? ;-) -- Regards, Ben Ramsey http://benramsey.com http://www.phpcommunity.org/wiki/People/BenRamsey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Decoding a URL without decoding values
I've got a querystring that looks like this: ?url=http%3A%2F%2Ftest.alpharetta.ga.us%2Findex.php%3Fm%3Dlinks%26category%3DRecreation%2B%2526%2BParks%26go.x%3D22%26go.y%3D7 As you can gather, I'm trying to pass a URL to another script for some processing. Before I urlencode() the URL and pass it to the query string, it looks like this: http://test.alpharetta.ga.us/index.php?m=linkscategory=Recreation+%26+Parksgo.x=22go.y=7 As you can see, there are already encoded entities in the URL, which are further encoded when passed through urlencode(). The problem I'm having is that when I urldecode() the string from $_GET[url], I get the following string: http://test.alpharetta.ga.us/index.php?m=linkscategory=Recreation Parksgo.x=22go.y=7 It's similar, but the category variable is now Recreation Parks when it needs to be Recreation+%26+Parks. When I try to use file_get_contents() on this string, I get nothing because of the ampersand and spaces in the URL. Is there a way to urldecode() $_GET[url] and still retain its original encoded entities so that I can use it again as a valid URL? -- Regards, Ben Ramsey http://benramsey.com http://www.phpcommunity.org/wiki/People/BenRamsey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] 9 Months Ago
Marek Kilimajer wrote: Jeff Oien wrote: When I do this: $lastmonth = mktime(0, 0, 0, date(m)-9, date(d), date(Y)); this will not work most of the year, if current month is August or less, the month value will be negative. Use strtotime('-9 months') instead. This code works just fine for me: $nine_months_ago = mktime(0, 0, 0, date(m)-9, date(d), date(Y)); echo date(m/d/Y, $nine_months_ago); If today is March 21, 2004, then this outputs 06/21/2003. That's exactly nine months ago. See http://www.php.net/date -- Regards, Ben Ramsey http://benramsey.com http://www.phpcommunity.org/wiki/People/BenRamsey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Decoding a URL without decoding values
JW You can base64_encode() it. Hadn't thought of that. Works perfect! Thanks! -- Regards, Ben Ramsey http://benramsey.com http://www.phpcommunity.org/wiki/People/BenRamsey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] RE: Randomly expired session cookies
I have noticed behavior like yours with our server setup. It is not a locally run (or owned) server so I cannot poke around to much. The session is timing out Randomly, causing our users to have to login again. It doesn't happen all the time either. In a rare case, less than a minute after login, I'll be forced to login again. Just to be sure I've set the following HUGE timeouts: session_set_cookie_params( 21600 ); session_cache_expire( 21600 ); This is ridicules I know, but I left it just for kicks. I don't know the load averages of the server and I'm very curious to find out if this is part of the issue. The server has PHP Version 4.2.3 installed on Linux w/ Apache. I'm not sure what version of Apache is installed. One last tidbit. I run the same site ( a mirror) locally while developing, and It never times out. Disclaimer: I'm not an expert (yet) so my problem could be caused by some completely unrelated setting. If someone knows of this mystery setting, please let me know. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how can I get the id of the last record I inserted into a table with an insert query?
hello. mysql_insert_id() should do what you need. lovely function, that one. hth, ben Diana Castillo [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] how can I get the id of the last record I inserted into a table with an insert query? (into Mysql database) -- Diana Castillo Global Reservas, S.L. C/Granvia 22 dcdo 4-dcha 28013 Madrid-Spain Tel : 00-34-913604039 ext 214 Fax : 00-34-915228673 email: [EMAIL PROTECTED] Web : http://www.hotelkey.com http://www.destinia.com --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.642 / Virus Database: 410 - Release Date: 24/03/2004 -- 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] Problem accessing an array inside if/switch
One of my co-workers posted this to PHPBuilder, and I'm posting it here. It's a problem that's baffling the snot out of us. It's an array that you can print_r() from outside an if or switch/case statement, but from inside, it seems unaccessible. His post follows: quote Ok Background: Database: MS SQL PHP: PHP 5 RC1 $block_data is pulled from the database and stored earlier on. The datatype of ranges is int. $events is a multi-dimensional array also pulled from the database. Problem: Whenever I try to print the varible $events inside an ( if ) statement or a ( case ) statement it appers to be blank, or inaccessible. code $myBlock = $block_data[0][ranges]; //$myBlock= 6;// Un-comment this and the print_r($events) inside the if statement prints out correctly. //$myArray = array(1, 2, 3, 4, 5);//Change the print_r($events) inside to $myArray and uncomment this and it works fine. print_r($events);// This prints out fine. if ($myBlock == 6) { echo $block_data[0][ranges].br;// This has a value of 6 print_r($events);// This prints out Array() } print_r($events);// This prints out fine. /code As you see it appears that the problem lies some how with two varibles that are pulled from the database. However, it should not make a difference as they are both correctly set before AND after the if statement. Any ideas on this i'm lost. Jesse /quote -- Regards, Ben Ramsey http://benramsey.com http://www.phpcommunity.org/wiki/People/BenRamsey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Simple one I think
DC I get and output of [0][0][0][1][1][1][2][2][2] why ? Try putting curly braces around your variables. Like this: {$val[name][$i]} -- Regards, Ben Ramsey http://benramsey.com http://www.phpcommunity.org/wiki/People/BenRamsey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] find string position using reg exp
RD Why use a regular expression? RD strpos() will do this just fine. strpos() will do it just fine, but if you need to use a regular expression to match a specific pattern and return the location in the string, preg_match() will also do this when you use the flag PREG_OFFSET_CAPTURE. -- Regards, Ben Ramsey http://benramsey.com http://www.phpcommunity.org/wiki/People/BenRamsey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: why won't mssql work?
EP I know I am missing a stupid step but I have php_mssql.dll in my EP php extensions folder and have uncommented the line in the ini EP file yet it still doesn't recognize the functions. Do I need to EP do something else? First of all, the obvious: make sure extension_dir in php.ini is set to the correct extensions directory. Also, did you restart IIS after you made the changes to php.ini? Evertime you change php.ini, you need to restart IIS. Secondly, for MS SQL extensions to work, you need to place ntwdblib.dll in the WINDOWS/System32 folder (the location could differ depending on your platform) on the machine that is running PHP. Then, restart IIS. -- Regards, Ben Ramsey http://benramsey.com http://www.phpcommunity.org/wiki/People/BenRamsey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: why won't mssql work?
EP And as far as IIS, I am running apache. Heh. Well, then I guess I can't help you there, as I've never run Apache on a Windows machine. :-) Sorry. I hope someone else can help. -- Regards, Ben Ramsey http://benramsey.com http://www.phpcommunity.org/wiki/People/BenRamsey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: STOP to send me mails !!!! Re: [PHP] Re: list to array help
W I do not want to receive all these email W W Please STOP W WDo not use the global list for your discussion What else is the global list for, then? Perhaps you need to sign up for the digested version or browse the mailing list as a newsgroup instead of selecting to receive every message. -- Regards, Ben Ramsey http://benramsey.com http://www.phpcommunity.org/wiki/People/BenRamsey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Problem accessing an array inside if/switch
Haven't heard any response on this yet, but we have been playing around with it. Here's our latest development: code $myBlock = $block_data[0][ranges]; if ($myBlock == 6) { echo 6 passes; } if ($myBlock != 6) { echo not 6 passes; } /code Guest what? Both statements pass. It should be one or the other, but both pass. What the heck is going on. I've looked in the database, and the value for that column is of type int and the value is exactly 6. See below for the earlier details of the problem. Is this a bug in PHP 5? Ben Ramsey wrote: One of my co-workers posted this to PHPBuilder, and I'm posting it here. It's a problem that's baffling the snot out of us. It's an array that you can print_r() from outside an if or switch/case statement, but from inside, it seems unaccessible. His post follows: quote Ok Background: Database: MS SQL PHP: PHP 5 RC1 $block_data is pulled from the database and stored earlier on. The datatype of ranges is int. $events is a multi-dimensional array also pulled from the database. Problem: Whenever I try to print the varible $events inside an ( if ) statement or a ( case ) statement it appers to be blank, or inaccessible. code $myBlock = $block_data[0][ranges]; //$myBlock= 6;// Un-comment this and the print_r($events) inside the if statement prints out correctly. //$myArray = array(1, 2, 3, 4, 5);//Change the print_r($events) inside to $myArray and uncomment this and it works fine. print_r($events);// This prints out fine. if ($myBlock == 6) { echo $block_data[0][ranges].br;// This has a value of 6 print_r($events);// This prints out Array() } print_r($events);// This prints out fine. /code As you see it appears that the problem lies some how with two varibles that are pulled from the database. However, it should not make a difference as they are both correctly set before AND after the if statement. Any ideas on this i'm lost. Jesse /quote -- Regards, Ben Ramsey http://benramsey.com http://www.phpcommunity.org/wiki/People/BenRamsey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Simple one I think
DC Thanks for the help but adding curly dose not seem to work. DC Any ideas why ? DC DC I get and output of [0][0][0][1][1][1][2][2][2] why ? DC BR Try putting curly braces around your variables. Like this: BR BR {$val[name][$i]} Please reply to the list so that others can help you out, as well--and so others can learn from your questions, if they happen to have the same ones. All right, I've taken a closer look at the code, and here's what's going wrong: When you do foreach($vocals as $val), it only sees 3 rows in $vocals, one for name, one for skill, and one for fee. You can see this when you do print_r($vocals). Thus, it can't find $val[name][$i] or any of the other variables because they don't exist in $val. You could change it to $val[$i], but then you're table would print out like this: Jonny FlashJonny FlashJonny Flash 77 77 77 39000 39000 39000 So, now you see a little bit of where the problem is. You need to rework your foreach to get things right. There are several ways you can do this. One is to store your array differently, like this: $vocals = array( array('name' = 'Jonny Flash', 'skill' = 87, 'fee' = 22000), array('name' = 'Bill Banger', 'skill' = 77, 'fee' = 18500), array('name' = 'Sarah Jane', 'skill' = 93, 'fee' = 39000) ); Then, you would print it out like this: $rows = table; foreach($vocals as $val){ $rows .= tr td{$val[name]}/tdtd{$val[skill]}/tdtd{$val[fee]}/td /tr ; } $rows .= /table; echo $rows; Another way, using the same array you had, would be to print it out like this: $rows = table; for ($i = 0; $i count($vocals['name']); $i++) { $rows .= tr td{$vocals[name][$i]}/tdtd{$vocals[skill][$i]}/tdtd{$vocals[fee][$i]}/td /tr ; } $rows .= /table; echo $rows; However, I feel that it is more logical and easier to use to store the array in the way I suggested above. -- Regards, Ben Ramsey http://benramsey.com http://www.phpcommunity.org/wiki/People/BenRamsey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] running php in sequence
I'd recommend that you build a set of functions (or a class) to do your bits and pieces, rather than include blocks of code. That way you can ZIP depending on the outcome of your CHECKOUT code. function checkoutStuff() { //if checkout code executes ok return true; } if(checkoutStuff()) { zipStuff(); } By all means stick those functions in a file and include them at the beginnign of your script. Make any sense? hth, Ben - Original Message - From: Edward Peloke [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, March 31, 2004 5:11 PM Subject: [PHP] running php in sequence I am using php in combination with ant to create a small automated build process. Will php run sequentially? What I mean is I have a series of modules or tasks: Example: //check out files include(modules/checkout.php) //zip up the files include (modules/zip.php) etc Will php wait to execute the zip.php until the checkout.php has completed because in my priliminary tests, it doesn't appear to do this. If not, what's the best way to execute it? Thanks, Eddie WARNING: The information contained in this message and any attachments is intended only for the use of the individual or entity to which it is addressed. This message may contain information that is privileged, confidential and exempt from disclosure under applicable law. It may also contain trade secrets and other proprietary information for which you and your employer may be held liable for disclosing. You are hereby notified that any unauthorized dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify [EMAIL PROTECTED] by E-Mail and then destroy this communication in a manner appropriate for privileged information. -- 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 statistics
I use AWStats for my web stats stuff. Pretty easy once the minimal configuration is done. http://awstats.sourceforge.net/ - Original Message - From: Jay Blanchard [EMAIL PROTECTED] To: Elliot J. Balanza [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Tuesday, March 30, 2004 7:00 PM Subject: RE: [PHP] web statistics [snip] Does any one knows of a good gnu php web statistics software? [/snip] [smart-ass alert] Yes and no depending on your definition of good. [/smart-ass alert] What kind of features are you looking for? -- 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] hello
Hello. - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, April 01, 2004 3:14 PM Subject: [PHP] hello Try this, or nothing! -- 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] PHP Access Violation using PEAR::Mail_smtp
I'm getting the following error when using the Mail_smtp package from PEAR: PHP has encountered an Access Violation at 0177A8B4 It does not occur everytime I use it, but even when send() returns true, e-mail messages are not being sent. However, it all worked fine a week ago when I was testing it, and I don't think anything has changed to my installation of PHP. I'm using PHP 5RC1 on a Windows Server 2003. The localhost has no built-in mail functionality, so I cannot use mail(). I must use Mail_smtp to log in to the mail server. I also have Net_SMTP and Net_Socket installed, and, like I said, when I first dropped in my code, all was working fine. My code is, as follows: code require_once 'Mail/smtp.php'; $smtp_settings = array( 'host' = 'localhost', 'port' = '25', 'auth' = 'LOGIN', 'username' = 'username', 'password' = 'password' ); $to = [EMAIL PROTECTED]; $msg = Line 1\nLine 2\nLine 3; $headers = array( 'Subject' = My Subject, 'From' = [EMAIL PROTECTED], 'Date' = date('r'), 'Content-Type' = 'text/plain', 'X-Mailer' = PHP/ . phpversion() ); $mail = new Mail_smtp($smtp_settings); if ($mail-send($to, $headers, $msg)) { echo h2Sent successfully/h2; } else { echo h2Not sent/h2; } /code If I don't get the access violation error, I get the message Sent successfully. Yet, I don't receive any messages. In the code for Mail_smtp (in Mail/smtp.php), I have added the following line just under the function declaration line for the send() method: echo test; When the access violation occurs, I get this line: PHP has encountered an Access Violation at 0177A8B4test From this, it appears to me that the access violation is not occurring when the class tries to send mail, but sometime earlier than that. However, I do not know much more about these Access Violoations, other than PHP is trying to access memory that it doesn't have permission to access. I couldn't find anything at bugs.php.net or through Google that helped much with this problem. Any help would be greatly appreciated. I am on a tight deadline, so any help ASAP would be even more greatly appreciated. ;-) -- Regards, Ben Ramsey http://benramsey.com http://www.phpcommunity.org/wiki/People/BenRamsey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Weird variable issue encountered... help needed!
Just don't use register globals and use if ($_POST) instead of if($action=='post') so you don't have to include that ?action=post in the query string of your action. Dvdmandt wrote: Accutually, I intented ?action=post, and if($action=='post'), just forgot to add method=post.. :p -- Regards, Ben Ramsey http://benramsey.com http://www.phpcommunity.org/wiki/People/BenRamsey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP Access Violation using PEAR::Mail_smtp
I've asked about PHP Access Violation errors before (this very same error, as a matter of fact), and every time I ask, I get no response. It's been 24 hours, and no one on php-general, pear-general, or #php and #pear in Freenode IRC has responded to this particular post. Do I smell bad? Please forgive me for refreshing my own post to the list, but this is an important question, and it is time-sensitive. Any help or pointers would be greatly appreciated, as I cannot get around this issue at all. Thanks, Ben Ben Ramsey wrote: I'm getting the following error when using the Mail_smtp package from PEAR: PHP has encountered an Access Violation at 0177A8B4 It does not occur everytime I use it, but even when send() returns true, e-mail messages are not being sent. However, it all worked fine a week ago when I was testing it, and I don't think anything has changed to my installation of PHP. I'm using PHP 5RC1 on a Windows Server 2003. The localhost has no built-in mail functionality, so I cannot use mail(). I must use Mail_smtp to log in to the mail server. I also have Net_SMTP and Net_Socket installed, and, like I said, when I first dropped in my code, all was working fine. My code is, as follows: code require_once 'Mail/smtp.php'; $smtp_settings = array( 'host' = 'localhost', 'port' = '25', 'auth' = 'LOGIN', 'username' = 'username', 'password' = 'password' ); $to = [EMAIL PROTECTED]; $msg = Line 1\nLine 2\nLine 3; $headers = array( 'Subject' = My Subject, 'From' = [EMAIL PROTECTED], 'Date' = date('r'), 'Content-Type' = 'text/plain', 'X-Mailer' = PHP/ . phpversion() ); $mail = new Mail_smtp($smtp_settings); if ($mail-send($to, $headers, $msg)) { echo h2Sent successfully/h2; } else { echo h2Not sent/h2; } /code If I don't get the access violation error, I get the message Sent successfully. Yet, I don't receive any messages. In the code for Mail_smtp (in Mail/smtp.php), I have added the following line just under the function declaration line for the send() method: echo test; When the access violation occurs, I get this line: PHP has encountered an Access Violation at 0177A8B4test From this, it appears to me that the access violation is not occurring when the class tries to send mail, but sometime earlier than that. However, I do not know much more about these Access Violoations, other than PHP is trying to access memory that it doesn't have permission to access. I couldn't find anything at bugs.php.net or through Google that helped much with this problem. Any help would be greatly appreciated. I am on a tight deadline, so any help ASAP would be even more greatly appreciated. ;-) -- Regards, Ben Ramsey http://benramsey.com http://www.phpcommunity.org/wiki/People/BenRamsey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP Access Violation using PEAR::Mail_smtp
Let me point something out here: I was a goof and had an authentication setting wrong. When I changed it back to LOGIN, it sends e-mail just fine. So, all is well... sort of. Every 3rd or 4th run of the script still generates the Access Violation message. However, since it happens intermittently, it makes it a pain in the rear to track down. DVD Also, you don't need a mailserver on localhost to use mail() I'm on Windows Server 2003... Here's the error I get when I use mail() and no SMTP authentication: Code: mail([EMAIL PROTECTED],This is a test,This is the message); Error: Warning: mail() [function.mail]: Failed to connect to mailserver at localhost port 25, verify your SMTP and smtp_port setting in php.ini or use ini_set() in E:\path\to\test.php on line 5 When I explicitly set the correct mail server with ini_set(), I get: Warning: mail() [function.mail]: SMTP server response: 550 Relaying is prohibited in E:\path\to\test.php on line 6 This is why I've gone with using the PEAR class Mail_smtp. It seems the easiest thing to use without having to write a whole lot of socket connection code. -- Regards, Ben Ramsey http://benramsey.com http://www.phpcommunity.org/wiki/People/BenRamsey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP security in a hosting environment
hi. one of my clients whom we host a website for has expressed interest in writing their own php/mySQL applications for their site. i've been looking in to the security implications of offering this service. My concerns are that the client *could* use a php script to access parts of the file system, registry (this is a Win32 environment), or other such things. I found a good article at http://www.securityfocus.com/infocus/1706 - it details some of the settings in the php config that can be used to prevent malicious scripting. Does anyone here have experience of securing a php server, and might have any advice on what else to watch out for? Any help appreciated. Thanks. Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Hiding email address from Robots ??
CZ It all depends on the persons dedication on finding them. I usually just convert them to HTML entities with a function like this: function spamProtect ($address) { $address = str_replace(@, #64;, $address); $address = str_replace(., #46;, $address); $address = str_replace(:, #58;, $address); return $address; } You can call it with: spamProtect([EMAIL PROTECTED]) or spamProtect(mailto:[EMAIL PROTECTED]) But, like Curt said, those dedicated to harvesting e-mail addresses can add further complexity to their e-mail harvesting programs and catch these rather easily. Ultimately, the best way to keep people from grabbing e-mail addresses is not to display them on your Web site at all. This hurts you if you need a point of contact; however, you could use a form that sends a message to a processing script that then e-mails the message to the intended recipient. The e-mail address would never need to be visible to the browser, and so, the harvesters would never get your address. -- Regards, Ben Ramsey http://benramsey.com http://www.phpcommunity.org/wiki/People/BenRamsey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP Access Violation using PEAR::Mail_smtp
So, I found a solution to my problem. I still do not know what was causing the PHP Access Violation errors, but I have an idea, which I will relate in this message. As many suggested, I have pared down my mail sending class by rewriting it down to about 250 lines of code. Previously, the PEAR::Mail::smtp class had much fewer lines of code, but if you count all of the other files it had to include, then it was a whopping amount of code. The difference here is that I am only using one class now to send mail, whereas the PEAR::Mail::smtp class was using about 5 different classes. Let me walk you through them. Mail::smtp included and extended the Mail class. The Mail class included and extended the PEAR class. The send() method of Mail::smtp included the Net::SMTP class and created an object of that class. The Net::SMTP class included the PEAR and Net::Socket classes (and optionally checked for and included the Auth::SASL class). The Net_SMTP() contstructor created a Net::Socket object. The Net::Socket class included and extended the PEAR class. So, in all, that's about 5 classes that Mail::stmp needed. Once I got it down to one class, the Access Violations disappeared. So, here's what I think was happening with the classes based on some of the information I have been told. I've been told that the Access Violation errors are probably caused when PHP tries to access a space of memory that it doesn't have permission to access. From this, I'm gathering that the sheer number of classes needed and objects and variables created confused PHP so that it wasn't sure what pointers pointed to the correct space in memory. (Again, I'm out on a limb with this guess.) Because the pointer lost its space in memory (I'm guessing that's what happened), PHP tried to access a space that it either no longer had permission to access or it never had permission to access. Make sense? I'm sharing this here because several people expressed an interest in knowing how it got resolved. -- Regards, Ben Ramsey http://benramsey.com http://www.phpcommunity.org/wiki/People/BenRamsey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] What does MAX_FILE_SIZE do?
I was reading about this here: http://us3.php.net/manual/en/features.file-upload.php It says: quote But you should add MAX_FILE_SIZE anyway as it saves users the trouble to wait for a big file being transferred only to find out that it was too big afterwards. /quote So, I decided to add input type=hidden name=MAX_FILE_SIZE value=3 / to my form. It didn't seem to do anything. Is the browser supposed to use this to throw a browser-genrated error to me, or something? -- Regards, Ben Ramsey http://benramsey.com http://www.phpcommunity.org/wiki/People/BenRamsey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What does MAX_FILE_SIZE do?
JWH I think the intent is that the browser would catch files that are JWH too large before they actually have to be uploaded. I don't know JWH that any browsers actually support this, though. Well, is there actually a way to do this or a way to check the filesize and send a nice message to the user that the file is over the limit--other than just some error being thrown? I can't find anything in the manual or in the user notes... or maybe I'm just not looking hard enough. -- Regards, Ben Ramsey http://benramsey.com http://www.phpcommunity.org/wiki/People/BenRamsey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What does MAX_FILE_SIZE do?
RD Just let them upload the file, check the size when it's arrived and RD say sorry, you just wasted X minutes of your life uploading that, RD try again. That's what I was asking about, actually. How do I capture the filesize without PHP throwing an error about the file being too big? -- Regards, Ben Ramsey http://benramsey.com http://www.phpcommunity.org/wiki/People/BenRamsey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What does MAX_FILE_SIZE do?
JWH That's what $_FILES['whatever']['size'] is for. Although if the JWH file is too large, like over the php.ini max file size setting, JWH I don't think you get to control what happens. That's what I JWH thought was being discussed. That's exactly what I was asking about. So, there's no way to throw a nice error to the user if the file goes over the max file size setting in php.ini? -- Regards, Ben Ramsey http://benramsey.com http://www.phpcommunity.org/wiki/People/BenRamsey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Passing Parameters to PHP Script
I'm executing a PHP script from the Windows command prompt: c:/path/to/php.exe c:/path/to/script.php I want to pass some parameters to script.php, but I can't use a query string because then I get a file not found type of error. So, how should I pass parameters to the script? -- Regards, Ben Ramsey http://benramsey.com http://www.phpcommunity.org/wiki/People/BenRamsey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] dynamically building insert/update forms from db
CB I believe there is a PEAR library package that does this. You might CB want to do some research to see if it fits your needs. Yes, there is. Check out PEAR::DB or PEAR::MDB which both have good classes for preparing INSERT and UPDATE statements, as well as for finding out information about what columns and datatypes a table has (which is what I think you are most interested in). These are really easy-to-use classes, too. Then, I would also suggest checking out the PEAR::HTML_QuickForm class, as it has functions you can use to generate HTML forms. -- Regards, Ben Ramsey http://benramsey.com --- http://www.phpcommunity.org/ Open Source, Open Community Visit for more information or to join the movement. --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How to use pcntl_fork()?
I'm working with PHP-GTK to create a GUI application. This GUI application opens a socket to a gaming server to send/receive data to display to the user. So far, this is working well, but the problem is that it can only receive data after I make a function call to send data. Here's my program logic so far: I have the following functions: enter_key() send() receive() output() When the user enters text into the text input field, they click their Enter key. This calls the enter_key() function. When this function is called, it gets the text from the input field and passes it along to send(), which sends it to the socket. Then enter_key() calls receive(), which receives data from the socket. The receive() function calls the output() function, which displays the received data to the user in a GTK widget. So far, the program can only receive data from the socket when a call has been made to receive(), and I am explicitly calling receive() after the user clicks the Enter key. This means that data the game is transmitting is not being received until the user enters something. This is not preferable. What I would like to do is to have a sort of listener that listens on the socket and contantly receives data. It has been suggested that I use pcntl_fork() to do this, but I have looked at the manual and user-contributed notes for this, and I can't quite grasp how it's supposed to look in my code. So far, I've done something along these lines at the very end of my script: $pid = pcntl_fork(); if ($pid == -1) { die(could not fork); } elseif ($pid) { exit(0); } else { while (1) { receive(); } } I'm not sure this is working, though. It does not seem to be receiving from the socket unless I send. Ultimately, I want to remove all calls to receive() from my main program and let the listener take control of that, but I can't even tell if the above code is working, or if I'm even grasping how to make it work. Any help or pointers is greatly appreciated. -- Regards, Ben Ramsey http://benramsey.com --- http://www.phpcommunity.org/ Open Source, Open Community Visit for more information or to join the movement. --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: How to use pcntl_fork()?
Does no one know how to use pcntl_fork(), then? ;-) Ben Ramsey wrote: I'm working with PHP-GTK to create a GUI application. This GUI application opens a socket to a gaming server to send/receive data to display to the user. So far, this is working well, but the problem is that it can only receive data after I make a function call to send data. Here's my program logic so far: I have the following functions: enter_key() send() receive() output() When the user enters text into the text input field, they click their Enter key. This calls the enter_key() function. When this function is called, it gets the text from the input field and passes it along to send(), which sends it to the socket. Then enter_key() calls receive(), which receives data from the socket. The receive() function calls the output() function, which displays the received data to the user in a GTK widget. So far, the program can only receive data from the socket when a call has been made to receive(), and I am explicitly calling receive() after the user clicks the Enter key. This means that data the game is transmitting is not being received until the user enters something. This is not preferable. What I would like to do is to have a sort of listener that listens on the socket and contantly receives data. It has been suggested that I use pcntl_fork() to do this, but I have looked at the manual and user-contributed notes for this, and I can't quite grasp how it's supposed to look in my code. So far, I've done something along these lines at the very end of my script: $pid = pcntl_fork(); if ($pid == -1) { die(could not fork); } elseif ($pid) { exit(0); } else { while (1) { receive(); } } I'm not sure this is working, though. It does not seem to be receiving from the socket unless I send. Ultimately, I want to remove all calls to receive() from my main program and let the listener take control of that, but I can't even tell if the above code is working, or if I'm even grasping how to make it work. Any help or pointers is greatly appreciated. -- Regards, Ben Ramsey http://benramsey.com --- http://www.phpcommunity.org/ Open Source, Open Community Visit for more information or to join the movement. --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] RE:php and java applets
This is straight from the http://java.sun.com/applets/ web page: When you use a Java technology-enabled browser to view a page that contains an applet, the applet's code is transferred to your system and executed by the browser's Java Virtual Machine (JVM). Java Applets cannot connect to the same host they were loaded from. They run on the client machine as a local program. I know this because I attempted to run an applet and have it connect to a mysql server the resided on the web server. The applet could not connect using localhost as the domain name of the server. ( Which due to security settings was the only URL I could connect to.) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: mail() problem
I would also suggest adding the following headers to the message, as they are supposed to help keep the spam filters from recognizing a message as spam: X-Priority: 3 X-MSMail-Priority: Normal Of course, you can read up on the various priority levels and change them if you want, but these settings are for normal priority mail and will help to pass it through the spam filters, from what I understand. They've worked for us so far. Stephen Lake wrote: Another suggestion is if its an HTML format mail, make sure you use properie making sure all tags are closed that kind of stuffsome software will block if the HTML is not well formed Rick [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi All, Does anyone know a good format for sending email using the mail() function that doesnt get stopped by antispam software? I need to send and email from my sever when a new member creates an account, this ive done but my email gets binned straight away? must be the headers? Regards Rick -- Regards, Ben Ramsey http://benramsey.com --- http://www.phpcommunity.org/ Open Source, Open Community Visit for more information or to join the movement. --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php installation verification
Did you fix this problem yet? The lines below are fine for your apache httpd.conf file. The only thing that appears out of the ordinary is the location of libphp4.so. In my setup (I'm also using Red Hat and Apache 2.0), when I compile PHP, it places libphp4.so in the modules directory (/etc/httpd/modules), which is where I would think it should be on your system, so try changing that line to: LoadModule php4_module modules/libphp4.so Of course, check to make sure the file is in that location first, as I could be way off. Then, restart apache and try to access your test.php script. Long P Nguyen wrote: OK - I tried that and what came up on the browser was the content of the test.php file. I checked in my httpd.conf file I do have the following: AddType application/x-httpd-php .php AddType application/x-http-php-source .phps LoadModule php4_module libexec/libphp4.so Any thoughts? thank you. -- Regards, Ben Ramsey http://benramsey.com --- http://www.phpcommunity.org/ Open Source, Open Community Visit for more information or to join the movement. --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php