php-general Digest 16 Oct 2012 00:16:49 -0000 Issue 8008
php-general Digest 16 Oct 2012 00:16:49 - Issue 8008 Topics (messages 319456 through 319467): Re: SNMP via PHP 319456 by: Bastien 319457 by: Lester Caine 319458 by: Jonathan Sundquist 319459 by: Jonathan Sundquist 319460 by: Lester Caine Re: Beneficial site spamming framework 319461 by: Daniel Brown 319466 by: Ashley Sheridan Serving an image 319462 by: Rick Dwyer 319463 by: viper Re: Is it possible to click download button,and run 2 tasks downloading a file and show number of downloads(ajax)simultaneously? 319464 by: Negin Nickparsa 319465 by: Negin Nickparsa foreach 319467 by: David McGlone 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--- Bastien Koert On 2012-10-15, at 7:09 AM, Lester Caine les...@lsces.co.uk wrote: OK I've spent the last two hours going through pages of crap generated by google, and that includes google crap created by searches on sites like http://www.phpbuilder.com - cause mainly of cause by php pages on sites supporting other languages :( Certainly it seems that PHP is preferred even to website java and ruby ... I had some problems over the weekend with the network here and decided it was time to get some monitoring in place locally. cacti simply loaded up and I have working system, but now I'm having trouble getting SNMP sorted on the target machines. So I started looking for an editor to handle the MIB data and keep hitting one dead end after another. I'm sure there must be something out there using php-snmp for a browser? -- Lester Caine - G8HFL - Contact - http://lsces.co.uk/wiki/?page=contact L.S.Caine Electronic Services - http://lsces.co.uk EnquirySolve - http://enquirysolve.com/ Model Engineers Digital Workshop - http://medw.co.uk Rainbow Digital Media - http://rainbowdigitalmedia.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Xenoss is a python solution with tons of monitoring capability. It's well worth a look Bastien---End Message--- ---BeginMessage--- Bastien wrote: Xenoss is a python solution with tons of monitoring capability. It's well worth a look If I wanted to move to python then I would not be asking here ;) I have enough of python on Hg and what I'm looking for here is PHP code that I can massage to do what I need ... I'm still working my way around this. cacti provides a nice monitoring layer and is PHP, but is not helping to set up SNMP on the client machines, so I'm looking for something that can help edit MIB files and also check the SNMP link to remote machines ... -- Lester Caine - G8HFL - Contact - http://lsces.co.uk/wiki/?page=contact L.S.Caine Electronic Services - http://lsces.co.uk EnquirySolve - http://enquirysolve.com/ Model Engineers Digital Workshop - http://medw.co.uk Rainbow Digital Media - http://rainbowdigitalmedia.co.uk ---End Message--- ---BeginMessage--- There appears to be quite a few examples, https://www.google.com/search?q=php+snmp+examplehttps://www.google.com/search?q=php+snmp+exampleaq=0oq=php+snmp+sugexp=chrome,mod=0sourceid=chromeie=UTF-8, and tutorials, https://www.google.com/search?q=php+snmp+examplehttps://www.google.com/search?q=php+snmp+exampleaq=0oq=php+snmp, on google. On Mon, Oct 15, 2012 at 7:25 AM, Lester Caine les...@lsces.co.uk wrote: Bastien wrote: Xenoss is a python solution with tons of monitoring capability. It's well worth a look If I wanted to move to python then I would not be asking here ;) I have enough of python on Hg and what I'm looking for here is PHP code that I can massage to do what I need ... I'm still working my way around this. cacti provides a nice monitoring layer and is PHP, but is not helping to set up SNMP on the client machines, so I'm looking for something that can help edit MIB files and also check the SNMP link to remote machines ... -- Lester Caine - G8HFL - Contact - http://lsces.co.uk/wiki/?page=**contacthttp://lsces.co.uk/wiki/?page=contact L.S.Caine Electronic Services - http://lsces.co.uk EnquirySolve - http://enquirysolve.com/ Model Engineers Digital Workshop - http://medw.co.uk Rainbow Digital Media - http://rainbowdigitalmedia.co.**ukhttp://rainbowdigitalmedia.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ---End Message--- ---BeginMessage--- There appears to be quite a few examples,
[PHP] SNMP via PHP
OK I've spent the last two hours going through pages of crap generated by google, and that includes google crap created by searches on sites like http://www.phpbuilder.com - cause mainly of cause by php pages on sites supporting other languages :( Certainly it seems that PHP is preferred even to website java and ruby ... I had some problems over the weekend with the network here and decided it was time to get some monitoring in place locally. cacti simply loaded up and I have working system, but now I'm having trouble getting SNMP sorted on the target machines. So I started looking for an editor to handle the MIB data and keep hitting one dead end after another. I'm sure there must be something out there using php-snmp for a browser? -- Lester Caine - G8HFL - Contact - http://lsces.co.uk/wiki/?page=contact L.S.Caine Electronic Services - http://lsces.co.uk EnquirySolve - http://enquirysolve.com/ Model Engineers Digital Workshop - http://medw.co.uk Rainbow Digital Media - http://rainbowdigitalmedia.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SNMP via PHP
Bastien Koert On 2012-10-15, at 7:09 AM, Lester Caine les...@lsces.co.uk wrote: OK I've spent the last two hours going through pages of crap generated by google, and that includes google crap created by searches on sites like http://www.phpbuilder.com - cause mainly of cause by php pages on sites supporting other languages :( Certainly it seems that PHP is preferred even to website java and ruby ... I had some problems over the weekend with the network here and decided it was time to get some monitoring in place locally. cacti simply loaded up and I have working system, but now I'm having trouble getting SNMP sorted on the target machines. So I started looking for an editor to handle the MIB data and keep hitting one dead end after another. I'm sure there must be something out there using php-snmp for a browser? -- Lester Caine - G8HFL - Contact - http://lsces.co.uk/wiki/?page=contact L.S.Caine Electronic Services - http://lsces.co.uk EnquirySolve - http://enquirysolve.com/ Model Engineers Digital Workshop - http://medw.co.uk Rainbow Digital Media - http://rainbowdigitalmedia.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Xenoss is a python solution with tons of monitoring capability. It's well worth a look Bastien -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SNMP via PHP
Bastien wrote: Xenoss is a python solution with tons of monitoring capability. It's well worth a look If I wanted to move to python then I would not be asking here ;) I have enough of python on Hg and what I'm looking for here is PHP code that I can massage to do what I need ... I'm still working my way around this. cacti provides a nice monitoring layer and is PHP, but is not helping to set up SNMP on the client machines, so I'm looking for something that can help edit MIB files and also check the SNMP link to remote machines ... -- Lester Caine - G8HFL - Contact - http://lsces.co.uk/wiki/?page=contact L.S.Caine Electronic Services - http://lsces.co.uk EnquirySolve - http://enquirysolve.com/ Model Engineers Digital Workshop - http://medw.co.uk Rainbow Digital Media - http://rainbowdigitalmedia.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SNMP via PHP
There appears to be quite a few examples, https://www.google.com/search?q=php+snmp+examplehttps://www.google.com/search?q=php+snmp+exampleaq=0oq=php+snmp+sugexp=chrome,mod=0sourceid=chromeie=UTF-8, and tutorials, https://www.google.com/search?q=php+snmp+examplehttps://www.google.com/search?q=php+snmp+exampleaq=0oq=php+snmp, on google. On Mon, Oct 15, 2012 at 7:25 AM, Lester Caine les...@lsces.co.uk wrote: Bastien wrote: Xenoss is a python solution with tons of monitoring capability. It's well worth a look If I wanted to move to python then I would not be asking here ;) I have enough of python on Hg and what I'm looking for here is PHP code that I can massage to do what I need ... I'm still working my way around this. cacti provides a nice monitoring layer and is PHP, but is not helping to set up SNMP on the client machines, so I'm looking for something that can help edit MIB files and also check the SNMP link to remote machines ... -- Lester Caine - G8HFL - Contact - http://lsces.co.uk/wiki/?page=**contacthttp://lsces.co.uk/wiki/?page=contact L.S.Caine Electronic Services - http://lsces.co.uk EnquirySolve - http://enquirysolve.com/ Model Engineers Digital Workshop - http://medw.co.uk Rainbow Digital Media - http://rainbowdigitalmedia.co.**ukhttp://rainbowdigitalmedia.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SNMP via PHP
There appears to be quite a few examples, https://www.google.com/search?q=php+snmp+examplehttps://www.google.com/search?q=php+snmp+exampleaq=0oq=php+snmp+sugexp=chrome,mod=0sourceid=chromeie=UTF-8, and tutorials, https://www.google.com/search?q=php+snmp+examplehttps://www.google.com/search?q=php+snmp+exampleaq=0oq=php+snmp, on google. On Mon, Oct 15, 2012 at 7:25 AM, Lester Caine les...@lsces.co.uk wrote: Bastien wrote: Xenoss is a python solution with tons of monitoring capability. It's well worth a look If I wanted to move to python then I would not be asking here ;) I have enough of python on Hg and what I'm looking for here is PHP code that I can massage to do what I need ... I'm still working my way around this. cacti provides a nice monitoring layer and is PHP, but is not helping to set up SNMP on the client machines, so I'm looking for something that can help edit MIB files and also check the SNMP link to remote machines ... -- Lester Caine - G8HFL - Contact - http://lsces.co.uk/wiki/?page=**contacthttp://lsces.co.uk/wiki/?page=contact L.S.Caine Electronic Services - http://lsces.co.uk EnquirySolve - http://enquirysolve.com/ Model Engineers Digital Workshop - http://medw.co.uk Rainbow Digital Media - http://rainbowdigitalmedia.co.**ukhttp://rainbowdigitalmedia.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SNMP via PHP
Jonathan Sundquist wrote: There appears to be quite a few examples, https://www.google.com/search?q=php+snmp+example https://www.google.com/search?q=php+snmp+exampleaq=0oq=php+snmp+sugexp=chrome,mod=0sourceid=chromeie=UTF-8, and tutorials, https://www.google.com/search?q=php+snmp+example https://www.google.com/search?q=php+snmp+exampleaq=0oq=php+snmp, on google. Care to point out something there which is ACTUALLY usable? Many of the 'php examples' only have a connection to php because they are on .php hosted pages ... But it's not examples I'm looking for but something like http://sourceforge.net/projects/php-netanalyzer/ which is still coming up on many searches but not even available just to play with :( -- Lester Caine - G8HFL - Contact - http://lsces.co.uk/wiki/?page=contact L.S.Caine Electronic Services - http://lsces.co.uk EnquirySolve - http://enquirysolve.com/ Model Engineers Digital Workshop - http://medw.co.uk Rainbow Digital Media - http://rainbowdigitalmedia.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Beneficial site spamming framework
On Sat, Oct 13, 2012 at 5:10 PM, Ashley Sheridan a...@ashleysheridan.co.uk wrote: It was only your replies coming through so often, so I doubt its my end. Also, the newsgroup is the same thing as the mailing list I believe, in this instance. Hmm I only got each reply once as well, so I'm not entirely convinced it's an issue with Maciek's setup. Ash, you don't happen to have any misfiring forwarders or multiple addresses subscribed, do you? -- /Daniel P. Brown Network Infrastructure Manager http://www.php.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Serving an image
Hello all. I am sending an email with a logo at the top of the email. The source of the image for the logo is: http://myurl.com/image.php?id=5 Image.php then calls a function that simply returns the following: $image='img src=http://myurl.com/images/logo.jpg; /'; return $image; Calling the page directly via the URL http://myurl.com/image.php?id=5 works fine. But when the email is opened, I get the broken link/image icon even though I can see in my source that the URL which works when loaded into a browser. What needs to be done to serve that image to a email client when it is opened? Thanks, --Rick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Serving an image
On Mon, Oct 15, 2012 at 5:48 PM, Rick Dwyer rpdw...@earthlink.net wrote: I am sending an email with a logo at the top of the email. The source of the image for the logo is: http://myurl.com/image.php?id=5 Image.php then calls a function that simply returns the following: $image='img src=http://myurl.com/images/logo.jpg; /'; return $image; Calling the page directly via the URL http://myurl.com/image.php?id=5 works fine. But when the email is opened, I get the broken link/image icon even though I can see in my source that the URL which works when loaded into a browser. What needs to be done to serve that image to a email client when it is opened? in image.php you should return an image/xxx file and not an HTML tag. try something like this: image.php: $im = imagecreatefrompng(test.png); header('Content-Type: image/png'); imagepng($im); imagedestroy($im); then in your email you can put: img src=http://myurl.com/image.php?id=5; / -- + http://vipertechnology.dyndns.org () ascii ribbon campaign - against html e-mail /\ www.asciiribbon.org - against proprietary attachments + http://vipertechnology.dyndns.org/cotnact/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is it possible to click download button,and run 2 tasks downloading a file and show number of downloads(ajax)simultaneously?
Thanks Tedd, ajax works fine now,when submiting a button it will show the number and it doesn't have any problem $(function() { $(.button).click(function(){ var id=$(this).attr('id'); var dataString = 'id='+ id ; $.ajax({ type: POST, url: download_number.php, data: dataString, cache: false, success: function(html) { $(#div_+id).html(html); } }); } button: input type = button value=Download class=button id=?php echo $id; ? div: div id=div_?php echo $id; ? ?php echo $downloadcount;?/div by the way* I totally will refuse this approach* because,although the ajax is working,but I can't do anything for click to download the related file because when I go to my php page I can't redirect it to a page for download and besides echo the output to be written in div element,so that,the best solution is just redirect to a page and download the file in first place. after submiting write a $_POST['submit'] and just store the download count,update the table and if user refreshed the page,can see the number of downloads,*as sure there isn't anything better than this.* Marco suggested me iframe,reloading it,like a manual ajax but I think it has much of troubles. by the way thanks for all helps.
Re: [PHP] Is it possible to click download button,and run 2 tasks downloading a file and show number of downloads(ajax)simultaneously?
oh my bad:)! there is a cool solution,I forgot the blank page!:) yep! solved:) window.open('download.php', '_blank' ); now I can count up,and download:) $(.button).click(function(){ var id=$(this).attr('id'); var dataString = 'id='+ id ; $.ajax({ type: POST, url: download_number.php, data: dataString, cache: false, success: function(html) { $(#div_+id).html(html); } }); window.open('download.php', '_blank' ); }); so cool!!:) On Mon, Oct 15, 2012 at 7:42 PM, Negin Nickparsa nickpa...@gmail.comwrote: Thanks Tedd, ajax works fine now,when submiting a button it will show the number and it doesn't have any problem $(function() { $(.button).click(function(){ var id=$(this).attr('id'); var dataString = 'id='+ id ; $.ajax({ type: POST, url: download_number.php, data: dataString, cache: false, success: function(html) { $(#div_+id).html(html); } }); } button: input type = button value=Download class=button id=?php echo $id; ? div: div id=div_?php echo $id; ? ?php echo $downloadcount;?/div by the way* I totally will refuse this approach* because,although the ajax is working,but I can't do anything for click to download the related file because when I go to my php page I can't redirect it to a page for download and besides echo the output to be written in div element,so that,the best solution is just redirect to a page and download the file in first place. after submiting write a $_POST['submit'] and just store the download count,update the table and if user refreshed the page,can see the number of downloads,*as sure there isn't anything better than this.* Marco suggested me iframe,reloading it,like a manual ajax but I think it has much of troubles. by the way thanks for all helps.
Re: [PHP] Beneficial site spamming framework
Daniel Brown danbr...@php.net wrote: On Sat, Oct 13, 2012 at 5:10 PM, Ashley Sheridan a...@ashleysheridan.co.uk wrote: It was only your replies coming through so often, so I doubt its my end. Also, the newsgroup is the same thing as the mailing list I believe, in this instance. Hmm I only got each reply once as well, so I'm not entirely convinced it's an issue with Maciek's setup. Ash, you don't happen to have any misfiring forwarders or multiple addresses subscribed, do you? Nope, it was just that one email I received 5 times. Guess it was a hiccup somewhere along the lines... -- Sent from my Android phone with K-9 Mail. Please excuse my brevity. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] foreach
I've been sitting here playing around with foreach() and I'm wondering why I am getting these results. here's what I've been fooling around with. the code has no perticular meaning, but I noticed if the script fails, I get the sentence Too expensive I'm going home LOL 6 times because there are 6 words in the sentence. I also have a database that looks like this: product_id product price 1 Milk2.59 2 bread 1.05 And when $row is equal to 0 the output I get is 1 1 Milk Milk 2.59 2.59 Which is printed to the screen according to how many rows are in the db I belive. So my question is why this behavior? I was expecting something like a while loop. -- David M.
Re: [PHP] foreach
Bastien Koert On 2012-10-15, at 8:16 PM, David McGlone da...@dmcentral.net wrote: I've been sitting here playing around with foreach() and I'm wondering why I am getting these results. here's what I've been fooling around with. the code has no perticular meaning, but I noticed if the script fails, I get the sentence Too expensive I'm going home LOL 6 times because there are 6 words in the sentence. I also have a database that looks like this: product_idproductprice 1Milk2.59 2bread1.05 And when $row is equal to 0 the output I get is 1 1 Milk Milk 2.59 2.59 Which is printed to the screen according to how many rows are in the db I belive. So my question is why this behavior? I was expecting something like a while loop. -- David M. Dave, Foreach is an iterator over an array. Your $row is a pointer to a db result set. If you were to pass the $row result set to the foreach as an array, you'd get what you think you should Www.php.net/foreach -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] foreach
On 10/15/2012 05:16 PM, David McGlone wrote: I've been sitting here playing around with foreach() and I'm wondering why I am getting these results. here's what I've been fooling around with. the code has no perticular meaning, but I noticed if the script fails, I get the sentence Too expensive I'm going home LOL 6 times because there are 6 words in the sentence. I also have a database that looks like this: product_id product price 1 Milk2.59 2 bread 1.05 And when $row is equal to 0 the output I get is 1 1 Milk Milk 2.59 2.59 Which is printed to the screen according to how many rows are in the db I belive. So my question is why this behavior? I was expecting something like a while loop. Code please. -- Jim Lucas http://www.cmsws.com/ http://www.cmsws.com/examples/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] foreach
On Monday, October 15, 2012 08:21:23 PM you wrote: Bastien Koert On 2012-10-15, at 8:16 PM, David McGlone da...@dmcentral.net wrote: I've been sitting here playing around with foreach() and I'm wondering why I am getting these results. here's what I've been fooling around with. the code has no perticular meaning, but I noticed if the script fails, I get the sentence Too expensive I'm going home LOL 6 times because there are 6 words in the sentence. I also have a database that looks like this: product_idproductprice 1Milk2.59 2bread1.05 And when $row is equal to 0 the output I get is 1 1 Milk Milk 2.59 2.59 Which is printed to the screen according to how many rows are in the db I belive. So my question is why this behavior? I was expecting something like a while loop. Dave, Foreach is an iterator over an array. Your $row is a pointer to a db result set. If you were to pass the $row result set to the foreach as an array, you'd get what you think you should Www.php.net/foreach Thanks Bastien. Heres what I started with: $result = mysql_query(SELECT * FROM items); $row = mysql_fetch_array($result); foreach($row as $rows){ $row = 0; if($row == 0){ echo $rows; } else{ echo Too expensive I'm going home LOL; } } Here's what I ended up with after you gave me the advise: $result = mysql_query(SELECT * FROM items); $rows = array(); while($row = mysql_fetch_array($result)) $rows[] = $row; foreach($rows as $row){ $product = $row['product']; $price = $row['price']; echo $product ; echo $price ; $justright = 0; $toohigh = 5; //I was going to use this to check if the price was too high just so I could use an elseif in the exercise, but I realized that it would only work if the if() evaluated to false, which would be impossible. Ahhh pizz on it, it was fun anyway! :-) if($justright = $price){ echo Not bad. I'll buy it.br /; } else echo Too expensive I'm going home LOL ; } It's a dumb script that makes no sense but I had a blast doing this. When things start coming together like this, it gets so gratifying. :-) -- David M.
Re: [PHP] SNMP via PHP
Hello Lester, Monday, October 15, 2012, 9:09:13 PM, you wrote: OK I've spent the last two hours going through pages of crap generated by google, and that includes google crap created by searches on sites like http://www.phpbuilder.com - cause mainly of cause by php pages on sites supporting other languages :( Certainly it seems that PHP is preferred even to website java and ruby ... I had some problems over the weekend with the network here and decided it was time to get some monitoring in place locally. cacti simply loaded up and I have working system, but now I'm having trouble getting SNMP sorted on the target machines. So I started looking for an editor to handle the MIB data and keep hitting one dead end after another. I'm sure there must be something out there using php-snmp for a browser? -- Lester Caine - G8HFL - Contact - http://lsces.co.uk/wiki/?page=contact L.S.Caine Electronic Services - http://lsces.co.uk EnquirySolve - http://enquirysolve.com/ Model Engineers Digital Workshop - http://medw.co.uk Rainbow Digital Media - http://rainbowdigitalmedia.co.uk Did you see this: http://www.php.net/manual/en/book.snmp.php -- Best regards, Tommailto:trog...@kwikin.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Serving an image
viper in php.general (Mon, 15 Oct 2012 17:58:06 +0200): then in your email you can put: img src=http://myurl.com/image.php?id=5; / Many receiving e-mail clients will not show external images. External images are used by spammers to trach if a message is read. Jan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php