Re: [PHP] Query regarding temporarily-uploaded files
Is there anything that would prevent you from somehow uniquely knowing who the user is uploading the file. For example you mentioned client'. If you know who the client is you can append that to the filename or prepend it, for the destination string (second parameter to the function call). That way it is unique to that client. -Anthony On Wed, Jul 10, 2013 at 2:15 PM, Ajay Garg ajaygargn...@gmail.com wrote: Thanks Jim and Matijn for the quick replies. I will try to have a workaround. On Wed, Jul 10, 2013 at 11:09 PM, Matijn Woudt tijn...@gmail.com wrote: On Wed, Jul 10, 2013 at 7:21 PM, Ajay Garg ajaygargn...@gmail.com wrote: Hi all. I have a requirement, wherein I need to allow vanilla uploads of files to a HTTPD server. Any client can upload any number of files (one at a time). Also, there is just one directory, where the files get stored finally (that is, after being copied from the temporary location, via move_uploaded_file) Also, I have been able to get the simple file uploading running via PHP, by picking up one of the numerous Hello World examples available :) Now, I am facing the following use-case :: 1) User 1 starts uploading a large file, say big_file.avi. 2) Meanwhile, user 2 also starts uploading a (different) file, but with the same name big_file.avi. In an ideal scenario, user 2 should be prompted with a message, that a file of the same name is already being uploaded by someone else somewhere. Is there a way to do this? ( Note that, had the user 2 started uploading AFTER user 1 had finished with the upload, we could probably modify the PHP-script at the sever-side, to let user-2 know that a file of the same name already exits. But I am failing to find a solution, when the user 2 starts the upload WHILE the large file of user 1 is in the process of completing uploading). Any way the issue may be solved? I will be grateful for any pointers :) Regards, Ajay Hi, This is not possible with PHP, PHP will not know about the file until the upload is completed. You can use HTML5 or flash(not recommended) for an alternative way of uploading, and then you can check the file name in advance. - Matijn -- Regards, Ajay -- Anthony W. ant92...@gmail.com
[PHP] SimpleXML - parsing attributes with a namespace
Hi, Using following code does not parse the xml:id attribute. If I change the attribute's namespace to anything other than xml ( e.g. new:id ) then it works. $string = XML TEI xml:id=decten1tlsg01 teiHeader profileDesc particDesc person xml:id=interviewerTlsg01 /person /particDesc /profileDesc /teiHeader /TEI XML; $xml = simplexml_load_string($string); foreach($xml-teiHeader-profileDesc-particDesc-person[0]-attributes() as $a = $b) { echo p$a = $b \n/p; } Is this a bug? And how do I get this to work? Many thanks, Anthony -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] SimpleXML - parsing attributes with a namespace
Hi, Using following code does not parse the xml:id attribute. If I change the attribute's namespace to anything other than xml ( e.g. new:id ) then it works. $string = XML TEI xml:id=decten1tlsg01 teiHeader profileDesc particDesc person xml:id=interviewerTlsg01 /person /particDesc /profileDesc /teiHeader /TEI XML; $xml = simplexml_load_string($string); foreach($xml-teiHeader-profileDesc-particDesc-person[0]-attributes() as $a = $b) { echo p$a = $b \n/p; } Is this a bug? And how do I get this to work? Many thanks, Anthony -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Question about using JSON_ENCODE()
I'm developing a basic webservice to compliment a mobile application I'm developing or iPhone. While I know how to encode simple variables and arrays, I'm not sure how to do what I'm needing to do. Basically, I want to encode a status message to return to the mobile client. Something like status good_request Right now, I'm thinking I should put this in an array and encode/return that. But is that the right way of thinking? Is there a more correct or better way to do this? Thanks! Anthony -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question about using JSON_ENCODE()
Thank you Ruan! This is just what I was looking for! Anthony Ryan Sun ryansu...@gmail.com wrote in message news:f7f19ac21001081308r4b202d45vedaf3561536ad...@mail.gmail.com... Yup, you put result in an array $result = array('status' = 'good'); and return encoded string return Json_Encode($result); your client will get a string '{status: good}' and you use your client tech(eg. javascrpt) to decode this string and finall get an object On Fri, Jan 8, 2010 at 3:43 PM, Anthony Papillion papill...@gmail.comwrote: I'm developing a basic webservice to compliment a mobile application I'm developing or iPhone. While I know how to encode simple variables and arrays, I'm not sure how to do what I'm needing to do. Basically, I want to encode a status message to return to the mobile client. Something like status good_request Right now, I'm thinking I should put this in an array and encode/return that. But is that the right way of thinking? Is there a more correct or better way to do this? Thanks! Anthony -- 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] eof bof in php
I would argue it is better practice as: h1?php echo 'Hello World'; ?/h1 than ?php echo h1Hello World/h1; ? Anthony Gentile On Mon, Dec 22, 2008 at 9:18 AM, tedd tedd.sperl...@gmail.com wrote: At 1:21 PM -0500 12/21/08, Anthony Gentile wrote: -snip exampe- is probably going to give you the result you want. However you should know it is bad practice to mix PHP and HTML as horridly as I just showed you. AKA you don't want your PHP writing your HTML. Anthony Gentile Anthony: Granted, the example you gave was a bit mixed, but it's perfectly Okay to have php write html. In fact, if you think about it that's the only way php can express itself to the user. A simple echo($var) is writing html to a browser. Good practice should to write code (i.e., php, mysql, css, html, js) that is semantic and compliant with standards. Mixing them well is almost an art form that observes best practices in all. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] eof bof in php
Well you said it...for my example it makes sense. For when it gets really messy by all means concatenate with php. However, my argument is not so much keeping html seperate from php as it is keeping the business logic separate from the presentationso if you have php writing html and its all dealing with the presentation...I personally don't think its a problem. However when you start writing html out with php in your business logic...to me that's a no no. Anthony Gentile On Mon, Dec 22, 2008 at 2:47 PM, Ashley Sheridan a...@ashleysheridan.co.ukwrote: On Mon, 2008-12-22 at 14:21 -0500, Anthony Gentile wrote: I would argue it is better practice as: h1?php echo 'Hello World'; ?/h1 than ?php echo h1Hello World/h1; ? Anthony Gentile On Mon, Dec 22, 2008 at 9:18 AM, tedd tedd.sperl...@gmail.com wrote: At 1:21 PM -0500 12/21/08, Anthony Gentile wrote: -snip exampe- is probably going to give you the result you want. However you should know it is bad practice to mix PHP and HTML as horridly as I just showed you. AKA you don't want your PHP writing your HTML. Anthony Gentile Anthony: Granted, the example you gave was a bit mixed, but it's perfectly Okay to have php write html. In fact, if you think about it that's the only way php can express itself to the user. A simple echo($var) is writing html to a browser. Good practice should to write code (i.e., php, mysql, css, html, js) that is semantic and compliant with standards. Mixing them well is almost an art form that observes best practices in all. 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 Why?! As you've seen, it can get awfully messy very quickly... Ash www.ashleysheridan.co.uk
Re: [PHP] eof bof in php
if (0 == $totalRows_rsSearch) { echo Sorry no products were found; } else Anthony Gentile On Sun, Dec 21, 2008 at 11:22 AM, Gary Maddock-Greene g...@maddock-greene.co.uk wrote: I have tried that but to no avail :) ?php if ($totalRows_rsSearch=0) echo Sorry no products were found; else // All seems OK to here, then the syntax error unexpected T_VARIABLE appears echo h3Please click on a product for further information./h3 ?php do { ? div class=productitemimg src=products?php echo $row_rsSearch['product_image']; ? / div class=text h3?php echo $row_rsSearch['product_name']; ?/h3 p class=style1?php echo $row_rsSearch['product_subtitle']; ?/p a href=products?php echo $row_rsSearch['product_url']; ?View Product/a div class=clear/div /div div class=clear/div center /center /div ?php } while ($row_rsSearch = mysql_fetch_assoc($rsSearch)); ? -- - Gary Maddock-Greene Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1229875150.4229.9.ca...@localhost.localdomain... On Sun, 2008-12-21 at 15:40 +, Gary Maddock-Greene wrote: Thanks Ashley ... I have been trying that but I think my syntax id shot!! ?php if ($totalRows_rsSearch=0) echo Sorry no products were found; else echo h3Please click on a product for further information./h3 ? !-- Product block start search results -- ?php do { ? div class=productitemimg src=products?php echo $row_rsSearch['product_image']; ? / div class=text h3?php echo $row_rsSearch['product_name']; ?/h3 p class=style1?php echo $row_rsSearch['product_subtitle']; ?/p a href=products?php echo $row_rsSearch['product_url']; ?View Product/a div class=clear/div /div div class=clear/div center /center /div ?php } while ($row_rsSearch = mysql_fetch_assoc($rsSearch)); ? -- - Gary Maddock-Greene Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1229873521.4229.6.ca...@localhost.localdomain... On Sun, 2008-12-21 at 15:22 +, Gary Maddock-Greene wrote: Hi, I'm very new to php. Please can someone point me in the right direction? I want to display a message: 'No Products Found' if my search record set returns no value. I think I need to be looking at this section of my code ... $query_rsSearch = sprintf(SELECT * FROM products WHERE product_name LIKE %s, GetSQLValueString(% . $colname_rsSearch . %, text)); $rsSearch = mysql_query($query_rsSearch, $sondia_lighting) or die(mysql_error()); $row_rsSearch = mysql_fetch_assoc($rsSearch); $totalRows_rsSearch = mysql_num_rows($rsSearch); ? Thanks - Gary Maddock-Greene Can you not just use the $totalRows_rsSearch value inside of an if statement? Ash www.ashleysheridan.co.uk It might be because you're comparing the total to a string rather than a number if ($totalRows_rsSearch=0) If you remove the quote marks, it should work. Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] eof bof in php
...missing semicolon and some brackets. ?php if (0 == $totalRows_rsSearch) { echo h3Sorry no products were found/h3; } else { echo h3Please click on a product for further information./h3; } ? If there is more code you can show by perhaps pasting here: http://pastebin.redlinktech.com We can help with further syntax problems. Anthony Gentile On Sun, Dec 21, 2008 at 12:33 PM, Gary Maddock-Greene g...@maddock-greene.co.uk wrote: Thanks guys .. I can get this part working great .. ?php if (0 == $totalRows_rsSearch) { echo h3Sorry no products were found/h3; } else echo h3Please click on a product for further information./h3 ? But I want to add the following so that only the products table appears when product are present. I cannot seem to add this code into the above after the echo h3Please click on a product for further information./h3. I can't get the syntax right ... I appreciate everyones help -- - Gary Maddock-Greene Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1229878234.4229.12.ca...@localhost.localdomain... On Sun, 2008-12-21 at 11:39 -0500, Anthony Gentile wrote: if (0 == $totalRows_rsSearch) { echo Sorry no products were found; } else Anthony Gentile On Sun, Dec 21, 2008 at 11:22 AM, Gary Maddock-Greene g...@maddock-greene.co.uk wrote: I have tried that but to no avail :) ?php if ($totalRows_rsSearch=0) echo Sorry no products were found; else // All seems OK to here, then the syntax error unexpected T_VARIABLE appears echo h3Please click on a product for further information./h3 ?php do { ? div class=productitemimg src=products?php echo $row_rsSearch['product_image']; ? / div class=text h3?php echo $row_rsSearch['product_name']; ?/h3 p class=style1?php echo $row_rsSearch['product_subtitle']; ?/p a href=products?php echo $row_rsSearch['product_url']; ?View Product/a div class=clear/div /div div class=clear/div center /center /div ?php } while ($row_rsSearch = mysql_fetch_assoc($rsSearch)); ? -- - Gary Maddock-Greene Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1229875150.4229.9.ca...@localhost.localdomain... On Sun, 2008-12-21 at 15:40 +, Gary Maddock-Greene wrote: Thanks Ashley ... I have been trying that but I think my syntax id shot!! ?php if ($totalRows_rsSearch=0) echo Sorry no products were found; else echo h3Please click on a product for further information./h3 ? !-- Product block start search results -- ?php do { ? div class=productitemimg src=products?php echo $row_rsSearch['product_image']; ? / div class=text h3?php echo $row_rsSearch['product_name']; ?/h3 p class=style1?php echo $row_rsSearch['product_subtitle']; ?/p a href=products?php echo $row_rsSearch['product_url']; ?View Product/a div class=clear/div /div div class=clear/div center /center /div ?php } while ($row_rsSearch = mysql_fetch_assoc($rsSearch)); ? -- - Gary Maddock-Greene Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1229873521.4229.6.ca...@localhost.localdomain... On Sun, 2008-12-21 at 15:22 +, Gary Maddock-Greene wrote: Hi, I'm very new to php. Please can someone point me in the right direction? I want to display a message: 'No Products Found' if my search record set returns no value. I think I need to be looking at this section of my code ... $query_rsSearch = sprintf(SELECT * FROM products WHERE product_name LIKE %s, GetSQLValueString(% . $colname_rsSearch . %, text)); $rsSearch = mysql_query($query_rsSearch, $sondia_lighting) or die(mysql_error()); $row_rsSearch = mysql_fetch_assoc($rsSearch); $totalRows_rsSearch = mysql_num_rows($rsSearch); ? Thanks - Gary Maddock-Greene Can you not just use the $totalRows_rsSearch value inside of an if statement? Ash www.ashleysheridan.co.uk It might be because you're comparing the total to a string rather than a number if ($totalRows_rsSearch=0) If you remove the quote marks, it should work. Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php D'oh, not sure how I missed that one too, the double ==. No wonder it wasn't working. Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] eof bof in php
?php if (0 == $totalRows_rsSearch) { echo h3Sorry no products were found/h3; } else { echo h3Please click on a product for further information./h3; while ($row_rsSearch = mysql_fetch_assoc($rsSearch)){ echo div class=\productitem\img src=\products\. $row_rsSearch['product_image']. div class=\text\ h3. $row_rsSearch['product_name']./h3 p class=\style1\. $row_rsSearch['product_subtitle'] . /p a href=\products\. $row_rsSearch['product_url'].View Product/a div class=\clear\/div /div div class=\clear\/div center /center /div; } } ? is probably going to give you the result you want. However you should know it is bad practice to mix PHP and HTML as horridly as I just showed you. AKA you don't want your PHP writing your HTML. Anthony Gentile On Sun, Dec 21, 2008 at 1:07 PM, Gary Maddock-Greene g...@maddock-greene.co.uk wrote: I've corrected those errors thanks but how do I insert this code as the else statement? ?php do { ? div class=productitemimg src=products?php echo $row_rsSearch['product_image']; ? / div class=text h3?php echo $row_rsSearch['product_name']; ?/h3 p class=style1?php echo $row_rsSearch['product_subtitle']; ?/p a href=products?php echo $row_rsSearch['product_url']; ?View Product/a div class=clear/div /div div class=clear/div center /center /div ?php } while ($row_rsSearch = mysql_fetch_assoc($rsSearch)); ? -- - Gary Maddock-Greene Anthony Gentile asgent...@gmail.com wrote in message news:2ce4207d0812210959k3491690ctbc4f0dbf971ac...@mail.gmail.com... ...missing semicolon and some brackets. ?php if (0 == $totalRows_rsSearch) { echo h3Sorry no products were found/h3; } else { echo h3Please click on a product for further information./h3; } ? If there is more code you can show by perhaps pasting here: http://pastebin.redlinktech.com We can help with further syntax problems. Anthony Gentile On Sun, Dec 21, 2008 at 12:33 PM, Gary Maddock-Greene g...@maddock-greene.co.uk wrote: Thanks guys .. I can get this part working great .. ?php if (0 == $totalRows_rsSearch) { echo h3Sorry no products were found/h3; } else echo h3Please click on a product for further information./h3 ? But I want to add the following so that only the products table appears when product are present. I cannot seem to add this code into the above after the echo h3Please click on a product for further information./h3. I can't get the syntax right ... I appreciate everyones help -- - Gary Maddock-Greene Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1229878234.4229.12.ca...@localhost.localdomain... On Sun, 2008-12-21 at 11:39 -0500, Anthony Gentile wrote: if (0 == $totalRows_rsSearch) { echo Sorry no products were found; } else Anthony Gentile On Sun, Dec 21, 2008 at 11:22 AM, Gary Maddock-Greene g...@maddock-greene.co.uk wrote: I have tried that but to no avail :) ?php if ($totalRows_rsSearch=0) echo Sorry no products were found; else // All seems OK to here, then the syntax error unexpected T_VARIABLE appears echo h3Please click on a product for further information./h3 ?php do { ? div class=productitemimg src=products?php echo $row_rsSearch['product_image']; ? / div class=text h3?php echo $row_rsSearch['product_name']; ?/h3 p class=style1?php echo $row_rsSearch['product_subtitle']; ?/p a href=products?php echo $row_rsSearch['product_url']; ?View Product/a div class=clear/div /div div class=clear/div center /center /div ?php } while ($row_rsSearch = mysql_fetch_assoc($rsSearch)); ? -- - Gary Maddock-Greene Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1229875150.4229.9.ca...@localhost.localdomain... On Sun, 2008-12-21 at 15:40 +, Gary Maddock-Greene wrote: Thanks Ashley ... I have been trying that but I think my syntax id shot!! ?php if ($totalRows_rsSearch=0) echo Sorry no products were found; else echo h3Please click on a product for further information./h3 ? !-- Product block start search results -- ?php do { ? div class=productitemimg src=products?php echo $row_rsSearch['product_image']; ? / div class=text h3?php echo $row_rsSearch['product_name']; ?/h3 p class=style1?php echo $row_rsSearch['product_subtitle']; ?/p a href=products?php echo $row_rsSearch['product_url']; ?View Product/a div class=clear/div /div div class=clear/div center /center /div ?php } while ($row_rsSearch = mysql_fetch_assoc($rsSearch)); ? -- - Gary Maddock-Greene Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1229873521.4229.6.ca
Re: [PHP] eof bof in php
err forgot the closing in img src=\products\. should look like img src=\products\. Anthony Gentile Cell: 704.657.8550 Diese E-Mail ist vertraulich. Wenn Sie nicht der rechtmaessige Empfaenger sind, duerfen Sie den Inhalt weder kopieren noch verbreiten oder benutzen. Sollten Sie diese E-Mail versehentlich erhalten haben, senden Sie diese bitte an uns zurueck und loeschen Sie sie anschliessend. This email is confidential. If you are not the intended recipient, you must not copy, disclose or use its contents. If you have received it in error, please inform us immediately by return email and delete the document. On Sun, Dec 21, 2008 at 1:21 PM, Anthony Gentile asgent...@gmail.comwrote: ?php if (0 == $totalRows_rsSearch) { echo h3Sorry no products were found/h3; } else { echo h3Please click on a product for further information./h3; while ($row_rsSearch = mysql_fetch_assoc($rsSearch)){ echo div class=\productitem\img src=\products\. $row_rsSearch['product_image']. div class=\text\ h3. $row_rsSearch['product_name']./h3 p class=\style1\. $row_rsSearch['product_subtitle'] . /p a href=\products\. $row_rsSearch['product_url'].View Product/a div class=\clear\/div /div div class=\clear\/div center /center /div; } } ? is probably going to give you the result you want. However you should know it is bad practice to mix PHP and HTML as horridly as I just showed you. AKA you don't want your PHP writing your HTML. Anthony Gentile On Sun, Dec 21, 2008 at 1:07 PM, Gary Maddock-Greene g...@maddock-greene.co.uk wrote: I've corrected those errors thanks but how do I insert this code as the else statement? ?php do { ? div class=productitemimg src=products?php echo $row_rsSearch['product_image']; ? / div class=text h3?php echo $row_rsSearch['product_name']; ?/h3 p class=style1?php echo $row_rsSearch['product_subtitle']; ?/p a href=products?php echo $row_rsSearch['product_url']; ?View Product/a div class=clear/div /div div class=clear/div center /center /div ?php } while ($row_rsSearch = mysql_fetch_assoc($rsSearch)); ? -- - Gary Maddock-Greene Anthony Gentile asgent...@gmail.com wrote in message news:2ce4207d0812210959k3491690ctbc4f0dbf971ac...@mail.gmail.com... ...missing semicolon and some brackets. ?php if (0 == $totalRows_rsSearch) { echo h3Sorry no products were found/h3; } else { echo h3Please click on a product for further information./h3; } ? If there is more code you can show by perhaps pasting here: http://pastebin.redlinktech.com We can help with further syntax problems. Anthony Gentile On Sun, Dec 21, 2008 at 12:33 PM, Gary Maddock-Greene g...@maddock-greene.co.uk wrote: Thanks guys .. I can get this part working great .. ?php if (0 == $totalRows_rsSearch) { echo h3Sorry no products were found/h3; } else echo h3Please click on a product for further information./h3 ? But I want to add the following so that only the products table appears when product are present. I cannot seem to add this code into the above after the echo h3Please click on a product for further information./h3. I can't get the syntax right ... I appreciate everyones help -- - Gary Maddock-Greene Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1229878234.4229.12.ca...@localhost.localdomain... On Sun, 2008-12-21 at 11:39 -0500, Anthony Gentile wrote: if (0 == $totalRows_rsSearch) { echo Sorry no products were found; } else Anthony Gentile On Sun, Dec 21, 2008 at 11:22 AM, Gary Maddock-Greene g...@maddock-greene.co.uk wrote: I have tried that but to no avail :) ?php if ($totalRows_rsSearch=0) echo Sorry no products were found; else // All seems OK to here, then the syntax error unexpected T_VARIABLE appears echo h3Please click on a product for further information./h3 ?php do { ? div class=productitemimg src=products?php echo $row_rsSearch['product_image']; ? / div class=text h3?php echo $row_rsSearch['product_name']; ?/h3 p class=style1?php echo $row_rsSearch['product_subtitle']; ?/p a href=products?php echo $row_rsSearch['product_url']; ?View Product/a div class=clear/div /div div class=clear/div center /center /div ?php } while ($row_rsSearch = mysql_fetch_assoc($rsSearch)); ? -- - Gary Maddock-Greene Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1229875150.4229.9.ca...@localhost.localdomain... On Sun, 2008-12-21 at 15:40 +, Gary Maddock-Greene wrote: Thanks Ashley ... I have been trying that but I think my syntax id shot!! ?php if ($totalRows_rsSearch=0) echo Sorry no products were found; else echo h3Please click on a product for further information
Re: [PHP] Variable as an index
for e.g. $var = 'world'; echo hello $var; vs echo 'hello '.$var; The first uses twice as many opcodes as compared to the second. The first is init a string and adding to it the first part(string) and then the second part (var); once completed it can echo it out. The second is simply two opcodes, a concatenate and an echo. Interpolation. Anthony Gentile On Sun, Dec 21, 2008 at 5:47 PM, German Geek geek...@gmail.com wrote: OK. I would think it uses more memory then, but doubt it would be slower. Isnt the output buffered in memory anyway though in PHP? Surely the buffer is bigger than 100 bytes (which is about the length of this string). So one way or the other, the memory is used. Tim-Hinnerk Heuer http://www.ihostnz.com On Mon, Dec 22, 2008 at 11:12 AM, Marc Steinert li...@bithub.net wrote: German Geek schrieb: Why is the first method faster and uses less memory? Because the concatenation operator first reassembles a new string, stores it in memory then passes this newly created string to the echo function, if I'm not misstaken. -- http://bithub.net/ Synchronize and share your files over the web for free
Re: [PHP] Variable as an index
True, it might mean the very slightest in milliseconds...depending on what you're doing/hardware. However, no harm in understanding the difference/how it works. Many will code echo Hello World and echo 'Hello World'; and never know the difference, I just happen to think being aware of the details will help for the long term programmer. Since, I brought it up, I'll go ahead and give another example. Ternaries that make a lot of people feel awesome because a lot is being accomplished in one line are also more opcodes than their if-else statement equivalents...and often times can be more confusing to future maintainers of the code. Anthony Gentile On Sun, Dec 21, 2008 at 6:20 PM, Chris dmag...@gmail.com wrote: Anthony Gentile wrote: for e.g. $var = 'world'; echo hello $var; vs echo 'hello '.$var; The first uses twice as many opcodes as compared to the second. The first is init a string and adding to it the first part(string) and then the second part (var); once completed it can echo it out. The second is simply two opcodes, a concatenate and an echo. Interpolation. I'd call this a micro-optimization. If changing this causes that much of a difference in your script, wow - you're way ahead of the rest of us. http://blog.libssh2.org/index.php?/archives/28-How-long-is-a-piece-of-string.html http://www.phpbench.com/ -- Postgresql php tutorials http://www.designmagick.com/
[PHP] Extract specific div element from page
Hey folks, I need to pull the contents inside of a specific div out of a page, and write it to a separate file. In this instance I am taking everything inside of div id=content/div tags from a wordpress blog, this will give me only the content and not the menus, or other stuff. I need to do this because the final document will be converted for viewing on a palm pilot. Is anyone aware of a simple solution to this problem, short of parsing the entire page and starting when I hit that div opening tag, and stopping when I hit the closing tag? One problem I can see with this method is that I would have to count divs inside of that div, otherwise I would end too early on. Any advice would be greatly appreciated. Peace and Love, distatica. -- - Anthony Hiscox Video Watch Group Public Site Currently Under Development Group Members Site Fully Operational -
Re: [PHP] Re: Extract specific div element from page
Oops, I accidentally sent this directly to CK, my apologies. Thank you for your replies. The reason that I didn't explore the JS route is because this will be running in the background, I didn't want to have to visit the page in any way. I went looking for an easy way to accomplish this in PHP but due to malformed HTML in some sites (not wordpress that I am aware of) it wasn't going to be so easy. Someone in ##php on irc.freenode.net pointed me to BeautifulSoup which is a Python module for scraping pages even if they have bad HTML. Within a minute I had a script that grabbed the parts I wanted, and even removed the parts I didn't (such as comments). Now I have a Python script that runs when I am going to update the docs on my Palm, it grabs the page(s), strips out the unimportant stuff, saves to a local directory, and then I have Sunrise parse that into plucker document format. Once again, thank you for the responses. On 6/15/07, Dan [EMAIL PROTECTED] wrote: Or you could just use Javascript combined with PHP, just use javascript it's something like this document.getElementById('tagId').innerHtml that will give you the html(contents) of the div tag you specify. Then just do something like document.form.value = document.getElementById('tagId').innerHtml. Basicly you're setting a hidden form element to have the value of the div, then when you submit the page, you have the content as $_POST['formYouSetTo']. You could have the JS execute on the submit button's onclick. It should be relatively easy if you look up the exact syntax of the javascript. - Daniel Anthony Hiscox [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hey folks, I need to pull the contents inside of a specific div out of a page, and write it to a separate file. In this instance I am taking everything inside of div id=content/div tags from a wordpress blog, this will give me only the content and not the menus, or other stuff. I need to do this because the final document will be converted for viewing on a palm pilot. Is anyone aware of a simple solution to this problem, short of parsing the entire page and starting when I hit that div opening tag, and stopping when I hit the closing tag? One problem I can see with this method is that I would have to count divs inside of that div, otherwise I would end too early on. Any advice would be greatly appreciated. Peace and Love, distatica. -- - Anthony Hiscox Video Watch Group Public Site Currently Under Development Group Members Site Fully Operational - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- - Anthony Hiscox Video Watch Group Public Site Currently Under Development Group Members Site Fully Operational -
[PHP] Developer / Client Documents
First my problem, then a tiny bit of background information. I am trying to start a small (Read: Tiny) web development company from home, which will handle only a few light contracts. I have been spending some time searching Google for common documents used by developers and their clients to help layout all the goals and features the site might have. Unfortunately since I have not obtained any formal education, I am experiencing a slight fish-out-of-water syndrome, and am not even sure of the names of the documents I am seeking. I would be eternally grateful if some experienced developers would point me in the right direction; any documents related to planning the website, contracts, really anything would be considered useful. Now a little background, I am a stay at home father, with the majority of my daily duties centralized around wiping feces from the rear end of a young boy, feeding, and teaching. I don't have the time, money, nor resources to go to school for this, but am quite happy reading about web development whenever I get the opportunity (often 3-6 hours daily). I have what I believe to be a solid understanding of PHP, MySQL and Javascript basics, as well as w3c compliant HTML, and CSS. Currently I am spending some time studying the CakePHP framework. I also have a (very) basic understanding of XSS attacks, and SQL injections techniques and am working on improving this. I welcome ALL advice, even if it is not related to my initial question (Developer / Client documents) especially if the responder is, or was, a stay at home parent. However advice from anyone would be greatly welcomed, regardless of prior experiences. -- - Anthony Hiscox Video Watch Group Public Site Currently Under Development Group Members Site Fully Operational -
[PHP] Reading Writing XML Documents...
Can anyone point me to some good online reference/examples of reading/writing XML documents? Thanks, Anthony
[PHP] Retrieving parameters passed from .html...?
Hey all, My first post here..., new to php and so far doing great picking it up... but, tonight I'm having a brain fart... How do you pick up (read) the parameters passed into a php script from an html file? Given... http://somewhere/dosomething.php?showtopic=9 How do you read or get the value showtopic and the value of 9? I know this is simple but I'm pulling my hair out here... Thanks! Anthony -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Retrieving parameters passed from .html...?
See... the second I sent this I took a sip of red-bull and my brain cleared up... $topicID = $_GET['showtopic']; Right? Anthony J. Maske [EMAIL PROTECTED] http://home.comcast.net/~ajmaske -Original Message- From: Anthony J. Maske [mailto:[EMAIL PROTECTED] Sent: Tuesday, April 10, 2007 8:33 PM To: PHP General Subject: [PHP] Retrieving parameters passed from .html...? Hey all, My first post here..., new to php and so far doing great picking it up... but, tonight I'm having a brain fart... How do you pick up (read) the parameters passed into a php script from an html file? Given... http://somewhere/dosomething.php?showtopic=9 How do you read or get the value showtopic and the value of 9? I know this is simple but I'm pulling my hair out here... Thanks! Anthony -- 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] Evaluating strings...
Hey, Thanks for the quick response on Retrieving parameters... This is another that has me stumped... if (trim($Line) = 'body') { $InBody = true; } elseif (trim($Line) = '/body') { $InBody = false; } $Line is a line from a html file, I'm trying to parse through it to ignore everything but the body section. When I run the above I get the following... Fatal error: Can't use function return value in write context in C:\wwwRoot\anthony.maske\cfr.php on line 43 If I do this... $Tag = trim($Line); if ($Tag = 'body') { $InBody = true; } elseif ($Tag = '/body') { $InBody = false; } Why won't the later work? What am I missing in the first snip... Thanks again...! Anthony -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Evaluating strings...
Got it... Thanks mucho! Anthony J. Maske [EMAIL PROTECTED] http://home.comcast.net/~ajmaske -Original Message- From: Chris [mailto:[EMAIL PROTECTED] Sent: Tuesday, April 10, 2007 9:03 PM To: Anthony J. Maske Cc: PHP General Subject: Re: [PHP] Evaluating strings... Anthony J. Maske wrote: Hey, Thanks for the quick response on Retrieving parameters... This is another that has me stumped... if (trim($Line) = 'body') { That should be == basically that is trying to set trim($line) to be equal to 'body' which won't work (and you get an error message). == means compare the values. === means compare the values AND the types (eg make sure they are both integers or strings). -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP Sockets - How to detect client disconnection?
How do I detect a disconnected client from a socket resource? In an infinite loop, I socket_read() every open resource that passes a socket_select(). As far as I know, the only way to detect if the client disconnected unexpectedly from their socket resource is when socket_read() returns FALSE (which, during my testing, produced the warning: An established connection was aborted by the software in your host machine.). However, socket_read() doesn't return FALSE on a disconnected client's socket resource until I first attempt to socket_write() to that resource. In brief pseudo code... socket_create(AF_INET, SOCK_STREAM, SOL_TCP) while (TRUE) foreach (resource where (false === socket_select($arrayofresources, NULL, NULL, 0, 0)) if (socket_read() === false) WON'T DETECT DISCONNECT UNTIL I FIRST socket_write() I appreciate any support you offer and thank you for your time. Best regards, -Tony _ Type your favorite song. Get a customized station. Try MSN Radio powered by Pandora. http://radio.msn.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Need help with RegEx
Hello Everyone, I am having a bit of problems wrapping my head around regular expressions. I thought I had a good grip on them but, for some reason, the expression I've created below simply doesn't work! Basically, I need to retreive all of the text between two unique and specific tags but I don't need the tag text. So let's say that the tag is tag lang='ttt'THIS IS A TEST/tag I would need to retreive THIS IS A TEST only and nothing else. Now, a bit more information: I am using cURL to retreive the entire contents of a webpage into a variable. I am then trying to perform the following regular expression on the retreived text: $trans_text = preg_match(\/div id=result_box dir=ltr(.+?)\/div/); The problem is that when I echo the value of $trans_text variable, I end up with the entire HTML of the page. Can anyone clue me in to what I am doing wrong? Thanks, Anthony -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] GET, POST, REQUEST
simply using $_POST is by no means more secure than $_REQUEST. On 6/17/06, Ben Ramsey [EMAIL PROTECTED] wrote: On 6/17/06 9:30 AM, David Tulloh wrote: Martin Marques wrote: Yesterday when reading some doc on PHP I noticed the $_REQUEST predefined array, which looked like a solution to having to check in GET and POST data (I'm not sure if it will really have an impact on my program yet). Yes, request is simply a merge of these arrays. It can be very useful and tends to be rather under used in PHP examples. Using $_REQUEST is similar to using register_globals. You simply cannot trust the origin of the data. It's possible that a variable by the name of foo exists as a cookie, POST value, and GET value. If you use $_REQUEST, you cannot be assured that the value you are getting is from the scope you intend to retrieve it. Consider the following script: ?php setcookie('foo', 'cookie'); ? form method=POST action=?php echo $_SERVER['SCRIPT_NAME']; ??foo=get input type=text name=foo value=post / input type=submit / /form pre ?php var_dump($_REQUEST); var_dump($_GET); var_dump($_POST); var_dump($_COOKIE); ? /pre Save this to a PHP file, access it through a Web browser, and click on the Submit button. You'll see four different arrays that output the $_REQUEST, $_GET, $_POST, and $_COOKIE values. The problem is that the $_REQUEST array contains only one value for foo, but we know it exists in all scopes with different values. A user that knows this can make use of this knowledge to add a GET variable to the query string, add a cookie header to the request, or spoof the form with other values in POST than you intend. So, there are two things you must do here: 1) always check the origin of your data (don't use $_REQUEST, even if it seems convenient), and 2) always check that the input received is input expected (filter the input). -- Ben Ramsey http://benramsey.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Anthony Ettinger Signature: http://chovy.dyndns.org/hcard.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] GET, POST, REQUEST
it's more like painting the color of your front door, but still leaving it unlocked. It doesn't change the fact that people can still open the door. every input field needs to be validated regardless of get vs. post. the web developer toolbar for firefox can easily convert all form fields to one or the other, so it's trivial to send a get request as post, and vice-versa. On 6/17/06, Chris Peterman [EMAIL PROTECTED] wrote: But it would seem that using $_POST cuts down on the number of possible ways that something bad could happen, doesn't it? (Someone correct me if I am wrong, I am by no means a security or PHP expert, though working towards both :D) On Saturday 17 June 2006 14:51, Anthony Ettinger wrote: simply using $_POST is by no means more secure than $_REQUEST. On 6/17/06, Ben Ramsey [EMAIL PROTECTED] wrote: On 6/17/06 9:30 AM, David Tulloh wrote: Martin Marques wrote: Yesterday when reading some doc on PHP I noticed the $_REQUEST predefined array, which looked like a solution to having to check in GET and POST data (I'm not sure if it will really have an impact on my program yet). Yes, request is simply a merge of these arrays. It can be very useful and tends to be rather under used in PHP examples. Using $_REQUEST is similar to using register_globals. You simply cannot trust the origin of the data. It's possible that a variable by the name of foo exists as a cookie, POST value, and GET value. If you use $_REQUEST, you cannot be assured that the value you are getting is from the scope you intend to retrieve it. Consider the following script: ?php setcookie('foo', 'cookie'); ? form method=POST action=?php echo $_SERVER['SCRIPT_NAME']; ??foo=get input type=text name=foo value=post / input type=submit / /form pre ?php var_dump($_REQUEST); var_dump($_GET); var_dump($_POST); var_dump($_COOKIE); ? /pre Save this to a PHP file, access it through a Web browser, and click on the Submit button. You'll see four different arrays that output the $_REQUEST, $_GET, $_POST, and $_COOKIE values. The problem is that the $_REQUEST array contains only one value for foo, but we know it exists in all scopes with different values. A user that knows this can make use of this knowledge to add a GET variable to the query string, add a cookie header to the request, or spoof the form with other values in POST than you intend. So, there are two things you must do here: 1) always check the origin of your data (don't use $_REQUEST, even if it seems convenient), and 2) always check that the input received is input expected (filter the input). -- Ben Ramsey http://benramsey.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Anthony Ettinger Signature: http://chovy.dyndns.org/hcard.html -- ~ Chris Kyral Peterman Computer Science Undergraduate Clarkson University Associate Member of the Free Software Foundation Ubuntu Member -- Anthony Ettinger Signature: http://chovy.dyndns.org/hcard.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Simple blog software... Simple but clean code... suggestions?
echo $_GET['comment'] htdocs/comments.html :) On 6/15/06, Micky Hulse [EMAIL PROTECTED] wrote: Dave Goodchild wrote: www.abuddhistpodcast.com http://www.abuddhistpodcast.com and www.mediamasters.co.uk/dg/insp http://www.mediamasters.co.uk/dg/insp Cool sites btw! Good work. :) Cheers, M -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Anthony Ettinger Signature: http://chovy.dyndns.org/hcard.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] transform RDF to HTML via XSL and PHP
xsl:template match=rdf:RDF html body table border=1 xsl:for-each select=item tr tdxsl:value-of select=title//td tdxsl:value-of select=link//td /tr /xsl:for-each /table /body /html /xsl:template /xsl:stylesheet I'ts been awhile, but try the above. -- Anthony Ettinger Signature: http://chovy.dyndns.org/hcard.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Tables vs. databases
On 6/9/06, Antonio Bassinger [EMAIL PROTECTED] wrote: Hi gang, Situation: I've a HTTP server. I intend to run a file upload service. There could be up to 1 subscribers. Each saving files up to 10 MB. I made a proof-of-concept service using PHP MySQL, where there is a single database, but many tables - a unique table for each subscriber. But I realize that I may land in trouble with such a huge database. Would it be better to have a separate database for each subscriber? Which approach is better, many tables in 1 database, or many databases with 1 or max 2 tables? Kindly suggest with pros and cons of each. you might want to consider storing the files outside of the database as well, and just a pointer to it's path in the table. with respect to table vs. databases per user, neither. -- Anthony Ettinger Signature: http://chovy.dyndns.org/hcard.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php sessions and Google
On 6/7/06, tedd [EMAIL PROTECTED] wrote: Can someone shed some light on this for me? How can one do sessions and make Google bots happy? I think what they're getting at is don't use session id's unless they're logged in. -- Anthony Ettinger Signature: http://chovy.dyndns.org/hcard.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Can a script run twice?
Is the 'Add Ticket' button a GET or POST request? If it's a POST then chances are the script itself has a logic error since the user would get asked if they wanted to repost the data. If it's a get then you've violated one of the cardinal rules of web-based application development - GETs get, POSTs do. a class=button accesskey=A href=ticketaddserve.php?enqno=0Add Ticket/a Just change enqno= for a different queue. Found the simple answer - Double click - two records ! Like the previous poster says, GET requests should not put, they should only get. Use POST to write to the database. -- Anthony Ettinger Signature: http://chovy.dyndns.org/hcard.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] file permission error
is it readable by nobody? On 5/22/06, suresh kumar [EMAIL PROTECTED] wrote: Hi, I am facing one problem in my project.I am uploading an image .its get storing in DB.i am storing images in /tmp folder as file.while i am retrieving a image its displaying file permission error.fopen() could not open socket.file permission error. A.suresh - Yahoo! India Answers Share what your know-how and wisdom Send free SMS to your Friends on Mobile from your Yahoo! Messenger Download now -- Anthony Ettinger Signature: http://chovy.dyndns.org/hcard.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Wikimedia - cookies
On 5/18/06, Richard Lynch [EMAIL PROTECTED] wrote: On Thu, May 18, 2006 10:39 pm, Christopher wrote: I've built a front-end to display information from a wikimedia database that uses Text_Wiki and Text_Wiki_Mediawiki, but I can't seem to figure out how the wiki keeps track of its cookies and such. I would like to expand this to front-end so if it can pick up someone has logged into the wiki before, and allow them more options. Does anyone know how the wikimedia cookies are stored and how I can access them? Sorry if this is something extremely simple, I'm still a bit of a noob :) While it's remotely possible somebody here uses WikiMedia and knows the answer it's not really a General PHP type of question... Your best options are: Ask the WikiMedia folks. Install LiveHTTPHeaders in Firefox and see what Cookies you get. Configure your browser to prompt you for all Cookies and see what Cookies you get. HTH mediawiki.org #mediawiki on irc.freenode.net -- Anthony Ettinger Signature: http://chovy.dyndns.org/hcard.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Quotation marks considered harmful
doesn't php have something like qq// and q// in perl? qq = double quote interpolation q = single quote (no interpolation) the delimiteer / can be any character you'd like. or, like stated previously, use a heredoc. or smarty-template engine. On 5/4/06, Richard Lynch [EMAIL PROTECTED] wrote: On Thu, May 4, 2006 1:53 pm, John Hicks wrote: Why not develop a language syntax that has distinct open and close string delimiters? Because then you need to escape the closing character anyway, to have it as data, so what did you just gain, really? Not to mention that all the good matching possible delimiters are already taken for Arrays, code blocks, tag start/end, and order of operations. -- 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 -- Anthony Ettinger Signature: http://chovy.dyndns.org/hcard.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] secure upload file
disabled indexes in .htaccess. On 5/3/06, Richard Lynch [EMAIL PROTECTED] wrote: On Tue, May 2, 2006 8:12 pm, kristianto adi widiatmoko wrote: how to secure folder upload file since the privilege of this folder is 777 is any method to create a secure upload file ?? There is no such thing as total security Here are things you can do to improve security: 1. chown the directory to the user PHP runs as, and make it be 755 or even 700. 2. If #1 is impossible, because you are not root, you could: 2A. chmod the folder ABOVE your upload directory to 777 TEMPORARILY. 2B. Use PHP script to mkdir() and chmod() new directory inside 2A. 2C. chmod the folder ABOVE your upload directory back to 755 You now have a PHP-user owned directory you can work with, in PHP scripts, to make more directories, upload files, etc. 3. *MOVE* your upload directory *OUTSIDE* your web-tree, so that arbitrary files uploaded are simply not something a Bad Guy can surf to. 3A. Now you have to write a bunch of PHP scripts to manage/view those files. Tough. 3B. The scripts you write in 3A can also make all kinds of sanity checks on the files. 3B1. Are the files in your database listing of known files that belong there? 3B2. Are the files of the right format? E.G. .jpg files should return reasonable values for http://php.net/getimagesize REQUIRED READING: http://phpsec.org If you write one more line of code without reading the above URL, we will have no sympathy for you when, when, not if, when your server is trashed. Sorry. -- 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 -- Anthony Ettinger Signature: http://chovy.dyndns.org/hcard.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mod_rewrite help
On 5/3/06, Jay Blanchard [EMAIL PROTECTED] wrote: [snip] I am trying to create a simply rule so that when someone goes to: mysite.com/users/1 They are redirected to: mysite.com/users/index.php?uid=1 But am a bit lost looking through all the docs. I know people do this all the time so am looking for some help. [/snip] mod_rewrite: A Beginner's Guide to URL Rewriting http://www.sitepoint.com/article/guide-url-rewriting [aha moment] I finally get it. PHP developers are the smartest people on the planet and therefore we know and use everything. JavaScript, Java, C++, SQL, network management, Apache internals, women and even PHP. That is why people come on this list to ask questions totally unrelated to PHP even if they try to relate it to PHP by including the URL of a PHP page within the request. Neat. So I am going to change my attitude. I will answer all questions that I can, knowing that if I fail someone else on the PHP list will pick up my slackbecause we know everything and we should share. I wonder if PHP developers should start wearing special robes or sit on a designated hilltop somewhere? If we do get robes, can they be blue? (It'll bring out the color in my eyes and go well with my pickup truck. Why didn't this occur to me sooner? I could have solved several other things without sarcasm or reservation. I could have been more 'enlightened'. My journey will have to start now [/aha moment] http://www.organicseo.org/URL_Rewriting.html -- Anthony Ettinger Signature: http://chovy.dyndns.org/hcard.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] converting REST result to SOAP object
is there a easy way of converting an xml REST result to an object returned by a SOAP call? I know I can simply parse the REST and put it in a hash, curious if there's a method of doing this. simplexml_load_string() seems to give me simplexml objects inside my multi-level hash, which isn't really what I want. -- Anthony Ettinger Signature: http://chovy.dyndns.org/hcard.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] simplexml and serialize error
Warning: var_dump() [function.var-dump]: Node no longer exists in Foo.php on line 78 object(SimpleXMLElement)#86 (0) { } [title]= I turn an xml string into a simplexml object, and then ran serialize() on it before caching the output locally. When I read it back in and run unserialize() to do a dump, I get this error. -- Anthony Ettinger Signature: http://chovy.dyndns.org/hcard.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] converting nested hash to xml
Is there a standard way of converting a nested hash/multidimensional array to an xml tree? My hash looks like: $foo = array( bar1 = array( baz1 = array( title = Some Title, text = Some Text, ), bazN = array(...), ), bar2 = array (...), barN = array(...), ); would want the output to be something like: foo bar1 baz1 titleSome Title/title textSome Text/text /baz1 baz2 titleSome Title2/title textSome Text2/text /baz2 /bar1 barN.../barN /foo -- Anthony Ettinger Signature: http://chovy.dyndns.org/hcard.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Need help with an if statement
Yikes...font? that's been deprecated since the turn of the century! do it with css... html ul liitem 1/li li class=selecteditem 2/li liitem 3/li /ul css: ul li { background-image: url(/img/arrow-off.png); color: gray; } ul .selected { background-image: url(/img/arrow-on.png); color: red; } http://www.w3.org/TR/CSS21/colors.html#propdef-background-image The real question here though is looping through your menu items or nodes in your tree (unordered list)...you'll need to read up on DOM in php5 or domxml in php4. I have broken down my page into libraries, for example, my menu.php is included at the top of every page, and loops through the tree, checking for whatever condition (in my case I check the current url against the anchor href for every list item, and if it's equal, then I dynamically set the class=selected on the item (parent of anchor), which can turn it blue, and add an arrowon.png (this part should be taken care of with css, so you can easily redesign it without changing your code. ?php function selectMenuItem() { global $htdocs; global $uri; $uri = getenv('REQUEST_URI'); $dom = new DOMDocument; #xhtml fragment which contains the menu $dom-load($htdocs/xml/menu.xml); $xpath = new DOMXPath($dom); #uses xpath query to find anchors with parent of list item $nodes = $xpath-query(//a[parent::li]); foreach ($nodes as $node) { $attr = $node-getAttribute('href'); if($attr == $uri) { $node-setAttribute('class', 'selected'); } } #print $dom-saveXML(); #prepends xml declaration and breaks in IE6 if not the first line. print $dom-saveHTML(); } You can read more about dom with php here: http://www.php.net/dom Be aware, that you can decorate the heck out of your class/id with css, an unordered list can look like a set of tabs if needed. On 4/23/06, Pub [EMAIL PROTECTED] wrote: Hello, I am really new to all this and I am really hoping I can get some help PLEASE... I am making a website with x-cart which uses PHP and Smarty templates. I need to make an if statement that puts a little arrow gif in front of the link that is clicked on! make any sense? In other words: item 1 (not selected) item 2 (not selected) item 3 (selected) item 4 (not selected) This is what I have now, but I don't know what to call my {if ?} {if ?}A href={?}FONT class=buttontextonlyIMG src={$ImagesDir}/arrow.gif width=9 height=7 border=0 align=abstop{$menu_content}/FONT/A {else} FONT class=VertMenuTitle{$menu_content}/FONT {/if}/TD -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Anthony Ettinger Signature: http://chovy.dyndns.org/hcard.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Instalation Nightmares For Word Press Please Help
wtf is your username = localhost, and your password = root? that's probably where you messed up ;-) On 4/12/06, Jochem Maas [EMAIL PROTECTED] wrote: marvin hunkin wrote: Hi. yes did put the wp-Config.php file in the www folder in easy php 1-8, wp-config.php NOT wp-Config.php ?? but still get this error when trying to use the http://localhost/instal.php so how do i get round this one? ask the guys at wordpress I guess. we don't support specific application installation on this list really. oh and please don't post your questions directly at me unless: a, I ask you to. or b, I can bill you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Anthony Ettinger Signature: http://chovy.dyndns.org/hcard.html
Re: [PHP] SQL result
http://us3.php.net/manual/en/function.mysqli-fetch-row.php On 4/25/06, Mohsen Pahlevanzadeh [EMAIL PROTECTED] wrote: Dear all, I remember that i use a func that it return an array what it consist of result of my sql query. Please name me that. Yours,Mohsen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Anthony Ettinger Signature: http://chovy.dyndns.org/hcard.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] interview
if PHP could PHP a PHP page, how much PHP would a PHP page take to PHP a PHP page? On 4/13/06, Ryan A [EMAIL PROTECTED] wrote: If a coal cart could cart coal, how much coal would a coal cart cart... if a coal cart could cart coal? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Anthony Ettinger Signature: http://chovy.dyndns.org/hcard.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php varible in Javascript alert()
alert('echo $errorMessage'); On 4/11/06, Mace Eliason [EMAIL PROTECTED] wrote: Hi, I am not sure why this won't work I am pretty sure I have done it before; if($error) { echo $errorMessage; // for testing error message is displayed to screen echoscript language=\JavaScript\alert('$errorMessage');/script; } I am capturing all the errors from a form and then output them all at once Thanks for any help -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Anthony Ettinger Signature: http://chovy.dyndns.org/hcard.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php varible in Javascript alert()
actually... alert('? echo $errorMessage; ?'); On 4/11/06, Anthony Ettinger [EMAIL PROTECTED] wrote: alert('echo $errorMessage'); On 4/11/06, Mace Eliason [EMAIL PROTECTED] wrote: Hi, I am not sure why this won't work I am pretty sure I have done it before; if($error) { echo $errorMessage; // for testing error message is displayed to screen echoscript language=\JavaScript\alert('$errorMessage');/script; } I am capturing all the errors from a form and then output them all at once Thanks for any help -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Anthony Ettinger Signature: http://chovy.dyndns.org/hcard.html -- Anthony Ettinger Signature: http://chovy.dyndns.org/hcard.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php varible in Javascript alert()
?php alert('echo addslashes($errorMsg);'); ? On 4/11/06, Chrome [EMAIL PROTECTED] wrote: Does $errorMessage have any single quotes in it? Eg: Can't connect to DB Because if it does it will cause a Javascript error: alert('Can't connect to DB'); Just another thing to look for :) Dan --- http://chrome.me.uk -Original Message- From: Mace Eliason [mailto:[EMAIL PROTECTED] Sent: 11 April 2006 19:41 To: php-general@lists.php.net Subject: [PHP] php varible in Javascript alert() Hi, I am not sure why this won't work I am pretty sure I have done it before; if($error) { echo $errorMessage; // for testing error message is displayed to screen echoscript language=\JavaScript\alert('$errorMessage');/script; } I am capturing all the errors from a form and then output them all at once Thanks for any help -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php __ NOD32 1.1482 (20060411) Information __ This message was checked by NOD32 antivirus system. http://www.eset.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Anthony Ettinger Signature: http://chovy.dyndns.org/hcard.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php varible in Javascript alert()
Yes, alert() as in the javascript: script language=javascript var $errorMsg = ?php echo addslashes($phpError) ?; alert('error found: ' + $errorMsg); /script On 4/11/06, Chrome [EMAIL PROTECTED] wrote: Alert isn't a native PHP command so: ?php alert('echo addslashes($errorMsg);'); ? wouldn't work... This might though: ?php $string = Can't connect to DB; // or 'Can\'t connect to DB'; echo 'script type=text/javascript language=javascriptalert(\'' . addslashes($string) . '\'); /script '; ? ? I think the line breaks may go a bit wonky :| HTH Dan --- http://chrome.me.uk -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Anthony Ettinger Sent: 12 April 2006 00:58 To: Chrome Cc: Mace Eliason; php-general@lists.php.net Subject: Re: [PHP] php varible in Javascript alert() ?php alert('echo addslashes($errorMsg);'); ? On 4/11/06, Chrome [EMAIL PROTECTED] wrote: Does $errorMessage have any single quotes in it? Eg: Can't connect to DB Because if it does it will cause a Javascript error: alert('Can't connect to DB'); Just another thing to look for :) Dan --- http://chrome.me.uk -Original Message- From: Mace Eliason [mailto:[EMAIL PROTECTED] Sent: 11 April 2006 19:41 To: php-general@lists.php.net Subject: [PHP] php varible in Javascript alert() Hi, I am not sure why this won't work I am pretty sure I have done it before; if($error) { echo $errorMessage; // for testing error message is displayed to screen echoscript language=\JavaScript\alert('$errorMessage');/script; } I am capturing all the errors from a form and then output them all at once Thanks for any help -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php __ NOD32 1.1482 (20060411) Information __ This message was checked by NOD32 antivirus system. http://www.eset.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Anthony Ettinger Signature: http://chovy.dyndns.org/hcard.html -- Anthony Ettinger Signature: http://chovy.dyndns.org/hcard.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] xsl / xslt in php 4+
My ISP has php5 with all the xml goodies installed, I'm not sure if that's typical or not, php5 is still relatively new for shared hosting providers to rollout. My previous ISP only has php 4. On 4/7/06, jonathan [EMAIL PROTECTED] wrote: I'm working on a piece of an application that we'd like to distribute to other sites. Basically, it would be a REST application where the client would transform the xml into html. I'd like to xsl for the transformation but was curious about how prevelant xsl is installed in a shared hosting environment. Is this a bad assumption? I'm pretty sure that both amazon uses a REST interface with the client transforming on the browser. What would be alternatives that could be achieved in a shared hosting environment? -j -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Anthony Ettinger Signature: http://chovy.dyndns.org/hcard.html
Re: [PHP] Problem with require_once
can you do a dump of what $file is? Seems the path is incorrect. On 4/7/06, Pablo L. de Miranda [EMAIL PROTECTED] wrote: Hey Guys, I have the code below: $file = $_SERVER['HTTP_REFERER'].'util/ClassUtil.php'; echo $file.'br'; require_once($file); $service = ClassUtil::loadClass('service.FormularioService'); And the output in browser: http://localhost/egressos/util/ClassUtil.php Fatal error: Class 'ClassUtil' not found in /home/pldm/projetos/egressos/src/controller/Controller.php on line 27 But, the file that I pass to require_once exist in the server... If someone know the problem, please sende a answer... Thank you, Pablo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Anthony Ettinger Signature: http://chovy.dyndns.org/hcard.html
Re: [PHP] Zend Certification
if it's job related, you may even get your co. to pay for it. On 4/7/06, Jad madi [EMAIL PROTECTED] wrote: in my case the salary increment is more valuable than the $400 On Sat, 2006-04-08 at 00:24 +0200, Rory Browne wrote: My info may be dated but AFAIK the exam is $200 - so what if you have to take one one month and another the next? That (assuming PHP5 was the same price) would still only be $400. I don't want to sound petty, but what's another $200 for a second certification - having both will give you that long_time_user status. On 4/7/06, Jad madi [EMAIL PROTECTED] wrote: If taking the exam now makes different to you then go for it, actually I scheduled the exam 29 April bluntly just for the sake of salary increment heh On Fri, 2006-04-07 at 14:33 -0700, Ray Hauge wrote: Hello All, I've been thinking about taking the ZCE test. I want to, but I also want it to be current for as long as possible. Should I wait for it to be revised for PHP5, or are they even going to update it? I just don't want to end up taking it and then a few months later have it be outdated because it was for PHP4, and not PHP5. Thanks, -- Ray Hauge Programmer/Systems Administrator American Student Loan Services www.americanstudentloan.com 1.800.575.1099 -- 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 -- Anthony Ettinger Signature: http://chovy.dyndns.org/hcard.html
Re: [PHP] session_start
because you have nothing in $session_id. On 4/6/06, Diana Castillo [EMAIL PROTECTED] wrote: If I have nothing in $session_id, why do I get this message when I do a session_start() ? Warning: session_start(): The session id contains invalid characters, valid characters are only a-z, A-Z and 0-9 at C:\Inetpub\wwwroot\usr\local\global\php\online\InterfaceManager.php line 149. -- Diana Castillo Destinia.com C/Granvia 22 dcdo 4-dcha 28013 Madrid-Spain Tel : 00-34-913604039 Ext 216 Fax : 00-34-915228673 email: [EMAIL PROTECTED] Web : http://www.hotelkey.com http://www.destinia.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Anthony Ettinger Signature: http://chovy.dyndns.org/hcard.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] microsoft PHP ?
that is f--'d up manI just started liking php5 :( Oh well, f-- this open source garbage. On 4/1/06, Gerry Danen [EMAIL PROTECTED] wrote: Come on, you should have played along... ;-) Gerry On 4/1/06, Stut [EMAIL PROTECTED] wrote: Zouari Fourat wrote: here's the link http://phpro.org/articles/Microsoft-Purchases-Zend-for-$113-Million.html Seriously... consider the date. -Stut On 4/1/06, Stut [EMAIL PROTECTED] wrote: Zouari Fourat wrote: I've just heard about Microsoft deal, the geant bought the Zend platform at 113 million US$. What will be the php future ? it's gonna switch to proprietary licence ? closed source ? or it was a Zend product deal ? (zend studio, platform ...) not affecting the php language in itself ? Does this mean that all efforts done in open source by thousands of people around the world to get a web scripting language at a high entreprise level is now bought by Micrsoft ? Where did you hear this? Have you considered the date? Have you considered how unlikely it is? Have you ever sought professional help? -Stut -- Anthony Ettinger Signature: http://chovy.dyndns.org/hcard.html
Re: [PHP] microsoft PHP ?
nice one! On 4/1/06, Joe Wollard [EMAIL PROTECTED] wrote: Leave poor Zouari alone! I for one think that Microsoft buying Zend would be the best thing to happen to PHP, EVAR! This Rasmus guy didn't even mean for PHP to be what it is, he just wanted something simple and now look at it. It's WAY to complex for an unorganized bunch of hobbyists to maintain. I'm personally looking forward to the way they'll clean things up. Who knows, maybe once they've got PHP under control we won't need these security 'experts' like Chris Shifflett any more because would be hackers won't be able to see the source code, which of course means they won't be able to find vulnerabilities. You guys just need to give up on this open source hippie dream and let Microsoft change things for the better - who cares if Stephen King thinks they are working in conjunction with the Crimson King and that they might build robots that will someday take over the world and more or less 'suck the s-m-r-t' out of 50% of the worlds twins? He looks creepy anyway. - and a happy April fool's to all ;-) On 4/1/06, Matt Richards [EMAIL PROTECTED] wrote: Zouari Fourat: lol, bet you feel silly now :) Stut wrote: Zouari Fourat wrote: :) Gerry not that funny ;) I was affraid :o from the news Rule #1 on the Internet... Never trust any news without a link to an official source Rule #2 on the Internet... Never trust anything you read on April 1st -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Anthony Ettinger Signature: http://chovy.dyndns.org/hcard.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Going loopy with arrays.....
foreach ($parent as $child) { print $parent; foreach ($child as $item) { print $child . = . $item; } } didn't test it, but this should work. On 3/31/06, Jay Blanchard [EMAIL PROTECTED] wrote: Howdy all! Here is hoping that Friday is just another day in paradise for everyone. I have an array, a multi-dimensional array. I need to either a. loop through it and recognize when I have com upon a new sub-array so that I can do 'new' output 2. OR get each of the sub-arrays out as individual arrays. Here is a sample; Array ( [H7] = Array ( [0] = Array ( [lon] = -99.2588 [lat] = 29.1918 ) [1] = Array ( [lon] = -99.2205 [lat] = 29.1487 ) [2] = Array ( [lon] = -99.23 [lat] = 29.1575 ) [3] = Array ( [lon] = -99.242 [lat] = 29.1545 ) ) [H6] = Array ( [0] = Array ( [lon] = -99.0876 [lat] = 29.216 ) [1] = Array ( [lon] = -99.0618 [lat] = 29.179 ) And so on I am sure that it has something to do with my lack of sleep and the looming of deadlines and this being something that I thought would be trivial. Can someone drop-kick me in the right direction please? The sub arrays need to be the points in each of the arrays with a H identifier (H7, H6 etc.) Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Anthony Ettinger Signature: http://chovy.dyndns.org/hcard.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Going loopy with arrays.....
can you paste the array you're using? On 3/31/06, Jay Blanchard [EMAIL PROTECTED] wrote: [snip] foreach ($parent as $child) { print $parent; foreach ($child as $item) { print $child . = . $item; } } didn't test it, but this should work. [/snip] Didn't work, returns ArrayArray=ArrayArrayArray=ArrayArray=Array -- Anthony Ettinger Signature: http://chovy.dyndns.org/hcard.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: setting the same value to multiple variables
($a, $b) = $c; On 3/31/06, Eduardo Raúl Galván Sánchez [EMAIL PROTECTED] wrote: You could use variable variables with an array, like this: $arr = array('readingGoalsEnjoymentLabelClass','readingGoalsInformationLabelClass', 'readingGoalsAlphabeticLabelClass','readingGoalsPrintLabelClass', 'readingGoalsPhonologicalLabelClass','readingGoalsPhoneticLabelClass', 'readingGoalsComprehensionLabelClass','readingGoalsVocabularyLabelClass', 'readingGoalsInstructionsLabelClass','readingGoalsCriticalLabelClass', 'readingGoalsCommunicateLabelClass'); foreach ($arr as $var) { ${$var} = 'class=errorHere'; } /* This is to check if it was done correctly. */ foreach ($arr as $var) { echo $var = ${$var}\n; } charles stuart escribió: Hi, I'm sure this is quite basic. Nonetheless I'm new to PHP so I haven't figured it out. I'd like to set each variable to the same value (without having to set that value individually for each variable). Thanks for the help. best, Charles if ( 1 == 1 ) { $goodToGo = 0; $errorArray[] = You must declare some goals on Activity 1.; // this block of code does not set each variable to class=\errorHere\; $readingGoalsEnjoymentLabelClass $readingGoalsInformationLabelClass $readingGoalsAlphabeticLabelClass $readingGoalsPrintLabelClass $readingGoalsPhonologicalLabelClass $readingGoalsPhoneticLabelClass $readingGoalsComprehensionLabelClass $readingGoalsVocabularyLabelClass $readingGoalsInstructionsLabelClass $readingGoalsCriticalLabelClass $readingGoalsCommunicateLabelClass = class=\errorHere\; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Anthony Ettinger Signature: http://chovy.dyndns.org/hcard.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Going loopy with arrays.....
that's a dump of the arraycan you paste the source? On 3/31/06, Jay Blanchard [EMAIL PROTECTED] wrote: [snip] can you paste the array you're using? [/snip] It was in the original post. Array ( [H7] = Array ( [0] = Array ( [lon] = -99.2588 [lat] = 29.1918 ) [1] = Array ( [lon] = -99.2205 [lat] = 29.1487 ) [2] = Array ( [lon] = -99.23 [lat] = 29.1575 ) [3] = Array ( [lon] = -99.242 [lat] = 29.1545 ) ) [H6] = Array ( [0] = Array ( [lon] = -99.0876 [lat] = 29.216 ) [1] = Array ( [lon] = -99.0618 [lat] = 29.179 ) } } -- Anthony Ettinger Signature: http://chovy.dyndns.org/hcard.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: setting the same value to multiple variables
nevermind, that doesn't work...after testing it :*( i've seen it in perlregex. On 3/31/06, Eduardo Raúl Galván Sánchez [EMAIL PROTECTED] wrote: Anthony Ettinger wrote: ($a, $b) = $c; ^^ I don't get the meaning of this... On 3/31/06, Eduardo Raúl Galván Sánchez [EMAIL PROTECTED] wrote: You could use variable variables with an array, like this: $arr = array('readingGoalsEnjoymentLabelClass','readingGoalsInformationLabelClass', 'readingGoalsAlphabeticLabelClass','readingGoalsPrintLabelClass', 'readingGoalsPhonologicalLabelClass','readingGoalsPhoneticLabelClass', 'readingGoalsComprehensionLabelClass','readingGoalsVocabularyLabelClass', 'readingGoalsInstructionsLabelClass','readingGoalsCriticalLabelClass', 'readingGoalsCommunicateLabelClass'); foreach ($arr as $var) { ${$var} = 'class=errorHere'; } /* This is to check if it was done correctly. */ foreach ($arr as $var) { echo $var = ${$var}\n; } charles stuart escribió: Hi, I'm sure this is quite basic. Nonetheless I'm new to PHP so I haven't figured it out. I'd like to set each variable to the same value (without having to set that value individually for each variable). Thanks for the help. best, Charles if ( 1 == 1 ) { $goodToGo = 0; $errorArray[] = You must declare some goals on Activity 1.; // this block of code does not set each variable to class=\errorHere\; $readingGoalsEnjoymentLabelClass $readingGoalsInformationLabelClass $readingGoalsAlphabeticLabelClass $readingGoalsPrintLabelClass $readingGoalsPhonologicalLabelClass $readingGoalsPhoneticLabelClass $readingGoalsComprehensionLabelClass $readingGoalsVocabularyLabelClass $readingGoalsInstructionsLabelClass $readingGoalsCriticalLabelClass $readingGoalsCommunicateLabelClass = class=\errorHere\; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Anthony Ettinger Signature: http://chovy.dyndns.org/hcard.html -- Anthony Ettinger Signature: http://chovy.dyndns.org/hcard.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MySQL close connection, what's the purpose?
On 3/31/06, Martin Zvarík [EMAIL PROTECTED] wrote: Richard Lynch wrote: On Fri, March 31, 2006 2:30 pm, Martin Zvarík wrote: I was wondering why is it necessary to use mysql_close() at the end of your script. If you don't do it, it works anyways, doesn't it? Yes, but... Suppose you write a script to read data from one MySQL server, and then insert it into 200 other MySQL servers, as a sort of home-brew replication (which would be really dumb to do, mind you)... In that case, you REALLY don't want the overhead of all 200 connections open, so after you finish each one, you would close it. There are also cases where you finish your MySQL work, but have a TON of other stuff to do in the script, which will not require MySQL. Close the connection to free up the resource, like a good little boy. :-) There also COULD be cases where your PHP script is not ending properly, and you'd be better off to mysql_close() yourself. So, does the connection close automatically at the end of the script ? My situation is following: I have a e-shop with a ridiculously small amount of max approved connections, so it gives an error to about 10% of my visitors a day, that the mysql connections were exceeded. Now, if I will delete the mysql_close() line, will that help me or not? My webhosting does not allow perminent connections either. Thanks, MZ deleting the mysql_close() line would keep the connection open until the script ends. by closing it earlier when you're done with the database for the event, your script continues on, ie - parsing/displaying of db query results, template rendering, etc. yet the connection was closed earlier so other processes can use mysql (assuming your hitting your limit this way with too many simultaneous connections). -- Anthony Ettinger Signature: http://chovy.dyndns.org/hcard.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MySQL close connection, what's the purpose?
On 3/31/06, chris smith [EMAIL PROTECTED] wrote: On 4/1/06, tedd [EMAIL PROTECTED] wrote: At 10:30 PM +0200 3/31/06, Martin Zvarík wrote: Hi, I was wondering why is it necessary to use mysql_close() at the end of your script. If you don't do it, it works anyways, doesn't it? MZ MZ: I always close the connection right after my query -- force of habit. It's like leaving the toilet seat up, it's only going to get you into trouble. So you close it after every query and then re-open it later for the next query? I don't see that as a good idea. No, you leave it open until you're done with the database. If you pee and poo in one sitting, you don't get up and flush between occurrences. -- Anthony Ettinger Signature: http://chovy.dyndns.org/hcard.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTTP status code
Are you seeing the IE-specific 404 page? The one that looks like this: http://redvip.homelinux.net/varios/404-ie.jpg On 3/30/06, Bronislav Klucka [EMAIL PROTECTED] wrote: Hi, I'm using following construction to send http status code -- header('HTTP/1.1 404 Not Found'); header(Status: 404 Not Found); exit; -- MSIE displays Page not found, but FireFox and Opera don't display anything. Just blank page with no text... full headers sent by this script (and server itself) are: -- Date: Thu, 30 Mar 2006 18:02:49 GMT Server: Apache/2.0.55 (Debian) PHP/4.4.0-4 mod_ssl/2.0.55 OpenSSL/0.9.8a X-Powered-By: PHP/5.1.2 Keep-Alive: timeout=15, max=99 Connection: Keep-Alive Transfer-Encoding: chunked Content-Type: text/html 404 Not Found -- can anyone tell me, why those two browsers are not affected? Brona -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Anthony Ettinger Signature: http://chovy.dyndns.org/hcard.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTTP status code
Then it's workingFireFox, et. al. show you the server 404, IE on the otherhand has it's own 404 error page (for those newbies who don't know what a 404 is). You can disable it under IE options. On 3/30/06, Bronislav Klucka [EMAIL PROTECTED] wrote: Yes, I do... B. Anthony Ettinger wrote: Are you seeing the IE-specific 404 page? The one that looks like this: http://redvip.homelinux.net/varios/404-ie.jpg On 3/30/06, Bronislav Klucka [EMAIL PROTECTED] wrote: Hi, I'm using following construction to send http status code -- header('HTTP/1.1 404 Not Found'); header(Status: 404 Not Found); exit; -- MSIE displays Page not found, but FireFox and Opera don't display anything. Just blank page with no text... full headers sent by this script (and server itself) are: -- Date: Thu, 30 Mar 2006 18:02:49 GMT Server: Apache/2.0.55 (Debian) PHP/4.4.0-4 mod_ssl/2.0.55 OpenSSL/0.9.8a X-Powered-By: PHP/5.1.2 Keep-Alive: timeout=15, max=99 Connection: Keep-Alive Transfer-Encoding: chunked Content-Type: text/html 404 Not Found -- can anyone tell me, why those two browsers are not affected? Brona -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Anthony Ettinger Signature: http://chovy.dyndns.org/hcard.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Anthony Ettinger Signature: http://chovy.dyndns.org/hcard.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTTP status code
well, you typically would redirect 404 to something like foo.com/404.html Otherwise, it's whatever your server (apache/IIS) has as the default 404 handler... Default is something like this: Not Found The requested URL /asdf was not found on this server. Apache Server at foo.org Port 80 On 3/30/06, Jasper Bryant-Greene [EMAIL PROTECTED] wrote: In other words, if you want Firefox/Opera/etc to display something, you have to output something. Strange, that. :P Jasper Anthony Ettinger wrote: Then it's workingFireFox, et. al. show you the server 404, IE on the otherhand has it's own 404 error page (for those newbies who don't know what a 404 is). You can disable it under IE options. On 3/30/06, Bronislav Klucka [EMAIL PROTECTED] wrote: Yes, I do... B. Anthony Ettinger wrote: Are you seeing the IE-specific 404 page? The one that looks like this: http://redvip.homelinux.net/varios/404-ie.jpg On 3/30/06, Bronislav Klucka [EMAIL PROTECTED] wrote: Hi, I'm using following construction to send http status code -- header('HTTP/1.1 404 Not Found'); header(Status: 404 Not Found); exit; -- MSIE displays Page not found, but FireFox and Opera don't display anything. Just blank page with no text... full headers sent by this script (and server itself) are: -- Date: Thu, 30 Mar 2006 18:02:49 GMT Server: Apache/2.0.55 (Debian) PHP/4.4.0-4 mod_ssl/2.0.55 OpenSSL/0.9.8a X-Powered-By: PHP/5.1.2 Keep-Alive: timeout=15, max=99 Connection: Keep-Alive Transfer-Encoding: chunked Content-Type: text/html 404 Not Found -- can anyone tell me, why those two browsers are not affected? Brona -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Anthony Ettinger Signature: http://chovy.dyndns.org/hcard.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Anthony Ettinger Signature: http://chovy.dyndns.org/hcard.html -- Jasper Bryant-Greene General Manager Album Limited http://www.album.co.nz/ 0800 4 ALBUM [EMAIL PROTECTED] 021 708 334 -- Anthony Ettinger Signature: http://chovy.dyndns.org/hcard.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] XML-RPC or SOAP
what about WSDL? On 3/30/06, Russell Jones [EMAIL PROTECTED] wrote: I would go with XML-RPC. I currently use XML-RPC to run LinkSleeve - a link-spam detection tool. In my opinion, I have found XML-RPC to be easier to use and understand. If at any point in your product you will be dealing with customers / vendors who will be beginners with both XML-RPC and SOAP, I would say the learning curve for XML-RPC is much lower. I do feel, however, that SOAP is potentially a more robust solution. Anyway, just my 2 cents and, good luck. On 3/30/06, Philip Hallstrom [EMAIL PROTECTED] wrote: I am at the beginning of creating a web service. As I am not very familar with both SOAP and XML-RPC it would not make much difference in which one I learn. Which one would you guys recommend for a web app that has to be transformed into a white lable solution. I just did one using SOAP. Seems to work just fine. Just be sure to get the WSDL generator from here: http://www.schlossnagle.org/~george/php/WSDL_Gen.tgz We did it using PHP5's soap extension. good luck! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Anthony Ettinger Signature: http://chovy.dyndns.org/hcard.html
Re: [PHP] Database connections
On 3/30/06, Chris [EMAIL PROTECTED] wrote: Jasper Bryant-Greene wrote: Chris wrote: If they're accessing the same database you don't need to disconnect/reconnect. Different db's - well, yeh you don't have a choice. Of course you do. mysql_select_db() or whatever it's called. Or just issue a USE [databasename] query. No need to reconnect! Only if you are using the same username/password, but you're right, it is an option. php5 still has the mysql_pconnect method for persistent database connections: http://us2.php.net/mysql_pconnect -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Anthony Ettinger Signature: http://chovy.dyndns.org/hcard.html
Re: [PHP] private $foo [HISTORY - TOTALLY THREAD JACKED]
On 3/29/06, Jay Blanchard [EMAIL PROTECTED] wrote: [snip] Read up on the history of computers -- the first programmer, as I recall, was one Lady Lovelace who programmed Babbage's first mechanical computer (if you don't count the abacus) in the early 1800's. Of course, I remember programming with rocks and that was before we had zero's. We only had one's and that was a programming nightmare. You new guys at least have 1's and 0's to work with. [/snip] ROFLMMFAO! You had rocks?!? Dang dude. I can't top that. lol! that must've been before the wheel. I remember when we got our first hard-drive in the lab...a 10Mb dishwasher sized behemoth with its own AC unit -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Anthony Ettinger Signature: http://chovy.dyndns.org/hcard.html
Re: [PHP] Can't get XSLT on PHP
obvious one, but did you restart apache? On 3/29/06, MARG [EMAIL PROTECTED] wrote: Hi, I'm trying to get XSLT support on PHP, but i'm not able :( I've compiled Sablotron 1.0.2 successfully and compiled PHP 5.1.2 with --enable-xslt \ --with-xslt-sablot I get no errors and PHP works fine, but i get no XSLT support (confirmed via phpinfo()). Any ideas ? Any help would be apreciated. Warm Regards, MA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Anthony Ettinger Signature: http://chovy.dyndns.org/hcard.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] private $foo
I see this all over the place, but I don't think it stores the variable in = $foo: class Foo { private $foo; public function __setFoo($arg) { $this-foo = $arg; } -- Anthony Ettinger Signature: http://chovy.dyndns.org/hcard.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] private $foo
On 3/28/06, Jay Blanchard [EMAIL PROTECTED] wrote: [snip] I see this all over the place, but I don't think it stores the variable in = $foo: class Foo { private $foo; public function __setFoo($arg) { $this-foo = $arg; } [/snip] I am always using 'foo' in conversation and finally said it enough that the CEO used it in a meeting the other day. Setter functions are cool. Nevermind, it does need private $foo; it works without it, but not if you want to use a default from within the class. if you set private $foo = 'foo'; print $f-__getFoo(); $f-__setFoo('bar'); print $f-__getFoo(); Yields: foo bar -- Anthony Ettinger Signature: http://chovy.dyndns.org/hcard.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] private $foo
On 3/28/06, Jochem Maas [EMAIL PROTECTED] wrote: Anthony Ettinger wrote: On 3/28/06, Jay Blanchard [EMAIL PROTECTED] wrote: [snip] I see this all over the place, but I don't think it stores the variable in = $foo: class Foo { private $foo; public function __setFoo($arg) { $this-foo = $arg; } [/snip] I am always using 'foo' in conversation and finally said it enough that the CEO used it in a meeting the other day. Setter functions are cool. hmmm, who wants to write setters for 100's of properties? ... see below for an alternative ... Nevermind, it does need private $foo; it works without it, but not if you want to use a default from within the class. if you set private $foo = 'foo'; print $f-__getFoo(); $f-__setFoo('bar'); print $f-__getFoo(); ?php class Foo { private $foo = 'foo'; function __get($k) { if (isset($this-{$k})) { return $this-{$k}; } throw new Exception(non existing property!); } function __set($k, $v) { if (isset($this-{$k})) { $this-{$k} = $v; return; } throw new Exception(non existing property!); } } $f = new Foo; echo $f-foo,\n; $f-foo = bar; echo $f-foo,\n; Yields: foo bar If you handle your properties all the same. -- Anthony Ettinger Signature: http://chovy.dyndns.org/hcard.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] private $foo
On 3/28/06, Joe Henry [EMAIL PROTECTED] wrote: On Tuesday 28 March 2006 1:12 pm, Jochem Maas wrote: ?php class Foo { private $foo = 'foo'; function __get($k) { if (isset($this-{$k})) { return $this-{$k}; } throw new Exception(non existing property!); } function __set($k, $v) { if (isset($this-{$k})) { $this-{$k} = $v; return; } throw new Exception(non existing property!); } } $f = new Foo; echo $f-foo,\n; $f-foo = bar; echo $f-foo,\n; Maybe I'm wrong, but I thought you couldn't use the $f-foo to access private variables from outside a class? I think he means: echo $f-__get('foo'); $f-__set('foo', 'bar'); echo $f-__get('foo'); --- foo bar If you want to validate input, you then have to have a block of nested conditionals if your validation expressions vary. -- Anthony Ettinger Signature: http://chovy.dyndns.org/hcard.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] private $foo
On 3/28/06, M. Sokolewicz [EMAIL PROTECTED] wrote: Anthony Ettinger wrote: On 3/28/06, Joe Henry [EMAIL PROTECTED] wrote: On Tuesday 28 March 2006 1:12 pm, Jochem Maas wrote: ?php class Foo { private $foo = 'foo'; function __get($k) { if (isset($this-{$k})) { return $this-{$k}; } throw new Exception(non existing property!); } function __set($k, $v) { if (isset($this-{$k})) { $this-{$k} = $v; return; } throw new Exception(non existing property!); } } $f = new Foo; echo $f-foo,\n; $f-foo = bar; echo $f-foo,\n; Maybe I'm wrong, but I thought you couldn't use the $f-foo to access private variables from outside a class? I think he means: echo $f-__get('foo'); $f-__set('foo', 'bar'); echo $f-__get('foo'); no, he doesn't. http://www.php.net/manual/en/language.oop5.magic.php should explain it, however the part about __get() and __set() isn't quite finished yet (and thus missing). Rest assured though, Jochem showed a correct way of handling this problem, though PHP had a bug relating to recursive lookups when using isset() in combination with __get(). private $foo; cannot be accessed directly outside the script. print $f-foo; #fails Fatal error: Cannot access private property Foo::$foo in /x/home/username/docs/misc/php/client.php on line 11 -- Anthony Ettinger Signature: http://chovy.dyndns.org/hcard.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] About wrapping a forum into your own design.
you should be able to edit the forum template instead... On 3/28/06, twistednetadmin [EMAIL PROTECTED] wrote: I am making a page with css for styling and php for browsing and dynamic content. I use a simple switch statement to get the main content of each page into the same div tag like this: div id=main?php switch(@$_GET['maintext']) { default; echo Welcome to the official website of bladablada! Feel free to navigate around and get to now us better; $maintitle=WELCOME; break; case news: echo A bunch of news; $maintitle=NEWS; break; case about: include (about.php); $maintitle=ABOUT; break; case gallery: include (gallery.php); $maintitle=SCREENSHOTS; break; case stats: include (stats.php); $maintitle=STATISTICS; break; case forum: include ('forum/index.php'); $maintitle=FORUM; break; } ?/div However. I am not that competent in PHP to make my own forum, so I use a premade forum. Invision Power Board actually. What I want to do is to get all the links I press in the forum (after loading forum/index.php into the div-tag with id=main) to show up in the same area. Not sure if this is a php question actually, but... What happens now is that when I press the link Forum in my main navigation on my site, the index.php of course loads into the div-tag with id=main. BUT when I press a topic or something within this page (index.php), it opens up in a new page. I know why, but I wonder if there is a way to get the rest of the links in the forum to stay within my div-tag other than tracking down all the variables and such in the forumscripts and alter them? (That's a hell of alot java and php to work through) Any help is appreciated. -- Anthony Ettinger Signature: http://chovy.dyndns.org/hcard.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] where php at?
On 3/27/06, Rory Browne [EMAIL PROTECTED] wrote: Jim Moseby: On second thought, I'm really not sorry to have brother you -- you don't have to reply to any request for help on this list. Two-Faced SOB - One minute you're sorry, the next you're not. Make up your gd Mind. Furthermore, I'm not asking you to provide me with how to connect to my host's server -- I've done that and that's not the problem. What I was asking for was some help, which Warren was capable of both understanding and providing. That's being pedantic. Da monsewers point still stands. If your host can't give you details of its host, we would have difficulty given that we don't have access to them. It would probably fall on the point that Warren managed to write a script to extract the details - but that wasn't the point you made. Now maybe you didn't mean to come off as you did, but if positions were reversed, I like to think I wouldn't. How would you like to come across? As an ungrateful SOB who can't take some constructive critisism? You have some growing up to do before entering el big bad world. Babies these days... I'll add more to this tomorrow morning when I'm sober. tedd -- In a related question, I have php5 installed on my box (works fine with Apache2)...but I can't seem to find php5 on the command line. Is there a separate package I need (fyi: I'm using Gentoo). -- Anthony Ettinger Signature: http://chovy.dyndns.org/hcard.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] where php at?
On 3/27/06, Ryan A [EMAIL PROTECTED] wrote: Ooops, and lets not forget this one: curl http://www.yoursite.com/path/to/script/yourscript.php you can put that in your cron job by going to cpanel its a long way round but sometimes it can be usefulyou should have CURL installed of course. The good thing about the above is it does not matter where the heck your php is installed or if you have the shebang or not... HTH again. Cheers, Ryan $which php returns nothing $whereis php php: /etc/ph $ ls /etc/php apache2-php4 apache2-php5 cli-php4 I don't think the binary php exists on my system. The only php* binary matches I have are: $ php php-config phpize I think cli-php4 is the command-line-interface php.ini file for php4, but the binary is no longer on my system. If anyone knows...otherwise, I'll redirect to #gentoo -- Anthony Ettinger Signature: http://chovy.dyndns.org/hcard.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] where php at?
On 3/27/06, Anthony Ettinger [EMAIL PROTECTED] wrote: On 3/27/06, Ryan A [EMAIL PROTECTED] wrote: Ooops, and lets not forget this one: curl http://www.yoursite.com/path/to/script/yourscript.php you can put that in your cron job by going to cpanel its a long way round but sometimes it can be usefulyou should have CURL installed of course. The good thing about the above is it does not matter where the heck your php is installed or if you have the shebang or not... HTH again. Cheers, Ryan $which php returns nothing $whereis php php: /etc/ph $ ls /etc/php apache2-php4 apache2-php5 cli-php4 I don't think the binary php exists on my system. The only php* binary matches I have are: $ php php-config phpize I think cli-php4 is the command-line-interface php.ini file for php4, but the binary is no longer on my system. If anyone knows...otherwise, I'll redirect to #gentoo fyi: i didn't have the cli use flag set when I installed php5. -- Anthony Ettinger Signature: http://chovy.dyndns.org/hcard.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] security risk by using remote files with include(); ?
On 3/24/06, Chris Shiflett [EMAIL PROTECTED] wrote: Merlin wrote: I am wondering if I am opening a potential security risk by including files on remote servers. Yes. I am doing an include ('http:/www.server.com/file.html') inside a php script of mine to seperate content from function. Content is produced by a friend of mine and I do not want to grant access to my server to him. You already are. You're basically instructing PHP to evaluate file.html as PHP code, so your friend can execute any PHP code on your server. If you only want to display file.html, use readfile(). This reduces your risk from remote code injection to cross-site scripting (XSS). If including ? phpinfo(); ? into his file, I do get the info of php and I believe it is the phpinfo of my server. If he's executing phpinfo() on his server, it's going to describe his server. If he's outputting: ?php phpinfo(); ? Then you're going to execute that when you include it. That lets me believe that he could write now any php code which would be ececuted on my server. Is that right? And if yes, what can I do against it? Use readfile(), but remember that this allows him to inject anything he likes into the content you send users, so your passing your risk onto your users. Chris If you don't trust him enough to give him access to your server, why are you letting him dynamically include code? -- Anthony Ettinger Signature: http://chovy.dyndns.org/hcard.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] using DOM functions with embedded html / encoding
saveHTML();? instead of saveXML(); On 3/21/06, jonathan [EMAIL PROTECTED] wrote: I'm interested in creating an xml doc from my php5/mysql 4.1 app. I'm using PHP's DOM functions to create the xml file. Some of the text fields now have well-formed html embedded in them. When I do a $dom-createElement('item_name', $clean_slot), it encodes the values to lt;bgt; for b. How would I suppress this behavior. It doesn't look like there is any other variable I can pass to createElement or to appendChild. thanks, jonathan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Anthony Ettinger Signature: http://chovy.dyndns.org/hcard.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] is there a guide for pda friendly web pages
xsl-fo On 3/21/06, tedd [EMAIL PROTECTED] wrote: is there a guide for pda friendly web pages. Rick: After all the ribbing (after all your's is a CSS question to a PHP list) -- but, you might try: http://www.w3.org/TR/css-mobile http://www.w3.org/2004/09/mwi-workshop-cfp.html http://www.webmonkey.com//04/12/index4a.html http://www.openmobilealliance.org/ http://www.macedition.com/cb/resources/handheldbrowsercsssupport.html http://my.opera.com/community/dev/device/ http://my.opera.com/community/netmeetings/designmobile/ http://www.opera.com/docs/specs/css/ HTH's tedd -- http://sperling.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Anthony Ettinger Signature: http://chovy.dyndns.org/hcard.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] using DOM functions with embedded html / encoding
...or you may have to decode the html entities first. On 3/21/06, Anthony Ettinger [EMAIL PROTECTED] wrote: saveHTML();? instead of saveXML(); On 3/21/06, jonathan [EMAIL PROTECTED] wrote: I'm interested in creating an xml doc from my php5/mysql 4.1 app. I'm using PHP's DOM functions to create the xml file. Some of the text fields now have well-formed html embedded in them. When I do a $dom-createElement('item_name', $clean_slot), it encodes the values to lt;bgt; for b. How would I suppress this behavior. It doesn't look like there is any other variable I can pass to createElement or to appendChild. thanks, jonathan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Anthony Ettinger Signature: http://chovy.dyndns.org/hcard.html -- Anthony Ettinger Signature: http://chovy.dyndns.org/hcard.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] yahoo webshosting
dreamhost.com On 3/16/06, Jay Blanchard [EMAIL PROTECTED] wrote: [snip] Does anyone use yahoo webhosting? I have a question about enabling php ftp module or something like that. [/snip] No. I have answers about enabling php ftp module or something like that. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Anthony Ettinger Signature: http://chovy.dyndns.org/hcard.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] help with setting menu styles with PHP
I did something similar on my page. I did a simple comparison in a loop through the menu DOM, foreach ($nodeList as $node){ if ($currentPage eq $nodeHref) { //set class attribute = 'active'; } } On 3/16/06, tedd [EMAIL PROTECTED] wrote: http://www.inspired-evolution.com/About_Me.php What I want to do next is to change the menu from being hard coded on all of my pages to being an include making the menu more manageable. The stumbling block is I want to be able to keep the CSS functionality where you have the active indicator which has different CSS for the link of the page you are on. I have seen this done with PHP before with something like IF on active page use this style ELSE use this style. Can any PHP gurus assist me in coding something like this? I don't believe it is too difficult, but beyond by scope right at the moment. It's not a php solution, but you can change it to one easy enough. This will give you the idea. http://www.sperling.com/examples/menu_aware/ tedd -- http://sperling.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Anthony Ettinger Signature: http://chovy.dyndns.org/hcard.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php 5 installation problem
dreamhost let's you choose php4 or 5, as I'm sure others do as well. On 3/16/06, Jochem Maas [EMAIL PROTECTED] wrote: tedd wrote: Hi gang: I asked my host to install the current versions of php 5 and the following was his answer: Sorry but php has some issues with cpanel. cpanel has issues with php5 not the other way around :-) Anyone heard of any problems or a work-around? get a different hosting provider. ;-) in the mean time why not install a cpoy of apache/php5/mysql/etc on your local PC and play with that? Thanks. tedd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Anthony Ettinger Signature: http://chovy.dyndns.org/hcard.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php 5 installation problem
On 3/16/06, Miles Thompson [EMAIL PROTECTED] wrote: At 05:40 PM 3/16/2006, Anthony Ettinger wrote: dreamhost let's you choose php4 or 5, as I'm sure others do as well. snipped all 'dat stuff A little more on dreamhost. PHP5 is installed as CGI, not Apache module. Is there a drawback to running php5 as CGI? -- Anthony Ettinger Signature: http://chovy.dyndns.org/hcard.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is this password protection script secure?
On 3/14/06, IG [EMAIL PROTECTED] wrote: Hello. I got a password protected login script of t'internet a while back and have implemented it. I just want to make sure it is secure. I am aware that the password is stored directly in the database and I don't think this is a good thing. If the following could be looked at to see if there are any improvements I would be most grateful. The script is then called on each page that requires password protection thus- ? session_start(); include('login.php'); ? Here is the code for login.php- ? if(!isset($username) | !isset($password)) { // escape from php mode. ? htmlhead/headbody form action=?=$PHP_SELF??if($QUERY_STRING){ echo?. $QUERY_STRING;}? method=POST name=customerlogin id=customerlogin table width=300 tr tdUsername:/td tdinput name=username type=text/td /tr tr tdPassword:/td tdinput name=password type=password/td /tr tr tdnbsp;/td tdinput type=submit class=formy value=Logingt;gt;gt;/td/tr/table /form /body /html ? exit(); } // If all is well so far. session_register(table_id); session_register(name); session_register(Forenames); session_register(Surname); session_register(username); session_register(password); session_register(pw); // register username and password as session variables. $link = mysql_connect(MYSQL_DATABASE_SERVER, MYSQL_USERNAME, MYSQL_PW) or die(--Could not connect--); mysql_select_db(MYSQL_DATABASE_NAME) or die(-- Could not select database--); $sql = SELECT `id`, `Surname`, `Forenames`, `username`, `pw` FROM MYSQL_TABLE_NAME WHERE `username` = '$username'; $result = mysql_query($sql) or die(Query failed 888); list($table_id, $Surname, $Forenames, $un, $pw) = mysql_fetch_row($result); $numrows = mysql_num_rows($result); if($numrows != 0 AND $password == $pw) { $valid_user = 1; $name = $Forenames. .$Surname; } else { $valid_user = 0; } // If the username exists and pass is correct, don't pop up the login code again. // If info can't be found or verified if (!($valid_user)) { session_unset(); // Unset session variables. session_destroy(); // End Session we created earlier. // escape from php mode. ? htmlhead/headbody form action=?=$PHP_SELF??if($QUERY_STRING){ echo?. $QUERY_STRING;}? method=POST Incorrect username and/or password. Please enter correct ones to log in: table width=300 tr tdUsername:/td tdinput name=username type=text/td /tr tr tdPassword:/td tdinput name=password type=password/td /tr tr tdnbsp;/td tdinput type=submit class=formy value=Logingt;gt;gt;/td/tr/table /body /html ? exit(); } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php You should encrypt the password in the database, with a one-way hash, then you simply compare what's in your db to what the login form submits. That way if you get hacked, or your admin goes postal, you won't have people's unencrypted passwords in the database. -- Anthony Ettinger Signature: http://chovy.dyndns.org/hcard.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Phone number validation
On 3/12/06, tedd [EMAIL PROTECTED] wrote: Paul: Also check out: http://www.weberdev.com/get_example-3605.html tedd Hi all, I am trying to validate phone numbers in a web form that I have created. I am using a regular expression to validate the phone number. It seems when I enter the phone number in the following ways I get errors (123) 456 7890 123 456 7890 (123) 456 - 7890 123 456-7890 I am using the ereg method in php to test the regular expression. Here is the Regular Expression that I am using to test against potential phone numbers $validPhone = ^([0-9]{3}[ ]*)?[0-9]{3}[ ]*[0-9]{4}$; By the way The phone numbers are in US format. If anyone can help me with this I would really appreciate it. Thanks, Paul -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- One suggestion is to have 1 field for all countries, I believe the total is 23? +011-049-069-13788-1234 http://sperling.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Anthony Ettinger Signature: http://chovy.dyndns.org/hcard.html
Re: [PHP] Re: Possible hacker using php script to send e-mails?
It's possible that they are including in email headers in the body. On 3/11/06, João Cândido de Souza Neto [EMAIL PROTECTED] wrote: If possible, i like to see this script to try to know exactly wath's happen. Merlin wrote: Hi there, I am running php 4.x on a suse 9.x machine. There is a php script which resides on a webapp that is responsible for sending e-mail to myself in case of errors like db-errors or similar. Called error.php This script does include phpmailer and uses it to send the e-mails to me. Now I am receiving on the e-mail specified as TO: e-mails with different subject than specified and different text?! All english text with wired sentences, must be a bot or so. How is this possible? The subject line is fixed and right after that commend send is executed. So no idea how they do it and how I can prevent it. It looks like this: $mail-Subject = 'Fehlerbericht'; $mail-Send(); How is it possible that they change this subject line? I checked the server log and each time an e-mail has been sent to me of that kind there is a logentry in apache log that says that this script has been executed. So the e-mails definatelly come from that script?! Can anybody help? Regards, Merlin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Anthony Ettinger Signature: http://chovy.dyndns.org/hcard.html
Re: [PHP] preg_replace problem (or possibly bug)
On 3/8/06, Michael [EMAIL PROTECTED] wrote: I am currently writing a forum system, but at the moment I have a bug that no one can seem to get to the root cause of. Basically I am using preg_replace with the pattern as '\[url=(.*?)\](.*?)\[/url\]'is. However for most links it works fine but for others it just doesn't render the bbcode to a link, we were trying to get to the root cause of it here http://michael-m.co.uk/forums/index.php?action=view_topicid=31page=1 but we failed. I'm not really that good with regular expresions so that might explain why. Also we had never noticed these problems until about 3 days ago, but I see no reason why it could have started. All help will be greatly appreciated, you may use the username php and the password php to log on to do your own tests but please keep the testing to the topic (and the spam forum if necessary). Many Thanks, Michael Mulqueen michael-m.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Is the last / interferring? Might want to try \[\/url\], in most regex engines / is used as the separater between the s/search/replace/si; -- Anthony Ettinger Signature: http://chovy.dyndns.org/hcard.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Classes and OOP
On 3/7/06, Wolf [EMAIL PROTECTED] wrote: I'm looking for a couple of good books or online sources where I can get a lot better grasp of Classes and OOP programming in general. Mostly I use PHP so that is the best option. Thanks, Robert PHP5 - Objects, Patterns, and Best Practices (publisher apress) http://tinyurl.com/ohybj I just finished reading this book, it's an excellent source for OOP with php5. Also includes common patterns, complete with UML diagrams, something you rarely see in programming books, at least the ones I've read. -- Anthony Ettinger Signature: http://chovy.dyndns.org/hcard.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Mysql Rows
On 3/6/06, Dusty Bin [EMAIL PROTECTED] wrote: Another point to consider, is that Tedds method of renumbering the rows, *may* not preserve the original sequence. I have not checked the mysql source, but if some delete activity has occurred in the table, then there will be holes in the data, in some circumstances, inserting further records to the table, some may go on the end, and some may fill the holes. I suspect that using Tedd's method of dropping the column, and then re-adding the column, the auto increment, will either be added in the physical sequence of the table, or added in the order of any index that may be traversed in this process. As an extreme example, if one had a table with 5 million rows, and then deleted the first 4.5 million rows, where will the next insert go? One of the benefits of a relational database, is that you do not need to consider how the data is physically stored. Best regards... Dusty [EMAIL PROTECTED] wrote: [snip] That's the reason when I started this thread I made it clear that I was NOT talking about a relational dB but rather a simple flat file. What I find interesting in all of this exchange -- however -- is that everyone agree's renumbering the id of a dB is something you don't do, but no one can come up with a concrete (other than relational) reason why. [/snip] Tedd, several here, including me, have said that if you have only a single table database that renumbering is OK, just not a preferred practice. (BTW, you never answered my question about this being a flat file database or single table, although I have figured it out now.) Renumber to your heart's content. If your users are allowed delete privileges (ACK!) and you don't want to confuse them, go ahead and renumber. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Not to mention adding other tables which references those numbers as a foreign key. Seems like the wrong way to do it in my opinion. Business logic should be abstracted from the database layer and handled in the source code, rather than relying on re-factoring the database everytime you want a count. -- Anthony Ettinger Signature: http://chovy.dyndns.org/hcard.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Mysql Rows
On 3/6/06, Jim Moseby [EMAIL PROTECTED] wrote: What I find interesting in all of this exchange -- however -- is that everyone agree's renumbering the id of a dB is something you don't do, but no one can come up with a concrete (other than relational) reason why. If you don't care that a given record may have a different, unpredictable record number each time its queried, and if you're sure no one is going to inherit this application and be stymied by your unorthodox approach, and if you know that in the future you will not need to access this data by a static record number, it doesn't matter. Otherwise, my advice would be to add a timestamp column and sort by that instead. JM -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php I think the main reason is fora more extensible design. Sure, you may only have the 1 table now, and think you never will enhance your functionality...but as soon as you do comes up with a new scenario, you'll have to change the current behavior...easier to plan for that ahead of time. Technically, it works the way you want it...there's no right or wrong way, just degrees of flexibility, and it so happens this method seems inflexible from what I gather. -- Anthony Ettinger Signature: http://chovy.dyndns.org/hcard.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Prepared statements
On 3/5/06, Curt Zirzow [EMAIL PROTECTED] wrote: On Sun, Mar 05, 2006 at 04:03:17AM +0100, Julius Hacker wrote: On 3/4/06, Julius Hacker [EMAIL PROTECTED] wrote: Before that foreach, I use mysqli_stmt_init, mysql_stmt_prepare and mysql_stmt_bind_param. In the foreach-loop I give the variables, which I bound with bind_param, their values and want to execute the statement. But now MySQL returns always an error. It seems that the values I gave the variables in the loop aren't used because I used bind_param before that. In the example for mysql_bind_param they do it like me. Is the example also wrong or do I have to consider something special? ... MySQL returns Column 'auction_house' cannot be null. Here're some parts of my code: --- code --- ... $insert = $this-sql-stmt_init(); $insert-prepare(INSERT INTO auctions (auction_house, name, link, prize, runtime, bids, picture) VALUES (?, ?, ?, ?, ?, ?, ?)); $insert-bind_param(issdsis, $auction_house[id], $auction_parts[name], $auction_parts[link], $auction_parts[prize], $auction_parts[runtime], $auction_parts[bids], $auction_parts[picture]); --- /code --- I assume your loop is something like: while(condition) { $auction_parts['id'] = 'some value'; $auction_parts['name'] = 'some value'; ... $insert-execute(); } My first guess would be, if not aleady done, initialize $auction_parts before you do your bind_param() with something like: $auction_parts = array('id' = null, 'name' = null, ...); $insert-bind_param(issdsis, $auction_house[id], ...); Curt. -- cat .signature: No such file or directory -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php might want to read up on bind_param. I'ts been awhile since I did this in Perl. -- Anthony Ettinger Signature: http://chovy.dyndns.org/hcard.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Prepared statements
On 3/4/06, Julius Hacker [EMAIL PROTECTED] wrote: One other thing: If I do the bind_param within the loop, it just works. The curious is that I have to prepared statements for this loop (one for inserting data and one for updating data) and the one for updating data works and that for inserting don't. Both statements are 100% valid. Julius Hacker wrote: Hi, so I need help again: I want to use prepared statements to insert lots of data in my MySQL-database. For that I use foreach because I have an array containing all necessary information. Before that foreach, I use mysqli_stmt_init, mysql_stmt_prepare and mysql_stmt_bind_param. In the foreach-loop I give the variables, which I bound with bind_param, their values and want to execute the statement. But now MySQL returns always an error. It seems that the values I gave the variables in the loop aren't used because I used bind_param before that. In the example for mysql_bind_param they do it like me. Is the example also wrong or do I have to consider something special? -- Regards Julius Hacker http://www.julius-hacker.de [EMAIL PROTECTED] OpenPGP-Key-ID: 0x4B4A486E -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Can you dump the error string reported back from the mysql database connection? Could provide some insight as to why your INSERT fails, and the UPDATE works. -- Anthony Ettinger Signature: http://chovy.dyndns.org/hcard.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Mysql Rows
define $1 = 0 outside your loop. i'm curious why you are relying on row-order in the database? Typically you'd have a PRIMARY KEY auto_increment for something like this. On 3/3/06, benifactor [EMAIL PROTECTED] wrote: i need to find a way to find out what number of a row is in a database... for example: //this is the database Username: Chuck Password: adsasa Username: jimmy Password: adsf Username: stewart Password: dfds the information i need is what row jimmy resides on.. this is what i tried: function i_gun ($user) { global $username; $gun = mysql_query(select * from users); while ($d = mysql_fetch_array($gun)) { while($d[username] != $user) { $i = $i + 1; } } } but it always returns 1. can sombody tell me what i am doing wrong or point me in the right direction in the manual? plase and thank you -- Anthony Ettinger Signature: http://chovy.dyndns.org/hcard.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Prepared statements
are you executing the statement in your loop too? On 3/3/06, Julius Hacker [EMAIL PROTECTED] wrote: Hi, so I need help again: I want to use prepared statements to insert lots of data in my MySQL-database. For that I use foreach because I have an array containing all necessary information. Before that foreach, I use mysqli_stmt_init, mysql_stmt_prepare and mysql_stmt_bind_param. In the foreach-loop I give the variables, which I bound with bind_param, their values and want to execute the statement. But now MySQL returns always an error. It seems that the values I gave the variables in the loop aren't used because I used bind_param before that. In the example for mysql_bind_param they do it like me. Is the example also wrong or do I have to consider something special? -- Regards Julius Hacker http://www.julius-hacker.de [EMAIL PROTECTED] OpenPGP-Key-ID: 0x4B4A486E -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Anthony Ettinger Signature: http://chovy.dyndns.org/hcard.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Mysql Rows
On 3/3/06, Murray @ PlanetThoughtful [EMAIL PROTECTED] wrote: On 4/03/2006 2:49 PM, benifactor wrote: thank you. the table does have and id feild that auto increments, however if you delete a user there will be a gap between the users between which would not be what is not acurate enough. thank you for you help. simple fix. i should have caught it. - Original Message - From: Anthony Ettinger [EMAIL PROTECTED] To: benifactor [EMAIL PROTECTED] Cc: php php-general@lists.php.net Sent: Friday, March 03, 2006 3:52 PM Subject: Re: [PHP] Mysql Rows define $1 = 0 outside your loop. i'm curious why you are relying on row-order in the database? Typically you'd have a PRIMARY KEY auto_increment for something like this. I have to agree with Anthony - why are you using row order to determine something relating to users? I couldn't follow your brief explanation above, and the fact that you're doing it sets off some soft alarm bells about the design of your application. Why is it important that there shouldn't be any 'gaps' between users? Because you want to know how many users there are? If so, simply do a SELECT COUNT(*) on the table whenever / wherever you need to know. If you're using it for IDs for the users, it's generally a bad idea to reuse this type of information. If you have some other purpose, I'm extremely curious about what it might be. Much warmth, planetthoughtful --- Lost in thought http://www.planetthoughtful.org What I was getting at is you get the unique id for the username (if you allow username changes, then you want a unique key to do your joins on from other tables). -- Anthony Ettinger Signature: http://chovy.dyndns.org/hcard.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Mysql Rows
On 3/3/06, Murray @ PlanetThoughtful [EMAIL PROTECTED] wrote: I have to agree with Anthony - why are you using row order to determine something relating to users? I couldn't follow your brief explanation above, and the fact that you're doing it sets off some soft alarm bells about the design of your application. Why is it important that there shouldn't be any 'gaps' between users? Because you want to know how many users there are? If so, simply do a SELECT COUNT(*) on the table whenever / wherever you need to know. If you're using it for IDs for the users, it's generally a bad idea to reuse this type of information. If you have some other purpose, I'm extremely curious about what it might be. What I was getting at is you get the unique id for the username (if you allow username changes, then you want a unique key to do your joins on from other tables). Yep, that's one good reason among many for using unique ids. Thinking a little about the OP's question, I could understand row order being relevant in certain situations where you wanted to display something like, You were the 432nd person to register at our site!, etc. I'd do this with a timestamp, and then sorting by date and doing a count() on the results. But then again that's just me. I remember the days where i'd clear a database after testing to keep the auto_increment inline, but eventually, you will get out of sync on that, so it's not a reliable way of keeping a numerical sequence. But, too often I've seen people new to database design not liking 'gaps' because 'user1' will have a unique id of '1', while 'user2' will have a unique id of '6' because the records associated with unique ids '2' through '5' were deleted during testing, and so on. So, they feel that 'user2' should have a unique id of '2', ignoring the fact that that's not a unique id at all, if you had id '2' associated with another record at some point. I'm not suggesting this is what the OP is doing, just that that's why I was curious about the purpose. Much warmth, planetthoughtful --- Lost in thought http://www.planetthoughtful.org -- Anthony Ettinger Signature: http://chovy.dyndns.org/hcard.html
[PHP] How do I ...
Hi! How do I un-subscribe to this list? Thank you! Anthony (Tony) Rodriguez ([EMAIL PROTECTED]) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How do I ...
Hi! How do I un-subscribe to this list? Thank you! Anthony (Tony) Rodriguez ([EMAIL PROTECTED]) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Displaying Form Errors
On 3/2/06, Paul Goepfert [EMAIL PROTECTED] wrote: Hello all, I am building a web page and I don't know how to display the errors that the user may enter. OK this is how I have my web page setup: I first do a isset check on $submit. And I am not sure about this. I believe that this variable is set when i click on the submit button. I don't have a $submit variable assigned to anything in my web page. What I would like is to have $submit assigned to the submit button. How do I do that? In the if block I do my validation of the web form. In the else block I have the contents of the page. I have posted this question before and I got some good pointers on how I should go about doing my validation but I have not yet figured out how to display the errors on the page. Could someone help me with that. I am doing the validation on the same page as the web page. I don't forward to a new page to do the validation. Thanks Paul -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php post it to itself ie - action=submit.php, and your data will end up in $_request[name1]; validate these, if an error occurs, I would add class=error to the html element, and use css to display it as red. And dump an error message above the form, make sure you validate all fields before breaking out, track them in an $errors = array(); ...makes for a better user experience. Typically, there is a hidden field called run or mode indicating what flow you're in. form action=controller.php method=post id=login input type=hidden name=run value=login/ fieldset legendLogin/legend labelUsername:/label input type=text name=username/ labelPassword:/label input type=password name=password/ /fieldset /form -- Anthony Ettinger Signature: http://chovy.dyndns.org/hcard.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] preg_replace - I don't have a clue
On 1/12/06, Frank Bax [EMAIL PROTECTED] wrote: reg_replace( ' (\d+\$)', '+$0', $prop ); /* results in dollar-alpha-space-space-plus-digits-dollar */ $Fencing +11$Lumber +17$Weight: 317 Stones$Energy Resist 2%$ Try: preg_replace( '/ (\d+\$)/', '+$1', $prop ); -- Anthony Best