php-general Digest 28 Apr 2009 07:52:15 -0000 Issue 6091
php-general Digest 28 Apr 2009 07:52:15 - Issue 6091 Topics (messages 292038 through 292060): error in printer_open function 292038 by: AYAN PAL Re: utf-8 ? 292039 by: Tom Worster 292040 by: Tom Worster 292041 by: 9el 292042 by: PJ 292044 by: Tom Worster 292046 by: PJ 292053 by: Tom Worster Re: I need ideas for things to code 292043 by: Govinda 292045 by: Nitsan Bin-Nun 292048 by: Lists Re: I need ideas for things to code -- Roach vs Bugzilla 292047 by: Daevid Vincent 292049 by: Michael Shadle 292051 by: Daevid Vincent 292054 by: Michael Shadle 292055 by: Shawn McKenzie 292056 by: Michael Shadle 292057 by: Shawn McKenzie 292059 by: Michael Shadle Re: I need ideas for things to code - webbytedd examples 292050 by: Daevid Vincent 292052 by: Andrew Hucks 292058 by: Paul M Foster Re: inexplicable behaviour SOLVED 292060 by: Richard Quadling 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--- hi, i am using local server to print a simple text i config the php.ini file as ;extension=php_printer.dll added in the extension list and add [printer] printer.default_printer = Send To OneNote 2007 in this file and write a sim ple page as- Prabal Cable Network ---End Message--- ---BeginMessage--- On 4/27/09 9:55 AM, PJ af.gour...@videotron.ca wrote: Since I have to use a number of Western languages that have those annoying accents on many characters, I am already finding some annoyances in my code results; like having to enter the aacute; type of stuff in inputs for searches queries. the sooner you quit this bad habit the better. utf-8 is the solution. MySql db is set up for InnoDB with latin1_swedish_ci for Collation; I believe this is default. Utf-8 seems to be one way to overcome the problems, but is it the only way - seems a little cumbersome as I have no need for oriental other extra-terrestrial cyphers. (I'm incorrigibly lazy.) i know no reasonable alternative. in mysql, converting your tables is easy. If it is the only way, what difficulties could I expect from an ISP hosting a virtual site? the difficulties are most likely to arise with non-mbstring-safe functions your php code may be using. when i converted my site to utf-8 after 5 years of running latin-1, i spent a few days combing through each string function to determine if it was mbsafe or not (many are not) and if not, what to use instead. if the host has the mbstring extension then you're job may be a lot easier (assuming you're willing to recode your app to depend on an extension that isn't present in all runtime environments). if not, then you'll work harder to find work-arounds. i made a list of notes as i was working on the conversion, including a list of my notes on about 90 string functions. i could post them here if that would be of interest. here, at least, are the web pages i referred to: http://www.phpwact.org/php/i18n/utf-8 http://www.phpwact.org/php/i18n/charsets http://www.phpwact.org/php/i18n/utf-8/mysql http://devlog.info/2008/08/24/php-and-unicode-utf-8/ http://www.sitepoint.com/blogs/2006/08/09/scripters-utf-8-survival-guide-sli des/ http://www.nicknettleton.com/zine/php/php-utf-8-cheatsheet http://www.cs.tut.fi/~jkorpela/chars.html ---End Message--- ---BeginMessage--- On 4/27/09 11:17 AM, PJ af.gour...@videotron.ca wrote: phpMyAdmin: in the structure view of the db show Collation as latin_swedish_ci ??? maybe a phpmyadmin feature? check it with the mysql client. when i did the conversion* it came out looking just right in phpmyadmin. *i followed instrunctions here: http://dev.mysql.com/doc/refman/5.0/en/alter-table.html ---End Message--- ---BeginMessage--- On Tue, Apr 28, 2009 at 1:50 AM, Tom Worster f...@thefsb.org wrote: On 4/27/09 11:17 AM, PJ af.gour...@videotron.ca wrote: phpMyAdmin: in the structure view of the db show Collation as latin_swedish_ci ??? maybe a phpmyadmin feature? check it with the mysql client. when i did the conversion* it came out looking just right in phpmyadmin. *i followed instrunctions here: http://dev.mysql.com/doc/refman/5.0/en/alter-table.html Hey Tom Also share your findings plz :) regards Lenin www.twitter.com/nine_L ---End Message--- ---BeginMessage--- Tom Worster wrote: On 4/27/09 9:55 AM, PJ af.gour...@videotron.ca wrote: Since I have to use a number of Western languages that have those annoying accents on many characters, I am already finding some annoyances in my code results; like having to enter the aacute; type of
Re: RES: [PHP] inexplicable behaviour SOLVED
2009/4/27 9el le...@phpxperts.net: Thanks for the clarification, Mike. In my ignorance, I was under the impression that the right side of the equation was only for the use of the left part. How stupid of me. So what I should have been doing was $Count1 = $Count + 1; right? $Count1 = $Count++; is not the same as $Count1 = $Count + 1; ?php $Count1 = 100; echo Start with $Count1, PHP_EOL; $Count1 = $Count1++; echo For \$Count1 = \$Count1++; the value in \$Count1 is $Count1, PHP_EOL; $Count1 = $Count1 + 1; echo For \$Count1 = \$Count1 + 1; the value in \$Count1 is $Count1, PHP_EOL; outputs ... Start with 100 For $Count1 = $Count1++; the value in $Count1 is 100 For $Count1 = $Count1 + 1; the value in $Count1 is 101 This shows that post-inc during an assignment does not affect the value assigned. Something that I thought would happen was if I ... ?php $Count1 = 100; echo $Count1 = $Count1++, PHP_EOL; echo $Count1, PHP_EOL; I thought I'd get ... 101 100 but I get 100 100 I thought the ++ would happen AFTER the assignment and the ++ to the value of the assignment. But this is not the case. $Count = $Count + 1; is exactly(?) same as $Count++; or ++$Count But not exactly same. PostFix notation adds the value after assigning. PreFix notation adds the value right away. But optimized programming argues about how machine is coded nowadays. Anyway, I don't need that statement anymore as I found the error of my ways and have corrected it. And behold, the light came forth and it worked. :-) Regards Lenin www.twitter.com/nine_L www.lenin9l.wordpress.com -- - Richard Quadling Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731 Standing on the shoulders of some very clever giants! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: RES: [PHP] inexplicable behaviour SOLVED
Thats why I used a (?) after exactly. PJ didn't have a need for the value. ;)
[PHP] Re: error in printer_open function
AYAN PAL wrote: hi, i am using local server to print a simple text i config the php.ini file as ;extension=php_printer.dll added in the extension list and add [printer] printer.default_printer = Send To OneNote 2007 in this file and write a sim ple page as- Prabal Cable Network The ; at the start of the configuration line in php.ini is a comment character... Remove that, restart the web server, and you might see things working better. -- Peter Ford phone: 01580 89 Developer fax: 01580 893399 Justcroft International Ltd., Staplehurst, Kent -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: RES: [PHP] inexplicable behaviour SOLVED
On 27 April 2009 14:21, PJ advised: Ford, Mike wrote: On 26 April 2009 22:59, PJ advised: kranthi wrote: if $Count1 is never referenced after this, then certainly this assignment operation is redundent. but assignment is not the ONLY operation of this statement. if u hav not noticed a post increment operator has been used which will affect the value of $Count as well, and this operation is required for the script to work. the script should work even if u replace $Count1 = $Count++; with $Count++; Kranthi. Not quite, since that would change the $Count variable and that is used leater in the code. Um -- I must be missing something here, because those two statements have exactly the same effect on $Count, incrementing it by one (and you said the first statement fixed your problem, so logically the second one must too). In fact, because you've used a post-increment, the statement $Count1 = $Count++; ends up with $Count == $Count1+1, and $Count1 being the original value of $Count!! This whole scenario smacks to me of a classic off-by-one error -- either $Count actually *needs* to be one greater than the value you first thought of, or some other value you are comparing it to should be one smaller than it actually is. Cheers! Thanks for the clarification, Mike. In my ignorance, I was under the impression that the right side of the equation was only for the use of the left part. How stupid of me. So what I should have been doing was $Count1 = $Count + 1; right? No -- because, as you stated, $Count1 was not referred to anywhere else, so there was and would have been no usefulness in assigning any value to it. You could equally well have said $Count1 = 2.71828 + 3.14159 * $Count++; and got the same result -- because this still increments $Count by 1, and anything else the statement does is irrelevant if $Count1 is never referred to anywhere else!!! ;) ;) What you did worked because $Count++ *always* adds one to the value of $Count, no matter where it appears -- the crucial part of your original statement was the $Count++ bit, with the assignment to $Count1 being a massive red herring. For ultimate clarification, the following 4 statements all have identical effect: $Count = $Count + 1; $Count += 1; $Count++; ++$Count; and any one of them would have had the same effect on your result. This is why I say it was an off-by-one error -- your programming logic somehow *needed* $Count to be 1 greater than you thought it did, so the inadvertent incrementation of it was doing the trick for you. Hope this helps increase the illumination in your head a tiny bit more. Cheers! Mike -- Mike Ford, Electronic Information Developer, C507, Leeds Metropolitan University, Civic Quarter Campus, Woodhouse Lane, LEEDS, LS1 3HE, United Kingdom Email: m.f...@leedsmet.ac.uk Tel: +44 113 812 4730 To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: RES: [PHP] inexplicable behaviour SOLVED
Ford, Mike wrote: On 27 April 2009 14:21, PJ advised: Ford, Mike wrote: On 26 April 2009 22:59, PJ advised: kranthi wrote: if $Count1 is never referenced after this, then certainly this assignment operation is redundent. but assignment is not the ONLY operation of this statement. if u hav not noticed a post increment operator has been used which will affect the value of $Count as well, and this operation is required for the script to work. the script should work even if u replace $Count1 = $Count++; with $Count++; Kranthi. Not quite, since that would change the $Count variable and that is used leater in the code. Um -- I must be missing something here, because those two statements have exactly the same effect on $Count, incrementing it by one (and you said the first statement fixed your problem, so logically the second one must too). In fact, because you've used a post-increment, the statement $Count1 = $Count++; ends up with $Count == $Count1+1, and $Count1 being the original value of $Count!! This whole scenario smacks to me of a classic off-by-one error -- either $Count actually *needs* to be one greater than the value you first thought of, or some other value you are comparing it to should be one smaller than it actually is. Cheers! Thanks for the clarification, Mike. In my ignorance, I was under the impression that the right side of the equation was only for the use of the left part. How stupid of me. So what I should have been doing was $Count1 = $Count + 1; right? No -- because, as you stated, $Count1 was not referred to anywhere else, so there was and would have been no usefulness in assigning any value to it. You could equally well have said $Count1 = 2.71828 + 3.14159 * $Count++; and got the same result -- because this still increments $Count by 1, and anything else the statement does is irrelevant if $Count1 is never referred to anywhere else!!! ;) ;) What you did worked because $Count++ *always* adds one to the value of $Count, no matter where it appears -- the crucial part of your original statement was the $Count++ bit, with the assignment to $Count1 being a massive red herring. For ultimate clarification, the following 4 statements all have identical effect: $Count = $Count + 1; $Count += 1; $Count++; ++$Count; and any one of them would have had the same effect on your result. This is why I say it was an off-by-one error -- your programming logic somehow *needed* $Count to be 1 greater than you thought it did, so the inadvertent incrementation of it was doing the trick for you. Hope this helps increase the illumination in your head a tiny bit more. Indeed, it does. Thanks. -- Hervé Kempf: Pour sauver la planète, sortez du capitalisme. - Phil Jourdan --- p...@ptahhotep.com http://www.ptahhotep.com http://www.chiccantine.com/andypantry.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: RES: [PHP] inexplicable behaviour SOLVED
$Count = $Count + 1; is *exactly(?)* same as $Count++; Â or ++$Count But not exactly same. Â PostFix notation adds the value after assigning . PreFix notation adds the value right away. But optimized programming argues about how machine is coded nowadays. Thanks Mike for clarifying this much. Butt I already said those in brief I marked them in red now :) Lenin www.twitter.com/nine_L
Re: RES: [PHP] inexplicable behaviour SOLVED
Richard Quadling wrote: 2009/4/27 9el le...@phpxperts.net: Thanks for the clarification, Mike. In my ignorance, I was under the impression that the right side of the equation was only for the use of the left part. How stupid of me. So what I should have been doing was $Count1 = $Count + 1; right? $Count1 = $Count++; is not the same as $Count1 = $Count + 1; ?php $Count1 = 100; echo Start with $Count1, PHP_EOL; $Count1 = $Count1++; echo For \$Count1 = \$Count1++; the value in \$Count1 is $Count1, PHP_EOL; $Count1 = $Count1 + 1; echo For \$Count1 = \$Count1 + 1; the value in \$Count1 is $Count1, PHP_EOL; outputs ... Start with 100 For $Count1 = $Count1++; the value in $Count1 is 100 For $Count1 = $Count1 + 1; the value in $Count1 is 101 This shows that post-inc during an assignment does not affect the value assigned. Something that I thought would happen was if I ... ?php $Count1 = 100; echo $Count1 = $Count1++, PHP_EOL; echo $Count1, PHP_EOL; I thought I'd get ... 101 100 but I get 100 100 I thought the ++ would happen AFTER the assignment and the ++ to the value of the assignment. But this is not the case. $Count = $Count + 1; is exactly(?) same as $Count++; Â or ++$Count But not exactly same. Â PostFix notation adds the value after assigning. PreFix notation adds the value right away. But optimized programming argues about how machine is coded nowadays. Anyway, I don't need that statement anymore as I found the error of my ways and have corrected it. And behold, the light came forth and it worked. :-) Regards Lenin www.twitter.com/nine_L www.lenin9l.wordpress.com Thanks. That is really a nice eye-opener. Phil -- Hervé Kempf: Pour sauver la planète, sortez du capitalisme. - Phil Jourdan --- p...@ptahhotep.com http://www.ptahhotep.com http://www.chiccantine.com/andypantry.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Help with scandir() -- Problem Solved
Deivys Delgado Hernandez wrote: Hi, I'm having problems when i try to use the function scandir() in a Novell Netware Volumen or a Windows Shared Folder they both are mapped as a windows network drive, so i suppose i could access them as local drive, but i can't. instead i receive this message: Warning: scandir(R:\) [function.scandir]: failed to open dir: Invalid argument in C:\WebServ\wwwroot\htdocs\index.php on line 3 Warning: scandir() [function.scandir]: (errno 22): Invalid argument in C:\WebServ\wwwroot\htdocs\index.php on line 3 For the windows shared folder: just including the server name in the URL works as sugested by Nathan Rixhamnrix...@gmail.com For Novell: the windows account under appache server is running Most exist in the Novell Server and most have the correct permissions to the Volumen as sugested by Simonturne...@gmail.com this is the Final Script (simplified of course) ?php $dir1 = \\\Windows_Server\\Install; //For the Windows Shared Folder $dir2 = \\\Novell_Server\\sys\\public;//For the Novell NetWare Server $files1 = scandir($dir1); $files2 = scandir($dir2); print_r($files1); print_r($files2); ? I'm very proud to belong this community. Thank you very much. Saludos, Dedel. --- Red Telematica de Salud - Cuba CNICM - Infomed
Re: [PHP] I need ideas for things to code - webbytedd examples
Paul M Foster wrote: On Mon, Apr 27, 2009 at 03:16:10PM -0700, Daevid Vincent wrote: This is tripping me out! i feel so duped! :) http://webbytedd.com/b1/photo-retouch/ this didn't work, maybe due to some JS errors. tried in FF3 and IE6. http://webbytedd.com/b/watermark/ I like your arrow captch idea: http://webbytedd.com/aa/assorted-captcha/ also the date and clock are nice: http://webbytedd.com/b/kewl-date/ http://webbytedd.com/b/binary-clock/ the transparent bg is green in FF3/XP and IE6/XP http://webbytedd.com/ccc/dragdrop/ http://webbytedd.com/b/color-rows/ you know you can do this too: tr class=?= (($r = !$r) ? 'row0' : 'row1' ) ? How come you don't have a way to see/download the source code for all these examples? I noticed that, too. But I have to say, this is one of the coolest sites I've ever seen. If you wanted to convince someone (a prospect) you could do something, this site would do it. Next time I talk to a prospect, I'm gonna call myself Tedd and refer them to this site. ;-} Paul You would need to call yourself tedd not Tedd :-) -- Thanks! -Shawn http://www.spidean.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Developing PHP extensions on Windows with VC++, linking problems
Hi all, I had to create a PHP extension and I read this article: http://www.talkphp.com/vbarticles.php?do=articlearticleid=49title=creating-custom-php-extensionshttp://www.talkphp.com/vbarticles.ph...php-extensions Everything worked fine if I keep Debug as Active solution configuration in Build-Configuration managerbut in this way I can only use the extension created on the machine I compiled it. If I choose Release instead of Debug I get a fatal error: dllmain.obj : fatal error LNK1179: invalid or corrupt file: duplicate COMDAT '_putwchar' Can you help me? I'm using Visual C++ 2008 Express edition, PHP 5.2.4, Win xp home. Thanks! Cheers, Eugenio -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] date time late or lagging
hi all, $dateNow = date('Y-m-d H:i:s'); echo pstrong.$dateNow ./strong/p; can some see why the date time is lagging or late by 30 minutes from the server time even when server time are correct
[PHP] $_session/$_cookie trouble
I am trying to set a cookie and a session, but seem to be running into a wall. I have tried different variations, and keep getting the same error message If I have this ?php session_start(); I get this: Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 If I have this: session_start(); setcookie('sale_cookie','$sale_value', time()-3600); setcookie('assess_cookie','$assess_value', time()-3600); I get this Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 6 Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 7 If I delete and start over, I stll get the headers already sent... I have tried numerous other variations, but all with the same error. What am I missing here? Thanks Gary -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] date time late or lagging RESOLVED
On Tue, Apr 28, 2009 at 3:45 PM, Andrew Williams andrew4willi...@gmail.comwrote: hi all, $dateNow = date('Y-m-d H:i:s'); echo pstrong.$dateNow ./strong/p; can some see why the date time is lagging or late by 30 minutes from the server time even when server time are correct -- Best Wishes Andrew Williams www.NPinvestor.com
RE: [PHP] $_session/$_cookie trouble
On 28 April 2009 15:48, Gary advised: I am trying to set a cookie and a session, but seem to be running into a wall. I have tried different variations, and keep getting the same error message If I have this ?php session_start(); I get this: Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 If I have this: session_start(); setcookie('sale_cookie','$sale_value', time()-3600); setcookie('assess_cookie','$assess_value', time()-3600); I get this Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 6 Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 7 If I delete and start over, I stll get the headers already sent... I have tried numerous other variations, but all with the same error. What am I missing here? Whatever it is on line 2 of assessresult.inc.php that is causing output to be started! More seriously, there is something on line 2 of that file that is causing something to be sent to the browser, which in turn causes the http headers to be sent. Once those headers have been sent, nothing else that wants to send headers, which includes starting the session and setting cookies, can be done. Either eliminate whatever it is on line 2 that is sending output, or move the session_start() and/or setcookie() calls above it. (This early in the file, prime candidate is actually a stray blank line outside your ?php tag, but that's only a guess based on past experience of many people in this list...!!) Cheers! Mike -- Mike Ford, Electronic Information Developer, C507, Leeds Metropolitan University, Civic Quarter Campus, Woodhouse Lane, LEEDS, LS1 3HE, United Kingdom Email: m.f...@leedsmet.ac.uk Tel: +44 113 812 4730 To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] I need ideas for things to code - webbytedd examples
At 3:16 PM -0700 4/27/09, Daevid Vincent wrote: http://webbytedd.com/b/color-rows/ you know you can do this too: tr class=?= (($r = !$r) ? 'row0' : 'row1' ) ? No -- never use the short tag. Use: tr class=?php echo( (($r = !$r) ? 'row0' : 'row1' )); ? How come you don't have a way to see/download the source code for all these examples? With some of my samples I do, but the main point here is for ME to have a place to fall back to for reference. Cheers, tedd PS: My site is down at the moment. -- --- 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
[PHP] E-Mail Verification - Yes, I know....
Our company wants to do e-mail verification and does not want to use the requests / response method (clicking a link in the e-mail to verify the address), which as we all know is the only way you can be truly sure. I found this; http://verify-email.org/ Which seems to be the next best deal and it is written in PHP. Has anyone used this? Is anyone doing something similar? How do you handle errors? I know that some domains will not accept these requests. I think that this method would really work for us and cut down on the bogus e-mail addresses we're receiving though. Thoughts? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] I need ideas for things to code - webbytedd examples
At 9:20 PM -0400 4/27/09, Paul M Foster wrote: I noticed that, too. But I have to say, this is one of the coolest sites I've ever seen. If you wanted to convince someone (a prospect) you could do something, this site would do it. Next time I talk to a prospect, I'm gonna call myself Tedd and refer them to this site. ;-} Paul Paul: Thanks. :-) But that's one of the points here and that is to have something you can show a client that you've done. Keep in mind, that it's better to have them in your office so you can control what they see and guide them through your examples. But if nothing else, you can show them something you've done without showing a client's site. I don't like showing client sites because: a) the site is not usually 100% yours; b) some of the sites I've worked on I don't want to be associated with (horrible front ends); c) and sometimes prospective clients want to contact your past employers and you may not want that. For example, your past client may not want to be contacted -- after all, it's their time -- what are you doing wasting their time? Also, who knows what they are going to say? Even good clients who like your service may look at someone inquiring as to your service and think Hey, what happens when I need something and my programmer is working for them? Belive me it happens. So, my recommendation is keep your experience and examples under your control. 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
[PHP] php forms - select menu selected behavior
I have the code below being used to rifle through a list of available categories and create select options for them. The code is being used to query the database and compare the product category to the current iteration, if there's a match, then add selected code so the category is prechosen. More code (not included) does the saving and all that, I've check phpmyadmin. But when the page submits, the old category appears in the drop down as selected. If I leave the page and come back it's fine, it's just right after it is saved. The form script is being used on itself, in that there is only one file for the form, the submission, etc. All of the other input elements will load the data after being saved, is it something specific to dropdowns, or it is the way the code is being instatiated? All help is much appreciated. Please let me know if anymore info is needed. //MAKE CATEGORIES DROPDOWN $sql=SELECT * FROM categories ORDER BY category; $catmatch=SELECT * FROM product WHERE dbi='$dbi'; $catresult=mysql_query($catmatch); $catquery=mysql_fetch_array($catresult); //for($a=0;$amysql_fetch_array($catresult)){ //echo $catquery['prod_cat0']; //} $result=mysql_query($sql); $catlist1=; while ($col2=mysql_fetch_array($result)) { $id=$col2[category]; if($id==$catquery['prod_cat0']){ $catlist1.=option value=\$id\ selected=\selected\.$id./option; } else { $catlist1.=option value=\$id\.$id./option; } } to instantiate ?=$catlist1?
Re: [PHP] I need ideas for things to code - webbytedd examples
At 9:10 AM -0500 4/28/09, Shawn McKenzie wrote: You would need to call yourself tedd not Tedd :-) -- Thanks! -Shawn That's true. I went by the name Tedd in my previous life, see: http://geophysics.com (I think the site is down at the moment) In my current life, I much less important so I go by the name tedd. 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] E-Mail Verification - Yes, I know....
2009/4/28 Jay Blanchard jblanch...@pocket.com: Our company wants to do e-mail verification and does not want to use the requests / response method (clicking a link in the e-mail to verify the address), which as we all know is the only way you can be truly sure. I found this; http://verify-email.org/ Which seems to be the next best deal and it is written in PHP. Has anyone used this? Is anyone doing something similar? How do you handle errors? I know that some domains will not accept these requests. I think that this method would really work for us and cut down on the bogus e-mail addresses we're receiving though. Thoughts? Been there, tried that, got blacklisted pretty quickly by most major ISPs and email providers. In short do this only if you have a very limited number of accounts, and only if you can afford to have your IP blacklisted should you hit individual mail server limits. Or, to put it another way, don't do it. There are reasons why the VRFY SMTP command is not implemented by most servers. Firstly it reveals too much information. Secondly it wastes server resources. Same goes for this method of checking an address. Question is why don't you want to ask the user to confirm their email address? It's a pretty standard requirement these days that most users are familiar with. I can't think of a single reason why any company would want to avoid it. -Stuart -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] E-Mail Verification - Yes, I know....
On Tue, Apr 28, 2009 at 11:40, Jay Blanchard jblanch...@pocket.com wrote: Our company wants to do e-mail verification and does not want to use the requests / response method (clicking a link in the e-mail to verify the address), which as we all know is the only way you can be truly sure. I found this; http://verify-email.org/ It apparently requires the www. CNAME to access it via the web. Which seems to be the next best deal and it is written in PHP. Has anyone used this? Is anyone doing something similar? How do you handle errors? I know that some domains will not accept these requests. I think that this method would really work for us and cut down on the bogus e-mail addresses we're receiving though. Thoughts? If it has a good CAPTCHA mechanism in place, maybe. Otherwise, it's not too difficult to write a parser to read bounces and auto-click the link (and even attempt to pass or bypass a challenge). -- /Daniel P. Brown daniel.br...@parasane.net || danbr...@php.net http://www.parasane.net/ || http://www.pilotpig.net/ 50% Off All Shared Hosting Plans at PilotPig: Use Coupon DOW1 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] E-Mail Verification - Yes, I know....
Top-posting on top of it all. Disregard *everything* from my previous email. I typed it up before checking out the site, since it wouldn't work from this system when hit without the alias. Then, when I did hit it and read it, I meant to click Discard and clicked Send. #...@%. On Tue, Apr 28, 2009 at 11:50, Daniel Brown danbr...@php.net wrote: On Tue, Apr 28, 2009 at 11:40, Jay Blanchard jblanch...@pocket.com wrote: Our company wants to do e-mail verification and does not want to use the requests / response method (clicking a link in the e-mail to verify the address), which as we all know is the only way you can be truly sure. I found this; http://verify-email.org/ It apparently requires the www. CNAME to access it via the web. Which seems to be the next best deal and it is written in PHP. Has anyone used this? Is anyone doing something similar? How do you handle errors? I know that some domains will not accept these requests. I think that this method would really work for us and cut down on the bogus e-mail addresses we're receiving though. Thoughts? If it has a good CAPTCHA mechanism in place, maybe. Otherwise, it's not too difficult to write a parser to read bounces and auto-click the link (and even attempt to pass or bypass a challenge). -- /Daniel P. Brown daniel.br...@parasane.net || danbr...@php.net http://www.parasane.net/ || http://www.pilotpig.net/ 50% Off All Shared Hosting Plans at PilotPig: Use Coupon DOW1 -- /Daniel P. Brown daniel.br...@parasane.net || danbr...@php.net http://www.parasane.net/ || http://www.pilotpig.net/ 50% Off All Shared Hosting Plans at PilotPig: Use Coupon DOW1 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] E-Mail Verification - Yes, I know....
Btw, if you're thinking of buying it lemme know - I probably have mine kicking around somewhere. 2009/4/28 Jay Blanchard jblanch...@pocket.com: Our company wants to do e-mail verification and does not want to use the requests / response method (clicking a link in the e-mail to verify the address), which as we all know is the only way you can be truly sure. I found this; http://verify-email.org/ Which seems to be the next best deal and it is written in PHP. Has anyone used this? Is anyone doing something similar? How do you handle errors? I know that some domains will not accept these requests. I think that this method would really work for us and cut down on the bogus e-mail addresses we're receiving though. Thoughts? -Stuart -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] E-Mail Verification - Yes, I know....
2009/4/28 Jay Blanchard jblanch...@pocket.com: Our company wants to do e-mail verification and does not want to use the requests / response method (clicking a link in the e-mail to verify the address), which as we all know is the only way you can be truly sure. I found this; http://verify-email.org/ Which seems to be the next best deal and it is written in PHP. Has anyone used this? Is anyone doing something similar? How do you handle errors? I know that some domains will not accept these requests. They don't even detect greylisting! I think that this method would really work for us and cut down on the bogus e-mail addresses we're receiving though. Thoughts? There's just one way: let the users confirm with an activation link. People often insert their addresses wrong without noticing it.. example: www.myal...@mydomain.org instead of myal...@mydomain.org, aol.DE|UK|NL|FR|etc instead of aol.com and so on. So ... nothing like insert your mail twice or re-check your address please actually works. ;) On the other hand: Douple-opt-In is quite like an industry standard - why wouldn't your firm use it? It makes customers happy as well as not-customers because people can't use their addressess to sign-up. I hate getting other peoples email. byebye -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Non-Object errors
Can someone help with how to make this work, trying to get the number of rows but am getting the trying to get property of non-object Code- $query = select blah, blah, blah from table where .$type. like '%.$name.%'; $result = mysql_query($query); $num_results = $result-num_rows; ---this is the line with error -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] E-Mail Verification - Yes, I know....
Stuart wrote: 2009/4/28 Jay Blanchard jblanch...@pocket.com: Our company wants to do e-mail verification and does not want to use the requests / response method (clicking a link in the e-mail to verify the address), which as we all know is the only way you can be truly sure. I found this; http://verify-email.org/ Which seems to be the next best deal and it is written in PHP. Has anyone used this? Is anyone doing something similar? How do you handle errors? I know that some domains will not accept these requests. I think that this method would really work for us and cut down on the bogus e-mail addresses we're receiving though. Thoughts? Been there, tried that, got blacklisted pretty quickly by most major ISPs and email providers. In short do this only if you have a very limited number of accounts, and only if you can afford to have your IP blacklisted should you hit individual mail server limits. Or, to put it another way, don't do it. There are reasons why the VRFY SMTP command is not implemented by most servers. verify-email.org doesn't use VRFY anyway. It just starts an SMTP-conversation, but terminates after RCPT TO. /Per -- Per Jessen, Zürich (8.2°C) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] E-Mail Verification - Yes, I know....
2009/4/28 Jan G.B. ro0ot.w...@googlemail.com 2009/4/28 Jay Blanchard jblanch...@pocket.com: Our company wants to do e-mail verification and does not want to use the requests / response method (clicking a link in the e-mail to verify the address), which as we all know is the only way you can be truly sure. I found this; http://verify-email.org/ Which seems to be the next best deal and it is written in PHP. Has anyone used this? Is anyone doing something similar? How do you handle errors? I know that some domains will not accept these requests. They don't even detect greylisting! I think that this method would really work for us and cut down on the bogus e-mail addresses we're receiving though. Thoughts? There's just one way: let the users confirm with an activation link. People often insert their addresses wrong without noticing it.. example: www.myal...@mydomain.org instead of myal...@mydomain.org, aol.DE|UK|NL|FR|etc instead of aol.com and so on. So ... nothing like insert your mail twice or re-check your address please actually works. ;) On the other hand: Douple-opt-In is quite like an industry standard - why wouldn't your firm use it? It makes customers happy as well as not-customers because people can't use their addressess to sign-up. I hate getting other peoples email. byebye -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php /** Validate an email address. Provide email address (raw input) Returns true if the email address has the email address format and the domain exists. Modified: 06/06/2003 **/ function validEmail($email) { $isValid = true; $atIndex = strrpos($email, @); if (is_bool($atIndex) !$atIndex) { $isValid = false; } else { $domain = substr($email, $atIndex+1); $local = substr($email, 0, $atIndex); $localLen = strlen($local); $domainLen = strlen($domain); if ($localLen 1 || $localLen 64) { // local part length exceeded $isValid = false; } else if ($domainLen 1 || $domainLen 255) { // domain part length exceeded $isValid = false; } else if ($local[0] == '.' || $local[$localLen-1] == '.') { // local part starts or ends with '.' $isValid = false; } else if (preg_match('/\\.\\./', $local)) { // local part has two consecutive dots $isValid = false; } else if (!preg_match('/^[A-Za-z0-9\\-\\.]+$/', $domain)) { // character not valid in domain part $isValid = false; } else if (preg_match('/\\.\\./', $domain)) { // domain part has two consecutive dots $isValid = false; } else if (!preg_match('/^(.|[A-Za-z0-9!#%`_=\\/$\'*+?^{}|~.-])+$/', str_replace(,,$local))) { // character not valid in local part unless // local part is quoted if (!preg_match('/^(|[^])+$/', str_replace(,,$local))) { $isValid = false; } } if ($isValid !(checkdnsrr($domain,MX) || checkdnsrr($domain,A))) { // domain not found in DNS $isValid = false; } } return $isValid; } -- Luke Slater http://dinosaur-os.com/ :O)
Re: [PHP] E-Mail Verification - Yes, I know....
On Tue, 28 Apr 2009 10:40:31 -0500, Jay Blanchard jblanch...@pocket.com wrote: Our company wants to do e-mail verification and does not want to use the requests / response method (clicking a link in the e-mail to verify the address), which as we all know is the only way you can be truly sure. I found this; http://verify-email.org/ Which seems to be the next best deal and it is written in PHP. Has anyone used this? Is anyone doing something similar? How do you handle errors? I know that some domains will not accept these requests. I think that this method would really work for us and cut down on the bogus e-mail addresses we're receiving though. Thoughts? Just tested this with two of my mailservers and it is not reliable. One server does say that a mailbox/alias exists while the other doesn't do this to protect against address harvesting. However, you could use it in combination with other methods like sending a confirmation code with a link, a better captcha check like balancing rotated photos or recognizing objects, MX and SPF records check (if available) and match against public black/graylists. Define a score for each method, when the total score gets above a certain threshold you flag it as invalid. -- Hawx -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] E-Mail Verification - Yes, I know....
2009/4/28 Luke l...@blog-thing.com: 2009/4/28 Jan G.B. ro0ot.w...@googlemail.com 2009/4/28 Jay Blanchard jblanch...@pocket.com: Our company wants to do e-mail verification and does not want to use the requests / response method (clicking a link in the e-mail to verify the address), which as we all know is the only way you can be truly sure. I found this; http://verify-email.org/ Which seems to be the next best deal and it is written in PHP. Has anyone used this? Is anyone doing something similar? How do you handle errors? I know that some domains will not accept these requests. They don't even detect greylisting! I think that this method would really work for us and cut down on the bogus e-mail addresses we're receiving though. Thoughts? There's just one way: let the users confirm with an activation link. People often insert their addresses wrong without noticing it.. example: www.myal...@mydomain.org instead of myal...@mydomain.org, aol.DE|UK|NL|FR|etc instead of aol.com and so on. So ... nothing like insert your mail twice or re-check your address please actually works. ;) On the other hand: Douple-opt-In is quite like an industry standard - why wouldn't your firm use it? It makes customers happy as well as not-customers because people can't use their addressess to sign-up. I hate getting other peoples email. byebye -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php /** Validate an email address. Provide email address (raw input) Returns true if the email address has the email address format and the domain exists. Modified: 06/06/2003 **/ function validEmail($email) { $isValid = true; $atIndex = strrpos($email, @); if (is_bool($atIndex) !$atIndex) { $isValid = false; } else { $domain = substr($email, $atIndex+1); $local = substr($email, 0, $atIndex); $localLen = strlen($local); $domainLen = strlen($domain); if ($localLen 1 || $localLen 64) { // local part length exceeded $isValid = false; } else if ($domainLen 1 || $domainLen 255) { // domain part length exceeded $isValid = false; } else if ($local[0] == '.' || $local[$localLen-1] == '.') { // local part starts or ends with '.' $isValid = false; } else if (preg_match('/\\.\\./', $local)) { // local part has two consecutive dots $isValid = false; } else if (!preg_match('/^[A-Za-z0-9\\-\\.]+$/', $domain)) { // character not valid in domain part $isValid = false; } else if (preg_match('/\\.\\./', $domain)) { // domain part has two consecutive dots $isValid = false; } else if (!preg_match('/^(.|[A-Za-z0-9!#%`_=\\/$\'*+?^{}|~.-])+$/', str_replace(,,$local))) { // character not valid in local part unless // local part is quoted if (!preg_match('/^(|[^])+$/', str_replace(,,$local))) { $isValid = false; } } if ($isValid !(checkdnsrr($domain,MX) || checkdnsrr($domain,A))) { // domain not found in DNS $isValid = false; } } return $isValid; } -- Luke Slater I Like the approach of checking the DNS. But all that regexp matching could be skipped when using filter_input() or filter_var() with the Filter FILTER_VALIDATE_EMAIL - or am I wrong? I'm using the filter in combination with a domain checker which basically checks for a valid TLD on a high traffic website with great success - so far. byebye -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] E-Mail Verification - Yes, I know....
2009/4/28 Jan G.B. ro0ot.w...@googlemail.com 2009/4/28 Luke l...@blog-thing.com: 2009/4/28 Jan G.B. ro0ot.w...@googlemail.com 2009/4/28 Jay Blanchard jblanch...@pocket.com: Our company wants to do e-mail verification and does not want to use the requests / response method (clicking a link in the e-mail to verify the address), which as we all know is the only way you can be truly sure. I found this; http://verify-email.org/ Which seems to be the next best deal and it is written in PHP. Has anyone used this? Is anyone doing something similar? How do you handle errors? I know that some domains will not accept these requests. They don't even detect greylisting! I think that this method would really work for us and cut down on the bogus e-mail addresses we're receiving though. Thoughts? There's just one way: let the users confirm with an activation link. People often insert their addresses wrong without noticing it.. example: www.myal...@mydomain.org instead of myal...@mydomain.org, aol.DE|UK|NL|FR|etc instead of aol.com and so on. So ... nothing like insert your mail twice or re-check your address please actually works. ;) On the other hand: Douple-opt-In is quite like an industry standard - why wouldn't your firm use it? It makes customers happy as well as not-customers because people can't use their addressess to sign-up. I hate getting other peoples email. byebye -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php /** Validate an email address. Provide email address (raw input) Returns true if the email address has the email address format and the domain exists. Modified: 06/06/2003 **/ function validEmail($email) { $isValid = true; $atIndex = strrpos($email, @); if (is_bool($atIndex) !$atIndex) { $isValid = false; } else { $domain = substr($email, $atIndex+1); $local = substr($email, 0, $atIndex); $localLen = strlen($local); $domainLen = strlen($domain); if ($localLen 1 || $localLen 64) { // local part length exceeded $isValid = false; } else if ($domainLen 1 || $domainLen 255) { // domain part length exceeded $isValid = false; } else if ($local[0] == '.' || $local[$localLen-1] == '.') { // local part starts or ends with '.' $isValid = false; } else if (preg_match('/\\.\\./', $local)) { // local part has two consecutive dots $isValid = false; } else if (!preg_match('/^[A-Za-z0-9\\-\\.]+$/', $domain)) { // character not valid in domain part $isValid = false; } else if (preg_match('/\\.\\./', $domain)) { // domain part has two consecutive dots $isValid = false; } else if (!preg_match('/^(.|[A-Za-z0-9!#%`_=\\/$\'*+?^{}|~.-])+$/', str_replace(,,$local))) { // character not valid in local part unless // local part is quoted if (!preg_match('/^(|[^])+$/', str_replace(,,$local))) { $isValid = false; } } if ($isValid !(checkdnsrr($domain,MX) || checkdnsrr($domain,A))) { // domain not found in DNS $isValid = false; } } return $isValid; } -- Luke Slater I Like the approach of checking the DNS. But all that regexp matching could be skipped when using filter_input() or filter_var() with the Filter FILTER_VALIDATE_EMAIL - or am I wrong? I'm using the filter in combination with a domain checker which basically checks for a valid TLD on a high traffic website with great success - so far. byebye -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php That's very possible, the reason for that not being in there I think is down to the fact that the code is so old. It would certainly simplify the code using filter_input(); Anyway, I think this kind of approach is probably
Re: [PHP] Non-Object errors
2009/4/28 Miller, Terion tmil...@springfi.gannett.com: Can someone help with how to make this work, trying to get the number of rows but am getting the trying to get property of non-object Code- $query = select blah, blah, blah from table where .$type. like '%.$name.%'; $result = mysql_query($query); $num_results = $result-num_rows; ---this is the line with error Hi Terion, you're mixing normal mysql_* with mysqli. Mysqli is object oriented and the mormalö mysql_ functions aren't - thei're procedural. So you can do it either like $result = mysql_query(SELECT 1); $num = mysql_num_rows($result); Or in OOP $res = $mysqlObj-query(SELECT 1); // $mysqlObj should be initialized first ;) hint: new mysqli() $num = $res-num_rows(); Check ot this URL: http://php.net/mysqli byebye -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Non-Object errors
On 4/28/09 11:23 AM, Jan G.B. ro0ot.w...@googlemail.com wrote: 2009/4/28 Miller, Terion tmil...@springfi.gannett.com: Can someone help with how to make this work, trying to get the number of rows but am getting the trying to get property of non-object Code- $query = select blah, blah, blah from table where .$type. like '%.$name.%'; $result = mysql_query($query); $num_results = $result-num_rows; ---this is the line with error Hi Terion, you're mixing normal mysql_* with mysqli. Mysqli is object oriented and the mormalö mysql_ functions aren't - thei're procedural. So you can do it either like $result = mysql_query(SELECT 1); $num = mysql_num_rows($result); Or in OOP $res = $mysqlObj-query(SELECT 1); // $mysqlObj should be initialized first ;) hint: new mysqli() $num = $res-num_rows(); Check ot this URL: http://php.net/mysqli byebye Hmm, well I did some looking at other codes etc and some tweaking but still get two problems: Changed my code to try and use an array because that has worked before when I have run into the object error, but I still get this error: Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource Here is my code now: $query = select name, age, warrant, bond, wnumber, crime FROM warrants where .$warranttype. = .$warranttype. OR .$searchname. = .$searchname. ;$result = mysql_query($query);$row = mysql_fetch_assoc($result); $num_results = mysql_num_rows ($result); Should this post of gone on the Db list maybe? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Non-Object errors
Terion, On Tue, Apr 28, 2009 at 1:14 PM, Miller, Terion tmil...@springfi.gannett.com wrote: Here is my code now: $query = select name, age, warrant, bond, wnumber, crime FROM warrants where .$warranttype. = .$warranttype. OR .$searchname. = .$searchname. ;$result = mysql_query($query);$row = mysql_fetch_assoc($result);$num_results = mysql_num_rows ($result); Should this post of gone on the Db list maybe? One thing I noticed about your code above has to do with your WHERE clause. Say, $warranttype = 'warrant' $searchname = 'Terion' Your $query will become: SELECT name, age, warrant, bond, wnumber, crime FROM warrants WHERE warrant = warrant OR Terion = Terion The first time you use $warranttype and $searchname should be the column names rather than the value you would like that column to be equal to. -- Lex
Re: [PHP] Non-Object errors
On 4/28/09 12:27 PM, Lex Braun lex.br...@gmail.com wrote: Terion, On Tue, Apr 28, 2009 at 1:14 PM, Miller, Terion tmil...@springfi.gannett.com wrote: Here is my code now: $query = select name, age, warrant, bond, wnumber, crime FROM warrants where .$warranttype. = .$warranttype. OR .$searchname. = .$searchname. ;$result = mysql_query($query);$row = mysql_fetch_assoc($result); $num_results = mysql_num_rows ($result); Should this post of gone on the Db list maybe? One thing I noticed about your code above has to do with your WHERE clause. Say, $warranttype = 'warrant' $searchname = 'Terion' Your $query will become: SELECT name, age, warrant, bond, wnumber, crime FROM warrants WHERE warrant = warrant OR Terion = Terion The first time you use $warranttype and $searchname should be the column names rather than the value you would like that column to be equal to. -- Lex OH Ah ha bet that's it!! I hope!! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] E-Mail Verification - Yes, I know....
2009/4/28 Per Jessen p...@computer.org: Stuart wrote: 2009/4/28 Jay Blanchard jblanch...@pocket.com: Our company wants to do e-mail verification and does not want to use the requests / response method (clicking a link in the e-mail to verify the address), which as we all know is the only way you can be truly sure. I found this; http://verify-email.org/ Which seems to be the next best deal and it is written in PHP. Has anyone used this? Is anyone doing something similar? How do you handle errors? I know that some domains will not accept these requests. I think that this method would really work for us and cut down on the bogus e-mail addresses we're receiving though. Thoughts? Been there, tried that, got blacklisted pretty quickly by most major ISPs and email providers. In short do this only if you have a very limited number of accounts, and only if you can afford to have your IP blacklisted should you hit individual mail server limits. Or, to put it another way, don't do it. There are reasons why the VRFY SMTP command is not implemented by most servers. verify-email.org doesn't use VRFY anyway. It just starts an SMTP-conversation, but terminates after RCPT TO. I never said they did. I compared use of that method to the VRFY command in an effort to explain why mail servers detect and block IPs that make repeated connections but don't actually send anything. To fully quote the paragraph you cut off... There are reasons why the VRFY SMTP command is not implemented by most servers. Firstly it reveals too much information. Secondly it wastes server resources. Same goes for this method of checking an address. Pay special attention to the last sentence. -Stuart -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_session/$_cookie trouble
On Tue, 2009-04-28 at 10:48 -0400, Gary wrote: I am trying to set a cookie and a session, but seem to be running into a wall. I have tried different variations, and keep getting the same error message If I have this ?php session_start(); I get this: Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 If I have this: session_start(); setcookie('sale_cookie','$sale_value', time()-3600); setcookie('assess_cookie','$assess_value', time()-3600); I get this Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 6 Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 7 If I delete and start over, I stll get the headers already sent... I have tried numerous other variations, but all with the same error. What am I missing here? Thanks Gary I would have thought it was obvious, the file assessresult.inc.php is being called before your session_start(). Have you put your code before every include? Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] utf-8 ?
PJ wrote: Tom Worster wrote: On 4/27/09 4:25 PM, PJ af.gour...@videotron.ca wrote: Exactly what are the advantages of using utf-8? How will it solve my problem? actually, i have no idea because i have no idea what problem you are trying to solve and i apologize for presumptuous. i presumed that you have a php app with a bunch of data in mysql and you needed to handle international characters in the db beyond latin-1. I think you hit the nail on the head, except I dont need any of those weird foreign pictograms and scribbles ;-) I'm only using English ( the most difficult, of course), French(a bit twisted), Italian(a bit slanted, German(lots of options), Swedish(cold, cold), Portugese(oh, boy) and maybe some other Western European variety. We do try to be civilized, don't we? So, in the end, utf-8 may not be so important for me after all. All seems to be working just fine. I think I'll upload the stuff to the real site and we can all have a bash at it. 8-) Use utf8 I don't know about your bsd keyboard map issues, but everything should be done in utf8 these days, there's no point in using latin1 anymore. It's not about the ability to use the Hebrew or Character set, it's about using a standard encoding that works everywhere and is the future of PHP anyway. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] utf-8 ?
Tom Worster wrote: On 4/27/09 4:25 PM, PJ af.gour...@videotron.ca wrote: Exactly what are the advantages of using utf-8? How will it solve my problem? actually, i have no idea because i have no idea what problem you are trying to solve and i apologize for presumptuous. i presumed that you have a php app with a bunch of data in mysql and you needed to handle international characters in the db beyond latin-1. Actually, that describes me. I'm using UTF-8 on XHTML 1 pages with the .php extension, so that I can do wizard-like things when it is necessary. But I recently encountered an issue with a lengthy passage Turkish text where it was necessary to display accent marks on consonant characters. Particularly, on upper and lower case G characters. Granted, this isn't a PHP question but I'm curious, how does UTF-8 solve this display issue? Because I've Googled until I'm blue in the face but I didn't find a resolution that was ISO-8859-1 or UTF-8 compatible. Bringing it back around, thank you Tedd for the suggestion of going through the .docs and writing examples of each function. Brilliant! Reese -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_session/$_cookie trouble
http://www.tech-recipes.com/rx/1489/solve-php-error-cannot-modify-header-information-headers-already-sent/ Regards, Igor Escobar Systems Analyst Interface Designer -- Personal Blog ~ blog.igorescobar.com Online Portifolio ~ www.igorescobar.com Twitter ~ @igorescobar On Tue, Apr 28, 2009 at 3:59 PM, Ashley Sheridan a...@ashleysheridan.co.ukwrote: On Tue, 2009-04-28 at 10:48 -0400, Gary wrote: I am trying to set a cookie and a session, but seem to be running into a wall. I have tried different variations, and keep getting the same error message If I have this ?php session_start(); I get this: Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 If I have this: session_start(); setcookie('sale_cookie','$sale_value', time()-3600); setcookie('assess_cookie','$assess_value', time()-3600); I get this Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 6 Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 7 If I delete and start over, I stll get the headers already sent... I have tried numerous other variations, but all with the same error. What am I missing here? Thanks Gary I would have thought it was obvious, the file assessresult.inc.php is being called before your session_start(). Have you put your code before every include? Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Non-Object errors (RESOLVED)
Thanks folks!! On 4/28/09 12:30 PM, Miller, Terion tmil...@springfi.gannett.com wrote: On 4/28/09 12:27 PM, Lex Braun lex.br...@gmail.com wrote: Terion, On Tue, Apr 28, 2009 at 1:14 PM, Miller, Terion tmil...@springfi.gannett.com wrote: Here is my code now: $query = select name, age, warrant, bond, wnumber, crime FROM warrants where .$warranttype. = .$warranttype. OR .$searchname. = .$searchname. ;$result = mysql_query($query);$row = mysql_fetch_assoc($result); $num_results = mysql_num_rows ($result); Should this post of gone on the Db list maybe? One thing I noticed about your code above has to do with your WHERE clause. Say, $warranttype = 'warrant' $searchname = 'Terion' Your $query will become: SELECT name, age, warrant, bond, wnumber, crime FROM warrants WHERE warrant = warrant OR Terion = Terion The first time you use $warranttype and $searchname should be the column names rather than the value you would like that column to be equal to. -- Lex OH Ah ha bet that's it!! I hope!! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] utf-8 ?
On 4/28/09 4:05 PM, Reese howel...@inkworkswell.com wrote: Granted, this isn't a PHP question but I'm curious, how does UTF-8 solve this display issue? if we're talking about web browsers, they are quite good at automatically choosing fonts that can display the unicode characters it finds in a page. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_session/$_cookie trouble
Ashley Thanks for your reply, but no, that is not it. There was no other code prior. Gary Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1240945179.3494.61.ca...@localhost.localdomain... On Tue, 2009-04-28 at 10:48 -0400, Gary wrote: I am trying to set a cookie and a session, but seem to be running into a wall. I have tried different variations, and keep getting the same error message If I have this ?php session_start(); I get this: Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 If I have this: session_start(); setcookie('sale_cookie','$sale_value', time()-3600); setcookie('assess_cookie','$assess_value', time()-3600); I get this Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 6 Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 7 If I delete and start over, I stll get the headers already sent... I have tried numerous other variations, but all with the same error. What am I missing here? Thanks Gary I would have thought it was obvious, the file assessresult.inc.php is being called before your session_start(). Have you put your code before every include? Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_session/$_cookie trouble
On Tue, 2009-04-28 at 15:24 -0400, Gary wrote: Ashley Thanks for your reply, but no, that is not it. There was no other code prior. Gary Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1240945179.3494.61.ca...@localhost.localdomain... On Tue, 2009-04-28 at 10:48 -0400, Gary wrote: I am trying to set a cookie and a session, but seem to be running into a wall. I have tried different variations, and keep getting the same error message If I have this ?php session_start(); I get this: Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 If I have this: session_start(); setcookie('sale_cookie','$sale_value', time()-3600); setcookie('assess_cookie','$assess_value', time()-3600); I get this Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 6 Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 7 If I delete and start over, I stll get the headers already sent... I have tried numerous other variations, but all with the same error. What am I missing here? Thanks Gary I would have thought it was obvious, the file assessresult.inc.php is being called before your session_start(). Have you put your code before every include? Ash www.ashleysheridan.co.uk The code is being pulled in from somewhere, have you checked to see if the framework you are using is pulling it in? Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_session/$_cookie trouble
Igor Thanks for the link. It was suggested that I must put the session_start() before all code on the parent page. I am no longer getting the error messages,so I am assuming I am making progress, however I have yet to be able to get the $_SESSION or $_COOKIE to produce results...such as the ability to echo them. Thanks for your help. Gary Igor Escobar titiolin...@gmail.com wrote in message news:1f5251d50904281208g35fcc98t696b51a4bfc74...@mail.gmail.com... http://www.tech-recipes.com/rx/1489/solve-php-error-cannot-modify-header-information-headers-already-sent/ Regards, Igor Escobar Systems Analyst Interface Designer -- Personal Blog ~ blog.igorescobar.com Online Portifolio ~ www.igorescobar.com Twitter ~ @igorescobar On Tue, Apr 28, 2009 at 3:59 PM, Ashley Sheridan a...@ashleysheridan.co.ukwrote: On Tue, 2009-04-28 at 10:48 -0400, Gary wrote: I am trying to set a cookie and a session, but seem to be running into a wall. I have tried different variations, and keep getting the same error message If I have this ?php session_start(); I get this: Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 If I have this: session_start(); setcookie('sale_cookie','$sale_value', time()-3600); setcookie('assess_cookie','$assess_value', time()-3600); I get this Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 6 Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 7 If I delete and start over, I stll get the headers already sent... I have tried numerous other variations, but all with the same error. What am I missing here? Thanks Gary I would have thought it was obvious, the file assessresult.inc.php is being called before your session_start(). Have you put your code before every include? Ash www.ashleysheridan.co.uk -- 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] $_session/$_cookie trouble
Ashley There are 3 include files, the first is all html, but it has a form, so I put the session_start above the DTD and I no longer get the error messages. I had the session_start at the beginning of the second file, the php processing file, but that produced the error. It seemed to be calling to itself (if that does not sound too naive). As I mentioned in a post above, I am no longer getting the error message, but have been unable to get either the $_SESSION or the cookie to produce results... Thanks for your help. Gary Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1240947209.3494.65.ca...@localhost.localdomain... On Tue, 2009-04-28 at 15:24 -0400, Gary wrote: Ashley Thanks for your reply, but no, that is not it. There was no other code prior. Gary Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1240945179.3494.61.ca...@localhost.localdomain... On Tue, 2009-04-28 at 10:48 -0400, Gary wrote: I am trying to set a cookie and a session, but seem to be running into a wall. I have tried different variations, and keep getting the same error message If I have this ?php session_start(); I get this: Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 If I have this: session_start(); setcookie('sale_cookie','$sale_value', time()-3600); setcookie('assess_cookie','$assess_value', time()-3600); I get this Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 6 Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 7 If I delete and start over, I stll get the headers already sent... I have tried numerous other variations, but all with the same error. What am I missing here? Thanks Gary I would have thought it was obvious, the file assessresult.inc.php is being called before your session_start(). Have you put your code before every include? Ash www.ashleysheridan.co.uk The code is being pulled in from somewhere, have you checked to see if the framework you are using is pulling it in? Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_session/$_cookie trouble
On Tue, 2009-04-28 at 15:34 -0400, Gary wrote: Ashley There are 3 include files, the first is all html, but it has a form, so I put the session_start above the DTD and I no longer get the error messages. I had the session_start at the beginning of the second file, the php processing file, but that produced the error. It seemed to be calling to itself (if that does not sound too naive). As I mentioned in a post above, I am no longer getting the error message, but have been unable to get either the $_SESSION or the cookie to produce results... Thanks for your help. Gary Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1240947209.3494.65.ca...@localhost.localdomain... On Tue, 2009-04-28 at 15:24 -0400, Gary wrote: Ashley Thanks for your reply, but no, that is not it. There was no other code prior. Gary Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1240945179.3494.61.ca...@localhost.localdomain... On Tue, 2009-04-28 at 10:48 -0400, Gary wrote: I am trying to set a cookie and a session, but seem to be running into a wall. I have tried different variations, and keep getting the same error message If I have this ?php session_start(); I get this: Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 If I have this: session_start(); setcookie('sale_cookie','$sale_value', time()-3600); setcookie('assess_cookie','$assess_value', time()-3600); I get this Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 6 Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 7 If I delete and start over, I stll get the headers already sent... I have tried numerous other variations, but all with the same error. What am I missing here? Thanks Gary I would have thought it was obvious, the file assessresult.inc.php is being called before your session_start(). Have you put your code before every include? Ash www.ashleysheridan.co.uk The code is being pulled in from somewhere, have you checked to see if the framework you are using is pulling it in? Ash www.ashleysheridan.co.uk There it is then. The HTML file causes the headers to be sent. Any output to the browser at all causes the headers to be sent, so any HTML or even spaces and newlines will trigger this error. Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Project Euler [Oh, this isn't spam mail...]
This isn't a question. :-D. Anyways, there's a website that I came across which has kept me up past bedtime the past few nights. Project Euler is a series of challenging mathematical/computer programming problems that will require more than just mathematical insights to solve. Although mathematics will help you arrive at elegant and efficient methods, the use of a computer and programming skills will be required to solve most problems. http://projecteuler.net/index.php?section=problems Take a look. A fun thing to do when you're bored. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_session/$_cookie trouble
Thanks again, dont see any DOM As I mentioned I am no longer getting error message, but not sure it is working. I have this at the begining of the first file. ?php session_start(); setcookie('sale_cookie','$sale_value', time()-3600); setcookie('assess_cookie','$assess_value', time()-3600); if (isset($_COOKIE['sale_cookie']) isset($_COOKIE['assess_cookie'])) { $_SESSION['sale_value'] = $_COOKIE['sale_cookie']; $_SESSION['assess_value'] = $_COOKIE['assess_cookie']; } ? I have tried this echo $sale_value; echo $_SESSION['assess_value']; echo $_COOKIE['sale_cookie']; I have also removed all of the if() and still not had success None of which are producing results... Anyone see where I am going wrong... I have spent all day online, in the books, in the manual... Thanks again gary Igor Escobar titiolin...@gmail.com wrote in message news:1f5251d50904281318ie275b06w219fb6e014775...@mail.gmail.com... Make sure your file isn't a UTF-8 with DOM. Regards, Igor Escobar Systems Analyst Interface Designer -- Personal Blog ~ blog.igorescobar.com Online Portifolio ~ www.igorescobar.com Twitter ~ @igorescobar On Tue, Apr 28, 2009 at 5:13 PM, Ashley Sheridan a...@ashleysheridan.co.ukwrote: On Tue, 2009-04-28 at 15:34 -0400, Gary wrote: Ashley There are 3 include files, the first is all html, but it has a form, so I put the session_start above the DTD and I no longer get the error messages. I had the session_start at the beginning of the second file, the php processing file, but that produced the error. It seemed to be calling to itself (if that does not sound too naive). As I mentioned in a post above, I am no longer getting the error message, but have been unable to get either the $_SESSION or the cookie to produce results... Thanks for your help. Gary Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1240947209.3494.65.ca...@localhost.localdomain... On Tue, 2009-04-28 at 15:24 -0400, Gary wrote: Ashley Thanks for your reply, but no, that is not it. There was no other code prior. Gary Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1240945179.3494.61.ca...@localhost.localdomain... On Tue, 2009-04-28 at 10:48 -0400, Gary wrote: I am trying to set a cookie and a session, but seem to be running into a wall. I have tried different variations, and keep getting the same error message If I have this ?php session_start(); I get this: Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 If I have this: session_start(); setcookie('sale_cookie','$sale_value', time()-3600); setcookie('assess_cookie','$assess_value', time()-3600); I get this Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 6 Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 7 If I delete and start over, I stll get the headers already sent... I have tried numerous other variations, but all with the same error. What am I missing here? Thanks Gary I would have thought it was obvious, the file assessresult.inc.php is being called before your session_start(). Have you put your code before every include? Ash www.ashleysheridan.co.uk The code is being pulled in from somewhere, have you checked to see if the framework you are using is pulling it in? Ash www.ashleysheridan.co.uk There it is then. The HTML file causes the headers to be sent. Any output to the browser at all causes the headers to be sent, so any HTML or even spaces and
Re: [PHP] $_session/$_cookie trouble
On Tue, 2009-04-28 at 16:38 -0400, Gary wrote: Thanks again, dont see any DOM As I mentioned I am no longer getting error message, but not sure it is working. I have this at the begining of the first file. ?php session_start(); setcookie('sale_cookie','$sale_value', time()-3600); setcookie('assess_cookie','$assess_value', time()-3600); if (isset($_COOKIE['sale_cookie']) isset($_COOKIE['assess_cookie'])) { $_SESSION['sale_value'] = $_COOKIE['sale_cookie']; $_SESSION['assess_value'] = $_COOKIE['assess_cookie']; } ? I have tried this echo $sale_value; echo $_SESSION['assess_value']; echo $_COOKIE['sale_cookie']; I have also removed all of the if() and still not had success None of which are producing results... Anyone see where I am going wrong... I have spent all day online, in the books, in the manual... Thanks again gary Igor Escobar titiolin...@gmail.com wrote in message news:1f5251d50904281318ie275b06w219fb6e014775...@mail.gmail.com... Make sure your file isn't a UTF-8 with DOM. Regards, Igor Escobar Systems Analyst Interface Designer -- Personal Blog ~ blog.igorescobar.com Online Portifolio ~ www.igorescobar.com Twitter ~ @igorescobar On Tue, Apr 28, 2009 at 5:13 PM, Ashley Sheridan a...@ashleysheridan.co.ukwrote: On Tue, 2009-04-28 at 15:34 -0400, Gary wrote: Ashley There are 3 include files, the first is all html, but it has a form, so I put the session_start above the DTD and I no longer get the error messages. I had the session_start at the beginning of the second file, the php processing file, but that produced the error. It seemed to be calling to itself (if that does not sound too naive). As I mentioned in a post above, I am no longer getting the error message, but have been unable to get either the $_SESSION or the cookie to produce results... Thanks for your help. Gary Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1240947209.3494.65.ca...@localhost.localdomain... On Tue, 2009-04-28 at 15:24 -0400, Gary wrote: Ashley Thanks for your reply, but no, that is not it. There was no other code prior. Gary Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1240945179.3494.61.ca...@localhost.localdomain... On Tue, 2009-04-28 at 10:48 -0400, Gary wrote: I am trying to set a cookie and a session, but seem to be running into a wall. I have tried different variations, and keep getting the same error message If I have this ?php session_start(); I get this: Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 If I have this: session_start(); setcookie('sale_cookie','$sale_value', time()-3600); setcookie('assess_cookie','$assess_value', time()-3600); I get this Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 6 Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 7 If I delete and start over, I stll get the headers already sent... I have tried numerous other variations, but all with the same error. What am I missing here? Thanks Gary I would have thought it was obvious, the file assessresult.inc.php is being called before your session_start(). Have you put your code before every include? Ash www.ashleysheridan.co.uk The code is being pulled in from somewhere, have you checked to see if the framework you
Re: [PHP] $_session/$_cookie trouble
Take the values out of single quotes, else it sets them as strings, and not as the variable value. Also, are you meaning to set the cookie's expiration to time()-3600? Try time()+3600. On Tue, Apr 28, 2009 at 4:49 PM, Ashley Sheridan a...@ashleysheridan.co.uk wrote: On Tue, 2009-04-28 at 16:38 -0400, Gary wrote: Thanks again, dont see any DOM As I mentioned I am no longer getting error message, but not sure it is working. I have this at the begining of the first file. ?php session_start(); setcookie('sale_cookie','$sale_value', time()-3600); setcookie('assess_cookie','$assess_value', time()-3600); if (isset($_COOKIE['sale_cookie']) isset($_COOKIE['assess_cookie'])) { $_SESSION['sale_value'] = $_COOKIE['sale_cookie']; $_SESSION['assess_value'] = $_COOKIE['assess_cookie']; } ? I have tried this echo $sale_value; echo $_SESSION['assess_value']; echo $_COOKIE['sale_cookie']; I have also removed all of the if() and still not had success None of which are producing results... Anyone see where I am going wrong... I have spent all day online, in the books, in the manual... Thanks again gary Igor Escobar titiolin...@gmail.com wrote in message news:1f5251d50904281318ie275b06w219fb6e014775...@mail.gmail.com... Make sure your file isn't a UTF-8 with DOM. Regards, Igor Escobar Systems Analyst Interface Designer -- Personal Blog ~ blog.igorescobar.com Online Portifolio ~ www.igorescobar.com Twitter ~ @igorescobar On Tue, Apr 28, 2009 at 5:13 PM, Ashley Sheridan a...@ashleysheridan.co.ukwrote: On Tue, 2009-04-28 at 15:34 -0400, Gary wrote: Ashley There are 3 include files, the first is all html, but it has a form, so I put the session_start above the DTD and I no longer get the error messages. I had the session_start at the beginning of the second file, the php processing file, but that produced the error. It seemed to be calling to itself (if that does not sound too naive). As I mentioned in a post above, I am no longer getting the error message, but have been unable to get either the $_SESSION or the cookie to produce results... Thanks for your help. Gary Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1240947209.3494.65.ca...@localhost.localdomain... On Tue, 2009-04-28 at 15:24 -0400, Gary wrote: Ashley Thanks for your reply, but no, that is not it. There was no other code prior. Gary Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1240945179.3494.61.ca...@localhost.localdomain... On Tue, 2009-04-28 at 10:48 -0400, Gary wrote: I am trying to set a cookie and a session, but seem to be running into a wall. I have tried different variations, and keep getting the same error message If I have this ?php session_start(); I get this: Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 If I have this: session_start(); setcookie('sale_cookie','$sale_value', time()-3600); setcookie('assess_cookie','$assess_value', time()-3600); I get this Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 6 Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 7 If I delete and start over, I stll get the headers already sent... I have tried numerous other variations, but all with the same error. What am I missing here? Thanks Gary I would have thought it was obvious, the file assessresult.inc.php is being called before
Re: [PHP] $_session/$_cookie trouble
Make sure your file isn't a UTF-8 with DOM. Regards, Igor Escobar Systems Analyst Interface Designer -- Personal Blog ~ blog.igorescobar.com Online Portifolio ~ www.igorescobar.com Twitter ~ @igorescobar On Tue, Apr 28, 2009 at 5:13 PM, Ashley Sheridan a...@ashleysheridan.co.ukwrote: On Tue, 2009-04-28 at 15:34 -0400, Gary wrote: Ashley There are 3 include files, the first is all html, but it has a form, so I put the session_start above the DTD and I no longer get the error messages. I had the session_start at the beginning of the second file, the php processing file, but that produced the error. It seemed to be calling to itself (if that does not sound too naive). As I mentioned in a post above, I am no longer getting the error message, but have been unable to get either the $_SESSION or the cookie to produce results... Thanks for your help. Gary Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1240947209.3494.65.ca...@localhost.localdomain... On Tue, 2009-04-28 at 15:24 -0400, Gary wrote: Ashley Thanks for your reply, but no, that is not it. There was no other code prior. Gary Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1240945179.3494.61.ca...@localhost.localdomain... On Tue, 2009-04-28 at 10:48 -0400, Gary wrote: I am trying to set a cookie and a session, but seem to be running into a wall. I have tried different variations, and keep getting the same error message If I have this ?php session_start(); I get this: Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 If I have this: session_start(); setcookie('sale_cookie','$sale_value', time()-3600); setcookie('assess_cookie','$assess_value', time()-3600); I get this Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 6 Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 7 If I delete and start over, I stll get the headers already sent... I have tried numerous other variations, but all with the same error. What am I missing here? Thanks Gary I would have thought it was obvious, the file assessresult.inc.php is being called before your session_start(). Have you put your code before every include? Ash www.ashleysheridan.co.uk The code is being pulled in from somewhere, have you checked to see if the framework you are using is pulling it in? Ash www.ashleysheridan.co.uk There it is then. The HTML file causes the headers to be sent. Any output to the browser at all causes the headers to be sent, so any HTML or even spaces and newlines will trigger this error. Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Unit Testing
Philip Thompson wrote: On Apr 27, 2009, at 11:38 AM, Simon wrote: As a programmer, i always test what I'm coding as i code it (mostly to make sure i dont include typos), but i feel it is best to make proper testing once the component is ready and working fine. If your project is large, it might be a good idea to break it in several 'modules' or section if possible and treat each of them as separate projects (testing would be done on a module once this one is ready). You may be interested in looking for information on the net on 'IT project management' which usually describe when is the best time to test according to a certain structure... Simon On Mon, Apr 27, 2009 at 12:16 PM, Nathan Rixham nrix...@gmail.com wrote: Philip Thompson wrote: Hi. I did some searching in the archives, but didn't quite find what I was looking for. Maybe a few of you can assist me... We have an application that's currently in production, but we're constantly modifying/upgrading it. We did not do unit testing early on because of the lack of time. Now that some time has opened up, we're considering unit testing. My question is. is it reasonable to start unit testing at this point in time with the application mostly built? Besides being really time-consuming, what are the pitfalls of starting unit testing at this stage? Thanks in advance, ~Philip maybe a useless answer, but, no pitfalls - just do it - I'm always surprised by my unit test results, its invaluable and it's never too late to start. just think about the next years worth of bugs found by the client not being there! A question I have about unit testing. The point is to test individual units... correct? So, let's say I have this core class which creates instances of other classes. Well, if I only want test the core class, I don't want to instantiate the other classes... correct? Example: ?php // Core.php require ('Class1.php'); require ('Class2.php'); class Core { public function __construct () { $this-class1 = new Class1 ($this); $this-class2 = new Class2 ($this); } } // CoreTest.php require ('../PHPUnit/Framework.php'); require ('../includes/Core.php'); class CoreTest extends PHPUnit_Framework_TestCase { protected function setUp () { $this-core = new Core(); } } ? So, here, Class1 and Class2 will be instantiated. However, I don't really care for them to be so that I can test all the methods in the core class. Is this a perfect example of how the original design of the core class is not conducive to implementing unit tests? Without rewriting the core class, is there a way to test this? Thanks, ~Philip well Class1 and Class2 should have there own unit tests, so by the time you get to Core you know the others are good so it doesn't matter if they are called or not. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_session/$_cookie trouble
Gary wrote: Thanks again, dont see any DOM As I mentioned I am no longer getting error message, but not sure it is working. I have this at the begining of the first file. ?php session_start(); setcookie('sale_cookie','$sale_value', time()-3600); setcookie('assess_cookie','$assess_value', time()-3600); if (isset($_COOKIE['sale_cookie']) isset($_COOKIE['assess_cookie'])) { $_SESSION['sale_value'] = $_COOKIE['sale_cookie']; $_SESSION['assess_value'] = $_COOKIE['assess_cookie']; } ? I have tried this echo $sale_value; echo $_SESSION['assess_value']; echo $_COOKIE['sale_cookie']; I have also removed all of the if() and still not had success None of which are producing results... Anyone see where I am going wrong... I have spent all day online, in the books, in the manual... Thanks again gary Looks to me like you are trying to set and retrieve a cookie on the same page. It doesn't work that way. Set it, access it on the next page... or, set it, and then redirect to the same page.. being sure to send a flag to hide the setcookie function to avoid the dreaded infinite loop. Also, Setting a cookie's expire param to history will delete it... so I don't think that is what you want to do. Donovan -- =o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o D. BROOKE EUCA Design Center WebDNA Software Corp. WEB: http://www.euca.us | http://www.webdna.us =o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o WebDNA: [** Square Bracket Utopia **] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Developing PHP extensions on Windows with VC++, linking problems
Eugenio Tacchini wrote: Hi all, I had to create a PHP extension and I read this article: http://www.talkphp.com/vbarticles.php?do=articlearticleid=49title=creating-custom-php-extensionshttp://www.talkphp.com/vbarticles.ph...php-extensions Everything worked fine if I keep Debug as Active solution configuration in Build-Configuration managerbut in this way I can only use the extension created on the machine I compiled it. If I choose Release instead of Debug I get a fatal error: dllmain.obj : fatal error LNK1179: invalid or corrupt file: duplicate COMDAT '_putwchar' Can you help me? Probably a better place to ask is the php-internals list, all of the people who develop the c code behind php are on there. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: $_session/$_cookie trouble
Many thanks to all for persevering my ignorance! I had read that setting a cookie into the past would destroy the cookie once the browser session was over, so that is why I had set it that way. I did two things to solve the problem, and I frankly dont know which one (or both) it was. First I reset the expiration into the future Next I changed setcookie('sale_cookie','$sale_value' time()-3600);to setcookie('sale_cookie',$_POST['sale'] time()+3600); So I was pulling the information from the post instead of the variable. $sale_value=$_POST['sale']; So again, thanks for all your help. Gary Gary gwp...@ptd.net wrote in message news:eb.4e.29799.53717...@pb1.pair.com... I am trying to set a cookie and a session, but seem to be running into a wall. I have tried different variations, and keep getting the same error message If I have this ?php session_start(); I get this: Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 If I have this: session_start(); setcookie('sale_cookie','$sale_value', time()-3600); setcookie('assess_cookie','$assess_value', time()-3600); I get this Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 6 Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 7 If I delete and start over, I stll get the headers already sent... I have tried numerous other variations, but all with the same error. What am I missing here? Thanks Gary -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: $_session/$_cookie trouble
$sale_value would have worked if it hadn't been in single quotes, I believe. (Assuming it was populated.). When you put it in quotes, you were making the cookie's value a string instead of a variable. So, the value would actually have literally been $sale_value, rather than the value for that variable. It is working with $_POST['sale'] because there are no single quotes. :-p. On Tue, Apr 28, 2009 at 6:46 PM, Gary gwp...@ptd.net wrote: Many thanks to all for persevering my ignorance! I had read that setting a cookie into the past would destroy the cookie once the browser session was over, so that is why I had set it that way. I did two things to solve the problem, and I frankly dont know which one (or both) it was. First I reset the expiration into the future Next I changed setcookie('sale_cookie','$sale_value' time()-3600); to setcookie('sale_cookie',$_POST['sale'] time()+3600); So I was pulling the information from the post instead of the variable. $sale_value=$_POST['sale']; So again, thanks for all your help. Gary Gary gwp...@ptd.net wrote in message news:eb.4e.29799.53717...@pb1.pair.com... I am trying to set a cookie and a session, but seem to be running into a wall. I have tried different variations, and keep getting the same error message If I have this ?php session_start(); I get this: Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 If I have this: session_start(); setcookie('sale_cookie','$sale_value', time()-3600); setcookie('assess_cookie','$assess_value', time()-3600); I get this Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 6 Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 7 If I delete and start over, I stll get the headers already sent... I have tried numerous other variations, but all with the same error. What am I missing here? Thanks Gary -- 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] Re: $_session/$_cookie trouble
Andrew Hucks wrote: $sale_value would have worked if it hadn't been in single quotes, I believe. (Assuming it was populated.). Which it wasn't.. ;-) according to Gary's last post. He assigned it now with 'sale'.. however, I think it should rather be in double quotes (sale) if he wants to get the posted value. echo $sale_value; now works because sale_value has been assigned a value. But: echo $_COOKIE['sale_cookie']; I would guess will still not work.. until landing on the next page, or reloading the first page. When you put it in quotes, you were making the cookie's value a string instead of a variable. So, the value would actually have literally been $sale_value, rather than the value for that variable. It is working with $_POST['sale'] because there are no single quotes. :-p. Gary, if you want to post your working code, we could probably tell you the why's... and it would also cater to my curiosity. ;-) Donovan -- =o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o D. BROOKE EUCA Design Center WebDNA Software Corp. WEB: http://www.euca.us | http://www.webdna.us =o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o WebDNA: [** Square Bracket Utopia **] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_session/$_cookie trouble
Gary wrote: Thanks again, dont see any DOM As I mentioned I am no longer getting error message, but not sure it is working. I have this at the begining of the first file. ?php session_start(); setcookie('sale_cookie','$sale_value', time()-3600); setcookie('assess_cookie','$assess_value', time()-3600); if (isset($_COOKIE['sale_cookie']) isset($_COOKIE['assess_cookie'])) { $_SESSION['sale_value'] = $_COOKIE['sale_cookie']; $_SESSION['assess_value'] = $_COOKIE['assess_cookie']; } ? I have tried this echo $sale_value; echo $_SESSION['assess_value']; echo $_COOKIE['sale_cookie']; I have also removed all of the if() and still not had success None of which are producing results... Anyone see where I am going wrong... I have spent all day online, in the books, in the manual... Thanks again gary Maybe I'm missing something, but why are you using session vars and cookie vars like you are? If you start a session it creates a cookie to track the session and the session persists your session vars. Why not just use session vars? -- Thanks! -Shawn http://www.spidean.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: $_session/$_cookie trouble
Ok, working code. I'm sure there is some left over code that is not actually working, but I have been playing frankenstein all day. Basically a vistor fills in 3 (only two set so far) inputs to see if they qualify for a rebate. If they do, they can go on to file two to submit their information. This is my first project using $_cookie or $_session. I have done an exercise or two in lessons using them, but this is my first attempt from scratch. File1 of 2 ?php session_start(); ? ?php $_SESSION=array('$sale_value', 'assess_value'); $sale_value=$_POST['sale']; $assess_value=$_POST['assess']; $mil_rate=.03965; $ratio=.51; $present_tax=($assess_value) * ($mil_rate); $correct_tax=($sale_value)*($ratio)*($mil_rate); $savings=($present_tax)-($correct_tax); if ($savings 0.00){ echo 'h2 style=margin:0;color:#ff;Yes, Your property appears to qualify!/h2br /br /'; } if ($savings 0.00){ echo 'h3 style=margin:0;NO, Your property does not appear to qualify. /h3br /br /'; } echo 'According to the information you have enteredbr /';?br / ?php echo You believe your home would today sell for $.number_format($sale_value).br /; echo Your current tax assessment is $.number_format($assess_value).br /; echo 'You live in br /br /'; echo 'According to preliminary calculationsbr /br /'; echo You are currently paying now $.number_format($present_tax, 2).br /br /; echo According to the information you have submitted, your taxes should be $ .number_format($correct_tax, 2).br /; ? br/?php if ($savings 0.00){ echo According to our preliminary calculations, a successful assessment appeal could save you annually on your current real estate taxes. b$ .number_format($savings, 2)./b ; } if ($savings 0.00){ echo 'It does not appear that an appeal would be successful in saving you money this year. If property values in your area continue to decline, you may wish to revisit the issue next year./h3br /br /'; } $_SESSION['sale_value'] ='$sale_value'; $_SESSION['assess_value'] ='$assess_value'; ? p style=font-size:.8em; color:#66;If you feel you have entered incorrect information, hit your browsers back button to re-calculate with the new information/pbr / p style=text-align:center; color:#FF; font-size:1.4em;bImportant Notice!/b/p p style=text-align:center; border:#99 1px solid;This bDOES NOT/b constitute a legal opinion by !br / No information has been submitted./p pIn order to proceed with an assessment appeal, you must contact my office that we may verify all pertinent information regarding your a real estate assessment appeal case/p p To submit this information to , please complete the following form./p form action=sendresult.inc.php method=post First Name input name=fname type=text /br /br / Last Name input name=lname type=text /br /br / Property Street Address input name=street type=text / br /br / Town or City input name=town type=text /br/br / Zip Code input name=zip type=text /br /br / County input name=county type=text /br /br / Phone Number input name=phone type=text /br /br / E-Mail Address input name=email type=text /br /br / input name=$assess_value type=hidden value=$assess_value input name=submit type=submit value=Submit /form File 2 ?php ? !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; html xmlns=http://www.w3.org/1999/xhtml; head meta http-equiv=Content-Type content=text/html; charset=utf-8 / titleUntitled Document/title /head body ?php $fname=STRIPSLASHES($_POST['fname']); $lname=STRIPSLASHES($_POST['lname']); $street=STRIPSLASHES($_POST['street']); $town=STRIPSLASHES($_POST['town']); $zip=STRIPSLASHES($_POST['zip']); $county=STRIPSLASHES($_POST['county']); $phone=STRIPSLASHES($_POST['phone']); $email=STRIPSLASHES($_POST['email']); $assess_value=$_COOKIE['assess_value']; $sale_value=$_COOKIE['sale_value']; echo Thank you $fname for your submission!br /; echo You have submitted the following information.br /; echo Name:$fname $lnamebr /; echo Address:$street $town $zipbr /; echo Phone Number: $phonebr /; echo E-Mail Address: $emailbr /; echo You believe your home would sell for $; echo $_COOKIE['sale_cookie']; ?br /?php echo Your assessment value is $; echo $_COOKIE['assess_cookie'];?br /?php echo You live in $countybr /; ? /body /html Lists li...@euca.us wrote in message news:49f790ed.5040...@euca.us... Andrew Hucks wrote: $sale_value would have worked if it hadn't been in single quotes, I believe. (Assuming it was populated.). Which it wasn't.. ;-) according to Gary's last post. He assigned it now with 'sale'.. however, I think it should rather be in double quotes (sale) if he wants to get the posted value. echo $sale_value; now works because sale_value has been assigned a value. But: echo $_COOKIE['sale_cookie']; I would guess will still not work.. until landing on the next page, or reloading the first page. When you put it in quotes, you were making the