[PHP] Question regarding linking PHP Parser library into my private Http server
Hi, I am porting my software from Linux to µC/OS-II OS. On Linux I ran the Boa Web server with PHP. The µC/OS-II has a basic open source Http Server that does not support PHP or CGI. What I was able to do - is from the Http server, each time an http request is received, call using 'System' function the PHP interpreter program (like from cli) with input the requested page. This seams to basically work but it is not efficient at all. What I would like to do is to link the Http Server to the basic PHP parser library and call the 'parse' function each time the server gets an http request. Is this possible? Does anyone know how to do this - which library to link to, which function to call, maybe an example. Thanks for your help. Talya Nevo [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Comparison Problems with 5.2.5
Hi, I have runned into a slight annoying problem with my code, that I have never had before. Either I have something wrong in my code or PHP 5.2.5 that I user is acting weird in windows. I have recently installed PHP on my windows machine for local developement instead of a remote server. What I try to do is to make an if statement betwean two string numbers. $_USER['level'] = The level the user has The $_USER['level'] string is taken from the Database and is 5. This will not work (I expect this to work since _USER['level'] is 5) if($_USER['level'] = 5) This will work (And I expect it to work to) if($_USER['level'] = 6) This will work (Not supposed to work since _USER['level'] is 5) if($_USER['level'] 5) -- View this message in context: http://www.nabble.com/Comparison-Problems-with-5.2.5-tp14547671p14547671.html Sent from the PHP - General mailing list archive at Nabble.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Comparison Problems with 5.2.5
Magnus Anderson wrote: ...snip... This will not work (I expect this to work since _USER['level'] is 5) if($_USER['level'] = 5) Try if($_USER['level'] = 5) maybe it helps ('=' is used when assigning values in an hash, maybe you are triggering something strange...) -- Antinori and Partners - http://www.antinoriandpartners.com Soluzioni web - da professionisti -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Using PHP to remove certain number of bytes from file
Is it possible with PHP to remove a certain number of bytes from a file, purely within PHP? If so, does someone have an example of doing this, removing the first 230 bytes from a file. Thanks, Scott. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question regarding linking PHP Parser library into my private Http server
On Dec 30, 2007 4:02 AM, Talya Nevo [EMAIL PROTECTED] wrote: Hi, I am porting my software from Linux to µC/OS-II OS. On Linux I ran the Boa Web server with PHP. The µC/OS-II has a basic open source Http Server that does not support PHP or CGI. What I was able to do - is from the Http server, each time an http request is received, call using 'System' function the PHP interpreter program (like from cli) with input the requested page. This seams to basically work but it is not efficient at all. What I would like to do is to link the Http Server to the basic PHP parser library and call the 'parse' function each time the server gets an http request. Is this possible? Does anyone know how to do this - which library to link to, which function to call, maybe an example. though i have not interacted with them, i suspect this question may be better received on the internals list. -nathan
Re: [PHP] Comparison Problems with 5.2.5
On Dec 30, 2007 8:04 AM, Silvio Porcellana [EMAIL PROTECTED] wrote: Magnus Anderson wrote: ...snip... This will not work (I expect this to work since _USER['level'] is 5) if($_USER['level'] = 5) Try if($_USER['level'] = 5) maybe it helps ('=' is used when assigning values in an hash, maybe you are triggering something strange...) -- Antinori and Partners - http://www.antinoriandpartners.com Soluzioni web - da professionisti -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php I think it needs to be = (greater than or equal to) or = (less than or equal to). -Casey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] script stoped working over christmas ?
Joker7 schreef: ... config.php ?php $max_summary = 6; $max_latest = 7; $summary_template = t_summary.tp; $article_template = t_article.tp; $password = password; latest.php ?php require('config.php'); $filename = article_summary.php; #- open article summaries if(file_exists($filename)){ full path to this file is not being used. $fh = fopen($filename, r); $old_news = fread($fh, filesize($filename)); fclose($fh); } does the file exist? is it readable by php? is there anything in the file? have you looked at the output source to see what if anything was actually outputted? #- get article $articles = explode(!--ARTICLE--, $old_news); $i=0; foreach ( $articles as $article ){ if(count($articles)$i){ if($max_latest = $i++){ print $article; } } } No error message it's as if it working ,but not ,if I change the path or any thing else I get the apporiate error message. Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Fwd: [PHP] Using PHP to remove certain number of bytes from file
Maybe one of these days I'll remember to actually reply to the list the first time. -- Forwarded message -- From: Benjamin Darwin [EMAIL PROTECTED] Date: Dec 30, 2007 2:12 PM Subject: Re: [PHP] Using PHP to remove certain number of bytes from file To: Scott Wilcox [EMAIL PROTECTED] Try this: $file_data = file_get_contents('filename', false, null, 230); file_put_contents('filename', $file_data); This should do exactly what you need, although you may want to see if either one returns false (indicating an error) and stop the script. On Dec 30, 2007 12:20 PM, Scott Wilcox [EMAIL PROTECTED] wrote: Is it possible with PHP to remove a certain number of bytes from a file, purely within PHP? If so, does someone have an example of doing this, removing the first 230 bytes from a file. Thanks, Scott. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Benjamin Darwin [EMAIL PROTECTED] Dream as if you'll live forever, live as if you'll die today. ~James Dean
Re: [PHP] Using PHP to remove certain number of bytes from file
On Sun, 2007-12-30 at 17:20 +, Scott Wilcox wrote: Is it possible with PHP to remove a certain number of bytes from a file, purely within PHP? Yes. Why wouldn't it? If so, does someone have an example of doing this, removing the first 230 bytes from a file. No, that's an awfully specific problem. But here's the tools you'll need: fopen(), fread(), fwrite(), fclose(). Further info... you could do this without creating a separate temporary file (meaning shift bytes within a single file), but I suggest using a temporary target file for writing the new content, and then replacing the original once everything has completed successfully. Cheers, Rob. -- ... SwarmBuy.com - http://www.swarmbuy.com Leveraging the buying power of the masses! ... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Question about sqli class
I don´t know if this is the correct place to ask this questions but I haver some doubts about using mysqli class in php. I am designing a web place using wamp2 (php5, mysql 5.0.x ). My databases have been done using phpmyadmin so they are normal mysql, I mean that I have done nothing with SQLITE. On the other hand, I am accessing to my databases and tables using mysqli class and methods for example: $conn = new mysqli ( ..) (this is what I am using) I am using that because I read in the internet that mysqli methods where more efficient but I don´t know if it´s correct to use that methods with my mysql database (it runs perfect). so... is it correct? supposing that it´s correct to use it..is it faster and better to use mysqli methods than using the functions that were used before these new classes appeared? thanks... my email is: [EMAIL PROTECTED]
Re: Fwd: [PHP] Using PHP to remove certain number of bytes from file
On Sun, 2007-12-30 at 14:14 -0500, Benjamin Darwin wrote: Maybe one of these days I'll remember to actually reply to the list the first time. -- Forwarded message -- From: Benjamin Darwin [EMAIL PROTECTED] Date: Dec 30, 2007 2:12 PM Subject: Re: [PHP] Using PHP to remove certain number of bytes from file To: Scott Wilcox [EMAIL PROTECTED] Try this: $file_data = file_get_contents('filename', false, null, 230); file_put_contents('filename', $file_data); I don't suggest this route with files that are in the hundreds of megs :) But admittedly, it's the simplest solution for small files. Also, can't use it if you're stuck with PHP 4 since it doesn't support file_put_contents(). PHP4 is dead now anyways, supposedly, so I read someplace ;) Cheers, Rob. -- ... SwarmBuy.com - http://www.swarmbuy.com Leveraging the buying power of the masses! ... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question about sqli class
On Dec 30, 2007 2:11 PM, alvaro [EMAIL PROTECTED] wrote: I don´t know if this is the correct place to ask this questions but I haver some doubts about using mysqli class in php. I am designing a web place using wamp2 (php5, mysql 5.0.x ). My databases have been done using phpmyadmin so they are normal mysql, I mean that I have done nothing with SQLITE. On the other hand, I am accessing to my databases and tables using mysqli class and methods for example: $conn = new mysqli ( ..) (this is what I am using) I am using that because I read in the internet that mysqli methods where more efficient but I don´t know if it´s correct to use that methods with my mysql database (it runs perfect). so... is it correct? supposing that it´s correct to use it..is it faster and better to use mysqli methods than using the functions that were used before these new classes appeared? [EMAIL PROTECTED] i believe the main reason for mysqli being 'better' than mysql is the object oriented approach to the api design. there may be other optimizations under the hood, but i am not aware of any off the top of my head (list: feel free to correct me). as per your overall system design, deciding to go w/ mysqli comes down to a few things - do you want to write all the sql by hand - do you plan on using a different database w/ the same system there are more questions of course but anyway; what im getting at is you might want to take a look at something like propel http://propel.phpdb.org/trac/ there are similar systems out there, but to summarize their features they essentially use a code generation paradigm to write all the database i/o in your system on your behalf; then you can just start using it. it is customizable as well. you will find pros / cons to such a system and a learning curve. but mainly i just want to acquaint you with such systems. anyway if youre not going to use something like that id say shoot for mysqli over mysql. -nathan
Re: Fwd: [PHP] Using PHP to remove certain number of bytes from file
On Dec 30, 2007 11:26 AM, Robert Cummings [EMAIL PROTECTED] wrote: On Sun, 2007-12-30 at 14:14 -0500, Benjamin Darwin wrote: Maybe one of these days I'll remember to actually reply to the list the first time. -- Forwarded message -- From: Benjamin Darwin [EMAIL PROTECTED] Date: Dec 30, 2007 2:12 PM Subject: Re: [PHP] Using PHP to remove certain number of bytes from file To: Scott Wilcox [EMAIL PROTECTED] Try this: $file_data = file_get_contents('filename', false, null, 230); file_put_contents('filename', $file_data); I don't suggest this route with files that are in the hundreds of megs :) But admittedly, it's the simplest solution for small files. Also, can't use it if you're stuck with PHP 4 since it doesn't support file_put_contents(). PHP4 is dead now anyways, supposedly, so I read someplace ;) Cheers, Rob. -- ... SwarmBuy.com - http://www.swarmbuy.com Leveraging the buying power of the masses! ... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php 30 seconds alternative: ?php $fh = fopen($file, 'rb'); $f2 = fopen('temp', 'wb'); fseek($fh, 230); do { fwrite($f2, fread($fh, 4069)); } while (!feof($fh); fclose($fh); fclose($f2); rename('temp', $file); ? -Casey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] read email
HI! I am trying to access qmail with php. Why! Because I would like to read mail who someone send an email me to qmail. If anyone knows the code, please send me the code. Regards, Yui
Re: [PHP] read email
On Sunday 30 December 2007 21:19:16 Yui Hiroaki wrote: HI! I am trying to access qmail with php. Why! Because I would like to read mail who someone send an email me to qmail. If anyone knows the code, please send me the code. NOW that was straight forward I always thought the easiest way to figure out how this works, is to take appart... something like squirrelmail or openwebmail... even something like the one we use on our students at work, a short name, like zork dork work... can't remember. :). Even so, never got to it and forgot about it. Never thought about the shortcut of askin' here... However, why doesn't this seem likely ;D Regards, Yui -- --- Børge Holen http://www.arivene.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Mail system
If i run coureir and postfix I want to have a signup script How should the code be written? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Mail system
mattias wrote: If i run coureir and postfix I want to have a signup script How should the code be written? Since you're asking on a PHP list I'm going to assume you want to use PHP. The answer you seek is... by you, using some form of text editor! We're not here to write code for you. Have a go, then come back if you have problems. The manual will help, as will Google. There's a good chance someone has already done this, so I'd start with Google. -Stut -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
SV: [PHP] Mail system
First of all If you have a bad day don't send to the list -Ursprungligt meddelande- Från: Stut [mailto:[EMAIL PROTECTED] Skickat: den 30 december 2007 21:46 Till: mattias Kopia: php-general@lists.php.net Ämne: Re: [PHP] Mail system mattias wrote: If i run coureir and postfix I want to have a signup script How should the code be written? Since you're asking on a PHP list I'm going to assume you want to use PHP. The answer you seek is... by you, using some form of text editor! We're not here to write code for you. Have a go, then come back if you have problems. The manual will help, as will Google. There's a good chance someone has already done this, so I'd start with Google. -Stut -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: SV: [PHP] Mail system
mattias wrote: First of all If you have a bad day don't send to the list I'm actually having a pretty good day thanks. Seriously though, Google for an existing solution, and if there isn't one have a go yourself and then ask for help if you have problems. I apologise if you feel that's harsh, but that's the way it is. -Stut -- http://stut.net/ -Ursprungligt meddelande- Från: Stut [mailto:[EMAIL PROTECTED] Skickat: den 30 december 2007 21:46 Till: mattias Kopia: php-general@lists.php.net Ämne: Re: [PHP] Mail system mattias wrote: If i run coureir and postfix I want to have a signup script How should the code be written? Since you're asking on a PHP list I'm going to assume you want to use PHP. The answer you seek is... by you, using some form of text editor! We're not here to write code for you. Have a go, then come back if you have problems. The manual will help, as will Google. There's a good chance someone has already done this, so I'd start with Google. -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
SV: SV: [PHP] Mail system
Yes but i are newbie in php I think i should use php exec but i dont know no more -Ursprungligt meddelande- Från: Stut [mailto:[EMAIL PROTECTED] Skickat: den 30 december 2007 22:01 Till: mattias Kopia: php-general@lists.php.net Ämne: Re: SV: [PHP] Mail system mattias wrote: First of all If you have a bad day don't send to the list I'm actually having a pretty good day thanks. Seriously though, Google for an existing solution, and if there isn't one have a go yourself and then ask for help if you have problems. I apologise if you feel that's harsh, but that's the way it is. -Stut -- http://stut.net/ -Ursprungligt meddelande- Från: Stut [mailto:[EMAIL PROTECTED] Skickat: den 30 december 2007 21:46 Till: mattias Kopia: php-general@lists.php.net Ämne: Re: [PHP] Mail system mattias wrote: If i run coureir and postfix I want to have a signup script How should the code be written? Since you're asking on a PHP list I'm going to assume you want to use PHP. The answer you seek is... by you, using some form of text editor! We're not here to write code for you. Have a go, then come back if you have problems. The manual will help, as will Google. There's a good chance someone has already done this, so I'd start with Google. -Stut -- 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: SV: SV: [PHP] Mail system
mattias wrote: Yes but i are newbie in php I think i should use php exec but i dont know no more GOOGLE GOOGLE GOOGLE GOOGLE GOOGLE http://postfixadmin.sourceforge.net/ was the first result I got. Seems to fit the bill from where I'm sitting. -Stut -- http://stut.net/ -Ursprungligt meddelande- Från: Stut [mailto:[EMAIL PROTECTED] Skickat: den 30 december 2007 22:01 Till: mattias Kopia: php-general@lists.php.net Ämne: Re: SV: [PHP] Mail system mattias wrote: First of all If you have a bad day don't send to the list I'm actually having a pretty good day thanks. Seriously though, Google for an existing solution, and if there isn't one have a go yourself and then ask for help if you have problems. I apologise if you feel that's harsh, but that's the way it is. -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] I'm trying to sending an image via email
Hi gang: I'm trying to send an image via email (hmm, must be an echo). In any event, the following is my main-code (word, dude) and a part of the email I receive back. The image file IS there. Any suggestions as to what I'm doing wrong? Cheers, tedd -- the code -- $eol=\r\n; $mime_boundary=md5(time()); $headers = From: .$myName..$from..$eol; $headers .= Reply-To: .$myName..$from..$eol; $headers .= Return-Path: .$myName..$from..$eol; $headers .= Message-ID: .time().-.$from..$eol; $headers .= X-Mailer: PHP v.phpversion().$eol; $headers .= 'MIME-Version: 1.0'.$eol; $headers .= Content-Type: multipart/related; boundary=\.$mime_boundary.\.$eol; $handle=fopen($filename, 'rb'); $f_contents=fread($handle, filesize($filename)); $f_contents=chunk_split(base64_encode($f_contents)); fclose($handle); $msg = --.$mime_boundary.$eol; $msg .= Content-Type: image/jpeg; name=\.$filename.\.$eol; $msg .= Content-Transfer-Encoding: base64.$eol; $msg .= Content-Disposition: attachment; filename=\.$filename.\.$eol.$eol; $msg .= $f_contents.$eol.$eol; mail($to, $subject, $msg, $headers); -- what I receive -- X-Mailer: PHP v5.1.6 MIME-Version: 1.0 Content-Type: multipart/related; boundary=d4a13b4aa61d40214e49820c8f2e2e2f --d4a13b4aa61d40214e49820c8f2e2e2f Content-Type: image/jpeg; name=tempa.jpg Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename=tempa.jpg /9j/4AAQSkZJRgABAgAAZABkAAD/7AARRHVja3kAAQAEZAAA/+4AJkFkb2JlAGTAAQMA -snip- more of the same -- --- 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: SV: SV: [PHP] Mail system
At 9:15 PM + 12/30/07, Stut wrote: mattias wrote: Yes but i are newbie in php I think i should use php exec but i dont know no more GOOGLE GOOGLE GOOGLE GOOGLE GOOGLE Sounds like the Ghost of Thanksgiving Turkey. I know, my holiday meter is pegged. 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: SV: SV: [PHP] Mail system
On Sunday 30 December 2007 22:10:50 mattias wrote: Yes but i are newbie in php I think i should use php exec but i dont know no more See there's no problem havin php reading your files, you just got to make sure that it's allowed to... PHP is not doing that very well job, so there is some perl cgi stuff thingy and I don't know. imho, start tearing apart some software and skip googling, to much small stuff to figure out just by thinking about it. It's like trying to think out a car in details all by yerself... could be done in a few months, but if you're like me... I won't even say it -Ursprungligt meddelande- Från: Stut [mailto:[EMAIL PROTECTED] Skickat: den 30 december 2007 22:01 Till: mattias Kopia: php-general@lists.php.net Ämne: Re: SV: [PHP] Mail system mattias wrote: First of all If you have a bad day don't send to the list I'm actually having a pretty good day thanks. Seriously though, Google for an existing solution, and if there isn't one have a go yourself and then ask for help if you have problems. I apologise if you feel that's harsh, but that's the way it is. -Stut -- http://stut.net/ -Ursprungligt meddelande- Från: Stut [mailto:[EMAIL PROTECTED] Skickat: den 30 december 2007 21:46 Till: mattias Kopia: php-general@lists.php.net Ämne: Re: [PHP] Mail system mattias wrote: If i run coureir and postfix I want to have a signup script How should the code be written? Since you're asking on a PHP list I'm going to assume you want to use PHP. The answer you seek is... by you, using some form of text editor! We're not here to write code for you. Have a go, then come back if you have problems. The manual will help, as will Google. There's a good chance someone has already done this, so I'd start with Google. -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- --- Børge Holen http://www.arivene.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question about sqli class
Both ext/mysql and ext/mysqli work exclusively with MySQL databases. They could not talk to SQLite, which is a different database engine entirely. If you have the choice and are using MySQL 5 and PHP 5, ext/mysqli is generally faster than ext/mysql. More importantly, it supports native prepared statements which is easier to use and more secure than trying to do your own escaping. Better still would be to use PDO, which provides the advantages of ext/mysqli and supports a half dozen databases using the same (or nearly the same) OO API. Even better than that is to write your own thin wrapper API and then use mysqli or PDO under the hood. Then if necessary you can switch from one to another with only minimal impact on your application code. Whether the API is OO or function-oriented doesn't make a huge difference. Prepared statements do. --Larry Garfield On Sun, 30 Dec 2007 20:11:16 +0100, alvaro [EMAIL PROTECTED] wrote: I don´t know if this is the correct place to ask this questions but I haver some doubts about using mysqli class in php. I am designing a web place using wamp2 (php5, mysql 5.0.x ). My databases have been done using phpmyadmin so they are normal mysql, I mean that I have done nothing with SQLITE. On the other hand, I am accessing to my databases and tables using mysqli class and methods for example: $conn = new mysqli ( ..) (this is what I am using) I am using that because I read in the internet that mysqli methods where more efficient but I don´t know if it´s correct to use that methods with my mysql database (it runs perfect). so... is it correct? supposing that it´s correct to use it..is it faster and better to use mysqli methods than using the functions that were used before these new classes appeared? thanks... my email is: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] looping through a $_POST variable
I am trying to loop through a $_POST variable. It comes from a text area and it will have data like many email address or just one listed with a space or on a new line. I can't seam to get the data to extract properly. I have tried this below $array = explode(' ', $_POST['emails']); foreach ($array as $value) { $sql = SELECT id FROM contacts where emailaddress = '$value' AND members_id = '$memberid'; $sql_result=safe_query($sql); while ($row=mysql_fetch_array($sql_result)){ $id = $row[id]; $sql1=UPDATE contacts SET emailstatus ='Unsubscribed' WHERE id = '$id'; safe_query($sql1); }} -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] looping through a $_POST variable
I am trying to get one email at a time and run it through the loop and process it but if I have more than one email in the text area it gives me nothing and does not run What kind of problems are you having in extracting the data? On Dec 30, 2007, at 4:29 PM, Richard Kurth wrote: I am trying to loop through a $_POST variable. It comes from a text area and it will have data like many email address or just one listed with a space or on a new line. I can't seam to get the data to extract properly. I have tried this below $array = explode(' ', $_POST['emails']); foreach ($array as $value) { $sql = SELECT id FROM contacts where emailaddress = '$value' AND members_id = '$memberid'; $sql_result=safe_query($sql); while ($row=mysql_fetch_array($sql_result)){ $id = $row[id]; $sql1=UPDATE contacts SET emailstatus ='Unsubscribed' WHERE id = '$id'; safe_query($sql1); }} -- 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] looping through a $_POST variable
On Sun, December 30, 2007 5:29 pm, Richard Kurth wrote: I am trying to loop through a $_POST variable. It comes from a text area and it will have data like many email address or just one listed with a space or on a new line. I can't seam to get the data to extract properly. I have tried this below $array = explode(' ', $_POST['emails']); //see what you have. //maybe it's not hat you think var_dump($_POST['emails']); foreach ($array as $value) { //you should probably validate the emails using: http://php.net/imap_rfc822_parse_adrlist $value_sql = mysql_real_escape_string($value); $sql = SELECT id FROM contacts where emailaddress = '$value' AND members_id = '$memberid'; Use '$value_sql' here. And I dunno where $memberid came from, but maybe it should be escaped as well. $sql_result=safe_query($sql); I'm not sure what safe_query is doing, and maybe you think it can escape the data you embedded into the SQL, but I don't see how you can do that... Sort of a Humpty-Dumpty problem... while ($row=mysql_fetch_array($sql_result)){ $id = $row[id]; $sql1=UPDATE contacts SET emailstatus ='Unsubscribed' WHERE id = '$id'; safe_query($sql1); }} -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [BULK] [PHP] I'm trying to sending an image via email
On Sun 30 Dec 07, tedd wrote: I'm trying to send an image via email (hmm, must be an echo). In any event, the following is my main-code (word, dude) and a part of the email I receive back. The image file IS there. Any suggestions as to what I'm doing wrong? -- the code -- $msg .= Content-Disposition: attachment; filename=\.$filename.\.$eol.$eol; $msg .= $f_contents.$eol.$eol; guess/think that should read: $msg .= $f_contents.$eol. $boundary . --- . $eol; i.e. message needs a closing boundary terminated with either 2 or 3 dashes (cant remember off-hand). -- Eddie Most burning issues generate far more heat than light. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: SV: SV: [PHP] Mail system
?php $arg1 = escapeshellarg($_POST['arg1']; exec(/full/path/to/courier /full/path/to/any/files $arg1, $output, $error); var_dump($output); if ($error){ die(Use shell 'perror $error' to find out what the OS said. Or install my nifty perror extension.br /\nhttp://l-i-e.com/perror;); } ? You're on your own to figure out the courier and postfix commands you need to use. You'll have to ask on courier and postfix mailing lists. You'll also probably run into permissions issues, as letting the webserver user (e.g. 'apache') run the postfix binaries is probably not a Good Idea, really... You need to think heavily about SECURITY before you do this, and, frankly, as a newbie, you should probably hire somebody to review your process/code for you. I dunno if Shiflett and co. take on such a small task, but somebody somewhere might... Or maybe the courier/postfix folks can comment on just how dangerously you are behaving. On Sun, December 30, 2007 3:10 pm, mattias wrote: Yes but i are newbie in php I think i should use php exec but i dont know no more -Ursprungligt meddelande- Från: Stut [mailto:[EMAIL PROTECTED] Skickat: den 30 december 2007 22:01 Till: mattias Kopia: php-general@lists.php.net Ämne: Re: SV: [PHP] Mail system mattias wrote: First of all If you have a bad day don't send to the list I'm actually having a pretty good day thanks. Seriously though, Google for an existing solution, and if there isn't one have a go yourself and then ask for help if you have problems. I apologise if you feel that's harsh, but that's the way it is. -Stut -- http://stut.net/ -Ursprungligt meddelande- Från: Stut [mailto:[EMAIL PROTECTED] Skickat: den 30 december 2007 21:46 Till: mattias Kopia: php-general@lists.php.net Ämne: Re: [PHP] Mail system mattias wrote: If i run coureir and postfix I want to have a signup script How should the code be written? Since you're asking on a PHP list I'm going to assume you want to use PHP. The answer you seek is... by you, using some form of text editor! We're not here to write code for you. Have a go, then come back if you have problems. The manual will help, as will Google. There's a good chance someone has already done this, so I'd start with Google. -Stut -- 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 -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] looping through a $_POST variable
When I do a var_dump($_POST['emails']); it has all the emails in it string(65) [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] I will validate the emails after I get the loop to work $memberid comes from a part of the script I did not show you $memberid =$_POST[members_id]; safe_query is a function that I call that does query stuff function safe_query ($query = ){ include (dataconf.inc.php); dbconnect($dbname,$rootusername,$rootpassword,$roothostname); global$query_debug; if (empty($query)) { return FALSE; } if (!empty($query_debug)) { print pre$query/pre\n; } $result = mysql_query($query) or die(Query Failed: .lierrorno=.mysql_errno(). br .lierror=.mysql_error(). brbr .liquery=.$query ); return $result; } On Sun, December 30, 2007 5:29 pm, Richard Kurth wrote: I am trying to loop through a $_POST variable. It comes from a text area and it will have data like many email address or just one listed with a space or on a new line. I can't seam to get the data to extract properly. I have tried this below $array = explode(' ', $_POST['emails']); //see what you have. //maybe it's not hat you think var_dump($_POST['emails']); foreach ($array as $value) { //you should probably validate the emails using: http://php.net/imap_rfc822_parse_adrlist $value_sql = mysql_real_escape_string($value); $sql = SELECT id FROM contacts where emailaddress = '$value' AND members_id = '$memberid'; Use '$value_sql' here. And I dunno where $memberid came from, but maybe it should be escaped as well. $sql_result=safe_query($sql); I'm not sure what safe_query is doing, and maybe you think it can escape the data you embedded into the SQL, but I don't see how you can do that... Sort of a Humpty-Dumpty problem... while ($row=mysql_fetch_array($sql_result)){ $id = $row[id]; $sql1=UPDATE contacts SET emailstatus ='Unsubscribed' WHERE id = '$id'; safe_query($sql1); }} -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: SV: SV: [PHP] Mail system
On Sun, December 30, 2007 3:36 pm, Børge Holen wrote: On Sunday 30 December 2007 22:10:50 mattias wrote: Yes but i are newbie in php I think i should use php exec but i dont know no more See there's no problem havin php reading your files, you just got to make sure that it's allowed to... PHP is not doing that very well job, so there is some perl cgi stuff thingy and I don't know. imho, start tearing apart some software and skip googling, to much small stuff to figure out just by thinking about it. It's like trying to think out a car in details all by yerself... could be done in a few months, but if you're like me... I won't even say it This one time, I worked a summer job for Macon County Highway in Illinois, and some punk-[bleep] kid decided to take it upon himself to completely strip down one of their dump trucks to parts... He got it pretty much all apart in a day, before anybody realized what he was doing! They made him put it back together, but he had to have so much help from the head mechanic, that said head mechanic was very [bleeped] off... I think it only took a few days/weeks of their spare time to get it back together, but it seemed like he was getting razzed forever... Which reminds me: I've still got a Lionel train engine to re-assemble from my teen years... But at least I know I can handle that task, when I have nothing more important to do... Obligatory On-Topic Forced Analogy: Fortunately, with code, we can BACKUP before tearing it all apart, or use subversion (et al) :-) -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] read email
On Sun, December 30, 2007 2:19 pm, Yui Hiroaki wrote: HI! I am trying to access qmail with php. Why! Because I would like to read mail who someone send an email me to qmail. If anyone knows the code, please send me the code. http://php.net/imap Sample Code: http://l-i-e.com/imap/index.phps Some spam filtering I set up to catch what slips through spam assasin and get the email sorted server-side rather than have my desktop client CHOKES trying to sort out thousands of emails upon login... -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [BULK] [PHP] I'm trying to sending an image via email
On Sun 30 Dec 07, tedd wrote: I'm trying to send an image via email (hmm, must be an echo). In any event, the following is my main-code (word, dude) and a part of the email I receive back. The image file IS there. Any suggestions as to what I'm doing wrong? -- the code -- $msg .= Content-Disposition: attachment; filename=\.$filename.\.$eol.$eol; $msg .= $f_contents.$eol.$eol; On Mon 31 Dec 07, Eddie Dunckley wrote: guess/think that should read: $msg .= $f_contents.$eol. $boundary . --- . $eol; i.e. message needs a closing boundary terminated with either 2 or 3 dashes (cant remember off-hand). oops .. didnt read properly. $msg .= $f_contents . $eol . '--' . $mime_boundary . --- . $eol.$eol; send yourself an email with an attachment and view the email source and compare with your program output. or you could just google for MIME.class site:*.phpbuilder.net and download and use it like require_once(MIME.class); // check if parm bcc is in lib, think its not. $msg = new MIME_mail($from, $to,$cc,$bcc, $subject); $msg-fattach($filename); // parms = $path, $description, $contenttype=OCTET, $encoding=BASE64, //$disp='inline' etc, view the mime class to see options $msg-send_mail(); -- Eddie Dreams are free, but you get soaked on the connect time. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question about sqli class
On Sun, December 30, 2007 1:11 pm, alvaro wrote: I don´t know if this is the correct place to ask this questions but I haver some doubts about using mysqli class in php. I am designing a web place using wamp2 (php5, mysql 5.0.x ). My databases have been done using phpmyadmin so they are normal mysql, I mean that I have done nothing with SQLITE. On the other hand, I am accessing to my databases and tables using mysqli class and methods for example: $conn = new mysqli ( ..) (this is what I am using) I am using that because I read in the internet that mysqli methods where more efficient but I don´t know if it´s correct to use that methods with my mysql database (it runs perfect). You can use either of the clients to access the DB safely. [At least in theory. I suppose there could exist some unknown bug that makes a serious difference...] so... is it correct? supposing that it´s correct to use it..is it faster and better to use mysqli methods than using the functions that were used before these new classes appeared? It might or might not be faster, depending on a lot of factors, I suspect... It also might be a lot less stable, since it's a lot less pounded upon by millions of users. The speed difference will probably be completely irrelevant to you in your real-life usage, if you're having to ask here... -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Comparison Problems with 5.2.5
You want = and not = The = operator doesn't even make any sense in that context, as far as I know... On Sun, December 30, 2007 8:34 am, Magnus Anderson wrote: Hi, I have runned into a slight annoying problem with my code, that I have never had before. Either I have something wrong in my code or PHP 5.2.5 that I user is acting weird in windows. I have recently installed PHP on my windows machine for local developement instead of a remote server. What I try to do is to make an if statement betwean two string numbers. $_USER['level'] = The level the user has The $_USER['level'] string is taken from the Database and is 5. This will not work (I expect this to work since _USER['level'] is 5) if($_USER['level'] = 5) This will work (And I expect it to work to) if($_USER['level'] = 6) This will work (Not supposed to work since _USER['level'] is 5) if($_USER['level'] 5) -- View this message in context: http://www.nabble.com/Comparison-Problems-with-5.2.5-tp14547671p14547671.html Sent from the PHP - General mailing list archive at Nabble.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Using PHP to remove certain number of bytes from file
On Sun, December 30, 2007 11:20 am, Scott Wilcox wrote: Is it possible with PHP to remove a certain number of bytes from a file, purely within PHP? If so, does someone have an example of doing this, removing the first 230 bytes from a file. Something like this might work: ?php $path = /full/path/to/file; $file = fopen($path, 'r+') or die(Could not open $path); //read 200 bytes $goners = fread($file, 200); if (!strlen($goners) === 200){ ftruncate($file, 0); } $offset = 0; while(!feof($file)){ $buffer = fread($file, 2048); ftell($file, $offset); fwrite($file, $buffer); $offset += strlen($buffer); ftell($file, $offset + 200); } ? -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question regarding linking PHP Parser library into my private Http server
On Sun, December 30, 2007 3:02 am, Talya Nevo wrote: I am porting my software from Linux to µC/OS-II OS. On Linux I ran the Boa Web server with PHP. The µC/OS-II has a basic open source Http Server that does not support PHP or CGI. What I was able to do - is from the Http server, each time an http request is received, call using 'System' function the PHP interpreter program (like from cli) with input the requested page. This seams to basically work but it is not efficient at all. What I would like to do is to link the Http Server to the basic PHP parser library and call the 'parse' function each time the server gets an http request. Is this possible? Does anyone know how to do this - which library to link to, which function to call, maybe an example. Thanks for your help. Talya Nevo [EMAIL PROTECTED] You could probably have a MUCH easier time and benefit the PHP community a WHOLE lot more by looking at the Apache/CLI/Isapi API implementations. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] looping through a $_POST variable
You might want to check the loop alone and check each value of $value: $array = explode(' ', $_POST['emails']); foreach($array as $value) { print '$value'br; } if it works that way, at least you narrow down the possibilities of weirdness. On Dec 30, 2007, at 5:34 PM, Richard Kurth wrote: When I do a var_dump($_POST['emails']); it has all the emails in it string(65) [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] I will validate the emails after I get the loop to work $memberid comes from a part of the script I did not show you $memberid =$_POST[members_id]; safe_query is a function that I call that does query stuff function safe_query ($query = ){ include (dataconf.inc.php); dbconnect($dbname,$rootusername,$rootpassword,$roothostname); global$query_debug; if (empty($query)) { return FALSE; } if (!empty($query_debug)) { print pre$query/pre\n; } $result = mysql_query($query) or die(Query Failed: .lierrorno=.mysql_errno(). br .lierror=.mysql_error(). brbr .liquery=.$query ); return $result; } On Sun, December 30, 2007 5:29 pm, Richard Kurth wrote: I am trying to loop through a $_POST variable. It comes from a text area and it will have data like many email address or just one listed with a space or on a new line. I can't seam to get the data to extract properly. I have tried this below $array = explode(' ', $_POST['emails']); //see what you have. //maybe it's not hat you think var_dump($_POST['emails']); foreach ($array as $value) { //you should probably validate the emails using: http://php.net/imap_rfc822_parse_adrlist $value_sql = mysql_real_escape_string($value); $sql = SELECT id FROM contacts where emailaddress = '$value' AND members_id = '$memberid'; Use '$value_sql' here. And I dunno where $memberid came from, but maybe it should be escaped as well. $sql_result=safe_query($sql); I'm not sure what safe_query is doing, and maybe you think it can escape the data you embedded into the SQL, but I don't see how you can do that... Sort of a Humpty-Dumpty problem... while ($row=mysql_fetch_array($sql_result)){ $id = $row[id]; $sql1=UPDATE contacts SET emailstatus ='Unsubscribed' WHERE id = '$id'; safe_query($sql1); }} -- 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] script stoped working over christmas ?
Dude, put some error checking in there... On Sat, December 29, 2007 5:23 am, Joker7 wrote: Can anyone see why this has stopped working... latest.php is used with ? include(/home/sever2/public_html/teaup/article/article_summary.php) ? to show the latest news articles. Cheers Chris config.php ?php $max_summary = 6; $max_latest = 7; $summary_template = t_summary.tp; $article_template = t_article.tp; $password = password; ? latest.php ?php require('config.php'); $filename = article_summary.php; #- open article summaries if(file_exists($filename)){ $fh = fopen($filename, r); if (!$fh) die(Failed to open $filename); $old_news = fread($fh, filesize($filename)); fclose($fh); } else{ die(file $filename does not exist!); #- get article $articles = explode(!--ARTICLE--, $old_news); $i=0; foreach ( $articles as $article ){ if(count($articles)$i){ if($max_latest = $i++){ print $article; } } } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php.ini in php5.2.1
make install should install one, but may be putting it in some place that it's not expected. If you are using some kind of package manager like apt-get or RedHat rpms or whatever, you are in duck soup for where some package-maker THINKS they should put the php.ini file, and where their binary actually looks for it... You can always just COPY the php.ini-dist file to where phpinfo() says it should be and then edit it. If PHP cannot find the file, it just uses all the defaults, so it's no real shock that there's nothing there. On Sat, December 29, 2007 12:23 am, jekillen wrote: Hello; I have not had the necessity to deal with php.ini files for some time. Now, because I switch from Sendmail to Postfix on one system I need to adjust the sendmail path variable. I cannot find a php.ini file in the specified location. That is not a problem because I can use ini_set(). What is puzzling is that my system, I built and installed from source on a number of different systems and seem to remember that the process creates a php.ini file. Maybe I have it wrong but in the past I seem to remember being able to find one to make sure register variables was set to off. (or maybe I ignored it because that is the default now). So, is the fact that this file is missing something I should be concerned about? PS; I have subscribed to the php-install list and get not responses to my posts, or e-mails my ISP says contain viruses, possibly from a user who requested I contact him (of her) off list. Thanks Jeff K -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] when does php stop php executing when user clicks stop
On Fri, December 28, 2007 6:33 pm, Eric Wood wrote: If database operations are underway when a user accesses a web page, then user clicks stop on the browser, does the php stop immediately too? Maybe. http://php.net/ignore_user_abort I'd rather the php continue behind the scenes to fullfill all the actions I need it do to whether the user wants to see if happen or not. Overall I wonder how modphp keeps the code executing even if the browser drops the connection via stop. Any insight is greatly appreciated. If you want to be 100% sure something gets done, then don't do it. :-) Set up a task to be done later, and put that in the DB, and then have a cron job to run through the tasks and do them, and mark them done or not. The fact you are asking indicates that you've got something that takes too long for a user to wait around anyway, and that's another reason to just insert a task and act on it later. Don't make a human wait for a slow computer, ever. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Unix date (even more bazaar)
Spacing and/or control (unprintable) characters could easily be messing you up. Use something like: $l = strlen($input); for ($i = 0; $i $l; $i++){ echo $i: $input[$i] (, ord($input[$i]), )br /\n; } to see what you're getting. On Fri, December 28, 2007 5:08 pm, tedd wrote: At 6:01 PM -0500 12/28/07, tedd wrote: Hi gang: This really bazaar Here's the code and demo: http://webbytedd.com/c/unix-time1/index.php If I cut/paste the following string as-is into the Input Date portion of the form: 10-18-2009 00:00:00 It works and returns a UNIX timestamp of 1255885200 However, if I cut/paste the following string as-is into the Input Date portion of the form: 10-18-2009 00:00:00 It doesn't work and returns a UNIX timestamp of . Am I going mad? What the hell is the difference between these two stings? Arr I knew this day would come. tedd As I feared, the email translation made both strings identical -- so this won't work for those trying it. BUT, I do have two strings that look identical but aren't. I hate it when things like this happen. 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 -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] socket_read can not read the whole HTTP page?
HTTP 1.1 requires more complex client/server interaction, and if your client (which is about as brain-dead simple as it gets) isn't doing that complex stuff, 1.1 will not work. All HTTP 1.1 servers will work just fine with 1.0, so stick with that unless you really NEED a feature of 1.1 On Fri, December 28, 2007 2:58 am, ked wrote: Wow, That's correct answer! Thank to Eddie Dunckley ! scheme: $in .= GET {$file} HTTP/1.0\r\n; //--- $in .= Accept: text/html\r\n; $in .= Accept-Language: zh-cn\r\n; $in .= User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 2.0.50727)\r\n; $in .= Host: {$host}\r\n; $in .= Cache-Control: no-cache\r\n; $in .= Connection: closed\r\n\r\n;//must be closed 1.must be HTTP/1.0 : why? IE post HTTP/1.1 . 2. must be closed : so that should be close not closed; Both modification are required. Shall anyone tell me sth. about HTTP/1.0 and HTTP/1.1 ? best regards! ked -Original Message- From: Eddie Dunckley [mailto:[EMAIL PROTECTED] Sent: Friday, December 28, 2007 3:50 PM To: php-general@lists.php.net Subject: Re: [PHP] socket_read can not read the whole HTTP page? On Fri 28 Dec 07, ked wrote: I wrote those script to get HTTP url content, and it works , but it can't read the whole content of the page. Blocked on while ($out = socket_read($socket, 1024)) . $in .= GET {$file} HTTP/1.1\r\n; try to change this to $in .= GET {$file} HTTP/1.0\r\n; $in .= Connection: Keep-Alive\r\n\r\n; and change this to $in .= Connection: closed\r\n\r\n; -- Eddie Dunckley - [EMAIL PROTECTED] - Realtime Travel Connections IBE Development, www.rttc.co.za, cell 083-379-6891, fax 086-617-7831 Where 33deg53'37.23S 18deg37'57.87E Cape Town Bellville Oakdale ZA Chaos, panic, and disorder - my work here is done. -- 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 -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: fopen() for http:// sometimes working, sometimes not
DNS records are failing to lookup the domain name for you... Maybe just put the URL back into a queue to try later. You should also toy with nslookup or dig from the command line and see if you can get it to fail as often. On Thu, December 27, 2007 12:00 pm, Albert Wiersch wrote: Some additional info. It seems I am getting these warnings when it fails: Warning: fopen() [function.fopen]: php_network_getaddresses: getaddrinfo failed: Name or service not known Warning: fopen(http://wanganda2u.co.uk) [function.fopen]: failed to open stream: Now I have to find out why that is failing some of the time but not other times. -- Albert Wiersch Fix your website: http://onlinewebcheck.com Albert Wiersch [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I noticed my script at http://onlinewebcheck.com was sometimes (fairly often) failing to open some URLs that users have entered. fopen() returns false very quickly, but when tried again with the same URL, sometimes it works. What would cause this behavior? Why does fopen() occasionally fail to open valid http addresses but works at other times? -- Albert Wiersch -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question regarding linking PHP Parser library into my private Http server
On Dec 30, 2007 7:57 PM, Richard Lynch [EMAIL PROTECTED] wrote: On Sun, December 30, 2007 3:02 am, Talya Nevo wrote: I am porting my software from Linux to µC/OS-II OS. On Linux I ran the Boa Web server with PHP. The µC/OS-II has a basic open source Http Server that does not support PHP or CGI. What I was able to do - is from the Http server, each time an http request is received, call using 'System' function the PHP interpreter program (like from cli) with input the requested page. This seams to basically work but it is not efficient at all. What I would like to do is to link the Http Server to the basic PHP parser library and call the 'parse' function each time the server gets an http request. Is this possible? Does anyone know how to do this - which library to link to, which function to call, maybe an example. Thanks for your help. Talya Nevo [EMAIL PROTECTED] You could probably have a MUCH easier time and benefit the PHP community a WHOLE lot more by looking at the Apache/CLI/Isapi API implementations. or maybe something more lean like lighttpd would be a bit easier. (it supports php via cgi and optionally fastcgi) -nathan
Re: [PHP] Re: fopen() for http:// sometimes working, sometimes not
If it's a busy server, you may be running out of TCP connections... If PHP can't open ANY connection at all, it can't do a DNS lookup, and it would fail very fast, as it's hitting an OS limit/cap on the number of connections and not even getting to try to talk to the Internet. On Fri, December 28, 2007 12:03 pm, Albert Wiersch wrote: I'm now using PHP 5.2.5. Well, it seems to still be happening. This describes the problem but I haven't found a solution that works for me yet: http://bugs.php.net/bug.php?id=11058 Is it a PHP problem or DNS? It works sometimes but not other times.. something strange is going on. Example messages: [Fri Dec 28 11:59:04 2007] [error] [client 192.168.0.51] PHP Warning: fopen() [a href='function.fopen'function.fopen/a]: php_network_getaddresses: getaddrinfo failed: Name or service not known [Fri Dec 28 11:59:04 2007] [error] [client 192.168.0.51] PHP Warning: fopen(http://www.lantanalinks.com) [a href='function.fopen'function.fopen/a]: failed to open stream: Success I suppose I could adjust the script to try again if it fails the first time, but I shouldn't have to. Some additional info, when it fails with this problem, it fails very quickly (in less than half a second)... its like it doesn't even try to look up the name. -- Albert Wiersch Fix your website: http://onlinewebcheck.com Albert Wiersch [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I noticed my script at http://onlinewebcheck.com was sometimes (fairly often) failing to open some URLs that users have entered. fopen() returns false very quickly, but when tried again with the same URL, sometimes it works. What would cause this behavior? Why does fopen() occasionally fail to open valid http addresses but works at other times? -- Albert Wiersch -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] looping through a $_POST variable
Okay. Now var_dump($array) and see what it has. On Sun, December 30, 2007 6:34 pm, Richard Kurth wrote: When I do a var_dump($_POST['emails']); it has all the emails in it string(65) [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] I will validate the emails after I get the loop to work $memberid comes from a part of the script I did not show you $memberid =$_POST[members_id]; safe_query is a function that I call that does query stuff function safe_query ($query = ){ include (dataconf.inc.php); dbconnect($dbname,$rootusername,$rootpassword,$roothostname); global$query_debug; if (empty($query)) { return FALSE; } if (!empty($query_debug)) { print pre$query/pre\n; } $result = mysql_query($query) or die(Query Failed: .lierrorno=.mysql_errno(). br .lierror=.mysql_error(). brbr .liquery=.$query ); return $result; } On Sun, December 30, 2007 5:29 pm, Richard Kurth wrote: I am trying to loop through a $_POST variable. It comes from a text area and it will have data like many email address or just one listed with a space or on a new line. I can't seam to get the data to extract properly. I have tried this below $array = explode(' ', $_POST['emails']); //see what you have. //maybe it's not hat you think var_dump($_POST['emails']); foreach ($array as $value) { //you should probably validate the emails using: http://php.net/imap_rfc822_parse_adrlist $value_sql = mysql_real_escape_string($value); $sql = SELECT id FROM contacts where emailaddress = '$value' AND members_id = '$memberid'; Use '$value_sql' here. And I dunno where $memberid came from, but maybe it should be escaped as well. $sql_result=safe_query($sql); I'm not sure what safe_query is doing, and maybe you think it can escape the data you embedded into the SQL, but I don't see how you can do that... Sort of a Humpty-Dumpty problem... while ($row=mysql_fetch_array($sql_result)){ $id = $row[id]; $sql1=UPDATE contacts SET emailstatus ='Unsubscribed' WHERE id = '$id'; safe_query($sql1); }} -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ASP 2 PHP
On Wed, December 26, 2007 10:26 am, tedd wrote: I have a client who has an entire site done in asp and wants me to convert it to php -- is there an easy way to do this or do I have to do it line by line? There once was an asp2php script that would convert the brain-dead code-by-click-wizard type ASP scripts to PHP with about 90% of it working right... If they coded ASP intelligently by hand, then it failed pretty miserably... I have no idea how well maintained it is, but Google for it and give it a whirl. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] looping through a $_POST variable
looks like that is my problem it is not separating the emails string(67) [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] array(1) { [0]= string(67) [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] } $array = explode(' ', $_POST['emails']); what should I use for spaces or next line to separate them Okay. Now var_dump($array) and see what it has. On Sun, December 30, 2007 6:34 pm, Richard Kurth wrote: When I do a var_dump($_POST['emails']); it has all the emails in it string(65) [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] I will validate the emails after I get the loop to work $memberid comes from a part of the script I did not show you $memberid =$_POST[members_id]; safe_query is a function that I call that does query stuff function safe_query ($query = ){ include (dataconf.inc.php); dbconnect($dbname,$rootusername,$rootpassword,$roothostname); global$query_debug; if (empty($query)) { return FALSE; } if (!empty($query_debug)) { print pre$query/pre\n; } $result = mysql_query($query) or die(Query Failed: .lierrorno=.mysql_errno(). br .lierror=.mysql_error(). brbr .liquery=.$query ); return $result; } On Sun, December 30, 2007 5:29 pm, Richard Kurth wrote: I am trying to loop through a $_POST variable. It comes from a text area and it will have data like many email address or just one listed with a space or on a new line. I can't seam to get the data to extract properly. I have tried this below $array = explode(' ', $_POST['emails']); //see what you have. //maybe it's not hat you think var_dump($_POST['emails']); foreach ($array as $value) { //you should probably validate the emails using: http://php.net/imap_rfc822_parse_adrlist $value_sql = mysql_real_escape_string($value); $sql = SELECT id FROM contacts where emailaddress = '$value' AND members_id = '$memberid'; Use '$value_sql' here. And I dunno where $memberid came from, but maybe it should be escaped as well. $sql_result=safe_query($sql); I'm not sure what safe_query is doing, and maybe you think it can escape the data you embedded into the SQL, but I don't see how you can do that... Sort of a Humpty-Dumpty problem... while ($row=mysql_fetch_array($sql_result)){ $id = $row[id]; $sql1=UPDATE contacts SET emailstatus ='Unsubscribed' WHERE id = '$id'; safe_query($sql1); }} -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Unix date (even more bazaar)
At 7:07 PM -0600 12/30/07, Richard Lynch wrote: Spacing and/or control (unprintable) characters could easily be messing you up. Use something like: $l = strlen($input); for ($i = 0; $i $l; $i++){ echo $i: $input[$i] (, ord($input[$i]), )br /\n; } to see what you're getting. Richard: As usual, you are exactly right. I found that somehow a gremlin had crept in -- I still don't understand how, but it did. So, I stepped through the string similar to what you did and replaced everything that wasn't supposed to be there. Interesting that making a text file with the string and looking at it via a Hex Editor, I found that the gremlin was a 0A (new line), but when it was on the server, it was two characters (High ASCII 194/160) -- very strange. In any event, I fixed it. I didn't have the time to run down why. Thanks, 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] looping through a $_POST variable
You should use whatever is actually BETWEEN the emails, which could be anything... See the thread about Tedd's bazaar (sic) problem and use the technique there to see what you are actually getting. You may even need to resort to a split instead of explode if newlines, spaces, and carriage-returns are all possible inputs from the end users... On Sun, December 30, 2007 7:33 pm, Richard Kurth wrote: looks like that is my problem it is not separating the emails string(67) [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] array(1) { [0]= string(67) [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] } $array = explode(' ', $_POST['emails']); what should I use for spaces or next line to separate them Okay. Now var_dump($array) and see what it has. On Sun, December 30, 2007 6:34 pm, Richard Kurth wrote: When I do a var_dump($_POST['emails']); it has all the emails in it string(65) [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] I will validate the emails after I get the loop to work $memberid comes from a part of the script I did not show you $memberid =$_POST[members_id]; safe_query is a function that I call that does query stuff function safe_query ($query = ){ include (dataconf.inc.php); dbconnect($dbname,$rootusername,$rootpassword,$roothostname); global$query_debug; if (empty($query)) { return FALSE; } if (!empty($query_debug)) { print pre$query/pre\n; } $result = mysql_query($query) or die(Query Failed: .lierrorno=.mysql_errno(). br .lierror=.mysql_error(). brbr .liquery=.$query ); return $result; } On Sun, December 30, 2007 5:29 pm, Richard Kurth wrote: I am trying to loop through a $_POST variable. It comes from a text area and it will have data like many email address or just one listed with a space or on a new line. I can't seam to get the data to extract properly. I have tried this below $array = explode(' ', $_POST['emails']); //see what you have. //maybe it's not hat you think var_dump($_POST['emails']); foreach ($array as $value) { //you should probably validate the emails using: http://php.net/imap_rfc822_parse_adrlist $value_sql = mysql_real_escape_string($value); $sql = SELECT id FROM contacts where emailaddress = '$value' AND members_id = '$memberid'; Use '$value_sql' here. And I dunno where $memberid came from, but maybe it should be escaped as well. $sql_result=safe_query($sql); I'm not sure what safe_query is doing, and maybe you think it can escape the data you embedded into the SQL, but I don't see how you can do that... Sort of a Humpty-Dumpty problem... while ($row=mysql_fetch_array($sql_result)){ $id = $row[id]; $sql1=UPDATE contacts SET emailstatus ='Unsubscribed' WHERE id = '$id'; safe_query($sql1); }} -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [BULK] [PHP] I'm trying to sending an image via email
oops .. didnt read properly. $msg .= $f_contents . $eol . '--' . $mime_boundary . --- . $eol.$eol; send yourself an email with an attachment and view the email source and compare with your program output. Yep, it's -- two hyphens. Thanks, 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] why is option '97' selectedJapan/option not highlighted
in my select scrolling list? Here is the offending code (abbreviated) select name=sr_location_id class= size=10 option value='94' Italy/option option value='97' selectedJapan/option option value='252' Jersey/option option value='294' Jiangsu/option option value='295' Jiangxi/option I have data series which have a location specified. I wish to edit the data series. I select the location from the database (Note: database stuff is not a problem) and display a scrolling list with the location specified by that data series highlighted. Problem is, even though the option is marked selected, the Japan entry in the scrolling list does not highlight. The offending page may be viewed at http://www.demog.berkeley.edu/~maryfran/memdev/edit_series.php?sr_data_series_id=2 Sometimes when it loads, Japan is highlighted correctly. Sometimes nothing is highlighted. Sometimes some random option in the list is highlighted. Similar behavior is observed in the data series types scrolling list next to the locations list on the page. I have been using Firefox 2.0.0.3. I just tried it out on IE7 and it seems to work OK. Maybe it is a browser problem, but the XDynamic HTML Definitive Reference seems to say that the selected attribute on option works OK with mozilla. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] looping through a $_POST variable
Hi. On Monday 31 December 2007 00:34, Richard Kurth wrote: When I do a var_dump($_POST['emails']); it has all the emails in it string(65) [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] Then this simple regex should do you; just use it instead of explode: $AddressList = preg_split('/\s+/', $_POST['emails']); I will validate the emails after I get the loop to work An better idea might be to do that INSIDE the loop (the following assumes your $memberid is a number, adjust to suit if this is not the case): foreach ($AddressList as $emailaddress) { // Escape the data before letting it near the db $SAFE_emailaddress = mysql_real_escape_string($emailaddress); $SAFE_memberid = intval($_POST[members_id]); // Build the query $sql = SELECT id FROM contact WHERE emailaddress = '$SAFE_emailaddress' AND members_id = '$SAFE_memberid'; // etc. etc. } safe_query is a function that I call that does query stuff That is a *terrible* name for that function, as it does nothing at all to make the query safe. You might consider renaming it to run_query or something. Remember, other people may have to make sense of your code one day. Hope this helps, Mark -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] why is option '97' selectedJapan/option not highlighted
On Dec 30, 2007 10:46 PM, Mary Anderson [EMAIL PROTECTED] wrote: in my select scrolling list? Here is the offending code (abbreviated) select name=sr_location_id class= size=10 option value='94' Italy/option option value='97' selectedJapan/option option value='252' Jersey/option option value='294' Jiangsu/option option value='295' Jiangxi/option I have data series which have a location specified. I wish to edit the data series. I select the location from the database (Note: database stuff is not a problem) and display a scrolling list with the location specified by that data series highlighted. Problem is, even though the option is marked selected, the Japan entry in the scrolling list does not highlight. The offending page may be viewed at http://www.demog.berkeley.edu/~maryfran/memdev/edit_series.php?sr_data_series_id=2 Sometimes when it loads, Japan is highlighted correctly. Sometimes nothing is highlighted. Sometimes some random option in the list is highlighted. Similar behavior is observed in the data series types scrolling list next to the locations list on the page. I have been using Firefox 2.0.0.3. I just tried it out on IE7 and it seems to work OK. Maybe it is a browser problem, but the XDynamic HTML Definitive Reference seems to say that the selected attribute on option works OK with mozilla. On five attempts, it worked 100% of the time on Firefox 2.0.0.11. -- Daniel P. Brown [Phone Numbers Go Here!] [They're Hidden From View!] If at first you don't succeed, stick to what you know best so that you can make enough money to pay someone else to do it for you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php