php-general Digest 12 Apr 2010 14:18:40 -0000 Issue 6688
php-general Digest 12 Apr 2010 14:18:40 - Issue 6688 Topics (messages 303993 through 304004): Re: PHP MYSQL sorting 303993 by: kranthi 303995 by: Nilesh Govindarajan 304004 by: tedd Re: need help w/ unfamiliar syntax 303994 by: kranthi 303996 by: Robert Cummings Mail Function Problem 303997 by: Alice Wei 303999 by: Kevin Kinsey 304000 by: Peter Lind 304001 by: Alice Wei 304002 by: Alexey Bovanenko 304003 by: Alice Wei Re: Inserting into multiple tables 303998 by: Paul M Foster Administrivia: To subscribe to the digest, e-mail: php-general-digest-subscr...@lists.php.net To unsubscribe from the digest, e-mail: php-general-digest-unsubscr...@lists.php.net To post to the list, e-mail: php-gene...@lists.php.net -- ---BeginMessage--- You can use javascript to trigger an onclick function every time a checkbox is selected. The onclick function can make an ajax call to a remote php script which can then make the database query. ---End Message--- ---BeginMessage--- On 04/12/10 05:46, Ernie Kemp wrote: Simple idea I thought. I need a webpage that displays a drop down list of number with a checkbox on the side that when checked will select the database again only in descending order. Small database with maybe 100 records. The user can click the submit button when they have located the correct number. The trick is to make the checkbox trigger a new Select statement. Thanks. Use jquery, trigger an ajax request onclick of that checkbox. -- Nilesh Govindarajan Site Server Administrator www.itech7.com मेरा भारत महान ! मम भारत: महत्तम भवतु ! ---End Message--- ---BeginMessage--- At 8:16 PM -0400 4/11/10, Ernie Kemp wrote: Simple idea I thought. I need a webpage that displays a drop down list of number with a checkbox on the side that when checked will select the database again only in descending order. Small database with maybe 100 records. The user can click the submit button when they have located the correct number. The trick is to make the checkbox trigger a new Select statement. Thanks. Ernie: form name=myForm action= input type=checkbox name=sort id=sort onClick=getData(this) /form The javascript getData() will have to launch a php script to get the data again OR you can simply sort the data yourself using sort(). Here's another idea using jQuery: http://webbytedd.com/jquery/sortable-table/ Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com ---End Message--- ---BeginMessage--- guess you are looking for http://www.php.net/manual/en/language.types.string.php#language.types.string.parsing ---End Message--- ---BeginMessage--- Daniel Egeberg wrote: On Sun, Apr 11, 2010 at 20:30, lala l...@mail.theorb.net wrote: Hi all, I've wasted two days trying to find this in the documentation. Google is no help here either; they only index text. While looking at some code using objects I came across this: $this-{$spec} The example works with or without the curly braces, but I know they aren't there for just for decoration ;) Will somebody be so kind as to point me where in the docs this syntax is explained? tia It's documented here: http://php.net/manual/en/language.variables.variable.php It works for function and class names as well. The style used above is superfluous since no additional operations are being done within the braces and so the braces are redundant. This is why it works either way. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP ---End Message--- ---BeginMessage--- Hi, I have an issue here where I see no PHP errors on my mail function usage, and yet I am not getting the mail in the desired account. Here is what I have for my PHP code: $headers = From: aj...@alumni.iu.edu; $to = aj...@alumni.iu.edu ; $subject = Comments Regarding My Studio; $body = From: $your_name\n E-Mail: $email\n Reason Contact: $question\n Comments:\n $comments; mail($to, $subject, $body,$headers); This is what I have in my PHP.ini: [mail function] ; For Win32 only. SMTP = smtp.live.com smtp_port = 587 ; For Win32 only. sendmail_from = aj...@alumni.iu.edu ; For Unix only. You may supply arguments as well (default: sendmail -t -i). ;sendmail_path = ; Force the addition of the specified parameters to be passed as extra parameters ; to the sendmail binary. These parameters will always replace the value of ; the 5th parameter to mail(), even in safe mode. ;mail.force_extra_parameters = Yet, I don't see any mail in my aj...@alumni.iu.edu Mailbox, can anyone on the list please give me some pointers on what I may have done wrong here? Thanks for your help. _ The New Busy is not the old busy.
php-general Digest 13 Apr 2010 03:24:10 -0000 Issue 6689
kind of link table between BlogPosts and Comments, / Users and Comments. In a real system we may even have another two primary tables introduced, Roles and UserRoles, as the system may have multiple Roles (Author, Commenter, Admin etc) and each User may have multiple Roles themselves, in one capacity I am an Admin, in another I'm an Author. (UserRoles may be better considered as Personas?) Ultimately there are many considerations to take in to account, the relationships between types of data, the frequency at which inserts/updates/selects occur, the complexity and speed of each query, and much more. Designing a table structure is different for each job, with different considerations and things to weigh up, generally though normalisation can cater for at least some future scope creep. It's also worth noting that some consider it bad practise to design a system from the storage point upwards, because the application and data should not be constrained by persistence layer features or limitations - which would indicate designing the data model in UML or suchlike and dealing with Objects rather than Tables (then later mapping objects to tables in order to persist them, if choosing a RDBMS as the persistence layer). It may also be worth noting that an EAV model is the ultimate in normalisation and allows all data to be persisted in a single 3 column structure (or 4 if you partition data). I'll save details of this though. Do hope that helps in some way, and if you need any more info just shout. Nathan __ Information from ESET Smart Security, version of virus signature database 5021 (20100412) __ The message was checked by ESET Smart Security. http://www.eset.com __ Information from ESET Smart Security, version of virus signature database 5021 (20100412) __ The message was checked by ESET Smart Security. http://www.eset.com ---End Message--- ---BeginMessage--- At 11:05 AM -0400 4/12/10, Gary wrote: -snip- If normalization is so important, why is it that the INSERT INTO multiple tables is not a standard command or procedure?. In my view, you are mixing apples and oranges. Normalization is simply cutting down on repetition. Inserting data into multiple tables is a different critter -- it doesn't make Normalization any better or worse. Just figure out what data you need to acquire, what tables you need to store it in, and then what references you need to what tables/fields to use it while reducing repetition. For example if you have a customer table, you don't need to add all the customer data to each sales receipt (sales table) when you can simply record the customer's ID. Likewise with the items that are sold, you don't need to include all the items attributes in the sales receipt (sales table) when you can simply record the items' ID. None of the above requires some special way to inserting data into multiple tables -- you just record the sales. Sales table Sales ID -- Customer ID -- Item ID -- and probably the date. 1234 -- 6789 -- 101112131415 -- 4/12/10 Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com ---End Message--- ---BeginMessage--- Tedd Thanks for your response, perhaps I was completely missing this or my powers of expanation have gone out the window. I have found a solution and I am going to put it in its own post. Thanks again. gary tedd tedd.sperl...@gmail.com wrote in message news:p0624080ac7e9123f4...@[192.168.1.102]... At 11:05 AM -0400 4/12/10, Gary wrote: -snip- If normalization is so important, why is it that the INSERT INTO multiple tables is not a standard command or procedure?. In my view, you are mixing apples and oranges. Normalization is simply cutting down on repetition. Inserting data into multiple tables is a different critter -- it doesn't make Normalization any better or worse. Just figure out what data you need to acquire, what tables you need to store it in, and then what references you need to what tables/fields to use it while reducing repetition. For example if you have a customer table, you don't need to add all the customer data to each sales receipt (sales table) when you can simply record the customer's ID. Likewise with the items that are sold, you don't need to include all the items attributes in the sales receipt (sales table) when you can simply record the items' ID. None of the above requires some special way to inserting data into multiple tables -- you just record the sales. Sales table Sales ID -- Customer ID -- Item ID -- and probably the date. 1234 -- 6789 -- 101112131415 -- 4/12/10 Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com __ Information from ESET Smart Security, version of virus signature database 5022 (20100412) __ The message was checked by ESET Smart Security
Re: [PHP] Mail Function Problem
On 12 April 2010 05:22, Kevin Kinsey k...@daleco.biz wrote: Thanks to the worldwide brotherhood of crooks known as spammers, sending e-mail these days isn't nearly as easy as PHP makes it look. You might wanna look into an errors-to header to help debug any problems with sender authorization, bad ports, etc. Along these lines: there's a chance that sending a mail from yourself, to yourself, through PHP like this, will cause mail servers to think it's spam. For testing email sending, normal scenarios are better (i.e. send an email to another account). Regards Peter -- hype WWW: http://plphp.dk / http://plind.dk LinkedIn: http://www.linkedin.com/in/plind Flickr: http://www.flickr.com/photos/fake51 BeWelcome: Fake51 Couchsurfing: Fake51 /hype -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Mail Function Problem
From: peter.e.l...@gmail.com Date: Mon, 12 Apr 2010 13:09:48 +0200 Subject: Re: [PHP] Mail Function Problem To: k...@daleco.biz CC: aj...@alumni.iu.edu; php-general@lists.php.net On 12 April 2010 05:22, Kevin Kinsey k...@daleco.biz wrote: Thanks to the worldwide brotherhood of crooks known as spammers, sending e-mail these days isn't nearly as easy as PHP makes it look. You might wanna look into an errors-to header to help debug any problems with sender authorization, bad ports, etc. Along these lines: there's a chance that sending a mail from yourself, to yourself, through PHP like this, will cause mail servers to think it's spam. For testing email sending, normal scenarios are better (i.e. send an email to another account). Regards Peter -- hype WWW: http://plphp.dk / http://plind.dk LinkedIn: http://www.linkedin.com/in/plind Flickr: http://www.flickr.com/photos/fake51 BeWelcome: Fake51 Couchsurfing: Fake51 /hype I have changed my $to to $email, so it is not the same email address as the $from. I also added Kevin's lines with the parameters that April suggested, and it looks like I still get Sending Mail failed. Which function should I use to find out why my sending mail failed? Thanks for your help. Alice _ The New Busy think 9 to 5 is a cute idea. Combine multiple calendars with Hotmail. http://www.windowslive.com/campaign/thenewbusy?tile=multicalendarocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_5
Re: [PHP] Mail Function Problem
Hi! You have the following php.ini params: SMTP = smtp.live.com smtp_port = 587 live.com not support relay and it requires authentication. On Mon, Apr 12, 2010 at 6:33 AM, Alice Wei aj...@alumni.iu.edu wrote: Hi, I have an issue here where I see no PHP errors on my mail function usage, and yet I am not getting the mail in the desired account. Here is what I have for my PHP code: $headers = From: aj...@alumni.iu.edu; $to = aj...@alumni.iu.edu ; $subject = Comments Regarding My Studio; $body = From: $your_name\n E-Mail: $email\n Reason Contact: $question\n Comments:\n $comments; mail($to, $subject, $body,$headers); This is what I have in my PHP.ini: [mail function] ; For Win32 only. SMTP = smtp.live.com smtp_port = 587 ; For Win32 only. sendmail_from = aj...@alumni.iu.edu ; For Unix only. You may supply arguments as well (default: sendmail -t -i). ;sendmail_path = ; Force the addition of the specified parameters to be passed as extra parameters ; to the sendmail binary. These parameters will always replace the value of ; the 5th parameter to mail(), even in safe mode. ;mail.force_extra_parameters = Yet, I don't see any mail in my aj...@alumni.iu.edu Mailbox, can anyone on the list please give me some pointers on what I may have done wrong here? Thanks for your help. _ The New Busy is not the old busy. Search, chat and e-mail from your inbox. http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_3 -- With regards, Alexei Bovanenko
RE: [PHP] Mail Function Problem
Date: Mon, 12 Apr 2010 15:26:46 +0400 Subject: Re: [PHP] Mail Function Problem From: a.bovane...@gmail.com To: aj...@alumni.iu.edu CC: php-general@lists.php.net Hi! You have the following php.ini params:SMTP = smtp.live.com smtp_port = 587 live.com not support relay and it requires authentication. Is there an email account that I could try? I thought most email accounts requires authentication anyway. Thanks for your help. Alice On Mon, Apr 12, 2010 at 6:33 AM, Alice Wei aj...@alumni.iu.edu wrote: Hi, I have an issue here where I see no PHP errors on my mail function usage, and yet I am not getting the mail in the desired account. Here is what I have for my PHP code: $headers = From: aj...@alumni.iu.edu; $to = aj...@alumni.iu.edu ; $subject = Comments Regarding My Studio; $body = From: $your_name\n E-Mail: $email\n Reason Contact: $question\n Comments:\n $comments; mail($to, $subject, $body,$headers); This is what I have in my PHP.ini: [mail function] ; For Win32 only. SMTP = smtp.live.com smtp_port = 587 ; For Win32 only. sendmail_from = aj...@alumni.iu.edu ; For Unix only. You may supply arguments as well (default: sendmail -t -i). ;sendmail_path = ; Force the addition of the specified parameters to be passed as extra parameters ; to the sendmail binary. These parameters will always replace the value of ; the 5th parameter to mail(), even in safe mode. ;mail.force_extra_parameters = Yet, I don't see any mail in my aj...@alumni.iu.edu Mailbox, can anyone on the list please give me some pointers on what I may have done wrong here? Thanks for your help. _ The New Busy is not the old busy. Search, chat and e-mail from your inbox. http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_3 -- With regards, Alexei Bovanenko _ The New Busy think 9 to 5 is a cute idea. Combine multiple calendars with Hotmail. http://www.windowslive.com/campaign/thenewbusy?tile=multicalendarocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_5
Re: [PHP] PHP MYSQL sorting
At 8:16 PM -0400 4/11/10, Ernie Kemp wrote: Simple idea I thought. I need a webpage that displays a drop down list of number with a checkbox on the side that when checked will select the database again only in descending order. Small database with maybe 100 records. The user can click the submit button when they have located the correct number. The trick is to make the checkbox trigger a new Select statement. Thanks. Ernie: form name=myForm action= input type=checkbox name=sort id=sort onClick=getData(this) /form The javascript getData() will have to launch a php script to get the data again OR you can simply sort the data yourself using sort(). Here's another idea using jQuery: http://webbytedd.com/jquery/sortable-table/ Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Inserting into multiple tables
by persistence layer features or limitations - which would indicate designing the data model in UML or suchlike and dealing with Objects rather than Tables (then later mapping objects to tables in order to persist them, if choosing a RDBMS as the persistence layer). It may also be worth noting that an EAV model is the ultimate in normalisation and allows all data to be persisted in a single 3 column structure (or 4 if you partition data). I'll save details of this though. Do hope that helps in some way, and if you need any more info just shout. Nathan __ Information from ESET Smart Security, version of virus signature database 5021 (20100412) __ The message was checked by ESET Smart Security. http://www.eset.com __ Information from ESET Smart Security, version of virus signature database 5021 (20100412) __ The message was checked by ESET Smart Security. http://www.eset.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Mail Function Problem
Alice Wei wrote: Hi! You have the following php.ini params:SMTP = smtp.live.com smtp_port = 587 live.com not support relay and it requires authentication. Is there an email account that I could try? I thought most email accounts requires authentication anyway. Well, therein lies the rub, as the Bard said (maybe). PHP's mail() was built on a general assumption that there would be a local SMTP server. It supports remote SMTP, but I'm not aware of any ability to do SMTP auth, even in the PEAR packages. You might just wanna read up on mail in general. The php.net/mail page lists several relevant RFC's, and has links to most of the PEAR mail classes, etc. You should definitely read up on live.com's email configuration. If they use SMTP auth, I'm not sure you can do this (per above). If it uses, say, POP before SMTP for authorization, you might be able to hack something together with the PHP IMAP functions, or even sockets, but you're getting into a big lotta work for what seems a small thing. Kevin Kinsey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Mail Function Problem
Date: Mon, 12 Apr 2010 11:09:42 -0500 From: k...@daleco.biz To: aj...@alumni.iu.edu CC: a.bovane...@gmail.com; php-general@lists.php.net Subject: Re: [PHP] Mail Function Problem Alice Wei wrote: Hi! You have the following php.ini params:SMTP = smtp.live.com smtp_port = 587 live.com not support relay and it requires authentication. Is there an email account that I could try? I thought most email accounts requires authentication anyway. Well, therein lies the rub, as the Bard said (maybe). PHP's mail() was built on a general assumption that there would be a local SMTP server. It supports remote SMTP, but I'm not aware of any ability to do SMTP auth, even in the PEAR packages. You might just wanna read up on mail in general. The php.net/mail page lists several relevant RFC's, and has links to most of the PEAR mail classes, etc. You should definitely read up on live.com's email configuration. If they use SMTP auth, I'm not sure you can do this (per above). If it uses, say, POP before SMTP for authorization, you might be able to hack something together with the PHP IMAP functions, or even sockets, but you're getting into a big lotta work for what seems a small thing. This is what I am talking about. Two years ago when I first set up my own server with Linux and not Windows, I never had to deal with this. Perhaps the authentication has since then got stricter, but it should not be so much of a heck of a deal. I found this doc from ATT's website, http://helpme.att.net/pdf/uverse/uverse_hsi_qsg_english.pdf, so obviously the smtp server I provided earlier is probably not up to date. I think I will fiddle around with the php.ini file and see what else is there. Thanks. Alice _ Hotmail has tools for the New Busy. Search, chat and e-mail from your inbox. http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_1
RE: [PHP] Mail Function Problem
On Mon, 2010-04-12 at 12:58 -0400, Alice Wei wrote: Hi, I found an article on the item you described. http://www.talkphp.com/vbarticles.php?do=articlearticleid=51title=sending-emails-with-the-zend-framework, but I am using Windows on my PHP. Would this still work? Looks like the example code it provided is from a Linux system. I also saw info. on this link: http://activecodeline.com/sending-emails-via-zend_mail-using-google-email-account. Since all the authentication is done here in one go, what should I edit on my PHP.ini file? Do I have to set the params as http://helpme.att.net/pdf/uverse/uverse_hsi_qsg_english.pdf is described? I use U-Verse from ATT, by by way. [mail function] ; For Win32 only. SMTP = smtp.att,yahoo.com smtp_port = 465 ; For Win32 only. sendmail_from = elite.engl...@att.net There's no need to edit anything in php.ini, and, since it is pure PHP, it should work on Windows too, though I didn't try it. It works well on Linux. Here's the class we used to send mail through Zend_Mail: ?php class Mail_Send { public function __construct($to_mail, $to_name, $subject, $body) { $config_general = Database_Config_General::getInstance (); $mail = new Zend_Mail(); $mail-setFrom($config_general-getSiteMailAddress(), $config_general-getSiteMailName()); $mail-addTo($to_mail, $to_name); $mail-setSubject($subject); $mail-setBodyText($body, UTF-8); $smtp_host = $config_general-getMailSendHost(); $smtp_authentication = $config_general-getMailSendAuthentication (); $smtp_user = $config_general-getMailSendUsername(); $smtp_password = $config_general-getMailSendPassword(); $smtp_security = $config_general-getMailSendSecurity(); $smtp_port = $config_general-getMailSendPort(); if ($smtp_host != ) { if ($smtp_authentication != None) { $config = array ('auth' = $smtp_authentication, 'username' = $smtp_user, 'password' = $smtp_password); $mta = new Zend_Mail_Transport_Smtp($smtp_host); } if ($smtp_security != NONE) { $config = array_merge ($config, array ('ssl' = $smtp_security)); } if ($smtp_port != ) { $config = array_merge ($config, array ('port' = $smtp_port)); } if (isset ($config)) { $mta = new Zend_Mail_Transport_Smtp($smtp_host, $config); } else { $mta = new Zend_Mail_Transport_Smtp($smtp_host); } $mail-send($mta); } else { // If no smtp host is given, it uses the default sendmail mail transport agent. $mail-send(); } } } ? Hope it works, Teus. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Mail Function Problem
PEAR's mail package does support authentication. http://email.about.com/od/emailprogrammingtips/qt/PHP_Email_SMTP_Authentication.htm In case you get a Sent Successfully message (but didn't get a mail in your inbox or spam folder) there is a problem with your SMTP server configuration. And There's no need to edit anything in php.ini, and, since it is pure PHP, it should work on Windows too (i tried it and it works) KK. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Inserting into multiple tables
At 11:05 AM -0400 4/12/10, Gary wrote: -snip- If normalization is so important, why is it that the INSERT INTO multiple tables is not a standard command or procedure?. In my view, you are mixing apples and oranges. Normalization is simply cutting down on repetition. Inserting data into multiple tables is a different critter -- it doesn't make Normalization any better or worse. Just figure out what data you need to acquire, what tables you need to store it in, and then what references you need to what tables/fields to use it while reducing repetition. For example if you have a customer table, you don't need to add all the customer data to each sales receipt (sales table) when you can simply record the customer's ID. Likewise with the items that are sold, you don't need to include all the items attributes in the sales receipt (sales table) when you can simply record the items' ID. None of the above requires some special way to inserting data into multiple tables -- you just record the sales. Sales table Sales ID -- Customer ID -- Item ID -- and probably the date. 1234 -- 6789 -- 101112131415 -- 4/12/10 Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Mail Function Problem
kranthi wrote: PEAR's mail package does support authentication. http://email.about.com/od/emailprogrammingtips/qt/PHP_Email_SMTP_Authentication.htm I will say mea culpa on this one; apparently I didn't dig deep enough into the PEAR docs to figure this out. It's certainly not mentioned on the manpage at php.net, but, of course, the PEAR stuff is elsewhere. I read over the first page linked from the PHP manpage, so it must have been a lil' deeper than that. If it's only available at about.com (lol), I'd suggest filing a PR with the PEAR folk's documentation team, eh? But, this time I'll do what I shoulda mentioned before and include the IANAE disclaimer on all things PEAR, many things PHP, and some things SMTP. Kevin Kinsey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Inserting into multiple tables
Tedd Thanks for your response, perhaps I was completely missing this or my powers of expanation have gone out the window. I have found a solution and I am going to put it in its own post. Thanks again. gary tedd tedd.sperl...@gmail.com wrote in message news:p0624080ac7e9123f4...@[192.168.1.102]... At 11:05 AM -0400 4/12/10, Gary wrote: -snip- If normalization is so important, why is it that the INSERT INTO multiple tables is not a standard command or procedure?. In my view, you are mixing apples and oranges. Normalization is simply cutting down on repetition. Inserting data into multiple tables is a different critter -- it doesn't make Normalization any better or worse. Just figure out what data you need to acquire, what tables you need to store it in, and then what references you need to what tables/fields to use it while reducing repetition. For example if you have a customer table, you don't need to add all the customer data to each sales receipt (sales table) when you can simply record the customer's ID. Likewise with the items that are sold, you don't need to include all the items attributes in the sales receipt (sales table) when you can simply record the items' ID. None of the above requires some special way to inserting data into multiple tables -- you just record the sales. Sales table Sales ID -- Customer ID -- Item ID -- and probably the date. 1234 -- 6789 -- 101112131415 -- 4/12/10 Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com __ Information from ESET Smart Security, version of virus signature database 5022 (20100412) __ The message was checked by ESET Smart Security. http://www.eset.com __ Information from ESET Smart Security, version of virus signature database 5023 (20100412) __ The message was checked by ESET Smart Security. http://www.eset.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Solution
database 5017 (20100411) __ The message was checked by ESET NOD32 Antivirus. http://www.eset.com __ Information from ESET Smart Security, version of virus signature database 5021 (20100412) __ The message was checked by ESET Smart Security. http://www.eset.com __ Information from ESET Smart Security, version of virus signature database 5023 (20100412) __ The message was checked by ESET Smart Security. http://www.eset.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Solution
On 13 April 2010 00:04, Gary gwp...@ptd.net wrote: For those that were looking to see a solution, this is what I have come up with. It was pointed out on another board (MySQL) that inserting multiple in one script is probably prohibited because of security reasons. What I did was open the connection, insert into the table, close the connection, close the php script, then start over again. This is the code: $dbc=mysqli_connect('localhost','root','','test')or die('Error connecting to MySQL server'); $query=INSERT INTO name(fname, lname).VALUES('$fname','$lname'); $result=mysqli_query($dbc, $query) or die('Error querying database.'); mysqli_close($dbc); ? ?php $dbc=mysqli_connect('localhost','root','','test')or die('Error connecting to MySQL server'); $query=INSERT INTO address (street, town, state, zip).VALUES('$street','$town','$state','$zip'); $result=mysqli_query($dbc, $query) or die('Error querying database.'); mysqli_close($dbc); ? It seems a little redundant for PHP, however it seems to work. Thank you to everyone that responded. If by the way someone sees an issue with this solution, I would love to read it. Off the top of my head: just reuse the connection. There's no need to close it, then reopen it. The only security problem you're facing is that you cannot send multiple queries in *the same string*[1]. So send the queries one by one, but in the same script, using the same connection. 1. The reason this is a security concern is that otherwise, should someone manage to inject sql into your query, they could drop in a semi-colon and then start a new query. By not allowing this, a lot of bad injections are by default ruled out. -- hype WWW: http://plphp.dk / http://plind.dk LinkedIn: http://www.linkedin.com/in/plind Flickr: http://www.flickr.com/photos/fake51 BeWelcome: Fake51 Couchsurfing: Fake51 /hype -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Mail Function Problem
Hi, Thanks to everyone's suggestions, I have followed some instructions from http://www.geeksengine.com/article/install-pear-on-windows.html and attempted to install PEAR. The problem is, when I do a test page, which only has: ?php error_reporting(-1); require_once PEAR.php; ?. utor It only gives me a blank page, with no errors. Has anyone who succeeded with using PEAR on PHP can guide me on a good tutorial to read? Thanks for your help. Alice Date: Mon, 12 Apr 2010 15:54:05 -0500 From: k...@daleco.biz To: kranthi...@gmail.com CC: aj...@alumni.iu.edu; php-general@lists.php.net Subject: Re: [PHP] Mail Function Problem kranthi wrote: PEAR's mail package does support authentication. http://email.about.com/od/emailprogrammingtips/qt/PHP_Email_SMTP_Authentication.htm I will say mea culpa on this one; apparently I didn't dig deep enough into the PEAR docs to figure this out. It's certainly not mentioned on the manpage at php.net, but, of course, the PEAR stuff is elsewhere. I read over the first page linked from the PHP manpage, so it must nks ve been a lil' deeper than that. If it's only available at about.com (lol), I'd suggest filing a PR with the PEAR folk's documentation team, eh? But, this time I'll do what I shoulda mentioned before and include the IANAE disclaimer on all things PEAR, many things PHP, and some things SMTP. Kevin Kinsey _ The New Busy is not the old busy. Search, chat and e-mail from your inbox. http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_3
Re: [PHP] Solution
Hey Gary, instead try something like this maybe? $dbc=mysqli_connect('localhost','root','','test') or die('Error connecting to MySQL server'); $query_name=INSERT INTO name(fname='$fname', lname='$lname'); $query_address=INSERT INTO address (street='$street', town='$town', state='$state', zip='$zip'); $result1=mysqli_query($dbc, $query_name) or die('Error querying database for name.'); $result2=mysqli_query($dbc, $query_address) or die('Error querying database for address.'); echo Success!br /; ? HTH, Karl On Apr 12, 2010, at 5:16 PM, Peter Lind wrote: $dbc=mysqli_connect('localhost','root','','test')or die('Error connecting to MySQL server'); $query=INSERT INTO name(fname, lname).VALUES('$fname','$lname'); $result=mysqli_query($dbc, $query) or die('Error querying database.'); mysqli_close($dbc); ? ?php $dbc=mysqli_connect('localhost','root','','test')or die('Error connecting to MySQL server'); $query=INSERT INTO address (street, town, state, zip).VALUES('$street','$town','$state','$zip'); $result=mysqli_query($dbc, $query) or die('Error querying database.'); mysqli_close($dbc); ? Karl DeSaulniers Design Drumm http://designdrumm.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Mail Function Problem
Hi Alice, I have a sendmail script I wrote on my way to learning PHP. Uses PHP 4 i believe, maybe 5. Wrote it a while ago. You and anyone else are welcome to use it/modify. You can reference this php it from multiple forms. Just specify the form names it should accept and their parameters. It can also send HTML results with a little modification. It isn't necessarily set up for mass emailing, but with a little tweaking, I am sure you could get it to work. You can separate the emails with comas , currently and it will send to all of them, but if they are in the TO:, everyone will see everyones email address. Might set it up to send to your email in the TO: and use the BCC: to send to your users. If you do convert it, mind sharing back?? :)) HTH, http://designdrumm.com/sendmail_gen.php.zip Karl On Apr 12, 2010, at 5:31 PM, Alice Wei wrote: Hi, Thanks to everyone's suggestions, I have followed some instructions from http://www.geeksengine.com/article/install-pear-on-windows.html and attempted to install PEAR. The problem is, when I do a test page, which only has: ?php error_reporting(-1); require_once PEAR.php; ?. utor It only gives me a blank page, with no errors. Has anyone who succeeded with using PEAR on PHP can guide me on a good tutorial to read? Thanks for your help. Alice Date: Mon, 12 Apr 2010 15:54:05 -0500 From: k...@daleco.biz To: kranthi...@gmail.com CC: aj...@alumni.iu.edu; php-general@lists.php.net Subject: Re: [PHP] Mail Function Problem kranthi wrote: PEAR's mail package does support authentication. http://email.about.com/od/emailprogrammingtips/qt/ PHP_Email_SMTP_Authentication.htm I will say mea culpa on this one; apparently I didn't dig deep enough into the PEAR docs to figure this out. It's certainly not mentioned on the manpage at php.net, but, of course, the PEAR stuff is elsewhere. I read over the first page linked from the PHP manpage, so it must nks ve been a lil' deeper than that. If it's only available at about.com (lol), I'd suggest filing a PR with the PEAR folk's documentation team, eh? But, this time I'll do what I shoulda mentioned before and include the IANAE disclaimer on all things PEAR, many things PHP, and some things SMTP. Kevin Kinsey _ The New Busy is not the old busy. Search, chat and e-mail from your inbox. http://www.windowslive.com/campaign/thenewbusy? ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_3 Karl DeSaulniers Design Drumm http://designdrumm.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Mail Function Problem
Date: Mon, 12 Apr 2010 15:54:05 -0500 From: k...@daleco.biz To: kranthi...@gmail.com CC: aj...@alumni.iu.edu; php-general@lists.php.net Subject: Re: [PHP] Mail Function Problem kranthi wrote: PEAR's mail package does support authentication. http://email.about.com/od/emailprogrammingtips/qt/PHP_Email_SMTP_Authentication.htm I will say mea culpa on this one; apparently I didn't dig deep enough into the PEAR docs to figure this out. It's certainly not mentioned on the manpage at php.net, but, of course, the PEAR stuff is elsewhere. I read over the first page linked from the PHP manpage, so it must have been a lil' deeper than that. If it's only available at about.com (lol), I'd suggest filing a PR with the PEAR folk's documentation team, eh? But, this time I'll do what I shoulda mentioned before and include the IANAE disclaimer on all things PEAR, many things PHP, and some things SMTP. Kevin Kinsey I tried installing the Pear Mail package, it is now located in php/PEAR/Mail, and my code is located in the htdocs. Here is the code: require_once(Mail.php); $mail = Mail::factory(mail); $your_name = $_POST['your_name']; $email = $_POST['email']; $question = $_POST['question']; $comments= $_POST['comments']; $submit = $_POST['submit']; if($_POST['submit']==Submit) { $from = elite.engl...@att.net; $to = $email; $subject = Comments Regarding HH Web Design Studio; $body = From: $your_name\n E-Mail: $email\n Reason Contact: $question\n Comments:\n $comments; $host = smtp.att.yahoo.com; $username = my_user_name; $password = password; $headers = array ('From' = $from, 'To' = $to, 'Subject' = $subject); $mail-send($to, $headers, $body); if (PEAR::isError($mail)) echo p . $mail-getMessage() . /p; This is what I get: Fatal error: Class 'Mail' not found in C:\xampp\htdocs\Alice.Wei\web\mail.php on line 30 Do I need to move the Mail PEAR class to the same folder as my web folder? How can I make sure that my Pear is running? Thanks for your help. Alice _ The New Busy is not the too busy. Combine all your e-mail accounts with Hotmail. http://www.windowslive.com/campaign/thenewbusy?tile=multiaccountocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_4
Re: [PHP] Mail Function Problem
thats weired... Mail.php contains the class Mail. So getting a class not found error is not possible... (require_once stops the script in case it can't find Mail.php) Do I need to move the Mail PEAR class to the same folder as my web folder ensure that C:/xampp/php/PEAR folder is added to your include list -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Mail Function Problem
From: kranthi...@gmail.com Date: Tue, 13 Apr 2010 07:41:19 +0530 Subject: Re: [PHP] Mail Function Problem To: aj...@alumni.iu.edu CC: k...@daleco.biz; php-general@lists.php.net thats weired... Mail.php contains the class Mail. So getting a class not found error is not possible... (require_once stops the script in case it can't find Mail.php) Do I need to move the Mail PEAR class to the same folder as my web folder ensure that C:/xampp/php/PEAR folder is added to your include list I thought so too, this is what I have in my php.ini: ; PHP's default setting for include_path is .;/path/to/php/pear ; http://php.net/include-path include_path = .;C:\xampp\php\PEAR This is the contents of my C:\xampp\php\PEAR\Mail: mail.php mime.php mimeDecode.php mimePart.php null.php RFC822.php sendmail.php smtp.php Unless, I have to do require_once(mail.php)? I am getting confused. Alice _ Hotmail is redefining busy with tools for the New Busy. Get more from your inbox. http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_2
Re: [PHP] Mail Function Problem
Hey Alice, Try throwing the MIME in. Sometimes messages get thrown in an abyss if they don't know the MIME version or content type of an email. They think its spam and so you wouldn't get an error message on your end. Just no email. $headers = 'MIME-Version: 1.0' . \r\n; $headers .= 'Content-type: text/html; charset=utf-8' . \r\n; Karl On Apr 12, 2010, at 10:24 PM, Alice Wei wrote: From: kranthi...@gmail.com Date: Tue, 13 Apr 2010 07:41:19 +0530 Subject: Re: [PHP] Mail Function Problem To: aj...@alumni.iu.edu CC: k...@daleco.biz; php-general@lists.php.net thats weired... Mail.php contains the class Mail. So getting a class not found error is not possible... (require_once stops the script in case it can't find Mail.php) Do I need to move the Mail PEAR class to the same folder as my web folder ensure that C:/xampp/php/PEAR folder is added to your include list I thought so too, this is what I have in my php.ini: ; PHP's default setting for include_path is .;/path/to/php/pear ; http://php.net/include-path include_path = .;C:\xampp\php\PEAR This is the contents of my C:\xampp\php\PEAR\Mail: mail.php mime.php mimeDecode.php mimePart.php null.php RFC822.php sendmail.php smtp.php Unless, I have to do require_once(mail.php)? I am getting confused. Alice _ Hotmail is redefining busy with tools for the New Busy. Get more from your inbox. http://www.windowslive.com/campaign/thenewbusy? ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_2 Karl DeSaulniers Design Drumm http://designdrumm.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Mail Function Problem
when you install pear package Mail a file called Mail.php will be installed into C:/xampp/php/PEAR Mail.php contains the class Mail. So getting a class not found error is not possible.. are you sure you are doing require_once 'Mail.php' ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php