Re: [PHP] Re: Scratch that
you're still issuing an HTTP request to get it, or executing perl on the command line... if it's a true non-profit 503(c)(3), you could offer someone the chance to write off their services... non-profits may not have a lot of money to spare but they do typically have money to fund things in the organization's interests... hopefully. On 1/9/08, Liam [EMAIL PROTECTED] wrote: My non-profit setup makes that 'Pay Someone' alternative. What I am planning on doing: When the script is called, it is equivilent of using the want=ssilinks GET parameter. So therefore, all I need to do is get the HTML returned from the script, not the contents of the script itself. Can anyone help now? -- 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] Get Parameters in Includes [SOLVED!!!]
mike wrote: you're still issuing an HTTP request to get it, or executing perl on the command line... if it's a true non-profit 503(c)(3), you could offer someone the chance to write off their services... non-profits may not have a lot of money to spare but they do typically have money to fund things in the organization's interests... hopefully. Well, heh, I am really the only person behind my organization, and I'm under 18, so I can't get a PayPal account or whatever and accumulate donations either. However, I did find a cURL solution: this is the code behind it for anyone else who had/has this problem: ?php $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,http://goldenlightsoft.org/cgi-bin/lt/linktrade.cgi?want=ssilinks;); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); $result=curl_exec ($ch); curl_close ($ch); echo $result ? Now, I just need to look into parsing the text. Thanks everyone for your assistance, I'll be sure to come back here and frustrate you with any future problems I have. :] :P -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Get Parameters in Includes [SOLVED!!!]
yeah - well you said you can't issue an http request although it depends - if your reporting is javascript/browser-executable, or if it's a server-side increment. if it's javascript, no worries, the curl request won't execute it. On 1/10/08, Liam [EMAIL PROTECTED] wrote: mike wrote: you're still issuing an HTTP request to get it, or executing perl on the command line... if it's a true non-profit 503(c)(3), you could offer someone the chance to write off their services... non-profits may not have a lot of money to spare but they do typically have money to fund things in the organization's interests... hopefully. Well, heh, I am really the only person behind my organization, and I'm under 18, so I can't get a PayPal account or whatever and accumulate donations either. However, I did find a cURL solution: this is the code behind it for anyone else who had/has this problem: ?php $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,http://goldenlightsoft.org/cgi-bin/lt/linktrade.cgi?want=ssilinks;); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); $result=curl_exec ($ch); curl_close ($ch); echo $result ? Now, I just need to look into parsing the text. Thanks everyone for your assistance, I'll be sure to come back here and frustrate you with any future problems I have. :] :P -- 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] Get Parameters in Includes [SOLVED!!!]
mike wrote: yeah - well you said you can't issue an http request although it depends - if your reporting is javascript/browser-executable, or if it's a server-side increment. if it's javascript, no worries, the curl request won't execute it. On 1/10/08, Liam [EMAIL PROTECTED] wrote: mike wrote: you're still issuing an HTTP request to get it, or executing perl on the command line... if it's a true non-profit 503(c)(3), you could offer someone the chance to write off their services... non-profits may not have a lot of money to spare but they do typically have money to fund things in the organization's interests... hopefully. Well, heh, I am really the only person behind my organization, and I'm under 18, so I can't get a PayPal account or whatever and accumulate donations either. However, I did find a cURL solution: this is the code behind it for anyone else who had/has this problem: ?php $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,http://goldenlightsoft.org/cgi-bin/lt/linktrade.cgi?want=ssilinks;); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); $result=curl_exec ($ch); curl_close ($ch); echo $result ? Now, I just need to look into parsing the text. Thanks everyone for your assistance, I'll be sure to come back here and frustrate you with any future problems I have. :] :P -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php It's a server side log thing. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Closures in PHP
Is there any functionality in PHP similar to closures? Are there any plans to add it..? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Closures in PHP
John Papas schreef: Is there any functionality in PHP similar to closures? Are there any plans to add it..? read the archives of the php internals or all posts pertaining to closures, that will answer all your questions. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Get Parameters in Includes [SOLVED!!!]
On Jan 10, 2008 4:00 AM, Liam [EMAIL PROTECTED] wrote: Thanks everyone for your assistance, I'll be sure to come back here and frustrate you with any future problems I have. :] :P That's fine, and it's for that reason this list exists, but here's a couple of pointers: 1.) Keep the attitude and sarcasm to a minimum (or follow it by a smiley face so it looks like you're not that rude). 2.) Keep ALL RELATED POSTS in one thread. It was a little overboard to have to follow your conversation across five separate threads, and that doesn't help people searching on Google (or directly in the archives) use your experience to solve a similar problem. Aside from that, parsing the text should be no problem. Depending on what you want to do, regexps are probably the way you want to do it, just as a heads-up. For that, look into the preg_*() and ereg() families. -- /Dan Daniel P. Brown Senior Unix Geek and #1 Rated Year's Coolest Guy By Self Since 1979. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Jpeg Uploads Corrupting
On Jan 9, 2008 7:57 PM, Jim Lucas [EMAIL PROTECTED] wrote: Scott Wilcox wrote: Greetings folks, I'm having a few issues with PHP this evening. I'm uploading various jpg images, doing a resize via GD, and then storing the image in a database. [snip!] First, start your own thread next time. Don't hijack someone else's. Now a question. Are you doing an error redirect for /account/photo ?? if so, the post data is not carried through the error redirect. Jim, This came through as a brand-new thread, complete with it's own IDs and all, on Gmail. What client/version are you using? I'd seriously like to check it out, because I'd rather have threads staying in-place as they should. Gmail has a habit of starting new threads for Re: [SUBJECT] messages and the like. -- /Dan Daniel P. Brown Senior Unix Geek and #1 Rated Year's Coolest Guy By Self Since 1979. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Jpeg Uploads Corrupting
Daniel Brown wrote: On Jan 9, 2008 7:57 PM, Jim Lucas [EMAIL PROTECTED] wrote: Scott Wilcox wrote: Greetings folks, I'm having a few issues with PHP this evening. I'm uploading various jpg images, doing a resize via GD, and then storing the image in a database. [snip!] First, start your own thread next time. Don't hijack someone else's. Now a question. Are you doing an error redirect for /account/photo ?? if so, the post data is not carried through the error redirect. Jim, This came through as a brand-new thread, complete with it's own IDs and all, on Gmail. What client/version are you using? I'd seriously like to check it out, because I'd rather have threads staying in-place as they should. Gmail has a habit of starting new threads for Re: [SUBJECT] messages and the like. Daniel - all the messages in this thread have a message id of References: [EMAIL PROTECTED] So correct threading will group them altogether. If an existing message is 'replied to' even if the title is changed, the threading reference will still be maintained. -- Lester Caine - G8HFL - Contact - http://home.lsces.co.uk/lsces/wiki/?page=contact L.S.Caine Electronic Services - http://home.lsces.co.uk MEDW - http://home.lsces.co.uk/ModelEngineersDigitalWorkshop/ Firebird - http://www.firebirdsql.org/index.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Jpeg Uploads Corrupting
Lester Caine wrote: Daniel Brown wrote: On Jan 9, 2008 7:57 PM, Jim Lucas [EMAIL PROTECTED] wrote: Scott Wilcox wrote: Greetings folks, I'm having a few issues with PHP this evening. I'm uploading various jpg images, doing a resize via GD, and then storing the image in a database. [snip!] First, start your own thread next time. Don't hijack someone else's. Now a question. Are you doing an error redirect for /account/photo ?? if so, the post data is not carried through the error redirect. Jim, This came through as a brand-new thread, complete with it's own IDs and all, on Gmail. What client/version are you using? I'd seriously like to check it out, because I'd rather have threads staying in-place as they should. Gmail has a habit of starting new threads for Re: [SUBJECT] messages and the like. Daniel - all the messages in this thread have a message id of References: [EMAIL PROTECTED] So correct threading will group them altogether. That is exactly the problem, Gmail ignores the message-id header and groups messages by Subject, not correct standard threading. This is my biggest problem with Gmail. I have requested this standard view to be added, with no response from them. If an existing message is 'replied to' even if the title is changed, the threading reference will still be maintained. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Jpeg Uploads Corrupting
On Jan 10, 2008 11:12 AM, Lester Caine [EMAIL PROTECTED] wrote: Daniel - all the messages in this thread have a message id of References: [EMAIL PROTECTED] So correct threading will group them altogether. If an existing message is 'replied to' even if the title is changed, the threading reference will still be maintained. That is correct, thank you. You may have noticed that I alluded to the fact that Gmail doesn't work as it should, and thus the threads don't remain intact. I know what the problem is and how to fix it (i.e. - using POP3/IMAP to grab from Gmail and use a better client), I was simply asking Jim what client he is using. -- /Dan Daniel P. Brown Senior Unix Geek and #1 Rated Year's Coolest Guy By Self Since 1979. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Jpeg Uploads Corrupting
Daniel Brown wrote: On Jan 10, 2008 11:12 AM, Lester Caine [EMAIL PROTECTED] wrote: Daniel - all the messages in this thread have a message id of References: [EMAIL PROTECTED] So correct threading will group them altogether. If an existing message is 'replied to' even if the title is changed, the threading reference will still be maintained. That is correct, thank you. You may have noticed that I alluded to the fact that Gmail doesn't work as it should, and thus the threads don't remain intact. I know what the problem is and how to fix it (i.e. - using POP3/IMAP to grab from Gmail and use a better client), I was simply asking Jim what client he is using. I use Thunderbird to view my php mailing list account. I use Gmail for my personal accounts. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Dependant listboxes
Hi everybody. I have a page with 3 combo box that contains rows from an oracle database. What I want to do, is to make those list dependant one from another. Let say that I have the combo boxes on a page1.php, then on change the first list box, reload the page1.php and make the selection of the second listbox, on change on the second box, the third listbox will be filled. Then, pressing the submit button, I want to go to the page2.php I dont want to use javascript. Does anyone knows where can I find an example to implement the dependant lists? Thanks in advance.
Re: [PHP] Dependant listboxes
On Jan 10, 2008 11:43 AM, Humani Power [EMAIL PROTECTED] wrote: Hi everybody. I have a page with 3 combo box that contains rows from an oracle database. What I want to do, is to make those list dependant one from another. Let say that I have the combo boxes on a page1.php, then on change the first list box, reload the page1.php and make the selection of the second listbox, on change on the second box, the third listbox will be filled. Then, pressing the submit button, I want to go to the page2.php I dont want to use javascript. Does anyone knows where can I find an example to implement the dependant lists? There's no way to do that without JavaScript (or some other client-side scripting - such as WSH, VBSH, AS, or whatever else may be available). In fact, onChange is a client-side command. -- /Dan Daniel P. Brown Senior Unix Geek and #1 Rated Year's Coolest Guy By Self Since 1979. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Unable to override status code in certain installations..?
It's the exact same situation as this bug: http://bugs.php.net/bug.php?id=24177 except, that bug was fixed back in PHP 4... In my case, the server that works is running PHP 5.2.2, and the server that DOESN'T work is running PHP 5.2.3! So either it's a bug that cropped up (again) after 5.2.2, or there's another factor here.. (For instance, the server on which it doesn't work is running Apache 1.3.37, and the server that handles it correctly is running Apache 2.2.4.) At least knowing that it's (likely) a bug, and not an obscure config setting, is something. If no-one else has any other suggestions, I guess I'll submit a bug report? Richard Lynch wrote: On Wed, January 9, 2008 4:35 pm, RavenWorks wrote: I'm currently trying to create a system where a custom 404 ErrorDocument in PHP is able to 301 Redirect the browser in certain cases. This works fine on some servers, however, on some other servers the PHP script seems to be unable to replace the 404 header. Correctly overrides with '200' status: http://fidelfilms.ca/redirectTest/ Unable to override default '404' status: http://fraticelli.info/redirectTest/ Those two pages will look the same in a browser window, but one returns 404 and one returns 200 (as it should, because of the header() call) -- check with whatever browser plugin you prefer for reading HTTP headers, such as Live HTTP Headers for Firefox. Returning the correct status code is important because we're migrating a site from one domain to another, and we don't want to lose ranking in search engines. (In the examples above, I return 200 as a test, but in practice this will be used to 301 all visitors -- and search engines -- to the new domain.) My question is this: What causes PHP to be able to override the ErrorDocument status on some servers and not others? Is it caused by PHP's behavior or Apache? Is this a configurable option, or was the behavior permanently changed in a given version of either? I think you are falling prey to a PHP bug. You should be able to find it in: http://bugs.php.net You could also check the ChangeLogs: http://php.net/ChangeLog-5.php http://php.net/ChangeLog-4.php I could be wrong, as my memory is rather vague on this one, and it's always possible that you have similar/same symptoms with an entirely different issue. -- View this message in context: http://www.nabble.com/Unable-to-override-status-code-in-certain-installations..--tp14723283p14738708.html Sent from the PHP - General mailing list archive at Nabble.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Dependant listboxes
2008. 01. 10, csütörtök keltezéssel 10.43-kor Humani Power ezt írta: Hi everybody. I have a page with 3 combo box that contains rows from an oracle database. What I want to do, is to make those list dependant one from another. Let say that I have the combo boxes on a page1.php, then on change the first list box, reload the page1.php and make the selection of the second listbox, on change on the second box, the third listbox will be filled. Then, pressing the submit button, I want to go to the page2.php I dont want to use javascript. Does anyone knows where can I find an example to implement the dependant lists? with javascript. greets Zoltán Németh Thanks in advance. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Dependant listboxes
There are several ways of doing it and all involve javascript, some more than others. Here are some of the problems; . without javascript the only thing that will cause a form to be submitted to the server for rebuilding, is clicking a submit button. . with a minimal amount of javascript you can cause the form to be submitted to the server when an item is selected from the first pulldown box. . with javascript and javascript arrays, you can cause one list to cascade to the next without going to the server (maybe). On your first list if you code something like the following; select name=firstsel onChange=this.form.submit(); Note: the code inside the onChange quotes is actually javascript, but it is rather minimal, don't you think. When your form is submitted form variable firstsel will have a value, base on that you can send back to the browser the same form, with the firstsel list with one item selected, and the filled in second dependent list. This technique requires a round trip to the server and back for each selection and is not the best of user experiences, but sometimes it is all you can do. Javascript is not too painful, and I would encourage plagerism while you are learning it. You can eventually avoid sending the entire form to the server and retrieving an entire refresh of the page by using AJAX, but even there a round trip to the server is required (just not the entire form). You can find lots of useful scripts at http://www.hotscripts.com in their javascript section, a good place to see different techniques. Also Google can be your friend. HTH, Warren Vail -Original Message- From: Daniel Brown [mailto:[EMAIL PROTECTED] Sent: Thursday, January 10, 2008 8:48 AM To: Humani Power Cc: php-general@lists.php.net Subject: Re: [PHP] Dependant listboxes On Jan 10, 2008 11:43 AM, Humani Power [EMAIL PROTECTED] wrote: Hi everybody. I have a page with 3 combo box that contains rows from an oracle database. What I want to do, is to make those list dependant one from another. Let say that I have the combo boxes on a page1.php, then on change the first list box, reload the page1.php and make the selection of the second listbox, on change on the second box, the third listbox will be filled. Then, pressing the submit button, I want to go to the page2.php I dont want to use javascript. Does anyone knows where can I find an example to implement the dependant lists? There's no way to do that without JavaScript (or some other client-side scripting - such as WSH, VBSH, AS, or whatever else may be available). In fact, onChange is a client-side command. -- /Dan Daniel P. Brown Senior Unix Geek and #1 Rated Year's Coolest Guy By Self Since 1979. -- 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] uh oh, I defined a resoruce
I have been using define to create a constant for the link resource returned by mysql pconnect like so: $PL = @mysql_pconnect(localhost, $DBUser, $DBPass); define(SITE_DB,$PL); Later I use the constant to select my databases. mysql_select_db($SrcdbID ,SITE_DB); This code seems to be working as I expected and I have many thousands of llines of code done over several years using this construct. But, I happened to be reading the php doco today and noticed that you are not supposed to use define for resources, so question is, is what I am doing safe or am I going to run into problems and if so what is the best way to globally pass resources to multiple classes and functions, command line scripts etc? Cheers Charlie Reese -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] uh oh, I defined a resoruce
On Jan 10, 2008 1:33 PM, [EMAIL PROTECTED] wrote: I have been using define to create a constant for the link resource returned by mysql pconnect like so: $PL = @mysql_pconnect(localhost, $DBUser, $DBPass); define(SITE_DB,$PL); Later I use the constant to select my databases. mysql_select_db($SrcdbID ,SITE_DB); This code seems to be working as I expected and I have many thousands of llines of code done over several years using this construct. But, I happened to be reading the php doco today and noticed that you are not supposed to use define for resources, so question is, is what I am doing safe or am I going to run into problems and if so what is the best way to globally pass resources to multiple classes and functions, command line scripts etc? Cheers Charlie Reese -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Hi Charlie! Well a CONSTANT is a value that doesn't change. I don't think that makes sense for a DB connection. The connection command returns a resource that could be different on each request depending on if you've worked on different resources. You could just do this: $GLOBALS['SITE_DB'] = @mysql_pconnect(localhost, $DBUser, $DBPass); Then inside your function reference it like this: mysql_query($sql, $GLOBALS['SITE_DB']); This would be an easy mass find/replace that you could do. Global variables are evil though. I personally use the registry pattern to hold an instance of the database connection that can be lazy loaded whenever I need it. Then inside of my gateway objects I pass that instance in the constructor so they only have to know how to work with its interface. If you're okay with using object that might be a nice road to travel. You could also use the singleton pattern but I would advise against that because what if you wanted 2 instances for different databases? I've never ran across this myself but you never know. Plus it makes unit testing a little tricky since you can't mock it as easily. Hopefully something in all this will help you to an answer. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] uh oh, I defined a resoruce
On Jan 10, 2008 2:02 PM, Philip Thompson [EMAIL PROTECTED] wrote: On Jan 10, 2008, at 12:48 PM, Eric Butera wrote: On Jan 10, 2008 1:33 PM, [EMAIL PROTECTED] wrote: I have been using define to create a constant for the link resource returned by mysql pconnect like so: $PL = @mysql_pconnect(localhost, $DBUser, $DBPass); define(SITE_DB,$PL); Later I use the constant to select my databases. mysql_select_db($SrcdbID ,SITE_DB); This code seems to be working as I expected and I have many thousands of llines of code done over several years using this construct. But, I happened to be reading the php doco today and noticed that you are not supposed to use define for resources, so question is, is what I am doing safe or am I going to run into problems and if so what is the best way to globally pass resources to multiple classes and functions, command line scripts etc? Cheers Charlie Reese Hi Charlie! Well a CONSTANT is a value that doesn't change. I don't think that makes sense for a DB connection. The connection command returns a resource that could be different on each request depending on if you've worked on different resources. You could just do this: $GLOBALS['SITE_DB'] = @mysql_pconnect(localhost, $DBUser, $DBPass); Then inside your function reference it like this: mysql_query($sql, $GLOBALS['SITE_DB']); This would be an easy mass find/replace that you could do. Global variables are evil though. I personally use the registry pattern to hold an instance of the database connection that can be lazy loaded whenever I need it. Then inside of my gateway objects I pass that instance in the constructor so they only have to know how to work with its interface. If you're okay with using object that might be a nice road to travel. You could also use the singleton pattern but I would advise against that because what if you wanted 2 instances for different databases? I've never ran across this myself but you never know. Plus it makes unit testing a little tricky since you can't mock it as easily. Hopefully something in all this will help you to an answer. I don't agree that Global variables are evil. If you have a valid purpose for defining a global variable, then go with it. The usual argument is that it could accidentally be changed elsewhere (and there are several more). However, defining a variable that you KNOW you're going to use only for a database connection, IMO, is perfectly fine. $GLOBALS['SITE_DB'] = @mysql_pconnect(localhost, $DBUser, $DBPass); If you accidently change $GLOBALS['SITE_DB'] elsewhere, then I think you have some bigger issues at hand. =P HTH. ~Philip Personally, most of my web applications do not have to factor 13.7 billion years of space drift in to the calculations, so PHP's rand function has been great for me... ~S. Johnson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Depending on what project I'm working on sometimes I use specific globals on our older procedural code because: 1) It is our code 2) It does not use outside code 3) I'm the only developer working on it 4) It is very simplistic By specific globals I mean that I have a namespaced entry such as $GLOBALS['ericonly']['db'] and put things inside of ericonly. I basically only use this for database connections and a few other very specific things. Aside from that I'm not going to argue the merits of globals. Someone else can do that as I've made up my mind and so have you. :) But just to prove that I'm right http://www.google.com/search?hl=enq=global+variables+are+evilbtnG=Search :D -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] uh oh, I defined a resoruce
On 1/10/08, Eric Butera [EMAIL PROTECTED] wrote: On Jan 10, 2008 2:02 PM, Philip Thompson [EMAIL PROTECTED] wrote: On Jan 10, 2008, at 12:48 PM, Eric Butera wrote: On Jan 10, 2008 1:33 PM, [EMAIL PROTECTED] wrote: I have been using define to create a constant for the link resource returned by mysql pconnect like so: $PL = @mysql_pconnect(localhost, $DBUser, $DBPass); define(SITE_DB,$PL); Later I use the constant to select my databases. mysql_select_db($SrcdbID ,SITE_DB); This code seems to be working as I expected and I have many thousands of llines of code done over several years using this construct. But, I happened to be reading the php doco today and noticed that you are not supposed to use define for resources, so question is, is what I am doing safe or am I going to run into problems and if so what is the best way to globally pass resources to multiple classes and functions, command line scripts etc? Cheers Charlie Reese Hi Charlie! Well a CONSTANT is a value that doesn't change. I don't think that makes sense for a DB connection. The connection command returns a resource that could be different on each request depending on if you've worked on different resources. You could just do this: $GLOBALS['SITE_DB'] = @mysql_pconnect(localhost, $DBUser, $DBPass); Then inside your function reference it like this: mysql_query($sql, $GLOBALS['SITE_DB']); This would be an easy mass find/replace that you could do. Global variables are evil though. I personally use the registry pattern to hold an instance of the database connection that can be lazy loaded whenever I need it. Then inside of my gateway objects I pass that instance in the constructor so they only have to know how to work with its interface. If you're okay with using object that might be a nice road to travel. You could also use the singleton pattern but I would advise against that because what if you wanted 2 instances for different databases? I've never ran across this myself but you never know. Plus it makes unit testing a little tricky since you can't mock it as easily. Hopefully something in all this will help you to an answer. I don't agree that Global variables are evil. If you have a valid purpose for defining a global variable, then go with it. The usual argument is that it could accidentally be changed elsewhere (and there are several more). However, defining a variable that you KNOW you're going to use only for a database connection, IMO, is perfectly fine. $GLOBALS['SITE_DB'] = @mysql_pconnect(localhost, $DBUser, $DBPass); If you accidently change $GLOBALS['SITE_DB'] elsewhere, then I think you have some bigger issues at hand. =P HTH. ~Philip Personally, most of my web applications do not have to factor 13.7 billion years of space drift in to the calculations, so PHP's rand function has been great for me... ~S. Johnson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Depending on what project I'm working on sometimes I use specific globals on our older procedural code because: 1) It is our code 2) It does not use outside code 3) I'm the only developer working on it 4) It is very simplistic By specific globals I mean that I have a namespaced entry such as $GLOBALS['ericonly']['db'] and put things inside of ericonly. I basically only use this for database connections and a few other very specific things. Aside from that I'm not going to argue the merits of globals. Someone else can do that as I've made up my mind and so have you. :) But just to prove that I'm right http://www.google.com/search?hl=enq=global+variables+are+evilbtnG=Search :D Well... Personalized Results *1* - *10* of about *121,000* for *globalhttp://www.google.com/url?sa=Xoi=dictei=InGGR9TUIYO6gATv4ZHKBgsig2=rv83RnqqLJDobfnA3d78Lgq=http://www.answers.com/global%26r%3D67usg=AFQjCNF3eQaMYwTOPeOFmY3o3_vKZoxD3g variableshttp://www.google.com/url?sa=Xoi=dictei=InGGR9TUIYO6gATv4ZHKBgsig2=PtlnDj6B_ES74-UoJFdoYgq=http://www.answers.com/variables%26r%3D67usg=AFQjCNHUllfcxecDiCBZ124r8p5KyQoZlQare evilhttp://www.google.com/url?sa=Xoi=dictei=InGGR9TUIYO6gATv4ZHKBgsig2=QHGtFJrSLNf_0ARuYMWpHAq=http://www.answers.com/evil%26r%3D67usg=AFQjCNF5_Fag6ntgqNkFzuWVU9bEyb717Q *. (*0.10* seconds) Personalized Results *1* - *10* of about *4,330,000* for *globalhttp://www.google.com/url?sa=Xoi=dictei=83CGR832BpbAggSao-G9Bgsig2=b4uu-ZcrCZM0QWEXalxTNAq=http://www.answers.com/global%26r%3D67usg=AFQjCNH3VaZGgornyBLBavFsd_hljiBXsA variableshttp://www.google.com/url?sa=Xoi=dictei=83CGR832BpbAggSao-G9Bgsig2=kto8MuCLr5saX5VPjN8ThQq=http://www.answers.com/variables%26r%3D67usg=AFQjCNF1uZkzAKhsWmdBCI0IzFzgLSEAhAare
Re: [PHP] uh oh, I defined a resoruce
On Jan 10, 2008, at 12:48 PM, Eric Butera wrote: On Jan 10, 2008 1:33 PM, [EMAIL PROTECTED] wrote: I have been using define to create a constant for the link resource returned by mysql pconnect like so: $PL = @mysql_pconnect(localhost, $DBUser, $DBPass); define(SITE_DB,$PL); Later I use the constant to select my databases. mysql_select_db($SrcdbID ,SITE_DB); This code seems to be working as I expected and I have many thousands of llines of code done over several years using this construct. But, I happened to be reading the php doco today and noticed that you are not supposed to use define for resources, so question is, is what I am doing safe or am I going to run into problems and if so what is the best way to globally pass resources to multiple classes and functions, command line scripts etc? Cheers Charlie Reese Hi Charlie! Well a CONSTANT is a value that doesn't change. I don't think that makes sense for a DB connection. The connection command returns a resource that could be different on each request depending on if you've worked on different resources. You could just do this: $GLOBALS['SITE_DB'] = @mysql_pconnect(localhost, $DBUser, $DBPass); Then inside your function reference it like this: mysql_query($sql, $GLOBALS['SITE_DB']); This would be an easy mass find/replace that you could do. Global variables are evil though. I personally use the registry pattern to hold an instance of the database connection that can be lazy loaded whenever I need it. Then inside of my gateway objects I pass that instance in the constructor so they only have to know how to work with its interface. If you're okay with using object that might be a nice road to travel. You could also use the singleton pattern but I would advise against that because what if you wanted 2 instances for different databases? I've never ran across this myself but you never know. Plus it makes unit testing a little tricky since you can't mock it as easily. Hopefully something in all this will help you to an answer. I don't agree that Global variables are evil. If you have a valid purpose for defining a global variable, then go with it. The usual argument is that it could accidentally be changed elsewhere (and there are several more). However, defining a variable that you KNOW you're going to use only for a database connection, IMO, is perfectly fine. $GLOBALS['SITE_DB'] = @mysql_pconnect(localhost, $DBUser, $DBPass); If you accidently change $GLOBALS['SITE_DB'] elsewhere, then I think you have some bigger issues at hand. =P HTH. ~Philip Personally, most of my web applications do not have to factor 13.7 billion years of space drift in to the calculations, so PHP's rand function has been great for me... ~S. Johnson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] uh oh, I defined a resoruce
On Jan 10, 2008 2:28 PM, David Giragosian [EMAIL PROTECTED] wrote: On 1/10/08, Eric Butera [EMAIL PROTECTED] wrote: On Jan 10, 2008 2:02 PM, Philip Thompson [EMAIL PROTECTED] wrote: On Jan 10, 2008, at 12:48 PM, Eric Butera wrote: On Jan 10, 2008 1:33 PM, [EMAIL PROTECTED] wrote: I have been using define to create a constant for the link resource returned by mysql pconnect like so: $PL = @mysql_pconnect(localhost, $DBUser, $DBPass); define(SITE_DB,$PL); Later I use the constant to select my databases. mysql_select_db($SrcdbID ,SITE_DB); This code seems to be working as I expected and I have many thousands of llines of code done over several years using this construct. But, I happened to be reading the php doco today and noticed that you are not supposed to use define for resources, so question is, is what I am doing safe or am I going to run into problems and if so what is the best way to globally pass resources to multiple classes and functions, command line scripts etc? Cheers Charlie Reese Hi Charlie! Well a CONSTANT is a value that doesn't change. I don't think that makes sense for a DB connection. The connection command returns a resource that could be different on each request depending on if you've worked on different resources. You could just do this: $GLOBALS['SITE_DB'] = @mysql_pconnect(localhost, $DBUser, $DBPass); Then inside your function reference it like this: mysql_query($sql, $GLOBALS['SITE_DB']); This would be an easy mass find/replace that you could do. Global variables are evil though. I personally use the registry pattern to hold an instance of the database connection that can be lazy loaded whenever I need it. Then inside of my gateway objects I pass that instance in the constructor so they only have to know how to work with its interface. If you're okay with using object that might be a nice road to travel. You could also use the singleton pattern but I would advise against that because what if you wanted 2 instances for different databases? I've never ran across this myself but you never know. Plus it makes unit testing a little tricky since you can't mock it as easily. Hopefully something in all this will help you to an answer. I don't agree that Global variables are evil. If you have a valid purpose for defining a global variable, then go with it. The usual argument is that it could accidentally be changed elsewhere (and there are several more). However, defining a variable that you KNOW you're going to use only for a database connection, IMO, is perfectly fine. $GLOBALS['SITE_DB'] = @mysql_pconnect(localhost, $DBUser, $DBPass); If you accidently change $GLOBALS['SITE_DB'] elsewhere, then I think you have some bigger issues at hand. =P HTH. ~Philip Personally, most of my web applications do not have to factor 13.7 billion years of space drift in to the calculations, so PHP's rand function has been great for me... ~S. Johnson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Depending on what project I'm working on sometimes I use specific globals on our older procedural code because: 1) It is our code 2) It does not use outside code 3) I'm the only developer working on it 4) It is very simplistic By specific globals I mean that I have a namespaced entry such as $GLOBALS['ericonly']['db'] and put things inside of ericonly. I basically only use this for database connections and a few other very specific things. Aside from that I'm not going to argue the merits of globals. Someone else can do that as I've made up my mind and so have you. :) But just to prove that I'm right http://www.google.com/search?hl=enq=global+variables+are+evilbtnG=Search :D Well... Personalized Results *1* - *10* of about *121,000* for *globalhttp://www.google.com/url?sa=Xoi=dictei=InGGR9TUIYO6gATv4ZHKBgsig2=rv83RnqqLJDobfnA3d78Lgq=http://www.answers.com/global%26r%3D67usg=AFQjCNF3eQaMYwTOPeOFmY3o3_vKZoxD3g variableshttp://www.google.com/url?sa=Xoi=dictei=InGGR9TUIYO6gATv4ZHKBgsig2=PtlnDj6B_ES74-UoJFdoYgq=http://www.answers.com/variables%26r%3D67usg=AFQjCNHUllfcxecDiCBZ124r8p5KyQoZlQare evilhttp://www.google.com/url?sa=Xoi=dictei=InGGR9TUIYO6gATv4ZHKBgsig2=QHGtFJrSLNf_0ARuYMWpHAq=http://www.answers.com/evil%26r%3D67usg=AFQjCNF5_Fag6ntgqNkFzuWVU9bEyb717Q *. (*0.10* seconds) Personalized Results *1* - *10* of about *4,330,000* for *globalhttp://www.google.com/url?sa=Xoi=dictei=83CGR832BpbAggSao-G9Bgsig2=b4uu-ZcrCZM0QWEXalxTNAq=http://www.answers.com/global%26r%3D67usg=AFQjCNH3VaZGgornyBLBavFsd_hljiBXsA
Re: [PHP] uh oh, I defined a resoruce
On 1/10/08, Eric Butera [EMAIL PROTECTED] wrote: On Jan 10, 2008 2:28 PM, David Giragosian [EMAIL PROTECTED] wrote: On 1/10/08, Eric Butera [EMAIL PROTECTED] wrote: On Jan 10, 2008 2:02 PM, Philip Thompson [EMAIL PROTECTED] wrote: On Jan 10, 2008, at 12:48 PM, Eric Butera wrote: On Jan 10, 2008 1:33 PM, [EMAIL PROTECTED] wrote: I have been using define to create a constant for the link resource returned by mysql pconnect like so: $PL = @mysql_pconnect(localhost, $DBUser, $DBPass); define(SITE_DB,$PL); Later I use the constant to select my databases. mysql_select_db($SrcdbID ,SITE_DB); This code seems to be working as I expected and I have many thousands of llines of code done over several years using this construct. But, I happened to be reading the php doco today and noticed that you are not supposed to use define for resources, so question is, is what I am doing safe or am I going to run into problems and if so what is the best way to globally pass resources to multiple classes and functions, command line scripts etc? Cheers Charlie Reese Hi Charlie! Well a CONSTANT is a value that doesn't change. I don't think that makes sense for a DB connection. The connection command returns a resource that could be different on each request depending on if you've worked on different resources. You could just do this: $GLOBALS['SITE_DB'] = @mysql_pconnect(localhost, $DBUser, $DBPass); Then inside your function reference it like this: mysql_query($sql, $GLOBALS['SITE_DB']); This would be an easy mass find/replace that you could do. Global variables are evil though. I personally use the registry pattern to hold an instance of the database connection that can be lazy loaded whenever I need it. Then inside of my gateway objects I pass that instance in the constructor so they only have to know how to work with its interface. If you're okay with using object that might be a nice road to travel. You could also use the singleton pattern but I would advise against that because what if you wanted 2 instances for different databases? I've never ran across this myself but you never know. Plus it makes unit testing a little tricky since you can't mock it as easily. Hopefully something in all this will help you to an answer. I don't agree that Global variables are evil. If you have a valid purpose for defining a global variable, then go with it. The usual argument is that it could accidentally be changed elsewhere (and there are several more). However, defining a variable that you KNOW you're going to use only for a database connection, IMO, is perfectly fine. $GLOBALS['SITE_DB'] = @mysql_pconnect(localhost, $DBUser, $DBPass); If you accidently change $GLOBALS['SITE_DB'] elsewhere, then I think you have some bigger issues at hand. =P HTH. ~Philip Personally, most of my web applications do not have to factor 13.7 billion years of space drift in to the calculations, so PHP's rand function has been great for me... ~S. Johnson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Depending on what project I'm working on sometimes I use specific globals on our older procedural code because: 1) It is our code 2) It does not use outside code 3) I'm the only developer working on it 4) It is very simplistic By specific globals I mean that I have a namespaced entry such as $GLOBALS['ericonly']['db'] and put things inside of ericonly. I basically only use this for database connections and a few other very specific things. Aside from that I'm not going to argue the merits of globals. Someone else can do that as I've made up my mind and so have you. :) But just to prove that I'm right http://www.google.com/search?hl=enq=global+variables+are+evilbtnG=Search :D Well... Personalized Results *1* - *10* of about *121,000* for *global http://www.google.com/url?sa=Xoi=dictei=InGGR9TUIYO6gATv4ZHKBgsig2=rv83RnqqLJDobfnA3d78Lgq=http://www.answers.com/global%26r%3D67usg=AFQjCNF3eQaMYwTOPeOFmY3o3_vKZoxD3g variables http://www.google.com/url?sa=Xoi=dictei=InGGR9TUIYO6gATv4ZHKBgsig2=PtlnDj6B_ES74-UoJFdoYgq=http://www.answers.com/variables%26r%3D67usg=AFQjCNHUllfcxecDiCBZ124r8p5KyQoZlQ are evil http://www.google.com/url?sa=Xoi=dictei=InGGR9TUIYO6gATv4ZHKBgsig2=QHGtFJrSLNf_0ARuYMWpHAq=http://www.answers.com/evil%26r%3D67usg=AFQjCNF5_Fag6ntgqNkFzuWVU9bEyb717Q *. (*0.10* seconds) Personalized Results *1* - *10* of about *4,330,000* for *global
Re: [PHP] uh oh, I defined a resoruce
On 1/10/08, David Giragosian [EMAIL PROTECTED] wrote: On 1/10/08, Eric Butera [EMAIL PROTECTED] wrote: On Jan 10, 2008 2:28 PM, David Giragosian [EMAIL PROTECTED] wrote: On 1/10/08, Eric Butera [EMAIL PROTECTED] wrote: On Jan 10, 2008 2:02 PM, Philip Thompson [EMAIL PROTECTED] wrote: On Jan 10, 2008, at 12:48 PM, Eric Butera wrote: On Jan 10, 2008 1:33 PM, [EMAIL PROTECTED] wrote: I have been using define to create a constant for the link resource returned by mysql pconnect like so: $PL = @mysql_pconnect(localhost, $DBUser, $DBPass); define(SITE_DB,$PL); Later I use the constant to select my databases. mysql_select_db($SrcdbID ,SITE_DB); This code seems to be working as I expected and I have many thousands of llines of code done over several years using this construct. But, I happened to be reading the php doco today and noticed that you are not supposed to use define for resources, so question is, is what I am doing safe or am I going to run into problems and if so what is the best way to globally pass resources to multiple classes and functions, command line scripts etc? Cheers Charlie Reese Hi Charlie! Well a CONSTANT is a value that doesn't change. I don't think that makes sense for a DB connection. The connection command returns a resource that could be different on each request depending on if you've worked on different resources. You could just do this: $GLOBALS['SITE_DB'] = @mysql_pconnect(localhost, $DBUser, $DBPass); Then inside your function reference it like this: mysql_query($sql, $GLOBALS['SITE_DB']); This would be an easy mass find/replace that you could do. Global variables are evil though. I personally use the registry pattern to hold an instance of the database connection that can be lazy loaded whenever I need it. Then inside of my gateway objects I pass that instance in the constructor so they only have to know how to work with its interface. If you're okay with using object that might be a nice road to travel. You could also use the singleton pattern but I would advise against that because what if you wanted 2 instances for different databases? I've never ran across this myself but you never know. Plus it makes unit testing a little tricky since you can't mock it as easily. Hopefully something in all this will help you to an answer. I don't agree that Global variables are evil. If you have a valid purpose for defining a global variable, then go with it. The usual argument is that it could accidentally be changed elsewhere (and there are several more). However, defining a variable that you KNOW you're going to use only for a database connection, IMO, is perfectly fine. $GLOBALS['SITE_DB'] = @mysql_pconnect(localhost, $DBUser, $DBPass); If you accidently change $GLOBALS['SITE_DB'] elsewhere, then I think you have some bigger issues at hand. =P HTH. ~Philip Personally, most of my web applications do not have to factor 13.7 billion years of space drift in to the calculations, so PHP's rand function has been great for me... ~S. Johnson -- PHP General Mailing List (http://www.php.net/ ) To unsubscribe, visit: http://www.php.net/unsub.php Depending on what project I'm working on sometimes I use specific globals on our older procedural code because: 1) It is our code 2) It does not use outside code 3) I'm the only developer working on it 4) It is very simplistic By specific globals I mean that I have a namespaced entry such as $GLOBALS['ericonly']['db'] and put things inside of ericonly. I basically only use this for database connections and a few other very specific things. Aside from that I'm not going to argue the merits of globals. Someone else can do that as I've made up my mind and so have you. :) But just to prove that I'm right http://www.google.com/search?hl=enq=global+variables+are+evilbtnG=Search :D Well... Personalized Results *1* - *10* of about *121,000* for *globalhttp://www.google.com/url?sa=Xoi=dictei=InGGR9TUIYO6gATv4ZHKBgsig2=rv83RnqqLJDobfnA3d78Lgq=http://www.answers.com/global%26r%3D67usg=AFQjCNF3eQaMYwTOPeOFmY3o3_vKZoxD3g variables http://www.google.com/url?sa=Xoi=dictei=InGGR9TUIYO6gATv4ZHKBgsig2=PtlnDj6B_ES74-UoJFdoYgq=http://www.answers.com/variables%26r%3D67usg=AFQjCNHUllfcxecDiCBZ124r8p5KyQoZlQ are
Re: [PHP] uh oh, I defined a resoruce
On Jan 10, 2008 3:34 PM, David Giragosian [EMAIL PROTECTED] wrote: On 1/10/08, David Giragosian [EMAIL PROTECTED] wrote: On 1/10/08, Eric Butera [EMAIL PROTECTED] wrote: On Jan 10, 2008 2:28 PM, David Giragosian [EMAIL PROTECTED] wrote: On 1/10/08, Eric Butera [EMAIL PROTECTED] wrote: On Jan 10, 2008 2:02 PM, Philip Thompson [EMAIL PROTECTED] wrote: On Jan 10, 2008, at 12:48 PM, Eric Butera wrote: On Jan 10, 2008 1:33 PM, [EMAIL PROTECTED] wrote: I have been using define to create a constant for the link resource returned by mysql pconnect like so: $PL = @mysql_pconnect(localhost, $DBUser, $DBPass); define(SITE_DB,$PL); Later I use the constant to select my databases. mysql_select_db($SrcdbID ,SITE_DB); This code seems to be working as I expected and I have many thousands of llines of code done over several years using this construct. But, I happened to be reading the php doco today and noticed that you are not supposed to use define for resources, so question is, is what I am doing safe or am I going to run into problems and if so what is the best way to globally pass resources to multiple classes and functions, command line scripts etc? Cheers Charlie Reese Hi Charlie! Well a CONSTANT is a value that doesn't change. I don't think that makes sense for a DB connection. The connection command returns a resource that could be different on each request depending on if you've worked on different resources. You could just do this: $GLOBALS['SITE_DB'] = @mysql_pconnect(localhost, $DBUser, $DBPass); Then inside your function reference it like this: mysql_query($sql, $GLOBALS['SITE_DB']); This would be an easy mass find/replace that you could do. Global variables are evil though. I personally use the registry pattern to hold an instance of the database connection that can be lazy loaded whenever I need it. Then inside of my gateway objects I pass that instance in the constructor so they only have to know how to work with its interface. If you're okay with using object that might be a nice road to travel. You could also use the singleton pattern but I would advise against that because what if you wanted 2 instances for different databases? I've never ran across this myself but you never know. Plus it makes unit testing a little tricky since you can't mock it as easily. Hopefully something in all this will help you to an answer. I don't agree that Global variables are evil. If you have a valid purpose for defining a global variable, then go with it. The usual argument is that it could accidentally be changed elsewhere (and there are several more). However, defining a variable that you KNOW you're going to use only for a database connection, IMO, is perfectly fine. $GLOBALS['SITE_DB'] = @mysql_pconnect(localhost, $DBUser, $DBPass); If you accidently change $GLOBALS['SITE_DB'] elsewhere, then I think you have some bigger issues at hand. =P HTH. ~Philip Personally, most of my web applications do not have to factor 13.7 billion years of space drift in to the calculations, so PHP's rand function has been great for me... ~S. Johnson -- PHP General Mailing List ( http://www.php.net/ ) To unsubscribe, visit: http://www.php.net/unsub.php Depending on what project I'm working on sometimes I use specific globals on our older procedural code because: 1) It is our code 2) It does not use outside code 3) I'm the only developer working on it 4) It is very simplistic By specific globals I mean that I have a namespaced entry such as $GLOBALS['ericonly']['db'] and put things inside of ericonly. I basically only use this for database connections and a few other very specific things. Aside from that I'm not going to argue the merits of globals. Someone else can do that as I've made up my mind and so have you. :) But just to prove that I'm right http://www.google.com/search?hl=enq=global+variables+are+evilbtnG=Search :D Well... Personalized Results *1* - *10* of about *121,000* for *global http://www.google.com/url?sa=Xoi=dictei=InGGR9TUIYO6gATv4ZHKBgsig2=rv83RnqqLJDobfnA3d78Lgq=http://www.answers.com/global%26r%3D67usg=AFQjCNF3eQaMYwTOPeOFmY3o3_vKZoxD3g variables
Re: [PHP] uh oh, I defined a resoruce
Eric Butera wrote: Haha. Thank you for all that insightful research. Seriously though, using globals you might already be in hell! =\ IMHO global variables are evil in the same way that register_globals were. Despite everything you've probably heard it is actually possible to create a secure site with register_globals enabled, but it needs to be done with due care and attention. The same goes for globals. They are not inherently evil but they are easily abused so you need to be careful when you use them. -Stut -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP MS-Word plugin
Hi everyone, I'm pretty sure that this question has been asked to death in the past, but I'm just curoius as to whether there is a plugin that can edit Microsoft Office Word documents in PHP. I'm interested in this because I am trying to put a text watermark on each page, but doing it online, without having to download the document, watermarking it, and then reuploading it (I won't deny that I'm lazy). So my question is has this even been done before? I've had a little search around and nothing exciting has popped out, so I'm wondering if anyone has used/heard of/made something as daunting as this before? Thanks in advance, DT
Re: [PHP] uh oh, I defined a resoruce
On Jan 10, 2008 4:00 PM, Stut [EMAIL PROTECTED] wrote: Eric Butera wrote: Haha. Thank you for all that insightful research. Seriously though, using globals you might already be in hell! =\ IMHO global variables are evil in the same way that register_globals were. Despite everything you've probably heard it is actually possible to create a secure site with register_globals enabled, but it needs to be done with due care and attention. The same goes for globals. They are not inherently evil but they are easily abused so you need to be careful when you use them. -Stut -- http://stut.net/ Stut, That is all well and fine and I agree with you on some level. The only problem is that this is the php-general list and as such I try and put red flags on things to help others realize sooner than I did the pro/con list of things. Register globals makes working with request data extremely easy. At the same time it also makes it where GPC collisions and whatnot can really burn you in the end. For the overwhelming majority of users it causes more problems than it solves which is why it is going away. someday. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP MS-Word plugin
Douglas Temple schreef: Hi everyone, I'm pretty sure that this question has been asked to death in the past, but I'm just curoius as to whether there is a plugin that can edit Microsoft Office Word documents in PHP. I'm interested in this because I am trying to put a text watermark on each page, but doing it online, without having to download the document, watermarking it, and then reuploading it (I won't deny that I'm lazy). So my question is has this even been done before? I've had a little search around and nothing exciting has popped out, so I'm wondering if anyone has used/heard of/made something as daunting as this before? this comes down to using the COM extension - creating an instance of Word and using that to edit a file. this assumes the server is running windows and has a copy of Word installed. of course Word document is a vague entity - there are many different versions and they are not all compatible, from what I read I gather that the latest SP for the latest version actually made all documents written in previous versions unreadable because they are deemed 'unsafe' by M$ (this can be fixed with a registry hack) ... actually the parser for previous versions is unsafe ... maybe M$ should have fixed that instead of making everyone's archive of word docs unreadable. that said I have no idea if there are any *nix based word doc manipulators, if there are they probably won't work with all versions of word documents - the file format is closed and changes from version to version. you might consider switching to PDF? alternatively look at writing a batch processing script that runs on a windows server that can interact with the app on the server you alude to in your question. Thanks in advance, DT -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] uh oh, I defined a resoruce
Eric Butera schreef: On Jan 10, 2008 4:00 PM, Stut [EMAIL PROTECTED] wrote: Eric Butera wrote: Haha. Thank you for all that insightful research. Seriously though, using globals you might already be in hell! =\ IMHO global variables are evil in the same way that register_globals were. Despite everything you've probably heard it is actually possible to create a secure site with register_globals enabled, but it needs to be done with due care and attention. The same goes for globals. They are not inherently evil but they are easily abused so you need to be careful when you use them. -Stut -- http://stut.net/ Stut, That is all well and fine and I agree with you on some level. The only problem is that this is the php-general list and as such I try and put red flags on things to help others realize sooner than I did the pro/con list of things. if you can follow Stut's advice regarding globals then it's a good thing, if you're very good at what you do you'll know when it's *acceptable* to take a little short cut and use a global (most people have one or two those little projects that have to be up and running in no time where a global or two helps shave some undesired time and complexity from the project) Register globals makes working with request data extremely easy. really? if you see $_POST['foo'] you know where it came from, if you see $foo you can't be sure it's a request var ... in the most extreme case it could be a var declared in an auto_prepend_file. of course if you know absolutely nothing about php it make's it easier - but in the long run (same the 5 or 10 minutes it takes to read up on request superglobals) it's an accident waiting to happen. At the same time it also makes it where GPC collisions and whatnot can really burn you in the end. For the overwhelming majority of users it causes more problems than it solves which is why it is going away. someday. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP MS-Word plugin
Jochem Maas wrote: that said I have no idea if there are any *nix based word doc manipulators, if there are they probably won't work with all versions of word documents - the file format is closed and changes from version to version. OpenOffice.org (the website is the same as the name) is pretty good at the basic manipulation of most word documents. James -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] uh oh, I defined a resoruce
On Jan 10, 2008 4:41 PM, Jochem Maas [EMAIL PROTECTED] wrote: Eric Butera schreef: On Jan 10, 2008 4:00 PM, Stut [EMAIL PROTECTED] wrote: Eric Butera wrote: Haha. Thank you for all that insightful research. Seriously though, using globals you might already be in hell! =\ IMHO global variables are evil in the same way that register_globals were. Despite everything you've probably heard it is actually possible to create a secure site with register_globals enabled, but it needs to be done with due care and attention. The same goes for globals. They are not inherently evil but they are easily abused so you need to be careful when you use them. -Stut -- http://stut.net/ Stut, That is all well and fine and I agree with you on some level. The only problem is that this is the php-general list and as such I try and put red flags on things to help others realize sooner than I did the pro/con list of things. if you can follow Stut's advice regarding globals then it's a good thing, if you're very good at what you do you'll know when it's *acceptable* to take a little short cut and use a global (most people have one or two those little projects that have to be up and running in no time where a global or two helps shave some undesired time and complexity from the project) Register globals makes working with request data extremely easy. really? if you see $_POST['foo'] you know where it came from, if you see $foo you can't be sure it's a request var ... in the most extreme case it could be a var declared in an auto_prepend_file. $foo is less characters than $_POST['foo'], so yes it is easier to type. I didn't say it was right, I just said it made it easier. Anytime you see id= in a url or name= in a form just throw a $ sign in front of it and you're in business. I guarantee you a starting user will get that faster than $_GET and $_POST. Someone just coming at this isn't going to understand the difference between request types or the fact that a form can even have both of them in the method. :) of course if you know absolutely nothing about php it make's it easier - but in the long run (same the 5 or 10 minutes it takes to read up on request superglobals) it's an accident waiting to happen. I never said it wasn't. At the same time it also makes it where GPC collisions and whatnot can really burn you in the end. For the overwhelming majority of users it causes more problems than it solves which is why it is going away. someday. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] /etc/php.init changes not honored
Hello, I am trying to increase upload_max_filesize beyond the 2M limit. I've set this in my /etc/php.ini file, but every time I look at the output of phpinfo(); the changes I make in /etc/php.init don't seem to be honored. This isn't limited to upload_max_filesize, I've changed the Engine safe_mode values, but these don't seem to make any difference either. I've looked in the /etc/php.d directory, and those files only reference other libraries. I've even removed the /etc/php.ini file which doesn't seem to make a difference. What am I missing? -Thanks, RYAN I'm running a default installation of CentOS 5. [EMAIL PROTECTED] etc]$ cat /etc/redhat-release CentOS release 5 (Final) [EMAIL PROTECTED] etc]$ rpm -qa | grep php php-5.1.6-5.el5 php-pdo-5.1.6-5.el5 php-pear-1.4.9-4 php-common-5.1.6-5.el5 php-cli-5.1.6-5.el5 php-mysql-5.1.6-5.el5 [EMAIL PROTECTED] etc]$ rpm -qa | grep httpd httpd-2.2.3-6.el5.centos.1 httpd-manual-2.2.3-6.el5.centos.1 [EMAIL PROTECTED] etc]$ Ryan Madison Senior Systems Administrator, UNIX Services Internet Services and Servers Department of Information Technology State of Nevada p. 775.684.4313 f. 775.684.4324 e. [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] w. http://sug.state.nv.us http://sug.state.nv.us/ P Please consider the environment before printing this email. This communication, including any attachments, may contain confidential information and is intended only for the individual or entity to it is addressed. Any review, dissemination or copying of this communication by anyone other than the intended recipient is strictly prohibited. If you are not the intended recipient, please contact the sender by reply e-Mail and delete all copies of the original message.
Re: [PHP] /etc/php.init changes not honored
reload apache Ryan H. Madison [EMAIL PROTECTED] wrote: Hello, I am trying to increase upload_max_filesize beyond the 2M limit. I've set this in my /etc/php.ini file, but every time I look at the output of phpinfo(); the changes I make in /etc/php.init don't seem to be honored. This isn't limited to upload_max_filesize, I've changed the Engine safe_mode values, but these don't seem to make any difference either. I've looked in the /etc/php.d directory, and those files only reference other libraries. I've even removed the /etc/php.ini file which doesn't seem to make a difference. What am I missing? -Thanks, RYAN I'm running a default installation of CentOS 5. [EMAIL PROTECTED] etc]$ cat /etc/redhat-release CentOS release 5 (Final) [EMAIL PROTECTED] etc]$ rpm -qa | grep php php-5.1.6-5.el5 php-pdo-5.1.6-5.el5 php-pear-1.4.9-4 php-common-5.1.6-5.el5 php-cli-5.1.6-5.el5 php-mysql-5.1.6-5.el5 [EMAIL PROTECTED] etc]$ rpm -qa | grep httpd httpd-2.2.3-6.el5.centos.1 httpd-manual-2.2.3-6.el5.centos.1 [EMAIL PROTECTED] etc]$ Ryan Madison Senior Systems Administrator, UNIX Services Internet Services and Servers Department of Information Technology State of Nevada p. 775.684.4313 f. 775.684.4324 e. [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] w. http://sug.state.nv.us http://sug.state.nv.us/ P Please consider the environment before printing this email. This communication, including any attachments, may contain confidential information and is intended only for the individual or entity to it is addressed. Any review, dissemination or copying of this communication by anyone other than the intended recipient is strictly prohibited. If you are not the intended recipient, please contact the sender by reply e-Mail and delete all copies of the original message. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] /etc/php.init changes not honored
restart the server process that is reading it, otherwise the server is using the original settings. You can do some override by using the .htaccess file and setting specific things in specific folders, but if you are setting global changes, you have to restart the server process for the changes to be read. Wolf Ryan H. Madison [EMAIL PROTECTED] wrote: Hello, I am trying to increase upload_max_filesize beyond the 2M limit. I've set this in my /etc/php.ini file, but every time I look at the output of phpinfo(); the changes I make in /etc/php.init don't seem to be honored. This isn't limited to upload_max_filesize, I've changed the Engine safe_mode values, but these don't seem to make any difference either. I've looked in the /etc/php.d directory, and those files only reference other libraries. I've even removed the /etc/php.ini file which doesn't seem to make a difference. What am I missing? -Thanks, RYAN I'm running a default installation of CentOS 5. [EMAIL PROTECTED] etc]$ cat /etc/redhat-release CentOS release 5 (Final) [EMAIL PROTECTED] etc]$ rpm -qa | grep php php-5.1.6-5.el5 php-pdo-5.1.6-5.el5 php-pear-1.4.9-4 php-common-5.1.6-5.el5 php-cli-5.1.6-5.el5 php-mysql-5.1.6-5.el5 [EMAIL PROTECTED] etc]$ rpm -qa | grep httpd httpd-2.2.3-6.el5.centos.1 httpd-manual-2.2.3-6.el5.centos.1 [EMAIL PROTECTED] etc]$ Ryan Madison Senior Systems Administrator, UNIX Services Internet Services and Servers Department of Information Technology State of Nevada p. 775.684.4313 f. 775.684.4324 e. [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] w. http://sug.state.nv.us http://sug.state.nv.us/ P Please consider the environment before printing this email. This communication, including any attachments, may contain confidential information and is intended only for the individual or entity to it is addressed. Any review, dissemination or copying of this communication by anyone other than the intended recipient is strictly prohibited. If you are not the intended recipient, please contact the sender by reply e-Mail and delete all copies of the original message. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] /etc/php.init changes not honored
Done several times in several different ways. - Same result in the phpinfo.php output. $ sudo apachectl graceful $ sudo apachectl stop $ sudo apachectl start $ sudo service httpd restart Stopping httpd:[ OK ] Starting httpd:[ OK ] $ sudo service httpd stop Stopping httpd:[ OK ] $ sudo service httpd start Starting httpd:[ OK ] $ -Original Message- From: Wolf [mailto:[EMAIL PROTECTED] Sent: Thursday, January 10, 2008 3:04 PM To: Ryan H. Madison Cc: php-general@lists.php.net Subject: Re: [PHP] /etc/php.init changes not honored reload apache Ryan H. Madison [EMAIL PROTECTED] wrote: Hello, I am trying to increase upload_max_filesize beyond the 2M limit. I've set this in my /etc/php.ini file, but every time I look at the output of phpinfo(); the changes I make in /etc/php.init don't seem to be honored. This isn't limited to upload_max_filesize, I've changed the Engine safe_mode values, but these don't seem to make any difference either. I've looked in the /etc/php.d directory, and those files only reference other libraries. I've even removed the /etc/php.ini file which doesn't seem to make a difference. What am I missing? -Thanks, RYAN I'm running a default installation of CentOS 5. [EMAIL PROTECTED] etc]$ cat /etc/redhat-release CentOS release 5 (Final) [EMAIL PROTECTED] etc]$ rpm -qa | grep php php-5.1.6-5.el5 php-pdo-5.1.6-5.el5 php-pear-1.4.9-4 php-common-5.1.6-5.el5 php-cli-5.1.6-5.el5 php-mysql-5.1.6-5.el5 [EMAIL PROTECTED] etc]$ rpm -qa | grep httpd httpd-2.2.3-6.el5.centos.1 httpd-manual-2.2.3-6.el5.centos.1 [EMAIL PROTECTED] etc]$ Ryan Madison Senior Systems Administrator, UNIX Services Internet Services and Servers Department of Information Technology State of Nevada p. 775.684.4313 f. 775.684.4324 e. [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] w. http://sug.state.nv.us http://sug.state.nv.us/ P Please consider the environment before printing this email. This communication, including any attachments, may contain confidential information and is intended only for the individual or entity to it is addressed. Any review, dissemination or copying of this communication by anyone other than the intended recipient is strictly prohibited. If you are not the intended recipient, please contact the sender by reply e-Mail and delete all copies of the original message. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] uh oh, I defined a resoruce
Well, ADODB and TYPO3 are successfull oss procjecs which uses PHP and they utilizes globals at large. Regards. Sancar -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] /etc/php.init changes not honored
On Jan 10, 2008 5:59 PM, Ryan H. Madison [EMAIL PROTECTED] wrote: Hello, I am trying to increase upload_max_filesize beyond the 2M limit. I've set this in my /etc/php.ini file, but every time I look at the output of phpinfo(); the changes I make in /etc/php.init don't seem to be honored. This isn't limited to upload_max_filesize, I've changed the Engine safe_mode values, but these don't seem to make any difference either. I've looked in the /etc/php.d directory, and those files only reference other libraries. I've even removed the /etc/php.ini file which doesn't seem to make a difference. What am I missing? -Thanks, RYAN I'm running a default installation of CentOS 5. [EMAIL PROTECTED] etc]$ cat /etc/redhat-release CentOS release 5 (Final) [EMAIL PROTECTED] etc]$ rpm -qa | grep php php-5.1.6-5.el5 php-pdo-5.1.6-5.el5 php-pear-1.4.9-4 php-common-5.1.6-5.el5 php-cli-5.1.6-5.el5 php-mysql-5.1.6-5.el5 [EMAIL PROTECTED] etc]$ rpm -qa | grep httpd httpd-2.2.3-6.el5.centos.1 httpd-manual-2.2.3-6.el5.centos.1 [EMAIL PROTECTED] etc]$ Ryan Madison Senior Systems Administrator, UNIX Services Internet Services and Servers Department of Information Technology State of Nevada p. 775.684.4313 f. 775.684.4324 e. [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] w. http://sug.state.nv.us http://sug.state.nv.us/ P Please consider the environment before printing this email. This communication, including any attachments, may contain confidential information and is intended only for the individual or entity to it is addressed. Any review, dissemination or copying of this communication by anyone other than the intended recipient is strictly prohibited. If you are not the intended recipient, please contact the sender by reply e-Mail and delete all copies of the original message. Are you 100% sure you're editing the right ini file as stated in the Loaded Configuration File setting in phpinfo()? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] /etc/php.init changes not honored
On Jan 10, 2008 6:09 PM, Ryan H. Madison [EMAIL PROTECTED] wrote: Done several times in several different ways. - Same result in the phpinfo.php output. $ sudo apachectl graceful $ sudo apachectl stop $ sudo apachectl start $ sudo service httpd restart Stopping httpd:[ OK ] Starting httpd:[ OK ] $ sudo service httpd stop Stopping httpd:[ OK ] $ sudo service httpd start Starting httpd:[ OK ] Make sure, first of all, that the file is named php.ini, not php.init. I'm sure that was just a typo, but just in case it wasn't, I thought I'd address it. Since you've already tried restarting Apache, chances are that the php.ini file is not being expected where you're writing it. If you have Zend Optimizer installed, that's probably the exact reason. If so, try this: ? phpinfo(); ? Read the Loaded Configuration File part. That will tell you where PHP is loading the php.ini file from, or what it expects the name to be. Modify that file, restart Apache with: sudo service httpd stop sudo service httpd startssl And you should be good to go. P.S. - The 'startssl' tag was thrown in to remind you to start your SSL services. If you don't want them, just do: sudo service httpd restart -- /Dan Daniel P. Brown Senior Unix Geek and #1 Rated Year's Coolest Guy By Self Since 1979. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] /etc/php.init changes not honored
-Original Message- From: Eric Butera [mailto:[EMAIL PROTECTED] Sent: Thursday, January 10, 2008 3:16 PM To: Ryan H. Madison Cc: php-general@lists.php.net Subject: Re: [PHP] /etc/php.init changes not honored On Jan 10, 2008 5:59 PM, Ryan H. Madison [EMAIL PROTECTED] wrote: Hello, I am trying to increase upload_max_filesize beyond the 2M limit. I've set this in my /etc/php.ini file, but every time I look at the output of phpinfo(); the changes I make in /etc/php.init don't seem to be honored. This isn't limited to upload_max_filesize, I've changed the Engine safe_mode values, but these don't seem to make any difference either. I've looked in the /etc/php.d directory, and those files only reference other libraries. I've even removed the /etc/php.ini file which doesn't seem to make a difference. What am I missing? -Thanks, RYAN I'm running a default installation of CentOS 5. [EMAIL PROTECTED] etc]$ cat /etc/redhat-release CentOS release 5 (Final) [EMAIL PROTECTED] etc]$ rpm -qa | grep php php-5.1.6-5.el5 php-pdo-5.1.6-5.el5 php-pear-1.4.9-4 php-common-5.1.6-5.el5 php-cli-5.1.6-5.el5 php-mysql-5.1.6-5.el5 [EMAIL PROTECTED] etc]$ rpm -qa | grep httpd httpd-2.2.3-6.el5.centos.1 httpd-manual-2.2.3-6.el5.centos.1 [EMAIL PROTECTED] etc]$ Ryan Madison Senior Systems Administrator, UNIX Services Internet Services and Servers Department of Information Technology State of Nevada p. 775.684.4313 f. 775.684.4324 e. [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] w. http://sug.state.nv.us http://sug.state.nv.us/ P Please consider the environment before printing this email. This communication, including any attachments, may contain confidential information and is intended only for the individual or entity to it is addressed. Any review, dissemination or copying of this communication by anyone other than the intended recipient is strictly prohibited. If you are not the intended recipient, please contact the sender by reply e-Mail and delete all copies of the original message. Are you 100% sure you're editing the right ini file as stated in the Loaded Configuration File setting in phpinfo()? I do not see an entry stating Loaded Configuration File in the output of phpinfo(). The relevant entries are: Configuration File (php.ini) Path /etc Scan this dir for additional .ini files /etc/php.d additional .ini files parsed/etc/php.d/mysql.ini, /etc/php.d/mysqli.ini, /etc/php.d/pdo.ini, /etc/php.d/pdo_mysql.ini, /etc/php.d/pdo_sqlite.ini The additional .ini files are all loading shared objects... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Dependant listboxes
Hello, on 01/10/2008 02:43 PM Humani Power said the following: Hi everybody. I have a page with 3 combo box that contains rows from an oracle database. What I want to do, is to make those list dependant one from another. Let say that I have the combo boxes on a page1.php, then on change the first list box, reload the page1.php and make the selection of the second listbox, on change on the second box, the third listbox will be filled. Then, pressing the submit button, I want to go to the page2.php I dont want to use javascript. Does anyone knows where can I find an example to implement the dependant lists? This popular PHP forms generation and validation class has a linked select plug-in to do precisely that. http://www.phpclasses.org/formsgeneration The basic version use alternative groups of option values taken from arrays, but there are also variant versions of the plug-in that take options from database query results. Here is a live example of the version that uses arrays: http://www.meta-language.net/forms-examples.html?example=test_linked_select There is one variant that supports MySQL and two other variants that support many databases, including Oracle, using either the Metabase or PEAR::MDB2 database independent APIs. Here you may watch a tutorial video that explains about this and other plug-ins of this forms class: http://www.phpclasses.org/browse/video/1/package/1/section/plugin-linked-select.html -- Regards, Manuel Lemos PHP professionals looking for PHP jobs http://www.phpclasses.org/professionals/ PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP MS-Word plugin
Hello, on 01/10/2008 07:10 PM Douglas Temple said the following: Hi everyone, I'm pretty sure that this question has been asked to death in the past, but I'm just curoius as to whether there is a plugin that can edit Microsoft Office Word documents in PHP. I'm interested in this because I am trying to put a text watermark on each page, but doing it online, without having to download the document, watermarking it, and then reuploading it (I won't deny that I'm lazy). So my question is has this even been done before? I've had a little search around and nothing exciting has popped out, so I'm wondering if anyone has used/heard of/made something as daunting as this before? There are a few classes in the PHPClasses site that can be used to edit Microsoft Word documents. Some require running under Windows as they need COM objects. Others just generate XML/HTML that can pretend to be Word documents if you save the document files with the .doc extension. http://www.phpclasses.org/search.html?words=mswordgo_search=1 -- Regards, Manuel Lemos PHP professionals looking for PHP jobs http://www.phpclasses.org/professionals/ PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP shell commands
Hello, Some php applications store database passwords into files which can be read by the user www-data. So, a malicious user which can write php scripts could read those passwords. What should I do to prevent users from viewing those passwords? regards -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Why is some_function()[some_index] invalid syntax?
Hi there, Why is it that if I try to evaluate an index of an array returned by a function immediately, a syntax error is produced? (unexpected '[', expecting ',' or ';') Thanks, Arlen. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Why is some_function()[some_index] invalid syntax?
Arlen Christian Mart Cuss wrote: Hi there, Why is it that if I try to evaluate an index of an array returned by a function immediately, a syntax error is produced? (unexpected '[', expecting ',' or ';') Thanks, Arlen. I asked that question years ago. It was explained to me that php does not have, what is called, messaging. Something that is in lower level languages. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Why is some_function()[some_index] invalid syntax?
On Jan 10, 2008, at 8:00 PM, Arlen Christian Mart Cuss [EMAIL PROTECTED] wrote: Hi there, Why is it that if I try to evaluate an index of an array returned by a function immediately, a syntax error is produced? (unexpected '[', expecting ',' or ';') Thanks, Arlen. I've run into this problem. (It works in Javascript .) While I don't know why, you could store it in a temporary variable or use the list() language construct. -Casey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Why is some_function()[some_index] invalid syntax?
On Jan 10, 2008 11:00 PM, Arlen Christian Mart Cuss [EMAIL PROTECTED] wrote: Hi there, Why is it that if I try to evaluate an index of an array returned by a function immediately, a syntax error is produced? (unexpected '[', expecting ',' or ';') thats hillarious, i literally brought this up at the office like 2 days ago. ill tell you why its really lame (imho), because php5 supports syntax like this: function someFunc() { return date_create(); } echo someFunc()-format('Y-m-d'); that is, it allows you to chain a method invocation to the invocation of a function if the function returns an object. -nathan
Re: [PHP] Why is some_function()[some_index] invalid syntax?
Nathan Nobbe wrote: On Jan 10, 2008 11:00 PM, Arlen Christian Mart Cuss [EMAIL PROTECTED] wrote: Hi there, Why is it that if I try to evaluate an index of an array returned by a function immediately, a syntax error is produced? (unexpected '[', expecting ',' or ';') thats hillarious, i literally brought this up at the office like 2 days ago. ill tell you why its really lame (imho), because php5 supports syntax like this: function someFunc() { return date_create(); } echo someFunc()-format('Y-m-d'); that is, it allows you to chain a method invocation to the invocation of a function if the function returns an object. -nathan So, make all your functions return objects, and have the object have a method called get or index or something like that that returns the index requested. :) Better yet, make everything an object: String, Numeric, Array, etc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Why is some_function()[some_index] invalid syntax?
On Jan 11, 2008 12:25 AM, Jim Lucas [EMAIL PROTECTED] wrote: So, make all your functions return objects, and have the object have a method called get or index or something like that that returns the index requested. :) Better yet, make everything an object: String, Numeric, Array, etc i like using stdClass as a container sometimes, however it doesnt have the plethora of utility functions that arrays do :( there are workarounds of course, but obviously i just store the result to a variable and subsequently use that. this is just one of those little things picky, non-commiters like myself bitch about :) -nathan
Re: [PHP] PHP shell commands
Lucas Prado Melo wrote: Hello, Some php applications store database passwords into files which can be read by the user www-data. So, a malicious user which can write php scripts could read those passwords. What should I do to prevent users from viewing those passwords? Not too much really. The webserver needs to be able to read a config file. You could obfuscate the fields/entries or encrypt them somehow, but it needs to be a two-way encryption (ie you're going to need to undo the encryption to be able to use the password). -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php