php-general Digest 22 Jun 2006 16:00:12 -0000 Issue 4200
php-general Digest 22 Jun 2006 16:00:12 - Issue 4200 Topics (messages 238500 through 238513): Re: GD problems 238500 by: David Robley Re: sort multidimension array 238501 by: Ford, Mike detect user click stop button in browser 238502 by: weetat 238503 by: Andrei templating 238504 by: Ryan A 238505 by: George Pitcher 238506 by: Jon Anderson 238507 by: Miles Thompson 238508 by: Dave Goodchild 238509 by: Joe Wollard 238511 by: Micky Hulse Need help with PEAR Quickform 238510 by: Robert Graham 238512 by: Chris Boget Equivelant to mysql_fetch_row for normal array 238513 by: Dave M G Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: php-general@lists.php.net -- ---BeginMessage--- Beauford wrote: There is something wonky with gd. I completely reinstalled Slackware today, including PHP, gd, and all the other stuff - and still nothing. I downloaded 5 separate captcha scripts and only got one to work. The code in all of them is very similar in that it creates a graphic with random letters and numbers. Here is the entire code from one that doesn't work. ? //--- //This program is free software; you can redistribute it and/or //modify it under the terms of the GNU General Public License //as published by the Free Software Foundation; either version 2 //of the License, or (at your option) any later version. // //This program is distributed in the hope that it will be useful, //but WITHOUT ANY WARRANTY; without even the implied warranty of //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //GNU General Public License for more details. // //Meezerk's CAPTCHA - A Computer Assisted Program for Telling //Computers and Humans Apart //Copyright (C) 2004 Daniel Foster [EMAIL PROTECTED] //--- //Select size of image $size_x = 75; $size_y = 25; //generate random string $code = mt_rand(10,99); //store captcha code in session vars session_start( ); $_SESSION['captcha_code'] = $code; //create image to play with $image = imageCreate($size_x,$size_y); //add content to image //-- //make background white - first colour allocated is background $background = imageColorAllocate($image,255,255,255); //select grey content number $text_number1 = mt_rand(0,150); $text_number2 = mt_rand(0,150); $text_number3 = mt_rand(0,150); //allocate colours $white = imageColorAllocate($image,255,255,255); $black = imageColorAllocate($image,0,0,0); $text = imageColorAllocate($image,$text_number1,$text_number2,$text_number3); //get number of dots to draw $total_dots = ($size_x * $size_y)/15; //draw many many dots that are the same colour as the text for($counter = 0; $counter $total_dots; $counter++) { //get positions for dot $pos_x = mt_rand(0,$size_x); $pos_y = mt_rand(0,$size_y); //draw dot imageSetPixel($image,$pos_x,$pos_y,$text); }; //draw border imageRectangle($image,0,0,$size_x-1,$size_y-1,$black); //get coordinates of position for string //on the font 5 size, each char is 15 pixels high by 9 pixels wide //with 6 digits at a width of 9, the code is 54 pixels wide $pos_x = bcmod($code,$size_x-60) +3; $pos_y = bcmod($code,$size_y-15); //draw random number imageString($image, 5, $pos_x, $pos_y, $code, $text); //-- //end add content to image //send browser headers header(Content-Type: image/jpeg); //send image to browser echo imagejpeg($image); //destroy image imageDestroy($image); ? Well, you may not have the BCmath enabled, and this script will break if bcmod isn't there, probably without you seeing an error message. A tip for debugging image scripts - comment out the line like header(Content-Type: image/jpeg); and run the script again; if there is an error it will be displayed (error settings permitting) whereas with the header in place, all you will get is the broken image icon, most likely. Cheers -- David Robley A life lived in fear is half a life lived. Today is Pungenday, the 27th day of Confusion in the YOLD 3172. ---End Message--- ---BeginMessage--- On 22 June 2006 02:22, weetat wrote: Hi all, I have multi-arrays as shown below: I implemented usort() to sort the array by 'country' field in the array. However there some empty string value in the array and i setup my cmpcountry() function to sort array, however , some country empty string value are sort first . Any
RE: [PHP] GD problems
Beauford wrote: There is something wonky with gd. I completely reinstalled Slackware today, including PHP, gd, and all the other stuff - and still nothing. I downloaded 5 separate captcha scripts and only got one to work. The code in all of them is very similar in that it creates a graphic with random letters and numbers. Here is the entire code from one that doesn't work. ? //--- //This program is free software; you can redistribute it and/or //modify it under the terms of the GNU General Public License //as published by the Free Software Foundation; either version 2 //of the License, or (at your option) any later version. // //This program is distributed in the hope that it will be useful, //but WITHOUT ANY WARRANTY; without even the implied warranty of //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //GNU General Public License for more details. // //Meezerk's CAPTCHA - A Computer Assisted Program for Telling //Computers and Humans Apart //Copyright (C) 2004 Daniel Foster [EMAIL PROTECTED] //--- //Select size of image $size_x = 75; $size_y = 25; //generate random string $code = mt_rand(10,99); //store captcha code in session vars session_start( ); $_SESSION['captcha_code'] = $code; //create image to play with $image = imageCreate($size_x,$size_y); //add content to image //-- //make background white - first colour allocated is background $background = imageColorAllocate($image,255,255,255); //select grey content number $text_number1 = mt_rand(0,150); $text_number2 = mt_rand(0,150); $text_number3 = mt_rand(0,150); //allocate colours $white = imageColorAllocate($image,255,255,255); $black = imageColorAllocate($image,0,0,0); $text = imageColorAllocate($image,$text_number1,$text_number2,$text_number3); //get number of dots to draw $total_dots = ($size_x * $size_y)/15; //draw many many dots that are the same colour as the text for($counter = 0; $counter $total_dots; $counter++) { //get positions for dot $pos_x = mt_rand(0,$size_x); $pos_y = mt_rand(0,$size_y); //draw dot imageSetPixel($image,$pos_x,$pos_y,$text); }; //draw border imageRectangle($image,0,0,$size_x-1,$size_y-1,$black); //get coordinates of position for string //on the font 5 size, each char is 15 pixels high by 9 pixels wide //with 6 digits at a width of 9, the code is 54 pixels wide $pos_x = bcmod($code,$size_x-60) +3; $pos_y = bcmod($code,$size_y-15); //draw random number imageString($image, 5, $pos_x, $pos_y, $code, $text); //-- //end add content to image //send browser headers header(Content-Type: image/jpeg); //send image to browser echo imagejpeg($image); //destroy image imageDestroy($image); ? Well, you may not have the BCmath enabled, and this script will break if bcmod isn't there, probably without you seeing an error message. A tip for debugging image scripts - comment out the line like header(Content-Type: image/jpeg); and run the script again; if there is an error it will be displayed (error settings permitting) whereas with the header in place, all you will get is the broken image icon, most likely. Cheers -- David Robley A life lived in fear is half a life lived. Today is Pungenday, the 27th day of Confusion in the YOLD 3172. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] sort multidimension array
On 22 June 2006 02:22, weetat wrote: Hi all, I have multi-arrays as shown below: I implemented usort() to sort the array by 'country' field in the array. However there some empty string value in the array and i setup my cmpcountry() function to sort array, however , some country empty string value are sort first . Any ideas what happen in the cmpcountry() function ? The result of sort array below is : Singapore Singapore Thailand '' Thailand '' '' Malaysia Phillipines function cmpcountry($a, $b) { $country1 = $a['country']; $country2 = $b['country']; if($country1 == ''){ if($country1 $country2){ return 1; } } if($country2 == '') { if($country1 $country2){ return 1; } } return ($country1 $country2) ? -1 : 1; } I can't see what your additional if statements give you that a straight comparison wouldn't. Under normal circumstances, '' will sort exactly where you want it, so this is an ideal case for a straight strcmp: function cmpcountry($a, $b) { return strcmp($a['country'], $b['country']); } If, however, what you're trying to do is send all blank entries to the end, you only need the tests for empty string: function cmpcountry($a, $b) { $country1 = $a['country']; $country2 = $b['country']; if($country1 == '') return 1; if($country2 == '') return -1; return strcmp($country1, $country2); } Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Headingley Campus, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] detect user click stop button in browser
Hi all, Can we detected if user have clicked the X button in browser or close browser ? I have tested in my php program ,when i click X in IE6 , the execution did not stop , it still running . Any ways to stop the program execution when user click the X button or close browser ? Thanks - weetat -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] detect user click stop button in browser
Check int connection_aborted ( ) in the PHP manual Andy weetat wrote: Hi all, Can we detected if user have clicked the X button in browser or close browser ? I have tested in my php program ,when i click X in IE6 , the execution did not stop , it still running . Any ways to stop the program execution when user click the X button or close browser ? Thanks - weetat -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] templating
Hi, A pal of mine needed some help on his project, he is using a header and footer file to template his project... but its gotten a bit complicated as he has a few dynamic parts in the header and footer files, so I told him to go with a proper templating method of templating the whole page rather than includ()ing the top and bottom. After having a better look at his scripts, I am just not sure if something big (like SMARTY for instance) would be good for him. He just needs maybe 5 template pages, same pages, different color. Searching google I see literally hundreds of templating solutions can anyone recommend a simple one or should I tell him to just use str_replace() for tags like: {{menu_here}} {{header_here} etc? Something like SMARTY would be like using a nuke to kill a fly (IMHO) esp since this project will not expand to anything much bigger or complicated. Thanks! Ryan -- - The faulty interface lies between the chair and the keyboard. - Creativity is great, but plagiarism is faster! - Smile, everyone loves a moron. :-) __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] templating
Ryan, I would still recommend Smarty. It can be as big as you like, but it can also be very simple to set up and maintain. It has the features should your friend decide to expand his usage in the future. If you opt now for something with limited features and later decide to step beyond them, you'll be faced with making another major change then. Just my 2p worth. George in Oxford -Original Message- From: Ryan A [mailto:[EMAIL PROTECTED] Sent: 22 June 2006 12:10 pm To: php php Subject: [PHP] templating Hi, A pal of mine needed some help on his project, he is using a header and footer file to template his project... but its gotten a bit complicated as he has a few dynamic parts in the header and footer files, so I told him to go with a proper templating method of templating the whole page rather than includ()ing the top and bottom. After having a better look at his scripts, I am just not sure if something big (like SMARTY for instance) would be good for him. He just needs maybe 5 template pages, same pages, different color. Searching google I see literally hundreds of templating solutions can anyone recommend a simple one or should I tell him to just use str_replace() for tags like: {{menu_here}} {{header_here} etc? Something like SMARTY would be like using a nuke to kill a fly (IMHO) esp since this project will not expand to anything much bigger or complicated. Thanks! Ryan -- - The faulty interface lies between the chair and the keyboard. - Creativity is great, but plagiarism is faster! - Smile, everyone loves a moron. :-) __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- 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] templating
Ryan A wrote: Hi, A pal of mine needed some help on his project, he is using a header and footer file to template his project... but its gotten a bit complicated as he has a few dynamic parts in the header and footer files, so I told him to go with a proper templating method of templating the whole page rather than includ()ing the top and bottom. This somewhat a religious issue for some, but my personal opinion is that PHP is often very good at being a simple template system. Just assign your variables beforehand, and display them with the ?= $var ? tag. (I do this with entire pages, split up into chunks for various parts of content.) I.e. template_head.php: ?php html head title?= $page_title ? ?php foreach ($css_files as $fn) { ? style type=text/css@import ?= $fn ?;/style ?php } /* end foreach ($js_files) */ ? /head body ? etc... Then your page would look like: ?php /* Assign some variables */ ... include('template_head.php'); /* A little workhorse code, assign some more variables */ ... include('template_content1.php'); /* Assign even more variables */ ... include('template_foot.php'); After having a better look at his scripts, I am just not sure if something big (like SMARTY for instance) would be good for him. He just needs maybe 5 template pages, same pages, different color. Smarty is also excellent. (I still prefer pure PHP though. :-) Searching google I see literally hundreds of templating solutions can anyone recommend a simple one or should I tell him to just use str_replace() for tags like: {{menu_here}} {{header_here} etc? Something like SMARTY would be like using a nuke to kill a fly (IMHO) esp since this project will not expand to anything much bigger or complicated. Why kill performance when you don't have to? jon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] templating
At 08:10 AM 6/22/2006, Ryan A wrote: Hi, A pal of mine needed some help on his project, he is using a header and footer file to template his project... but its gotten a bit complicated as he has a few dynamic parts in the header and footer files, so I told him to go with a proper templating method of templating the whole page rather than includ()ing the top and bottom. After having a better look at his scripts, I am just not sure if something big (like SMARTY for instance) would be good for him. He just needs maybe 5 template pages, same pages, different color. Searching google I see literally hundreds of templating solutions can anyone recommend a simple one or should I tell him to just use str_replace() for tags like: {{menu_here}} {{header_here} etc? Something like SMARTY would be like using a nuke to kill a fly (IMHO) esp since this project will not expand to anything much bigger or complicated. Thanks! Ryan Ryan, Don't forget, PHP itself is a templating language. Just do a standard page, with includes for headers and footers, menus, and content. If he wants to change colour, then load a different stylesheet for a given page or content section. This way he can use the tool that's right in front of him, he's not adding another layer, he does not have to learn another language - the template system written in PHP, and he hones his PHP skills. Whew! Hope this is helpful. Regards - Miles -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.1.394 / Virus Database: 268.9.2/372 - Release Date: 6/21/2006 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] templating
On 22/06/06, Miles Thompson [EMAIL PROTECTED] wrote: At 08:10 AM 6/22/2006, Ryan A wrote:Hi,A pal of mine needed some help on his project, he isusing a header and footer file to template hisproject... but its gotten a bit complicated as he has a few dynamic parts in the header and footer files, soI told him to go with a proper templating method oftemplating the whole page rather than includ()ing thetop and bottom.After having a better look at his scripts, I am just not sure if something big (like SMARTY for instance)would be good for him. He just needs maybe 5 templatepages, same pages, different color.Searching google I see literally hundreds of templating solutions can anyone recommend a simpleone or should I tell him to just use str_replace() fortags like: {{menu_here}} {{header_here} etc?Something like SMARTY would be like using a nuke to kill a fly (IMHO) esp since this project will notexpand to anything much bigger or complicated.Thanks!RyanI agree with Ryan - here is an example of a simple template I am using on a project at the moment. Stylesheets are used to control look and feel and the body tag is assigned a class so that different pages can use different layout elements. Hope this helps. -- http://www.web-buddha.co.uk http://www.projectkarma.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] templating
IMHO I would go with Smarty as it has excellent documentation and would fit almost anything that the project would require. I also think it would be a cleaner way of templating than using str_replace () over and over again. For what it's worth, I use Smarty on almost all of my projects, large and small. I find that once you learn it you can use it to develop new sites rather quickly. ...and it's not like using a nuke to kill a fly - Smarty only loads the files it needs as it needs them instead of loading everything - so it's quite fast really. - Joe On Jun 22, 2006, at 7:10 AM, Ryan A wrote: Hi, A pal of mine needed some help on his project, he is using a header and footer file to template his project... but its gotten a bit complicated as he has a few dynamic parts in the header and footer files, so I told him to go with a proper templating method of templating the whole page rather than includ()ing the top and bottom. After having a better look at his scripts, I am just not sure if something big (like SMARTY for instance) would be good for him. He just needs maybe 5 template pages, same pages, different color. Searching google I see literally hundreds of templating solutions can anyone recommend a simple one or should I tell him to just use str_replace() for tags like: {{menu_here}} {{header_here} etc? Something like SMARTY would be like using a nuke to kill a fly (IMHO) esp since this project will not expand to anything much bigger or complicated. Thanks! Ryan -- - The faulty interface lies between the chair and the keyboard. - Creativity is great, but plagiarism is faster! - Smile, everyone loves a moron. :-) __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Need help with PEAR Quickform
Good day I am busy working on a form using QuickForm. I would like to make use of a confirmation page where the user must eitheir select to change the details or continue. Does anyone know how to achieve this? Regards Robert -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] templating
Miles Thompson wrote: Don't forget, PHP itself is a templating language. Just do a standard page, with includes for headers and footers, menus, and content. If he wants to change colour, then load a different stylesheet for a given page or content section. This way he can use the tool that's right in front of him, he's not adding another layer, he does not have to learn another language - the template system written in PHP, and he hones his PHP skills. I agree. I think this would be the best solution for a simple site. Good point about honing PHP skillz. As far as a CMS goes, textpattern is pretty dope. Simple to setup, free, and it has a kick-butt template system. Gl, Cheers, Micky -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Need help with PEAR Quickform
I am busy working on a form using QuickForm. I would like to make use of a confirmation page where the user must eitheir select to change the details or continue. Does anyone know how to achieve this? On POST, you could redisplay the form in a Frozen state. If the form is frozen, you display a separate set of submit buttons and in checking to see if those new buttons were clicked do you actually process the form normally (access data store, etc). This is just one of the many ways you can go about achieving the same results. thnx, Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Equivelant to mysql_fetch_row for normal array
PHP List, Very frequently I use mysql_fetch_row in a while statement to while($variable = mysql_fetch_row($mysqlResult)){ echo $variable[text1]; echo $variable[text2]; } Pretty standard. But what do I do when I want to do the same kind of while loop not with a MySQL result, but with just a regular array? while (variable = ($array)){ echo $variable[text1]; echo $variable[text2]; } I've been up and down the manual, and looked at foreach statements and functions like each(), but I can't seem to zero in on what I need. Can anyone let me know what it is I'm missing? Thank you for any advice. -- Dave M G -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Equivelant to mysql_fetch_row for normal array
Dave M G a écrit : PHP List, Pretty standard. But what do I do when I want to do the same kind of while loop not with a MySQL result, but with just a regular array? while (variable = ($array)){ echo $variable[text1]; echo $variable[text2]; } did you try something like this ? foreach ($array as $variable) { echo $variable; } or for associative array foreach ($array as $key = $value) { echo $key. .$value; } I've been up and down the manual, and looked at foreach statements and functions like each(), but I can't seem to zero in on what I need. Can anyone let me know what it is I'm missing? Thank you for any advice. hope this'll help N F -- Dave M G -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Equivelant to mysql_fetch_row for normal array
Dave M G wrote: PHP List, Very frequently I use mysql_fetch_row in a while statement to while($variable = mysql_fetch_row($mysqlResult)){ echo $variable[text1]; echo $variable[text2]; } Pretty standard. But what do I do when I want to do the same kind of while loop not with a MySQL result, but with just a regular array? while (variable = ($array)){ echo $variable[text1]; echo $variable[text2]; } I've been up and down the manual, and looked at foreach statements and functions like each(), but I can't seem to zero in on what I need. Can anyone let me know what it is I'm missing? Thank you for any advice. -- Dave M G If we translate a mysql resultset to an array notation, you would have: restultset[1][text1] = a; restultset[1][text2] = b; restultset[2][text1] = c; restultset[2][text2] = d; restultset[3][text1] = e; restultset[3][text2] = f; Thus, going trough it with a foreacht: foreach(resultset as $key=$val) { echo $val[text1]; } will give you the same result as the original loop construct you did with while() (assuming an array resultset for purposes of demonstration). foreach($mysqlResultSet as $variable) { echo $variable[text1]; echo $variable[text2]; } is what you're probably after though. Might I suggest reading the manual about foreach (and especially array) construct again please? very carefuly preferably, as it seems you're missing quite a lot of insight there :) - tul -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Equivelant to mysql_fetch_row for normal array
the foreach loop is probably better (it doesn't require reset()ing the array pointer for instance) but you should also look at the example on this page (using the current() function in a while loop): http://php.net/key Dave M G wrote: PHP List, Very frequently I use mysql_fetch_row in a while statement to while($variable = mysql_fetch_row($mysqlResult)){ echo $variable[text1]; echo $variable[text2]; } Pretty standard. But what do I do when I want to do the same kind of while loop not with a MySQL result, but with just a regular array? while (variable = ($array)){ echo $variable[text1]; echo $variable[text2]; } I've been up and down the manual, and looked at foreach statements and functions like each(), but I can't seem to zero in on what I need. Can anyone let me know what it is I'm missing? Thank you for any advice. -- Dave M G -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Equivelant to mysql_fetch_row for normal array
Dave M G wrote: PHP List, Very frequently I use mysql_fetch_row in a while statement to while($variable = mysql_fetch_row($mysqlResult)){ echo $variable[text1]; echo $variable[text2]; another thing. $variable[text2] is bad because you very likely don't have a constant in your code named 'text2' - you should be using string keys (if you had error_reporting set to include E_NOTICE errors you would see notices output regarding non-existent constants... do this instead: echo $variable['text1']; echo $variable['text2']; } Pretty standard. But what do I do when I want to do the same kind of while loop not with a MySQL result, but with just a regular array? while (variable = ($array)){ echo $variable[text1]; echo $variable[text2]; } I've been up and down the manual, and looked at foreach statements and functions like each(), but I can't seem to zero in on what I need. Can anyone let me know what it is I'm missing? Thank you for any advice. -- Dave M G -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Equivelant to mysql_fetch_row for normal array
Jochem, Tul, Nicolas, Thank you for your help. I must be doing something wrong with how my array is generated. It's actually just a MySQL result, but because it is returned from a function, it does not seem to behave as I would expect a MySQL result should. I'm trying the foreach function and key values, but I'm clearly not quite getting it right. Perhaps there is something about my code which is wrong. So I'm presenting what I hope is all the relevant parts: public function getData($row, $type, $column, $match) { $query = SELECT . $row . FROM . $type . WHERE .$column . = . $match; echo query = . $query . br /; $result = mysql_query($query); $data = mysql_fetch_array($result); return $data; } foreach($elements as $key = $val){ echo val[type] = . $val[type] . br /; echo val[resource] = . $val[resource] . br /; } What I'm getting back doesn't make sense. I can't go all the way into my code, but $val[type] should be a string value containing the words Article or Text. But instead, I get: val[type] = 2 val[resource] = 2 Am I still not doing the foreach correctly? -- Dave M G -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] rss feeds from db
I'm having some problems where some undefined entity are getting in, these entities are usually html entities. sad thing isquot;brvbar;bringing in these large chains is putting the xml doc points to the in ;brvbar as the problem. what do I need to do to get this stuff cleaned up? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Oracle Commits
Good afternoon and salutations denizens of the greatest list generated by electrons! I have a situation where I am trying to commit a transaction in Oracle with PHP as follows; $udGeocode = oci_parse($conn, UPDATE CONT_ADDRESS SET GEOCODE = '.$geocode[0].' WHERE CONTRACT_ID = '.$row[0].' AND POSTAL_CODE = '.$ROW[1].' AND ADDRESS_TYPE = 'S'); oci_execute($udGeocode, OCI_DEFAULT); // commit $committed = oci_commit($conn); if (!$committed) { $error = oci_error($conn); echo 'Commit failed. Oracle reports: ' . $error['message']; } else { echo 'nbsp;Commit succeeded'; } The commit returns as successful, but it is not successful in the database itself. Am I missing something here? I have RTFM on oci_execute and oci_commit and cannot find anything. Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Equivelant to mysql_fetch_row for normal array
Dave M G wrote: Jochem, Tul, Nicolas, Thank you for your help. I must be doing something wrong with how my array is generated. It's actually just a MySQL result, but because it is returned from a function, it does not seem to behave as I would expect a MySQL result should. I'm trying the foreach function and key values, but I'm clearly not quite getting it right. Perhaps there is something about my code which is wrong. So I'm presenting what I hope is all the relevant parts: public function getData($row, $type, $column, $match) { $query = SELECT . $row . FROM . $type . WHERE .$column . = . $match; echo query = . $query . br /; $result = mysql_query($query); $data = mysql_fetch_array($result); return $data; } foreach($elements as $key = $val){ echo val[type] = . $val[type] . br /; echo val[resource] = . $val[resource] . br /; } What I'm getting back doesn't make sense. I can't go all the way into my code, but $val[type] should be a string value containing the words Article or Text. But instead, I get: val[type] = 2 val[resource] = 2 Am I still not doing the foreach correctly? -- Dave M G First of all, you're using invalid syntax. You should have $val['type'] rather than $val[type]. Second of all, mysql_fetch_array returns only a single row, $elements. This is an array. From there, you're asking foreach to return each element of the array as $val. So each time through the foreach loop, $val will have the contents of that element. The element isn't an array, it's a scalar. So you're taking a scalar and trying to treat it like an array. You really should read the manual, the pages for all these functions describe EXACTLY what they do. Remember that mysql_fetch_array returns an associative array. You can refer to the SQL fields by their names. So if your select query was SELECT foo, bar FROM mytable, after doing a mysql_fetch_array you could do this: echo $row['foo'] . br /; echo $row['bar'] . br /; Regards, Adam. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: rss feeds from db
Dan McCullough wrote: I'm having some problems where some undefined entity are getting in, these entities are usually html entities. sad thing isquot;brvbar;bringing in these large chains is putting the xml doc points to the in ;brvbar as the problem. what do I need to do to get this stuff cleaned up? Not quite. That first ; is part of the previous entity, quot;. You want to do a search/replace for brvbar; And brvbar; is a perfectly valid entity. It represents a pipe character (¦), so it is NOT an undefined entity. If you really don't want it there, do a search-replace for brvbar; and either replace it with an alternative character (perhaps a ¦ directly), or an empty string to remove it entirely. Regards, Adam. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] helping people...
fiberuplink.com - unavailable.. looks like rob's ddos attack worked on his own server, must be his testing before turning in his paper... Wolf Adam Zey wrote: Rob W. wrote: No that wasnt a ddos threat you idiot, i dont play them games. And when you keep sending spam is when it starts to piss people off. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Oracle Commits
Jay Blanchard wrote: Good afternoon and salutations denizens of the greatest list generated by electrons! I have a situation where I am trying to commit a transaction in Oracle with PHP as follows; $udGeocode = oci_parse($conn, UPDATE CONT_ADDRESS SET GEOCODE = '.$geocode[0].' WHERE CONTRACT_ID = '.$row[0].' AND POSTAL_CODE = '.$ROW[1].' AND ADDRESS_TYPE = 'S'); oci_execute($udGeocode, OCI_DEFAULT); did the execute actually succeed? does the data get into the DB if you use OCI_COMMIT_ON_SUCCESS instead of OCI_DEFAULT? I don't support using oci_internal_debug() gives you any extra info? // commit $committed = oci_commit($conn); if (!$committed) { $error = oci_error($conn); echo 'Commit failed. Oracle reports: ' . $error['message']; } else { echo 'nbsp;Commit succeeded'; } The commit returns as successful, but it is not successful in the database itself. Am I missing something here? I have RTFM on oci_execute and oci_commit and cannot find anything. Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] templating
On Thu, June 22, 2006 6:10 am, Ryan A wrote: He just needs maybe 5 template pages, same pages, different color. For something THIS simple, I truly believe you are Better Off (tm) with a simple head() and foot() function in a globals.inc file: function head($title = My Site, $bgcolor = '#ff'){ ? !DOCTYPE ... html head title?php echo $title?/title /head body bgcolor=?php echo $bgcolor? ?php } function foot(){ ? /body /html ?php } ? Your header and footer are now in one template-like file which makes it easy to match up tags. And the 5 pages will look like: ?php require 'globals.inc'; head('Page One', '#fcfcfc'); ? pPage One specific content here/p ?php foot(); ? The reason I prefer this to header/footer includes, is that it's too easy to mess up closing tags in footer/header out of sync with separate files, but with one file, they're right there and a decent HTML editor will pick them out for you. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] detect user click stop button in browser
On Thu, June 22, 2006 4:16 am, weetat wrote: Can we detected if user have clicked the X button in browser or close browser ? I have tested in my php program ,when i click X in IE6 , the execution did not stop , it still running . Any ways to stop the program execution when user click the X button or close browser ? There is no RELIABLE way to do that. An javascript thingie for onStop if it exists might help. PHP's ignore_user_abort being on/off can sometimes pass back their stop action, or not... I suspect that the return value from feof('php://stdout') *MIGHT* maybe change to FALSE when Apache recognizes that the browser is gone... But 100% reliable way probably does not exist, afaik. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Stream download problem
On Tue, June 20, 2006 7:32 pm, Michael Satterwhite wrote: I have a site that generates a file to be streamed down. The relevant code is: -- header(Content-type: application/vnd.ms-excel); header(Content-disposition: attachment; filename=$EXPORT_TIME.txt); header(Content-disposition: attachment); This is too funny... Sorry. We just had a big long flame-fest about this last week. And today in IRC somebody else is going through your same grief. Rather than repeat myself, I decided to just blog my answer: http://richardlynch.blogspot.com/ Let the flame-fest (on blogspot, please) begin! -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Processing HTML in mail form
On Tue, June 20, 2006 4:56 pm, Jonas Rosling wrote: I've done the following code bellow for an e-mail form. But it handles the HTML tags as text. Is there anyway to get the HTML tags processed to form the mail? ?php @extract($_POST); Errr. You might as well just turn register_globals on, because there is NO significant difference between the above one line of code and having register_globals ON. So if you already know register_globals ON is bad and you think you've made your script good turning it OFF and doing this instead, then you don't really understand what is going on, either with register_globals, or with extract, or both. $subject = 'Intresseanmalan'; $forname = stripslashes($forname); This rigth here tells me that you magic_quotes_gpc on, and you could easily turn that OFF in .htaccess (probably) for this script at least, and save yourself a lot of grief as well... $lastname = stripslashes($lastname); $text = 'F-name: '.$forname.'br'. If you want plain old regular text email, just make 'br' be \n If you want HTML-enhanced (cough, cough) email, do not attempt to re-invent the wheel, but use something from http://phpclasses.org for that instead, or PEAR or PECL or whatever. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] shutting down a web app for maintenance
On 6/20/06, Jon Anderson [EMAIL PROTECTED] wrote: Assuming you're using a web server that supports htaccess files, you could easily just pop in a .htaccess file that denies access to everything. You could even add a PHP ini directive like: php_value auto_prepend_file maintenance.php where maintenance.php could contain something like: htmlheadtitleDown for Maintenance/title/headbodySite down for maintenance!/body/html ?php exit(0); ? if this is the case, why don't you put clean session sentences in your maintenance.php. With those sentences you are sure that anybody that wants to access your application will be kicked off. -- Saludos Oscar -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Oracle Commits SOLVED
[snip] did the execute actually succeed? does the data get into the DB if you use OCI_COMMIT_ON_SUCCESS instead of OCI_DEFAULT? I don't support using oci_internal_debug() gives you any extra info? [/snip] I finally did an oci_bind_by_name and then performed the commit. It worked. Oci_internal_debug gave me nada at that point. The reason for using OCI_DEFAULT was so that I could perform a kind of bulk update and check before committing. oci_commit_on_success would have committed each time the update was performed and it seems that would have cost more overhead. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] templating
At 6:26 PM -0500 6/22/06, Richard Lynch wrote: On Thu, June 22, 2006 6:10 am, Ryan A wrote: He just needs maybe 5 template pages, same pages, different color. For something THIS simple, I truly believe you are Better Off (tm) with a simple head() and foot() function in a globals.inc file: function head($title = My Site, $bgcolor = '#ff'){ ? !DOCTYPE ... html head title?php echo $title?/title /head body bgcolor=?php echo $bgcolor? ?php } function foot(){ ? /body /html ?php } ? Your header and footer are now in one template-like file which makes it easy to match up tags. -snip- The reason I prefer this to header/footer includes, is that it's too easy to mess up closing tags in footer/header out of sync with separate files, but with one file, they're right there and a decent HTML editor will pick them out for you. Well... I prefer to separate the header and footer into two files and load them as needed in my web page. In addition, I would most certainly remove ALL attribute stuff that could/should be controlled by css out of html and php and into a css file. I usually start my pages off with: ?php include('includes/header.inc'); ? and end them with: ?php include('includes/footer.inc'); ? Inside the header, I have the DOCTYPE, html, head (with all the header stuff including css) and body tags. The footer has my closing Last Modified, Copyright, and the ending /body and /html tags. In between the two body/body tags it's pretty simple to manage the html and keep track of div's. I never have a header or footer that goes beyond the body tags -- so even if there is NO html in between, I still have a valid page. I also use other includes, like for navigation. However, every include file is complete from its start tag to its finish tag so I never get my tags out of sync. It's just a matter of good housekeeping. If I want to control the color of something, then I do it in css. If I have to do it via php, then I wrap css in php and do it there. But, I always try to keep presentation out of my code. Besides, I find it's much easier for me that way because I can do anything to my code and the presentation stays the same -- likewise, I can do anything I want to my css, and my code remains unaffected. It works for me. 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] shutting down a web app for maintenance
On Tue, June 20, 2006 12:53 pm, Ben Liu wrote: I'm not sure this is strictly a PHP related question or perhaps a server admin question as well. What do you do when you are trying to shutdown a web application for maintenance (like a membership or registration-required system)? I understand that you can temporarily upload or activate a holding page that prevents users from continuing to login/use the system, but how can you insure that there are no ongoing sessions or users still in the process of doing something? What's the best method for handling this, especially if you don't have full control of the server hosting the web app? It's too late for this go-around, but... If it's something you really want to do right and it's mission-critical and you have a ton of time... You *could* tag every user/record/session with a version number, and then you *could* check what version they are currently on and then do the right thing for them in that version. Obviously, this could get very complicated, very very very fast... Or, perhaps not. Perhaps you'd have a special dir set up for each old version, and if they submitted a page under the old version in their session, you'd just include stuff from that old version directory, by munging include_path() to use old code and not new code. Then, when they logout, and get a new session later, poof they are now in the new version. This is obviously not a TRIVIAL solution, but it's at least feasible if this problem truly must be solved rather than ignored. :-) Crude, but effective Captain -- Spock _Bearskins and Knives_ -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem displaying a mysql database field
On Tue, June 20, 2006 4:02 pm, Don wrote: I have a varchar field in a MySQL database that contains a line of text like so: This is a line if text The double quotes are included in the database field. I cannot seem to display it on my HTML page, it always shows as blank. I have tried using both the stripslashes() and the html_entity_decode() but it still shows as blank. How can I display this please??? There is nothing you've said so far that would exhibit the symptoms you describe... Now, if the field also had in it, so the browser was showing it as an HTML tag, then you'd see nothing... The best guess so far has been to use htmlentities, but, indeed, that cannot be the whole answer if what you have posted is correct... -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] User Login Problem
On Tue, June 20, 2006 6:43 am, suresh kumar wrote: I am facing one problem in my project.i want to restrict more than one user login in the same account .Is there any functions available to check r we can implement using session. You'll have to decide for yourself when a user is or isn't logged in or out for this purpose. it may match up exactly with the state of the $_SESSION or maybe you'll have an even shorter time allowance on changing of IP, User-Agent or so on. Personally, though, I hate sites that do that, as if their site is broken and I have to switch browsers to avoid a browser-dependency issue, then I'm screwed. :-( Think long and hard about this one... -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Still trying to figure this out...
On Tue, June 20, 2006 1:37 am, Rob W. wrote: I still have not yet found anybody to help me with this. All the code that people have given me has not worked at all. I still get no output. So to add a little more to this, I'm gonna define how the database looks. -- |switchid|switchport | -- |1 | 1 | |1 | 2 | |1 | 3 | |1 | 4 | |1 | 7 | |1 | 10| -- ect so on and so forth. There are other switch id's in there as well along with their switch port's which sorting the other switchid's is not a problem. I also know the maximum amount for each switchid so that's not a problem as well. I need to be able to display the missing numbers in there. I have no extra spaces in there for blank numbers. After a server has been entered in to the database, it take's that number that was not shown previously in the database and enters it in, there for displaying it and not making it available for the next time another server is added. I have no way to alter the database as I am trying to clone a program and this is the only thing haning me up as of right now. If I can find someone to solve this problem for me, I will be glad to send money via paypal for helping out solving this problem as I have been on it for 2 days now and this is the last bit of code for this program that is holding me up. Please read below for more information on what I am doing. Here's the first problem I am seeing... Between the time that you search for an open port and you then assign it to something, ANOTHER script might run, get the same open port, and then assign it to something. That's pretty much your basic race condition right there. If you've got that all solved, then I would go for a crude solution, personally. ?php $query = 'select switchport from switches where switchid = 1 order by switchport'; $used = mysql_query($query) or die(mysql_error()); $last_used = 0; while (list($port) = mysql_fetch_row($used)){ for ($p = $last_used + 1; $p $port; $p++){ echo $p is openbr /\n; } $last_used = $port; } ? But I'm a crude kind of guy, so there you go. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Still trying to figure this out...
Damn. Tack on this at the end: $max_port = 2048; for ($p = $last_port + 1; $p $max_port; $p++) echo $p is openbr /\n; On Tue, June 20, 2006 1:37 am, Rob W. wrote: I still have not yet found anybody to help me with this. All the code that people have given me has not worked at all. I still get no output. So to add a little more to this, I'm gonna define how the database looks. -- |switchid|switchport | -- |1 | 1 | |1 | 2 | |1 | 3 | |1 | 4 | |1 | 7 | |1 | 10| -- ect so on and so forth. There are other switch id's in there as well along with their switch port's which sorting the other switchid's is not a problem. I also know the maximum amount for each switchid so that's not a problem as well. I need to be able to display the missing numbers in there. I have no extra spaces in there for blank numbers. After a server has been entered in to the database, it take's that number that was not shown previously in the database and enters it in, there for displaying it and not making it available for the next time another server is added. I have no way to alter the database as I am trying to clone a program and this is the only thing haning me up as of right now. If I can find someone to solve this problem for me, I will be glad to send money via paypal for helping out solving this problem as I have been on it for 2 days now and this is the last bit of code for this program that is holding me up. Please read below for more information on what I am doing. - Original Message - From: Rob W. [EMAIL PROTECTED] To: php-general@lists.php.net Sent: Monday, June 19, 2006 3:39 PM Subject: [PHP] Still trying to figure this out... Ok, I am still trying to get this figured out from what I tried doing last night. If anybody wants to try it, please be my guest. This is the deal. Create an INTEGER table. Put the numbers 1 - 24 in it. Leave out like number 8, 9, 22, 23 ect.. Now create a php statement that will take and pull that out of the database, find out the missing numbers and display them as an html drop down selection. And tedd in response to why, is because the values that are already located in the database represent in use already. They represent a server port that a server is sitting on, so that's not the problem. I could have done that along time ago. Any help is appreciated but here is the current code that I have. $query=SELECT switchport FROM network; $result=mysql_query($query); $sql_range=mysql_fetch_array($result); $true_range=range(1,24); $next_range=array_diff($true_range,$sql_range); foreach ($next_range as $final_range) { echo option value='$final_range'$final_range\n; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] CDATA tag
Hi all, I need to parse and write data to xml file , There some value as shown below: InstanceName![CDATA[�ù?¸€ü÷Œ�ú�ù?à�ù?Ø€�Z4À„�Ï]]/InstanceName I need to write the data to be valid value. I am using PEAR:XMLSerializer to read the xml file, however , the PEAR XMLSerializer always prompt me the error message below: No unserialized data available. Use XML_Unserializer::unserialize() first. It cause by the CDATA above. I have attached for your reference. Thanks - weetat ?xml version=1.0 encoding='ISO-8859-1'? InvDetails SchemaInfo RMEServerRMEhostname/RMEServer CreatedAtTue Mar 28 14:37:43 CST 2006/CreatedAt SchemaVersion1.0/SchemaVersion /SchemaInfo RMEPlatform Cisco_Chassis InstanceID1/InstanceID ModelWS-C6506/Model SerialNumberTBA04490054/SerialNumber ChassisSystemTypewsc6506/ChassisSystemType NumberOfSlots6/NumberOfSlots Cisco_Backplane BackplaneTypegiga16/BackplaneType /Cisco_Backplane Cisco_Card InstanceID1/InstanceID ModelWS-X6K-SUP1A-2GE/Model SerialNumberSAD04520AZD/SerialNumber LocationWithinContainer1/LocationWithinContainer CardTypewsx6ksup1a2ge/CardType HardwareVersion7.1/HardwareVersion OperationalStatusok/OperationalStatus SoftwareIdentity ClassificationFirmware/Classification VersionString5.3(1)/VersionString /SoftwareIdentity SoftwareIdentity ClassificationSoftware/Classification VersionString7.6(10)/VersionString /SoftwareIdentity AdditionalInformation AD name=RedundantModule value=active/AD AD name=ModuleSubType value=wsf6kpfc/AD AD name=ModuleSubType2 value=empty/AD /AdditionalInformation /Cisco_Card Cisco_Card InstanceID2/InstanceID ModelWS-X6348-RJ-45/Model SerialNumberSAL04430RE9/SerialNumber LocationWithinContainer2/LocationWithinContainer CardTypewsx6348rj45/CardType HardwareVersion1.4/HardwareVersion OperationalStatusok/OperationalStatus SoftwareIdentity ClassificationFirmware/Classification VersionString5.4(2)/VersionString /SoftwareIdentity SoftwareIdentity ClassificationSoftware/Classification VersionString7.6(10)/VersionString /SoftwareIdentity AdditionalInformation AD name=RedundantModule value=other/AD AD name=ModuleSubType value=empty /AD AD name=ModuleSubType2 value=empty/AD /AdditionalInformation /Cisco_Card Cisco_Card InstanceID3/InstanceID ModelWS-X6348-RJ-45/Model SerialNumberSAL04430M00/SerialNumber LocationWithinContainer3/LocationWithinContainer CardTypewsx6348rj45/CardType HardwareVersion1.4/HardwareVersion OperationalStatusok/OperationalStatus SoftwareIdentity ClassificationFirmware/Classification VersionString5.4(2)/VersionString /SoftwareIdentity SoftwareIdentity ClassificationSoftware/Classification VersionString7.6(10)/VersionString /SoftwareIdentity AdditionalInformation AD name=RedundantModule value=other/AD AD name=ModuleSubType value=empty /AD AD name=ModuleSubType2 value=empty/AD /AdditionalInformation /Cisco_Card AdditionalInformation AD name=PowerSupply1 value=wscac1300/AD AD name=PowerSupply2 value=wscac1300/AD AD name=MgmtType value=snmpV3V2cV1/AD AD name=BroadcastAddress value=99.99.99.99/AD AD name=AvailableSlots value=3/AD /AdditionalInformation /Cisco_Chassis Cisco_NetworkElement InstanceID1/InstanceID DescriptionCisco Systems WS-C6506 Cisco Catalyst Operating System Software, Version 7.6(10) Copyright (c) 1995-2004 by Cisco Systems /Description PrimaryOwnerNameNetwork Services Asia Pacific Head Office/PrimaryOwnerName InstanceName![CDATA[�ù?¸€ü÷Œ�ú�ù?à�ù?Ø€�Z4À„�Ï]]/InstanceName PhysicalPosition/Thailand/BANGKOK/208 Wireless Rd//PhysicalPosition SysObjectId99.99.99.99.99.99.99.99.45 /SysObjectId OfficialHostNamehostname1/OfficialHostName Cisco_LogicalModule InstanceID1/InstanceID NumberOfPorts2/NumberOfPorts Cisco_Port PortNumber1/PortNumber IfInstanceID106/IfInstanceID /Cisco_Port Cisco_Port PortNumber2/PortNumber IfInstanceID107/IfInstanceID /Cisco_Port AdditionalInformation AD name=ModuleIPAddress value=99.99.99.99/AD /AdditionalInformation /Cisco_LogicalModule Cisco_LogicalModule InstanceID3/InstanceID NumberOfPorts48/NumberOfPorts Cisco_Port PortNumber1/PortNumber IfInstanceID58/IfInstanceID /Cisco_Port Cisco_Port PortNumber2/PortNumber IfInstanceID59/IfInstanceID /Cisco_Port Cisco_Port PortNumber3/PortNumber IfInstanceID60/IfInstanceID /Cisco_Port Cisco_Port PortNumber4/PortNumber IfInstanceID61/IfInstanceID /Cisco_Port Cisco_Port PortNumber5/PortNumber IfInstanceID62/IfInstanceID /Cisco_Port Cisco_Port PortNumber6/PortNumber IfInstanceID63/IfInstanceID /Cisco_Port Cisco_Port PortNumber7/PortNumber IfInstanceID64/IfInstanceID /Cisco_Port Cisco_Port PortNumber8/PortNumber IfInstanceID65/IfInstanceID /Cisco_Port Cisco_Port PortNumber9/PortNumber IfInstanceID66/IfInstanceID /Cisco_Port Cisco_Port PortNumber10/PortNumber IfInstanceID67/IfInstanceID /Cisco_Port Cisco_Port PortNumber11/PortNumber IfInstanceID68/IfInstanceID /Cisco_Port Cisco_Port PortNumber12/PortNumber IfInstanceID69/IfInstanceID /Cisco_Port Cisco_Port PortNumber13/PortNumber
Re: [PHP] GET, POST, REQUEST
On Tue, June 20, 2006 2:38 am, Satyam wrote: I come from languages where you not only have to initialize a variable but have to declare it as well so initializing comes natural, I feel wrong if I don't do it, even if the interpreter does not care. Just to be pedantic... The interpreter actually DOES care, but you have to be wise enough to enable E_NOTICE messages for the interpreter to tell you that it does care. You may want to get in the habit of using .htaccess to do that, as you will be more comfy with PHP helping you catch any typos in failing to initialize vars. :-) -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] detect user click stop button in browser
Hi Andrei, I have tried the connection_aborted() in my code , however it not working at all , below is my code: If i close the browser window(IE) , the script still running and call the difference() function as shown below: Any ideas what is happening ? Thanks ignore_user_abort(true); $options = array(complexType = object); $xml_util = new XMLUtil($filepath, $options); $xml_util-unserializer_XML(false); $xml_error = $xml_util-getXMLError(); $_logger-logdebug(xml error listflag.php, $xml_error); if (!$xml_error) { $data = $xml_util-getUnserializedData(); } else { $errorMessage = 'XML file is not well-formed. Please amend XML file before upload.'; echo $errorMessage; } if (!connection_aborted()) { $diffresult = difference($data); call function even close browser window $_SESSION['diffresult'] = $diffresult; header('Location: ../difference.php'); exit; } else { $_logger-logdebug(program aborted); header('Location: ../difference.php'); exit; } Andrei wrote: Check int connection_aborted ( ) in the PHP manual Andy weetat wrote: Hi all, Can we detected if user have clicked the X button in browser or close browser ? I have tested in my php program ,when i click X in IE6 , the execution did not stop , it still running . Any ways to stop the program execution when user click the X button or close browser ? Thanks - weetat -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] templating
On Thu, June 22, 2006 7:23 pm, tedd wrote: At 6:26 PM -0500 6/22/06, Richard Lynch wrote: On Thu, June 22, 2006 6:10 am, Ryan A wrote: He just needs maybe 5 template pages, same pages, different color. For something THIS simple, I truly believe you are Better Off (tm) with a simple head() and foot() function in a globals.inc file: function head($title = My Site, $bgcolor = '#ff'){ ? !DOCTYPE ... html head title?php echo $title?/title /head body bgcolor=?php echo $bgcolor? ?php } function foot(){ ? /body /html ?php } ? -snip- Well... I prefer to separate the header and footer into two files and load them as needed in my web page. In addition, I would most certainly remove ALL attribute stuff that could/should be controlled by css out of html and php and into a css file. Putting the stuff into CSS is fine with what I did -- I do that all the time. In between the two body/body tags it's pretty simple to manage the html and keep track of div's. I never have a header or footer that goes beyond the body tags -- so even if there is NO html in between, I still have a valid page. The header and footer frequently contain the logo, site nav, possibly a site-wide context-sensitive nav, maybe a mailing list signup, and then copyright and so on. There's no need to be doing a bunch of include files to hit the HD (expensive) separately for each. It's also all too easy to forget one of the include files on one of the pages and never even notice it... I've done it too many times when I went back to add some fluff page to some ancient site. :-( A reasonable amount of the all the same stuff in head() handles all that, and the footer, in one HD seek, with matching tags between head() and foot() in a single file. It's also very easy to call foot() in an error condition to be sure all tags balance. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] detect user click stop button in browser
On Thu, June 22, 2006 9:48 pm, weetat wrote: I have tried the connection_aborted() in my code , however it not working at all , below is my code: If i close the browser window(IE) , the script still running and call the difference() function as shown below: Any ideas what is happening ? Thanks ignore_user_abort(true); Doesn't this tell PHP: Keep going even if the window is closed. I think you want FALSE here... But I never did get this to work reliably back in PHP3 days... -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] GD problems
On Wed, June 21, 2006 1:06 pm, Beauford wrote: This is the output from ?php var_dump(gd_info()); ?. As far as I can tell, jpeg support is enabled. It also says it is if I run phpinfo(). Yet is still doesn't work. Anyone know of a way I can test this further. A small script perhaps. ?php $image = imagecreatetruecolor(50, 50); imagefilledrectangle($image, 0, 0, 50, 50, 0xff); imagejpeg($image); ? -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php