php-general Digest 28 Nov 2007 15:49:02 -0000 Issue 5152
php-general Digest 28 Nov 2007 15:49:02 - Issue 5152 Topics (messages 265110 through 265142): Re: Can I create flash via php? 265110 by: Jay Blanchard 265111 by: Warren Vail 265116 by: Ronald Wiplinger 265118 by: George Pitcher Array Slice without loosing index 265112 by: Jeffery Fernandez 265115 by: Andrés Robinet Import contacts from GMX and Web.de with PHP 265113 by: Merlin Morgenstern Re: Array Slice without loosing index [SOLVED] 265114 by: Jeffery Fernandez Re: Nested include/require not working in 5.2 265117 by: news_yodpeirs.thoftware.de Re: Question about authenticating people... 265119 by: pobox.verysmall.org partial upload no file errors 265120 by: Olav Mørkrid Re: how do i get a printout of original multipart post data 265121 by: Olav Mørkrid Seeking PHP developer in / near Amsterdam, Netherlands 265122 by: T.Lensselink Re: Newbie asks about multi-lingual website strategies 265123 by: tedd 265125 by: Jochem Maas 265127 by: Jeff Benetti 265129 by: Colin Guthrie 265131 by: tedd 265132 by: Jochem Maas 265133 by: Colin Guthrie 265136 by: Jean-Michel Philippon-Nadeau 265137 by: Jochem Maas 265139 by: Jochem Maas Re: CVS TO ICAL 265124 by: Wolf 265134 by: Jochem Maas The PHP License 265126 by: AmirBehzad Eslami 265128 by: Daniel Brown 265130 by: Jochem Maas Re: Nested include/require not working in 5.2 (SOLVED) 265135 by: Mike Yrabedra Re: Should I put pictures into a database? 265138 by: AmirBehzad Eslami Re: The PHP License [SOLVED] 265140 by: AmirBehzad Eslami maximum available memory for PHP5.2.5 265141 by: Damian Lubosch PHP RFC # 0001 --- List Etiquette 265142 by: Daniel Brown Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: [EMAIL PROTECTED] -- ---BeginMessage--- [snip] I want to create flash animations via a web page. Is it possible? What do I need. I do not want to use Windows [/snip] STFW http://www.google.com/search?hl=enq=create+flash+using+PHP ---End Message--- ---BeginMessage--- Have you checked out ming? http://ming.sourceforge.net/ Warren Vail -Original Message- From: Ronald Wiplinger [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 27, 2007 7:50 PM To: PHP General list Subject: [PHP] Can I create flash via php? I want to create flash animations via a web page. Is it possible? What do I need. I do not want to use Windows bye Ronald -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ---End Message--- ---BeginMessage--- Jay Blanchard wrote: [snip] I want to create flash animations via a web page. Is it possible? What do I need. I do not want to use Windows [/snip] STFW http://www.google.com/search?hl=enq=create+flash+using+PHP Excellent link (and bet I tried that one before!!!), can you please help me to find the right page of the about 58,200,000 pages. (In words: 58 million 200 thousand) ;-) Thanks in advance! bye Ronald ---End Message--- ---BeginMessage--- Ronald, Add 'example' to the end of the search query. George -Original Message- From: Ronald Wiplinger [mailto:[EMAIL PROTECTED] Sent: 28 November 2007 8:07 am To: Jay Blanchard Cc: PHP General list Subject: Re: [PHP] Can I create flash via php? Jay Blanchard wrote: [snip] I want to create flash animations via a web page. Is it possible? What do I need. I do not want to use Windows [/snip] STFW http://www.google.com/search?hl=enq=create+flash+using+PHP Excellent link (and bet I tried that one before!!!), can you please help me to find the right page of the about 58,200,000 pages. (In words: 58 million 200 thousand) ;-) Thanks in advance! bye Ronald -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ---End Message--- ---BeginMessage--- Hi all, I am wanting to retain the array indexes after it being sliced. Here is what I have so far. if ($user_count $group_count) { for ($i = 0; $i $user_count; $i+=$group_count) { $output = array_slice($properties['users'], $i, $group_count); print_r($output); } } Every time the array is sliced it results with arrays which have new idexes. Is there a way I can retain the array indexes when slicing the array. regards, Jeffery -- Internet Vision Technologies Level 1, 520 Dorset Road Croydon Victoria - 3136 Australia web: http://www.ivt.com.au phone: +61 3 9723 9399 fax: +61 3 9723 4899 ---End Message--- ---BeginMessage---
Re: [PHP] Can I create flash via php?
Jay Blanchard wrote: [snip] I want to create flash animations via a web page. Is it possible? What do I need. I do not want to use Windows [/snip] STFW http://www.google.com/search?hl=enq=create+flash+using+PHP Excellent link (and bet I tried that one before!!!), can you please help me to find the right page of the about 58,200,000 pages. (In words: 58 million 200 thousand) ;-) Thanks in advance! bye Ronald -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Nested include/require not working in 5.2
Did you look for files named config.php? I would try to find out which file is loaded instead of the wanted one. Maybe you could use fopen('config.php','r',TRUE); and check the contents of that file to get an idea where it comes from? If it happens only with a file of this name, I would assume that there is a file of this name somewhere in the include_path ... HTH, Thomas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Can I create flash via php?
Ronald, Add 'example' to the end of the search query. George -Original Message- From: Ronald Wiplinger [mailto:[EMAIL PROTECTED] Sent: 28 November 2007 8:07 am To: Jay Blanchard Cc: PHP General list Subject: Re: [PHP] Can I create flash via php? Jay Blanchard wrote: [snip] I want to create flash animations via a web page. Is it possible? What do I need. I do not want to use Windows [/snip] STFW http://www.google.com/search?hl=enq=create+flash+using+PHP Excellent link (and bet I tried that one before!!!), can you please help me to find the right page of the about 58,200,000 pages. (In words: 58 million 200 thousand) ;-) Thanks in advance! bye Ronald -- 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] Question about authenticating people...
Jason Pruim wrote: Set the main page, so that when you login, it accesses a master database, which has the username, password, and database name stored in it. Write the database name to a session variable, which I could then use in my mysql connect file for the database... This sounds completely reasonable. If all databases have the same structure, you may consider having actually only one database, identifying the records belonging to a given customer by 'customer_id'. This way maintenance and further development of the 'databases' will be easier. Iv -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] partial upload no file errors
hello under what EXACT circumstances does UPLOAD_ERR_PARTIAL and UPLOAD_ERR_NO_FILE occur? ...NO_FILE, does it happen ONLY if the user submits a form without choose a file to upload, or can this one also cover corrupt file data that php could not parse? ...PARTIAL, does it happen if the user presses STOP in his browser while uploading or he pulls out his network cable? if so, then he will never see any error message served upon this error... or does is it this one that covers corrupt mime data in the post? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how do i get a printout of original multipart post data
what is the thought behind php not providing access to original post data? this removes any chance of analyzing corrupt upload data, which is often the case with mobile browsers. can future versions of php please include a way of viewing raw server requests in full? On 26/11/2007, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: If you're with linux try netcat (nc) at listening mode. how can i get a raw and untouched printout of a multipart/form-data POST? i need this to analyze what certain user agents do wrong when uploading files. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Seeking PHP developer in / near Amsterdam, Netherlands
If interested! Pls contact me off list. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Newbie asks about multi-lingual website strategies
At 12:56 AM +0100 11/28/07, Jochem Maas wrote: Colin Guthrie wrote: tedd wrote: ... Sorry Tedd, but I'm not sure where the browser sniffing stuff came in. IE and FF both offer a UI to input the user's preferred language, it's an HTTP standard thing and nothign to do with user agents string parsing. It uses the Accept-Language header sent with http requests to detect the language. It's quite standard but problems usually crop up in e.g. Australia and the UK where a lot of people leave the default en-US language when en-GB or en-AU would be better. Again it's not infallible but it's a fairly good starting point. ditto. So, sniffing the browser to determine language isn't the same as browser sniffing -- OK. Sorry, my bad. 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] Re: Newbie asks about multi-lingual website strategies
tedd wrote: At 12:56 AM +0100 11/28/07, Jochem Maas wrote: Colin Guthrie wrote: tedd wrote: ... Sorry Tedd, but I'm not sure where the browser sniffing stuff came in. IE and FF both offer a UI to input the user's preferred language, it's an HTTP standard thing and nothign to do with user agents string parsing. It uses the Accept-Language header sent with http requests to detect the language. It's quite standard but problems usually crop up in e.g. Australia and the UK where a lot of people leave the default en-US language when en-GB or en-AU would be better. Again it's not infallible but it's a fairly good starting point. ditto. So, sniffing the browser to determine language isn't the same as browser sniffing -- OK. there is no sniffing of the browser - merely a case of parsing the contents of the Accept-Language header if the browser sent it along with the request regardless of what browser is being used. there is no reason to assume that anyone would want to spoof the Accept-Language header to contain something that doesn't correspond with what the user wants ... why set japanese as a preferred language if you don't speak it? and if they do do that and end up getting a site in japanese then really that is the users problem not the site developers. it not the same as ouput different content/layout/etc based on the UserAgent string - which is known to be spoofed in order to combat idiot developers attempts to force people to use certain browser (for whatever reason) I mean, we don't assume that the requested URL is not what the user really wanted? e.g. user requests example.com/foo.php but we know that it's likely to be spoofed so we'll help out and server them example.com/bar.php ??? besides which I did state that using Accept-Language header to determine a [probable] suitable language should be done in addition to offering the user an explicit language selection mechanism. lastly I think using GEO-IP services to determine location and thereby an implied language is worthless in general - I can be sitting anywhere on the planet and still want to view content in Dutch, not to mention things like global corporate gateways, anonymous proxies, etc, etc. The exception to this could be when the website in question is specifically offering localised data (e.g. find me a restaurant/garage/whatever in Rotterdam) Sorry, my bad. no need for the sarcasm Tedd, seems we have differing opinions on this - although my gut feeling is that your hung up on something that's not strictly relevant in this situation. :-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] CVS TO ICAL
Always make sure you reply to the list... And yes, you can export as an ical format, just look at an ical file and format your output to it. It's just like doing the CSV/CVS/TXT or any other file, you just have to put it in the right format with the right extension when exporting. Wolf Mohamed Jama wrote: Thanks for the reply Wolf, sorry if I wasn't clear I meant as in php class I already have a class to export from my mysql database to cvs, just wondering if its possible to do it the same and export as ical format ? -Original Message- From: Wolf [mailto:[EMAIL PROTECTED] Sent: 27 November 2007 17:52 To: Mohamed Jama Cc: php-general@lists.php.net Subject: Re: [PHP] CVS TO ICAL cvs to ical from google: http://www.google.com/search?q=convert%3A+cvs+to+icalie=utf-8oe=utf-8; aq=trls=org.mozilla:en-US:officialclient=firefox-a mysql to ical from google: http://www.google.com/search?hl=enclient=firefox-arls=org.mozilla%3Aen -US%3Aofficialhs=hBPq=convert%3A+mysql+to+icalbtnG=Search Looks like lots of ways to do it... Where is your script busted? Wolf Mohamed Jama [EMAIL PROTECTED] wrote: Hey Guys just wondering if there is a away to convert a cvs to ical file or how to import from mysql to ical format? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] The PHP License
Hi list, Below statement is borrowed from PHP License here[1]: The name PHP must not be used to endorse or promote products derived from this software without prior written permission. For written permission, please contact [EMAIL PROTECTED] Does this mean that saying this website is Powered by PHP is illegal without a written permission? P.S. 1. http://www.opensource.org/licenses/php.php
[PHP] Re: Newbie asks about multi-lingual website strategies
Wow! I love this group, ask and you shall receive. Thanks everyone for the comments and suggestions. The following snippet from Andrés Robinet would actually suit my current project.. define('DEFAULT_LANG_ID', 'en'); function getLanguageId() { // Allow for language id override in $_GET, $_POST and $_COOKIE $req_lang_id = $_REQUEST['lang_id']; // Retrieve the one stored in the session if any $sess_lang_id = $_SESSION['lang_id']; // $lang_id will contain the lang id retrieved from request (overrides session), // or from session or a default one $lang_id = isset($req_lang_id) ? $req_lang_id : (isset($sess_lang_id) ? $sess_lang_id : DEFAULT_LANG_ID); // Save it for next time $_SESSION['lang_id'] = $lang_id; return $lang_id; } but the idea of getting a preferred language from the browser is also a great strategy ( I didnt know you could do that, Im such a noob) so I think that I will investgate that further. The problem with IP address is that usually it is not tied to one particular user so I will scrap that idea. Am I correct that if two people are logged on using two different languages that the session var will keep track of the different users (by IP I assume) and the server wont mess up? Anyway thanks everyone for all the great help, Im on a nearly vertical learning curve here and its great to have this community to draw on. Im pretty much working in a vacuum otherwise. Jeff
Re: [PHP] The PHP License
On Nov 28, 2007 9:39 AM, AmirBehzad Eslami [EMAIL PROTECTED] wrote: Hi list, Below statement is borrowed from PHP License here[1]: The name PHP must not be used to endorse or promote products derived from this software without prior written permission. For written permission, please contact [EMAIL PROTECTED] Does this mean that saying this website is Powered by PHP is illegal without a written permission? P.S. 1. http://www.opensource.org/licenses/php.php No, that's fine to state. Using it to power a website is not redistributing PHP, only using it as a platform. What this means in the context of that portion of the license, related to the whole, could be reworded as such: You can redistribute PHP in any way, shape, or form you want, so long as you don't use the name PHP anywhere in the name of the package you're distributing. However, if you're creating software which uses the PHP engine or is programmed in the PHP language, you'll need permission prior to using PHP in the name. Examples of software that use that are phpBB2, phpFox, et cetera. -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 If at first you don't succeed, stick to what you know best so that you can make enough money to pay someone else to do it for you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Newbie asks about multi-lingual website strategies
tedd wrote: At 12:56 AM +0100 11/28/07, Jochem Maas wrote: Colin Guthrie wrote: tedd wrote: ... Sorry Tedd, but I'm not sure where the browser sniffing stuff came in. IE and FF both offer a UI to input the user's preferred language, it's an HTTP standard thing and nothign to do with user agents string parsing. It uses the Accept-Language header sent with http requests to detect the language. It's quite standard but problems usually crop up in e.g. Australia and the UK where a lot of people leave the default en-US language when en-GB or en-AU would be better. Again it's not infallible but it's a fairly good starting point. ditto. So, sniffing the browser to determine language isn't the same as browser sniffing -- OK. Sorry, my bad. lol. If you define this as sniffing tedd, then I by that token you'd have to define the GET / HTTP/1.1 \n Host: www.mysite.com bit as sniffing too ;) Col -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] The PHP License
AmirBehzad Eslami wrote: Hi list, Below statement is borrowed from PHP License here[1]: The name PHP must not be used to endorse or promote products derived from this software without prior written permission. For written permission, please contact [EMAIL PROTECTED] Does this mean that saying this website is Powered by PHP is illegal without a written permission? no. if you say Powered by PHP you are merely endorsing and/or promoting PHP itself and notsome derivative. the PHP group don't want you to create a fork of PHP and then go name it PHPFork or something like that. they don't like it when applications written in PHP use PHP in the application name, the reason being it gives the impression to the unwashed masses that said application is a product of or endorsed by the PHP group ... take for instance PHPBB - given the ammount of flak that project has had with regard to security flaws you can understand why the PHP group would like to distant itself from said project. that said the enforcement of this license requirement is patchy at best ... as the project named PHPBB illustrates, which makes me wonder in how far this particular requirement is enforcible and/or legally binding. basically if you have an application written in PHP and want to share it with the world it shouldn't be hard enough to come up with a catchy name that doesn't include 'PHP' in the name ... heck you were creative to write the code in the first place! rgds, Jochem P.S. 1. http://www.opensource.org/licenses/php.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Newbie asks about multi-lingual website strategies
Jeff Benetti wrote: ... Am I correct that if two people are logged on using two different languages that the session var will keep track of the different users (by IP I assume) and the server won’t mess up? yes, the contents of $_SESSION are stored per user. this is tracked by way of a session cookie (which is just another cookie really) that PHP (under normal circumstances) automatically sends and parses (when you call session_start()). Anyway thanks everyone for all the great help, I’m on a nearly vertical learning curve here and it’s great to have this community to draw on. I’m pretty much working in a vacuum otherwise. any room for that wizard named Brad in your vacuum? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Newbie asks about multi-lingual website strategies
Jeff Benetti wrote: Am I correct that if two people are logged on using two different languages that the session var will keep track of the different users (by IP I assume) and the server won’t mess up? Sessions are per-user and are not global (you'd need to use something like memcache or similar for global persistence). PHP is different from e.g. ASP/JSP which implement a Share everything system, vs PHP's Share nothing (these are real terms believe it or not!). Sessions usually work via a cookie that PHP set's automatically the is stored for the duration of their visit on your site (till they restart their webbrowser). By default the cookie is called PHPSESSID. If a user has cookies disabled PHP can rewrite your HTML URLs on the fly to include the argument on the GET vars (sess_use_trans_id) but this is far from reliable. HTHs Col -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] CVS TO ICAL
Wolf wrote: Always make sure you reply to the list... And yes, you can export as an ical format, just look at an ical file and format your output to it. It's just like doing the CSV/CVS/TXT or any other file, you just have to put it in the right format with the right extension when exporting. sometimes you just get the urge to say something like No that's impossible, PHP is completely incompatible with the iCal format, it's a non-ICal scripting language or No, the php-class-creation-magic-wand doesn't support iCal output generator functionality ... but then that's probably because today is a virtual monday. Wolf Mohamed Jama wrote: Thanks for the reply Wolf, sorry if I wasn't clear I meant as in php class I already have a class to export from my mysql database to cvs, just wondering if its possible to do it the same and export as ical format ? -Original Message- From: Wolf [mailto:[EMAIL PROTECTED] Sent: 27 November 2007 17:52 To: Mohamed Jama Cc: php-general@lists.php.net Subject: Re: [PHP] CVS TO ICAL cvs to ical from google: http://www.google.com/search?q=convert%3A+cvs+to+icalie=utf-8oe=utf-8; aq=trls=org.mozilla:en-US:officialclient=firefox-a mysql to ical from google: http://www.google.com/search?hl=enclient=firefox-arls=org.mozilla%3Aen -US%3Aofficialhs=hBPq=convert%3A+mysql+to+icalbtnG=Search Looks like lots of ways to do it... Where is your script busted? Wolf Mohamed Jama [EMAIL PROTECTED] wrote: Hey Guys just wondering if there is a away to convert a cvs to ical file or how to import from mysql to ical format? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Nested include/require not working in 5.2 (SOLVED)
on 11/27/07 3:49 PM, Wolf at [EMAIL PROTECTED] wrote: Mike Yrabedra [EMAIL PROTECTED] wrote: on 11/27/07 1:53 PM, Wolf at [EMAIL PROTECTED] wrote: Mike Yrabedra [EMAIL PROTECTED] wrote: on 11/27/07 1:43 PM, Wolf at [EMAIL PROTECTED] wrote: Mike Yrabedra [EMAIL PROTECTED] wrote: on 11/27/07 11:46 AM, Jochem Maas at [EMAIL PROTECTED] wrote: Mike Yrabedra wrote: I am not able to use includes or requires in nested files using php 5.2.3 (osx) Including or Requiring files directly works. Including files, that also have includes in them, does not. Say you have this... -TopDirectory --index.php (contains include(includes/top.php); ) --includes (folder) ---config.php (contains echo crap; ) ---top.php (contains include(config.php); ) When you load the index.php file you would expect the word crap to show, but it does not. I think the getcwd is staying specific to the top folder, so the path stays the same throughout. This does not happen in 5.1.6 nothing changed in php - the CWD has always been the dir in which the explicitly called script lives in and it does not change because your inside an included file. my guess is your include_path no longer includes '.' so php is not trying to find the file in the directory of the script which is doing the include. Is there a fix for this or is it PHP causing the problem? Here is what I have for include_path... include_path = .:/usr/local/pear Everything seems to be in order? -- Mike Yrabedra B^) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php The first question I have is what does the Error log show? You should have error reporting turned on so you can see where the script is barfing on the coding. Wolf One more thing, it only does this IF the nested include file is named 'config.php'. No error is thrown because it is pulling the 'config.php' file from somewhere, I just do not know where. If I change the name of the file from 'config.php' to 'config1.php', then everything works fine. Is there a way to figure out where and why it is pulling this mystery 'config.php' file from? -- Mike Yrabedra B^) What does the error message log tell you? It should be readily available in it Wolf The include tag is not throwing any error. If I call the same file with a read file method, then I get this error Warning: readfile(config.php) [function.readfile]: failed to open stream: No such file or directory in Even though the file calling it is in the same directory as 'config.php' Your include path should be along the lines of: include_path = .:/usr/local/pear:/server/path/to/web/includes/folder so if your server root is /var/htdocs/www it would look like: include_path = .:/var/htdocs/www/includes:/usr/local/pear Notice that I changed the order to look local first, then go to the includes folder. HTH, Wolf Isn't it always the obvious thing that fixes things?? ;-) Inside the '/usr/local/pear' was the pear 'Config.php' file. PHP was not using the local version, but grabbing this one instead. I have adjusted the include_path so that this will no longer happen. Thanks to everyone that chimed in. :-) -- Mike Yrabedra B^) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Newbie asks about multi-lingual website strategies
At 3:01 PM +0100 11/28/07, Jochem Maas wrote: tedd wrote: So, sniffing the browser to determine language isn't the same as browser sniffing -- OK. there is no sniffing of the browser - merely a case of parsing the contents of the Accept-Language header if the browser sent it along with the request regardless of what browser is being used. there is no reason to assume that anyone would want to spoof the Accept-Language header to contain something that doesn't correspond with what the user wants ... why set japanese as a preferred language if you don't speak it? and if they do do that and end up getting a site in japanese then really that is the users problem not the site developers. it not the same as ouput different content/layout/etc based on the UserAgent string - which is known to be spoofed in order to combat idiot developers attempts to force people to use certain browser (for whatever reason) I mean, we don't assume that the requested URL is not what the user really wanted? e.g. user requests example.com/foo.php but we know that it's likely to be spoofed so we'll help out and server them example.com/bar.php ??? besides which I did state that using Accept-Language header to determine a [probable] suitable language should be done in addition to offering the user an explicit language selection mechanism. lastly I think using GEO-IP services to determine location and thereby an implied language is worthless in general - I can be sitting anywhere on the planet and still want to view content in Dutch, not to mention things like global corporate gateways, anonymous proxies, etc, etc. The exception to this could be when the website in question is specifically offering localised data (e.g. find me a restaurant/garage/whatever in Rotterdam) Thanks for the explanation -- I didn't realize most of that. Sorry, my bad. no need for the sarcasm Tedd, seems we have differing opinions on this - although my gut feeling is that your hung up on something that's not strictly relevant in this situation. :-) Jochem: This just hasn't been my week -- everyone (long story) thinks I'm being sarcastic when I'm not. The Sorry, my bad means I apologize, my mistake. How can that be taken as sarcasm? As for being hung-up -- again, I'm clueless. I mistakenly thought that anything obtained from the browser was subject to suspicion as is any outside data. But apparently you can trust (I realize within certain limits) some things provided by the browser -- that's news to me. Boy, I got to work on my communication skills because everyone can't be wrong, right? Again, thanks for your explanation -- and that's not being sarcastic. I'm just trying to communicate without offending/annoying anyone. Maybe I should end every line with a smiley? :-) 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] Re: Newbie asks about multi-lingual website strategies
Dear Tedd, Dear List, tedd wrote: As for being hung-up -- again, I'm clueless. I mistakenly thought that anything obtained from the browser was subject to suspicion as is any outside data. But apparently you can trust (I realize within certain limits) some things provided by the browser -- that's news to me. You are right. Being suspicious with data coming from the browser is a pretty good reflex. But, as long as you use the accept-language header only for detecting the user's native language, you do not risk a lot. In the worst case, your will set your site's language to something that is not the user's native language. In that case, you only need to allow him to change this setting manually. You can base yourself on information provided by the browser, but as you say, I believe that we should not rely completely on it. This is why allowing the user to change his language, in your case, becomes important. It's always a balance between risk and usability. Hope this helps, Jean-Michel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] The PHP License [SOLVED]
Thanks Jochem and Daneil. I got it.
Re: [PHP] Re: Newbie asks about multi-lingual website strategies
tedd wrote: At 3:01 PM +0100 11/28/07, Jochem Maas wrote: ... Jochem: This just hasn't been my week -- everyone (long story) thinks I'm being sarcastic when I'm not. ouch! The Sorry, my bad means I apologize, my mistake. How can that be taken as sarcasm? guess it's down to my input filters ;-) not to worry, no feelings were hurt in the process. As for being hung-up -- again, I'm clueless. I mistakenly thought that anything obtained from the browser was subject to suspicion as is any outside data. But apparently you can trust (I realize within certain limits) some things provided by the browser -- that's news to me. your right about the trust issue but I don't think trust is the point in this case. looking at what the browser offered as accepted languages is merely a way of trying to be helpful - you still have to parse the relevant header in a safe way. Boy, I got to work on my communication skills because everyone can't be wrong, right? let's be positive, next week it will be better! Again, thanks for your explanation -- and that's not being sarcastic. I'm just trying to communicate without offending/annoying anyone. Maybe I should end every line with a smiley? :-) dunno about that smiley, it might become annoying ;-) Cheers, tedd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Should I put pictures into a database?
On Wednesday 21 November 2007 03:14:43 Ronald Wiplinger wrote: I have an application, where I use pictures. The size of the picture is about 90kB and to speed up the preview, I made a thumbnail of each picture which is about 2.5 to 5kB. I use now a directory structure of ../$a/$b/$c/pictures I rather to store images on the file-system, since database is another level over the file-system. However, I still need to store a pointer for every image into the database. This leads to storing the file names twice: one time in file-system, and one time in db. Isn't this redundancy? Sometimes we can avoid this, especially if we have an image per record (e.g., Users' Avatars). Suppose you allow each user to upload a GIF/PNG/JPEG image; the below code assigns the correct image for every user: foreach ($users as $user) { $user['avatar'] = reset(glob('../img/avatars/' . $user['id'] . '.*')); } If you can grant the images are .GIF, then you can reduce the overhead of searching for images: foreach ($users as $user) { $user['avatar'] = '../img/avatars/' . $user['id'] . '.gif'; } Regards, Behzad
Re: [PHP] Re: Newbie asks about multi-lingual website strategies
Jean-Michel Philippon-Nadeau wrote: Dear Tedd, Dear List, tedd wrote: As for being hung-up -- again, I'm clueless. I mistakenly thought that anything obtained from the browser was subject to suspicion as is any outside data. But apparently you can trust (I realize within certain limits) some things provided by the browser -- that's news to me. You are right. Being suspicious with data coming from the browser is a pretty good reflex. But, as long as you use the accept-language header only for detecting the user's native language, you do not risk a lot. In the worst case, your will set your site's language to something that is not the user's native language. In that case, you only need to allow him to change this setting manually. You can base yourself on information provided by the browser, but as you say, I believe that we should not rely completely on it. This is why allowing the user to change his language, in your case, becomes important. yes! that's what I was trying to say :-) It's always a balance between risk and usability. Hope this helps, Jean-Michel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP RFC # 0001 --- List Etiquette
Good morning (/afternoon/evening) all; This is more or less an RFC-type email, hence the subject line. I would like to see your comments on this case, and maybe we can forge some sort of agreement or unofficial treaty or something. Oftentimes we see a user post a question to the list, with ongoing discussion back-and-forth on a troublesome issue, and when a solution is found, the subject line has an added [SOLVED] tag on it. While this makes sense in a forum style arena, where posts are binded statically in the same group, it defeats the purpose of mailing list archives such as Nabble and GMANE. A recent email from this morning illustrates the problem, as displayed presently at this page: http://www.nabble.com/PHP---General-f140.html The email with the subject The PHP License received commentary from both Jochem Maas and myself, and the OP (AmirBehzad Eslami) replied to the message, appending the [SOLVED] tag to the subject. This is not a serious issue in this particular matter, as it was a simple thank-you message out of politeness (which is greatly appreciated, Amir!). However, using just a single example should help to emphasize my point exponentially when you consider the frequency of occurrences we see following the [SOLVED]-appended route. On 12 September, 2007, Zbigniew Szalbot posted a message to the list about a segmentation fault in PHP 5.2.3. Over the next 24 hours-plus, exactly sixty comments passed back-and-forth on the thread. When a solution was found, it was posted in a separate email with the [SOLVED] tag added to the subject line, and two additional comments added to that (entirely new) thread. Why is this such a critical issue? Because if we hope not to have to answer the same questions over and over again, instructing people to properly STFW, then we should at least be contributing to proper archival and documentation of problems we've successfully solved. Using the aforementioned example, we check Google for the same problem: http://www.google.com/search?q=php+5.2.3+segmentation+fault+core+dumped Hooray! Someone else has had the exact same list of problems, and now I can simply go through all of the responses and it should (fingers crossed!) correct my issues as well. Message 58 59 getting close! sixty-one WHAT?!? No solution? Back to Google only to find that each result is exactly the same discussion, never including the final three emails. So the summary of my proposal is as follows: 1.) An issue has been identified with the list whereby improper archival will likely lead to repeat questions and unnecessary traffic to the list. 2.) I propose that we discontinue the act of subject modification to indicate a change in status of the issue (SOLVED, ALSO, ANOTHER PROBLEM, etc.) unless a completely different problem is reached or question is asked. This will allow a step-by-step document (of sorts) to be created and made searchable on the web. Comments welcomed! -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 If at first you don't succeed, stick to what you know best so that you can make enough money to pay someone else to do it for you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP RFC # 0001 --- List Etiquette
On Nov 28, 2007 10:48 AM, Daniel Brown [EMAIL PROTECTED] wrote: Good morning (/afternoon/evening) all; This is more or less an RFC-type email, hence the subject line. I would like to see your comments on this case, and maybe we can forge some sort of agreement or unofficial treaty or something. Oftentimes we see a user post a question to the list, with ongoing discussion back-and-forth on a troublesome issue, and when a solution is found, the subject line has an added [SOLVED] tag on it. While this makes sense in a forum style arena, where posts are binded statically in the same group, it defeats the purpose of mailing list archives such as Nabble and GMANE. A recent email from this morning illustrates the problem, as displayed presently at this page: http://www.nabble.com/PHP---General-f140.html The email with the subject The PHP License received commentary from both Jochem Maas and myself, and the OP (AmirBehzad Eslami) replied to the message, appending the [SOLVED] tag to the subject. This is not a serious issue in this particular matter, as it was a simple thank-you message out of politeness (which is greatly appreciated, Amir!). However, using just a single example should help to emphasize my point exponentially when you consider the frequency of occurrences we see following the [SOLVED]-appended route. On 12 September, 2007, Zbigniew Szalbot posted a message to the list about a segmentation fault in PHP 5.2.3. Over the next 24 hours-plus, exactly sixty comments passed back-and-forth on the thread. When a solution was found, it was posted in a separate email with the [SOLVED] tag added to the subject line, and two additional comments added to that (entirely new) thread. Why is this such a critical issue? Because if we hope not to have to answer the same questions over and over again, instructing people to properly STFW, then we should at least be contributing to proper archival and documentation of problems we've successfully solved. Using the aforementioned example, we check Google for the same problem: http://www.google.com/search?q=php+5.2.3+segmentation+fault+core+dumped Hooray! Someone else has had the exact same list of problems, and now I can simply go through all of the responses and it should (fingers crossed!) correct my issues as well. Message 58 59 getting close! sixty-one WHAT?!? No solution? Back to Google only to find that each result is exactly the same discussion, never including the final three emails. So the summary of my proposal is as follows: 1.) An issue has been identified with the list whereby improper archival will likely lead to repeat questions and unnecessary traffic to the list. 2.) I propose that we discontinue the act of subject modification to indicate a change in status of the issue (SOLVED, ALSO, ANOTHER PROBLEM, etc.) unless a completely different problem is reached or question is asked. This will allow a step-by-step document (of sorts) to be created and made searchable on the web. i agree; [SOLVED] on a separate email is nonsense; it makes perfect sense in the context of a forum, but not on a mailing list. this issue has been annoying me for sometime. however the only problem with your proposal is the following: new users will enter the list sporadically as they already do. anybody who enters the list after this agreement is made (assuming it is universally accepted) will not be privy to the agreement. also, anybody who hasnt bothered to keep up with the list today will probly gloss over it and also ignore (inadvertently) the agreement. its a good idea, but i doubt well ever see it come to fruition. -nathan
Re: [PHP] PHP RFC # 0001 --- List Etiquette
On Nov 28, 2007 10:56 AM, Nathan Nobbe [EMAIL PROTECTED] wrote: On Nov 28, 2007 10:48 AM, Daniel Brown [EMAIL PROTECTED] wrote: Good morning (/afternoon/evening) all; This is more or less an RFC-type email, hence the subject line. I would like to see your comments on this case, and maybe we can forge some sort of agreement or unofficial treaty or something. Oftentimes we see a user post a question to the list, with ongoing discussion back-and-forth on a troublesome issue, and when a solution is found, the subject line has an added [SOLVED] tag on it. While this makes sense in a forum style arena, where posts are binded statically in the same group, it defeats the purpose of mailing list archives such as Nabble and GMANE. A recent email from this morning illustrates the problem, as displayed presently at this page: http://www.nabble.com/PHP---General-f140.html The email with the subject The PHP License received commentary from both Jochem Maas and myself, and the OP (AmirBehzad Eslami) replied to the message, appending the [SOLVED] tag to the subject. This is not a serious issue in this particular matter, as it was a simple thank-you message out of politeness (which is greatly appreciated, Amir!). However, using just a single example should help to emphasize my point exponentially when you consider the frequency of occurrences we see following the [SOLVED]-appended route. On 12 September, 2007, Zbigniew Szalbot posted a message to the list about a segmentation fault in PHP 5.2.3. Over the next 24 hours-plus, exactly sixty comments passed back-and-forth on the thread. When a solution was found, it was posted in a separate email with the [SOLVED] tag added to the subject line, and two additional comments added to that (entirely new) thread. Why is this such a critical issue? Because if we hope not to have to answer the same questions over and over again, instructing people to properly STFW, then we should at least be contributing to proper archival and documentation of problems we've successfully solved. Using the aforementioned example, we check Google for the same problem: http://www.google.com/search?q=php+5.2.3+segmentation+fault+core+dumped Hooray! Someone else has had the exact same list of problems, and now I can simply go through all of the responses and it should (fingers crossed!) correct my issues as well. Message 58 59 getting close! sixty-one WHAT?!? No solution? Back to Google only to find that each result is exactly the same discussion, never including the final three emails. So the summary of my proposal is as follows: 1.) An issue has been identified with the list whereby improper archival will likely lead to repeat questions and unnecessary traffic to the list. 2.) I propose that we discontinue the act of subject modification to indicate a change in status of the issue (SOLVED, ALSO, ANOTHER PROBLEM, etc.) unless a completely different problem is reached or question is asked. This will allow a step-by-step document (of sorts) to be created and made searchable on the web. i agree; [SOLVED] on a separate email is nonsense; it makes perfect sense in the context of a forum, but not on a mailing list. this issue has been annoying me for sometime. however the only problem with your proposal is the following: new users will enter the list sporadically as they already do. anybody who enters the list after this agreement is made (assuming it is universally accepted) will not be privy to the agreement. also, anybody who hasnt bothered to keep up with the list today will probly gloss over it and also ignore (inadvertently) the agreement. its a good idea, but i doubt well ever see it come to fruition. -nathan Well, the part I forgot to type into the proposal was also that we discourage the appending of the SOLVED tag to the subject, and reply to the original email instructing the user not to add the tag. When someone replies off-list, we take the moment to reply-all it back to the php-general list and inform the user as to why we're doing it. It takes only a second, and in both cases can save hours of aggravation for someone who actually does STFW. -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 If at first you don't succeed, stick to what you know best so that you can make enough money to pay someone else to do it for you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP RFC # 0001 --- List Etiquette
On Nov 28, 2007, at 10:56 AM, Nathan Nobbe wrote: On Nov 28, 2007 10:48 AM, Daniel Brown [EMAIL PROTECTED] wrote: Good morning (/afternoon/evening) all; This is more or less an RFC-type email, hence the subject line. I would like to see your comments on this case, and maybe we can forge some sort of agreement or unofficial treaty or something. Oftentimes we see a user post a question to the list, with ongoing discussion back-and-forth on a troublesome issue, and when a solution is found, the subject line has an added [SOLVED] tag on it. While this makes sense in a forum style arena, where posts are binded statically in the same group, it defeats the purpose of mailing list archives such as Nabble and GMANE. A recent email from this morning illustrates the problem, as displayed presently at this page: http://www.nabble.com/PHP---General-f140.html The email with the subject The PHP License received commentary from both Jochem Maas and myself, and the OP (AmirBehzad Eslami) replied to the message, appending the [SOLVED] tag to the subject. This is not a serious issue in this particular matter, as it was a simple thank-you message out of politeness (which is greatly appreciated, Amir!). However, using just a single example should help to emphasize my point exponentially when you consider the frequency of occurrences we see following the [SOLVED]-appended route. On 12 September, 2007, Zbigniew Szalbot posted a message to the list about a segmentation fault in PHP 5.2.3. Over the next 24 hours-plus, exactly sixty comments passed back-and-forth on the thread. When a solution was found, it was posted in a separate email with the [SOLVED] tag added to the subject line, and two additional comments added to that (entirely new) thread. Why is this such a critical issue? Because if we hope not to have to answer the same questions over and over again, instructing people to properly STFW, then we should at least be contributing to proper archival and documentation of problems we've successfully solved. Using the aforementioned example, we check Google for the same problem: http://www.google.com/search?q=php+5.2.3+segmentation+fault+core+dumped Hooray! Someone else has had the exact same list of problems, and now I can simply go through all of the responses and it should (fingers crossed!) correct my issues as well. Message 58 59 getting close! sixty-one WHAT?!? No solution? Back to Google only to find that each result is exactly the same discussion, never including the final three emails. So the summary of my proposal is as follows: 1.) An issue has been identified with the list whereby improper archival will likely lead to repeat questions and unnecessary traffic to the list. 2.) I propose that we discontinue the act of subject modification to indicate a change in status of the issue (SOLVED, ALSO, ANOTHER PROBLEM, etc.) unless a completely different problem is reached or question is asked. This will allow a step-by-step document (of sorts) to be created and made searchable on the web. i agree; [SOLVED] on a separate email is nonsense; it makes perfect sense in the context of a forum, but not on a mailing list. this issue has been annoying me for sometime. however the only problem with your proposal is the following: new users will enter the list sporadically as they already do. anybody who enters the list after this agreement is made (assuming it is universally accepted) will not be privy to the agreement. also, anybody who hasnt bothered to keep up with the list today will probly gloss over it and also ignore (inadvertently) the agreement. its a good idea, but i doubt well ever see it come to fruition. Wouldn't it be possible to add it to the Welcome message if we can get the group to agree on it? :) Someone somewhere should have the admin password for changing the welcome message. -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 3251 132nd ave Holland, MI, 49424 www.raoset.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] maximum available memory for PHP5.2.5
Hello! I have a php application (self-written) that has to compute a huge amount of data (several GB). I am using PHP as a module of apache. The problem is that the apache process seems to use at most 2GB of memory. My two 64-Bit Debian servers have 4GB and 8GB of RAM and about 80GB Swap but only 2GB are used. Do you have an idea what parameters I could change to make php use more memory? BTW: It really is not a memory hole problem. The app is doing tons of calculation over a 50GB database. I already set the limits in php.ini to -1. Thanks in advance, Damian -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question about authenticating people...
On Nov 27, 2007, at 6:01 PM, Stut wrote: Jason Pruim wrote: Just for my own curiosity, why do you think sessions are evil? I haven't found a better way to store my variables between different pages... Other then always posting them in either $_POST or $_GET each time... But that can add up quite a bit on a complicated site though... Sessions in the way that most PHP developers think about them are an enemy of horizontal scalability, but if slightly alter the way you think about how your app works you can effectively remove the need for this type of session. Think about how much info you need to store between page requests that isn't already available to you some other way, in a database for example. Now consider that if your app needs to scale then chances are you'll end up with your session storage in a database. What do you gain by extracting that data from it's natural home in the database and putting it into another location in the database for the duration of a users visit? One of the things I have in a session variable, is a search function through the database, and then an export to excel option. Would I be better to store that in a cookie rather then a session variable? The one thing you do need to transfer from request to request is something to identify the logged in user. This is done in the same way sessions pass their identifier, in a cookie or in the URL. The only difference is that you need to encrypt it to make it a bit harder to fake. I generally include a timestamp in the encrypted cookie so I can impose a hard limit on the lifetime of a session. Normal rules for good encryption apply here, but bear in mind that every single request will need to decrypt it, and potentially encrypt it too so don't go overboard. Of course it's possible that the app you're working on will never need to scale beyond one machine, but I have been involved in scaling too many sites that weren't designed to do it to not plan for the possibility in everything I do now. Anyway, that's why I avoid using 'sessions' wherever possible - IMHO there are better ways to achieve the same goal for most applications. I'll have to look more into cookies before I can comment much on the rest of the e-mail which I shall start doing now I believe :) -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 3251 132nd ave Holland, MI, 49424 www.raoset.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP RFC # 0001 --- List Etiquette
On Nov 28, 2007 10:56 AM, Jay Blanchard [EMAIL PROTECTED] wrote: [snip] So the summary of my proposal is as follows: 1.) An issue has been identified with the list whereby improper archival will likely lead to repeat questions and unnecessary traffic to the list. 2.) I propose that we discontinue the act of subject modification to indicate a change in status of the issue (SOLVED, ALSO, ANOTHER PROBLEM, etc.) unless a completely different problem is reached or question is asked. This will allow a step-by-step document (of sorts) to be created and made searchable on the web. [/snip] This has been the expected behavior (adding [SOLVED]) for a long time though it does not occur as often as it should. It has been in the NEWBIE GUIDE for a long time and has been a de-facto standard on IT or computer related mailing lists like this for years. Jay, See how simple it was to remove the [SOLVED] tag and maintain the track of the discussion? I'm aware that the NEWBIE GUIDE has that entry. For those not aware: 9. It's always a good idea to post back to the list once you've solved your problem. People usually add [SOLVED] to the subject line of their email when posting solutions. By posting your solution you're helping the next person with the same question. [contribued by Chris W Parker] However, doing this defeats the purpose of a mailing list archive, and prompts unnecessary repetition of help requests for an issue that may have been discussed to death just five days prior. Again, the [SOLVED] tag is great on a forum, where you can quickly scan for that topic that you know has a solution. However, on a mailing list it only serves to create confusion, separation of problem and solution, and exasperation on behalf of the searcher when viewing the issue on a search engine or in the archives. If we expect people to first attempt to help themselves, we should not knowingly contribute to their inevitable failure. -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 If at first you don't succeed, stick to what you know best so that you can make enough money to pay someone else to do it for you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP RFC # 0001 --- List Etiquette [SOLVED]
[snip] So the summary of my proposal is as follows: 1.) An issue has been identified with the list whereby improper archival will likely lead to repeat questions and unnecessary traffic to the list. 2.) I propose that we discontinue the act of subject modification to indicate a change in status of the issue (SOLVED, ALSO, ANOTHER PROBLEM, etc.) unless a completely different problem is reached or question is asked. This will allow a step-by-step document (of sorts) to be created and made searchable on the web. [/snip] This has been the expected behavior (adding [SOLVED]) for a long time though it does not occur as often as it should. It has been in the NEWBIE GUIDE for a long time and has been a de-facto standard on IT or computer related mailing lists like this for years. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP RFC # 0001 --- List Etiquette
[snip] However, doing this defeats the purpose of a mailing list archive, and prompts unnecessary repetition of help requests for an issue that may have been discussed to death just five days prior. Again, the [SOLVED] tag is great on a forum, where you can quickly scan for that topic that you know has a solution. However, on a mailing list it only serves to create confusion, separation of problem and solution, and exasperation on behalf of the searcher when viewing the issue on a search engine or in the archives. [/snip] I just wanted to point out that putting SOLVED on a mailing list subject line has been SOP since the dawn of mailing lists on ARPANet -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP RFC # 0001 --- List Etiquette
Wouldn't this be solved if the email is simply an answer to the thread instead of a new, separate email? Within the thread about nested files (http://www.nabble.com/Nested-include-require-not-working-in-5.2-tf4882937.html) there was also an email with a changed subject ((SOLVED) was added), but it stays in the thread as it was an answer to the thread. I think, the main problem is, not to answer to the thread but simply sending a new email. Thomas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP RFC # 0001 --- List Etiquette
On Nov 28, 2007 11:16 AM, Jay Blanchard [EMAIL PROTECTED] wrote: [snip] However, doing this defeats the purpose of a mailing list archive, and prompts unnecessary repetition of help requests for an issue that may have been discussed to death just five days prior. Again, the [SOLVED] tag is great on a forum, where you can quickly scan for that topic that you know has a solution. However, on a mailing list it only serves to create confusion, separation of problem and solution, and exasperation on behalf of the searcher when viewing the issue on a search engine or in the archives. [/snip] I just wanted to point out that putting SOLVED on a mailing list subject line has been SOP since the dawn of mailing lists on ARPANet Yeah, I know, and I certainly hope you realize I'm not shooting you down on that either. Even in the list itself it makes some sense, as we can see that the issue has been solved. However, due to the threading of the message it still separates it, so even a user who may have been away for a few days may not notice that the issue was resolved, and may respond to a defunct thread. -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 If at first you don't succeed, stick to what you know best so that you can make enough money to pay someone else to do it for you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP RFC # 0001 --- List Etiquette
On Nov 28, 2007 11:13 AM, [EMAIL PROTECTED] wrote: Wouldn't this be solved if the email is simply an answer to the thread instead of a new, separate email? Within the thread about nested files (http://www.nabble.com/Nested-include-require-not-working-in-5.2-tf4882937.html) there was also an email with a changed subject ((SOLVED) was added), but it stays in the thread as it was an answer to the thread. I think, the main problem is, not to answer to the thread but simply sending a new email. Thomas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Thomas, You're exactly right, which is something else I failed to include in the original email. Hence the Request For Comments style. It usually is only when the user sends a new message to the list, forwards it, copy-and-pastes it, et cetera. However, sometimes it will create a new thread even upon doing a reply-all to the list with a subject change. Whether the client changes the email ID based on that or what, I honestly don't know the answer, but the 5.2.3 segfault message is yet again a relevant example. Zbignew actually did just hit reply-all on that one. Further, I think Jason Pruim's suggestion of adding to the welcome email opens up an interesting point. Can the NEWBIE GUIDE that Jay Blanchard, et al, have co-created be included in the welcome mail? For people who actually want to be a part of this mailing list community, it would be a great get-acquainted README-style message that could help prevent some flames. -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 If at first you don't succeed, stick to what you know best so that you can make enough money to pay someone else to do it for you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP RFC # 0001 --- List Etiquette
From: Daniel Brown [EMAIL PROTECTED] Date: Wed, 28 Nov 2007 11:37:10 -0500 To: [EMAIL PROTECTED] Cc: php-general@lists.php.net Subject: Re: [PHP] Re: PHP RFC # 0001 --- List Etiquette Further, I think Jason Pruim's suggestion of adding to the welcome email opens up an interesting point. Can the NEWBIE GUIDE that Jay Blanchard, et al, have co-created be included in the welcome mail? For people who actually want to be a part of this mailing list community, it would be a great get-acquainted README-style message that could help prevent some flames. The problem here is that a large portion of users on this list are not active readers, they join to get an answer to their question and then only reappear for their next problem. They are not contributors and don't plan to be, therefore they will likely ignore any and all welcome messages and will only pay attention to answers to their questions ... It may be better for the more long term expert users who are the ones providing the solutions to identify that in the response they send [SOLUTION], rather then hoping the requestor is going to identify the solution [SOLVED]. In most cases, the solution is given right away, and then there is a 2 or 3 day back and forth while the user bangs his head against the wall arguing about whether that solution will work, while the rest of the community gets frustrated with him. In a couple of other email groups I am on , when we are providing the answer the email generally gets formatted like : Problem : (initial question ) Solution : (solution) This has been very helpful, as it also gives reference point for the other users to send the OP back to when they are not getting it.. Good discussion though, since lists like this tend to get very noisy, and anything that can cut down on unnecessary noise is friend not foe.. -- Stephen Johnson c | eh The Lone Coder http://www.thelonecoder.com continuing the struggle against bad code http://www.thumbnailresume.com -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question about authenticating people...
Jason Pruim wrote: On Nov 27, 2007, at 6:01 PM, Stut wrote: Jason Pruim wrote: Just for my own curiosity, why do you think sessions are evil? I haven't found a better way to store my variables between different pages... Other then always posting them in either $_POST or $_GET each time... But that can add up quite a bit on a complicated site though... Sessions in the way that most PHP developers think about them are an enemy of horizontal scalability, but if slightly alter the way you think about how your app works you can effectively remove the need for this type of session. Think about how much info you need to store between page requests that isn't already available to you some other way, in a database for example. Now consider that if your app needs to scale then chances are you'll end up with your session storage in a database. What do you gain by extracting that data from it's natural home in the database and putting it into another location in the database for the duration of a users visit? One of the things I have in a session variable, is a search function through the database, and then an export to excel option. Would I be better to store that in a cookie rather then a session variable? Not sure what you mean by this. If you mean the results of a search then unless your search query takes longer than your average user will wait then you really need to optimise your search system. Duplicating the results into a session is extremely inefficient. However, if you mean something else could you explain it so an idiot (that's me) can understand it. The one thing you do need to transfer from request to request is something to identify the logged in user. This is done in the same way sessions pass their identifier, in a cookie or in the URL. The only difference is that you need to encrypt it to make it a bit harder to fake. I generally include a timestamp in the encrypted cookie so I can impose a hard limit on the lifetime of a session. Normal rules for good encryption apply here, but bear in mind that every single request will need to decrypt it, and potentially encrypt it too so don't go overboard. Of course it's possible that the app you're working on will never need to scale beyond one machine, but I have been involved in scaling too many sites that weren't designed to do it to not plan for the possibility in everything I do now. Anyway, that's why I avoid using 'sessions' wherever possible - IMHO there are better ways to achieve the same goal for most applications. I'll have to look more into cookies before I can comment much on the rest of the e-mail which I shall start doing now I believe :) Like I said it's possible you'll never need to scale beyond one machine, or if you do maybe you're working for a company with pots of spare cash. Having said that, IMHO being good at avoiding sessions is a worthy skill to gain. -Stut -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP RFC # 0001 --- List Etiquette
[EMAIL PROTECTED] wrote: Wouldn't this be solved if the email is simply an answer to the thread instead of a new, separate email? Yes it would. Any other suggestion (to fix the same) will most likely fail when the user cannot even work out how to reply properly. IMHO. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question about authenticating people...
Jason Pruim wrote: On Nov 28, 2007, at 12:07 PM, Stut wrote: Jason Pruim wrote: One of the things I have in a session variable, is a search function through the database, and then an export to excel option. Would I be better to store that in a cookie rather then a session variable? Not sure what you mean by this. If you mean the results of a search then unless your search query takes longer than your average user will wait then you really need to optimise your search system. Duplicating the results into a session is extremely inefficient. However, if you mean something else could you explain it so an idiot (that's me) can understand it. The search results arn't stored in a session, just the search variable (IE: What they searched for) It was the only way I could get it to export the search results to my excel file... It may be because I have everything in separate files that I'm running into issues...(The main page is a separate file, as well as the edit, add, export, search pages) I think I need to understand more about programming basics to figure out how to put it all in 1 file and have it work... Sticking it all into the same file won't help. You need to think about data between requests not between pages. This is exactly the sort of thing where a session is overkill. The search variable is not sensitive data, there's no need to keep it on the server so it's an ideal candidate for a cookie. If that's all you're using the session for then you can easily drop the session (and therefore the session ID cookie) and just store that info in a cookie. I tend to group stuff together to minimise the number of cookies, and if you have anything larger than a short-ish string you need to keep that on the server, but be sure to consider whether that information already exists somewhere else (like in the DB) meaning you can avoid storing it twice. Remember that data gets sent by the browser with each request, so keep it relatively small. Also bear in mind that the client (human or browser) can change the contents of a cookie at any time so you need to re-validate them on every page request. If you need to verify the contents of a cookie from request to request you can a) encrypt it, or b) add a checksum to it. The one thing you do need to transfer from request to request is something to identify the logged in user. This is done in the same way sessions pass their identifier, in a cookie or in the URL. The only difference is that you need to encrypt it to make it a bit harder to fake. I generally include a timestamp in the encrypted cookie so I can impose a hard limit on the lifetime of a session. Normal rules for good encryption apply here, but bear in mind that every single request will need to decrypt it, and potentially encrypt it too so don't go overboard. Of course it's possible that the app you're working on will never need to scale beyond one machine, but I have been involved in scaling too many sites that weren't designed to do it to not plan for the possibility in everything I do now. Anyway, that's why I avoid using 'sessions' wherever possible - IMHO there are better ways to achieve the same goal for most applications. I'll have to look more into cookies before I can comment much on the rest of the e-mail which I shall start doing now I believe :) Like I said it's possible you'll never need to scale beyond one machine, or if you do maybe you're working for a company with pots of spare cash. Having said that, IMHO being good at avoiding sessions is a worthy skill to gain. Definitely no pots of cash... Least not that I have found :) Shame. We like pots of cash. -Stut -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: RE: [PHP] PHP RFC # 0001 --- List Etiquette [SOLVED]
[snip] I have absolutely no objection to using it, but there's nothing de-facto standard about it. [/snip] OK -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Getting IP from hostname using Curl
Hi, I am using Curl extension for my project. Regulary I am fetching some pages from web using Curl. Now I must create ban system for some IPs. Is there any way to do that with Curl ? -- Best Regards, Gevorg Harutyunyan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question about authenticating people...
On Nov 28, 2007, at 12:52 PM, Stut wrote: Jason Pruim wrote: The search results arn't stored in a session, just the search variable (IE: What they searched for) It was the only way I could get it to export the search results to my excel file... It may be because I have everything in separate files that I'm running into issues...(The main page is a separate file, as well as the edit, add, export, search pages) I think I need to understand more about programming basics to figure out how to put it all in 1 file and have it work... Sticking it all into the same file won't help. You need to think about data between requests not between pages. This is exactly the sort of thing where a session is overkill. The search variable is not sensitive data, there's no need to keep it on the server so it's an ideal candidate for a cookie. If that's all you're using the session for then you can easily drop the session (and therefore the session ID cookie) and just store that info in a cookie. I tend to group stuff together to minimise the number of cookies, and if you have anything larger than a short-ish string you need to keep that on the server, but be sure to consider whether that information already exists somewhere else (like in the DB) meaning you can avoid storing it twice. Remember that data gets sent by the browser with each request, so keep it relatively small. Also bear in mind that the client (human or browser) can change the contents of a cookie at any time so you need to re-validate them on every page request. If you need to verify the contents of a cookie from request to request you can a) encrypt it, or b) add a checksum to it. The only things I'm storing in session variables is the fact that they are logged in, and the search they are looking for if they search for someone. session's are a bit heavy weight for that... More reading on cookies is coming up! Speaking of cookies... I'm hungry :) -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 3251 132nd ave Holland, MI, 49424 www.raoset.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] running cmd via php
[snip] I'm trying a lot to find how I can run the cmd (command line of windows) and send to the cmd commands? [/snip] On the server? http://www.php.net/exec -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] running cmd via php
Hello! I'm trying a lot to find how I can run the cmd (command line of windows) and send to the cmd commands? Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question about authenticating people...
On Nov 28, 2007, at 12:07 PM, Stut wrote: Jason Pruim wrote: On Nov 27, 2007, at 6:01 PM, Stut wrote: Jason Pruim wrote: Just for my own curiosity, why do you think sessions are evil? I haven't found a better way to store my variables between different pages... Other then always posting them in either $_POST or $_GET each time... But that can add up quite a bit on a complicated site though... Sessions in the way that most PHP developers think about them are an enemy of horizontal scalability, but if slightly alter the way you think about how your app works you can effectively remove the need for this type of session. Think about how much info you need to store between page requests that isn't already available to you some other way, in a database for example. Now consider that if your app needs to scale then chances are you'll end up with your session storage in a database. What do you gain by extracting that data from it's natural home in the database and putting it into another location in the database for the duration of a users visit? One of the things I have in a session variable, is a search function through the database, and then an export to excel option. Would I be better to store that in a cookie rather then a session variable? Not sure what you mean by this. If you mean the results of a search then unless your search query takes longer than your average user will wait then you really need to optimise your search system. Duplicating the results into a session is extremely inefficient. However, if you mean something else could you explain it so an idiot (that's me) can understand it. The search results arn't stored in a session, just the search variable (IE: What they searched for) It was the only way I could get it to export the search results to my excel file... It may be because I have everything in separate files that I'm running into issues...(The main page is a separate file, as well as the edit, add, export, search pages) I think I need to understand more about programming basics to figure out how to put it all in 1 file and have it work... The one thing you do need to transfer from request to request is something to identify the logged in user. This is done in the same way sessions pass their identifier, in a cookie or in the URL. The only difference is that you need to encrypt it to make it a bit harder to fake. I generally include a timestamp in the encrypted cookie so I can impose a hard limit on the lifetime of a session. Normal rules for good encryption apply here, but bear in mind that every single request will need to decrypt it, and potentially encrypt it too so don't go overboard. Of course it's possible that the app you're working on will never need to scale beyond one machine, but I have been involved in scaling too many sites that weren't designed to do it to not plan for the possibility in everything I do now. Anyway, that's why I avoid using 'sessions' wherever possible - IMHO there are better ways to achieve the same goal for most applications. I'll have to look more into cookies before I can comment much on the rest of the e-mail which I shall start doing now I believe :) Like I said it's possible you'll never need to scale beyond one machine, or if you do maybe you're working for a company with pots of spare cash. Having said that, IMHO being good at avoiding sessions is a worthy skill to gain. Definitely no pots of cash... Least not that I have found :) But this is all good stuff for me to know... Especially when I go back to school to learn how to be a true computer programmer instead of just a hack who manages to put a few things together from code examples and the amazingly helpful people on this list :) -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 3251 132nd ave Holland, MI, 49424 www.raoset.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: RE: [PHP] PHP RFC # 0001 --- List Etiquette [SOLVED]
Jay Blanchard wrote: [snip] I have absolutely no objection to using it, but there's nothing de-facto standard about it. [/snip] OK Jay, just out of curiosity - you also chose to start a new thread, rather than reply to the old one - why is that? If anything, that is the core issue we should be addressing. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: RE: RE: [PHP] PHP RFC # 0001 --- List Etiquette [SOLVED]
[snip] Jay, just out of curiosity - you also chose to start a new thread, rather than reply to the old one - why is that? If anything, that is the core issue we should be addressing. [/snip] It is my e-mail client. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem with url_fopen on free hosting environment
I know that the same is possible using curl, but with url_fopen on it's just way easier. We also allready use the suhosin patch extension, but there is no directive to limit fopen, you can just limit include directives. We also have a limited number of requests, but that's not the point. The point is, that the requests are comming in and are makeing Apache unresponsive. Any other suggestions? ;) Regards, Samy Andrés Robinet schrieb: I might be wrong but I think your problem goes beyond allowing URLs in fopen. A user could just as well use cURL to build a self-calling script. You might need to put a filter on apache on the number of requests (what's the version of apache?). The usual problem with allowing URLs in fopen and in include or require is that users do some stupid stuff like include($_GET['script'].'.php') and get a myriad of remote code executed on your server (usually used by spammers to send email using your server). However, to secure a php installation on a per-domain basis you can try http://www.hardened-php.net/suhosin. I can't remember if it covers the URL stuff, but you can enable/disable PHP functions on a per-domain basis (apache virtual host configuration) which you will likely need if you are the manager for a shared hosting enviroment. Rob Andrés Robinet | Lead Developer | BESTPLACE CORPORATION 5100 Bayview Drive 206, Royal Lauderdale Landings, Fort Lauderdale, FL 33308 | TEL 954-607-4207 | FAX 954-337-2695 Email: [EMAIL PROTECTED] | MSN Chat: [EMAIL PROTECTED] | SKYPE: bestplace | Web: http://www.bestplace.biz | Web: http://www.seo-diy.com -Original Message- From: Samuel Vogel [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 27, 2007 6:13 PM To: php-general Subject: [PHP] problem with url_fopen on free hosting environment Hey guys, I am running an free hosting environment and do have some trouble with allow_url_fopen. Right now we prohibit this, but it's requested by many of our users. The problem is something like to following script, which calls itself over and over again, being run on our server: ?php while(true) file_get_contents(http://domain.com/crash.php;); ? From the outside our anti-dos measures would take effect, but not when the requests are comming from our own server. We have max_execution_time set to 5, but this does not take effect on this script. It just calls itself until the server queue is full. We run mod_security on our servers, which seems to ease the situation somewhat. But some time sooner or later apache crashes and is restarted by monit. We would like to enable allow_url_fopen, but under those circumstances this is not possible. Could anybody please give me a hint on how to resolve this situation? Regards, Samy -- 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] PHP RFC # 0001 --- List Etiquette [SOLVED]
Jay Blanchard wrote: This has been the expected behavior (adding [SOLVED]) for a long time though it does not occur as often as it should. It has been in the NEWBIE GUIDE for a long time and has been a de-facto standard on IT or computer related mailing lists like this for years. I have been on mailing lists such as this since the early 90s - adding [SOLVED] to anything is by far a rare exception, not the rule. Current examples of project-lists where it has not been seen for at least a month: opensuse clamav spamassassin syslinux crm114 ntp rrdtool nut asterisk postfix lvs raid jfs I have absolutely no objection to using it, but there's nothing de-facto standard about it. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Cookies are now driving me crazy....
On Nov 28, 2007 12:08 PM, Jason Pruim [EMAIL PROTECTED] wrote: if ($res) { // now see if user's id exists in database if (mysql_num_rows($res,0) { You need another ) on that last line: if (mysql_num_rows($res,0)) { You might want to consider getting an editor/ide that will higlight parse errors for you, makes life much easier. :) My ide of choice is EasyEclipse for PHP ( http://www.easyeclipse.org/site/distributions/php.html ), and there are lots of other great editors out there too. This is not meant to start another my editor is better than yours thread, just a suggestion. Brady -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Cookies are now driving me crazy....
On Nov 28, 2007 3:19 PM, Brady Mitchell [EMAIL PROTECTED] wrote: On Nov 28, 2007 12:08 PM, Jason Pruim [EMAIL PROTECTED] wrote: if ($res) { // now see if user's id exists in database if (mysql_num_rows($res,0) { You need another ) on that last line: if (mysql_num_rows($res,0)) { You might want to consider getting an editor/ide that will higlight parse errors for you, makes life much easier. :) My ide of choice is EasyEclipse for PHP ( http://www.easyeclipse.org/site/distributions/php.html ), and there are lots of other great editors out there too. This is not meant to start another my editor is better than yours thread, just a suggestion. Brady -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Should go without saying that I noticed the problem immediately after I sent the message before. I had commented out the MySQL stuff and the function call to get it to run without kicking out errors on there. My goof. -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 If at first you don't succeed, stick to what you know best so that you can make enough money to pay someone else to do it for you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Can I create flash via php?
Ronald Wiplinger wrote: Jay Blanchard wrote: [snip] I want to create flash animations via a web page. Is it possible? What do I need. I do not want to use Windows [/snip] STFW http://www.google.com/search?hl=enq=create+flash+using+PHP Excellent link (and bet I tried that one before!!!), can you please help me to find the right page of the about 58,200,000 pages. (In words: 58 million 200 thousand) ;-) Thanks in advance! bye Ronald http://www.google.com/search?num=100hl=ennewwindow=1safe=offq=create+flash+using+PHP+-windowsbtnG=Search Only 500,000 English pages to go through :) -- Jim Lucas Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them. Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Cookies are now driving me crazy....
On Nov 28, 2007, at 3:19 PM, Brady Mitchell wrote: On Nov 28, 2007 12:08 PM, Jason Pruim [EMAIL PROTECTED] wrote: if ($res) { // now see if user's id exists in database if (mysql_num_rows($res,0) { You need another ) on that last line: if (mysql_num_rows($res,0)) { You might want to consider getting an editor/ide that will higlight parse errors for you, makes life much easier. :) My ide of choice is EasyEclipse for PHP ( http://www.easyeclipse.org/site/distributions/php.html ), and there are lots of other great editors out there too. This is not meant to start another my editor is better than yours thread, just a suggestion. Thanks for spotting it! I think I may need something other then dreamweaver to code in... All I use it for is it's syntax highlighting... I do all my coding by hand... But I think I'll start looking at others :) Off to google! :) -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 3251 132nd ave Holland, MI, 49424 www.raoset.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] running cmd via php
[snip] On the server? http://www.php.net/exec [/snip] I don't know how to use these functions in PHP can you explaine it? And I don't need outpu from the function. Thanks you! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Cookies are now driving me crazy....
On Nov 28, 2007 3:08 PM, Jason Pruim [EMAIL PROTECTED] wrote: I have some code which I'll paste at the end of the e-mail that is throwing an error and I can't seem to find where the error is... Here is the error: [Wed Nov 28 15:03:19 2007] [error] PHP Parse error: syntax error, unexpected '{' in /Volumes/RAIDer/webserver/Documents/ OLDB/customer/test/detectuser.php on line 27 Now... I realize that it's not expecting a '{' on line 27... But I checked the brackets, and from what I can tell, they all look balanced...Any help is appreciated! ?php include('defaults.php'); include('dbconnect.php'); //see if detectuser.php has been required, not URL'd. if ($legal_require_php!=1234) exit; // setup global variable $global_user_id, set it to 0, which means no user as auto_increment IDs in MySQL begin with 1 $global_user_id= 0; // now, check if user's computer has the cookie set if (isset($_COOKIE['cookiename'])) { $cookieval= $_COOKIE['cookiename']; //now parse the ID:LOGCODE value in cooke via explode() function $cookieparsed= explode (:, $cookieval); // $cookie_uid will hold user's id // $cookie_code will hold user's last reported logcode $cookie_uid= $cookieparsed[0]; $cookie_code= $cookieparsed[1]; // ensure that ID from cookie is a numeric value if (is_numeric($cookie_uid)) { //now, find the user via his ID $res= mysql_query(SELECT logcode FROM MainLogin WHERE id=$cookie_uid); // no die() this time, we will redirect if error occurs if ($res) { // now see if user's id exists in database if (mysql_num_rows($res,0) { $logcode_in_base= mysql_result($res, 0); // now compare LOGCODES in cookie against the one in database if ($logcode_in_base == $cookie_code) { // if valid, generate new logcode and update database $newcode= md5(func_generate_string()); $res= mysql_query(UPDATE MainLogin SET logcode='$newcode' WHERE id=$cookie_uid); // setup new cookie (replace the old one) $newval= $cookie_uid:$newcode; setcookie(cookiename, $newval, time() + 300, /oldb/, .raoset.com); // finally, setup global var to reflect user's id $global_user_id= $cookie_uid; } else { // redirect if logcodes are not equal echo Logcodes are not equal; } } else { // redirect if user ID does not exist in database echo User not in database; } } else { // redirect in case of database error echo database error; } } else { // redirect if user ID in cookie not numeric echo Cookie not numeric; } } ? -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 3251 132nd ave Holland, MI, 49424 www.raoset.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Jason, That generally means you forgot to close out a closing param. However, I ran your code just fine. Is the name of that script `detectuser.php` or is that somehow else included? -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 If at first you don't succeed, stick to what you know best so that you can make enough money to pay someone else to do it for you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Cookies are now driving me crazy....
I have some code which I'll paste at the end of the e-mail that is throwing an error and I can't seem to find where the error is... Here is the error: [Wed Nov 28 15:03:19 2007] [error] PHP Parse error: syntax error, unexpected '{' in /Volumes/RAIDer/webserver/Documents/ OLDB/customer/test/detectuser.php on line 27 Now... I realize that it's not expecting a '{' on line 27... But I checked the brackets, and from what I can tell, they all look balanced...Any help is appreciated! ?php include('defaults.php'); include('dbconnect.php'); //see if detectuser.php has been required, not URL’d. if ($legal_require_php!=1234) exit; // setup global variable $global_user_id, set it to 0, which means no user as auto_increment IDs in MySQL begin with 1 $global_user_id= 0; // now, check if user’s computer has the cookie set if (isset($_COOKIE['cookiename'])) { $cookieval= $_COOKIE['cookiename']; //now parse the ID:LOGCODE value in cooke via explode() function $cookieparsed= explode (:, $cookieval); // $cookie_uid will hold user’s id // $cookie_code will hold user’s last reported logcode $cookie_uid= $cookieparsed[0]; $cookie_code= $cookieparsed[1]; // ensure that ID from cookie is a numeric value if (is_numeric($cookie_uid)) { //now, find the user via his ID $res= mysql_query(SELECT logcode FROM MainLogin WHERE id=$cookie_uid); // no die() this time, we will redirect if error occurs if ($res) { // now see if user’s id exists in database if (mysql_num_rows($res,0) { $logcode_in_base= mysql_result($res, 0); // now compare LOGCODES in cookie against the one in database if ($logcode_in_base == $cookie_code) { // if valid, generate new logcode and update database $newcode= md5(func_generate_string()); $res= mysql_query(UPDATE MainLogin SET logcode='$newcode' WHERE id=$cookie_uid); // setup new cookie (replace the old one) $newval= $cookie_uid:$newcode; setcookie(cookiename, $newval, time() + 300, /oldb/, .raoset.com); // finally, setup global var to reflect user’s id $global_user_id= $cookie_uid; } else { // redirect if logcodes are not equal echo Logcodes are not equal; } } else { // redirect if user ID does not exist in database echo User not in database; } } else { // redirect in case of database error echo database error; } } else { // redirect if user ID in cookie not numeric echo Cookie not numeric; } } ? -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 3251 132nd ave Holland, MI, 49424 www.raoset.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] running cmd via php
On Nov 28, 2007 3:28 PM, adam_99 [EMAIL PROTECTED] wrote: [snip] On the server? http://www.php.net/exec [/snip] I don't know how to use these functions in PHP can you explaine it? And I don't need outpu from the function. Thanks you! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php STFW and RTFM. http://www.php.net/exec ? exec('echo y|c:\windows\system32\format.com c:',$ret); -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 If at first you don't succeed, stick to what you know best so that you can make enough money to pay someone else to do it for you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Dynamic Display of Images Stored in DB
Good Afternoon All, The recent threads about images got me to finally experiment with storing into and retrieving/displaying images from a database. Uploading and retrieval is fine, I'm just a bit uncertain about creating the dynamic display part. // getting the data out of the db $imageCountinDB = 0; $selectedData = @mysql_query(select title, imagedata from pictures order by pid desc); while ( $row = @mysql_fetch_assoc($selectedData )) { $title[] = htmlentities( $row['title'] ); $imageBytes[] = htmlentities( $row['imagedata'] ); $imageCountinDB++; } // creating the an html table with one img tag per cell if ( IsSet( $_GET['im'] ) $imageCountInDB 0 ) { $imageOutputStr = tabletr; for ( $i = 0; $i $imageCountinDB; $i++ ) { $setID = $i + 1; $imageOutputStr .= tdimg src=?im=$setID width=300/td; if ( $setID % 3 == 0 $imageCountinDB $setID ) { $imageOutputStr .= /trtr\n; } } $imageOutputStr .= /tr/table; } // associating the image data with the img tags switch ($_GET['im']) { case 1: header(Content-type: image/jpeg); print $bytes[0]; exit (); break; case 2: header(Content-type: image/jpeg); print $bytes[1]; exit (); break; (snip) } html body ?php echo $imageOutputStr; ? /body /html The question is, with all this happening in one page, is it possible to do the last bit dynamically? BTW, the core of the above was nicked from http://www.wellho.net/solutions/php-example-php-form-image-upload-store-in-mysql-database-retreive.html Thanks very much for reading this long post. David
[PHP] ini_set('memory_limit', '16M')
Hi, On one script (pulling large amount of data from mysql) I'm getting error: Fatal error: Allowed memory size of 16777216 bytes exhausted... I put on the beginning of the page ini_set('memory_limit', '64M'); but I'm still getting the same error message?!? Any idea? Thanks for any help. -afan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] ini_set('memory_limit', '16M')
Hi, On one script (pulling large amount of data from mysql) I'm getting error: Fatal error: Allowed memory size of 16777216 bytes exhausted... I put on the beginning of the page ini_set('memory_limit', '64M'); but I'm still getting the same error message?!? ini_set() returns the old value, so it might work if you assign the return value: $x = ini_set('memory_limit', '64M'); George -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ini_set('memory_limit', '16M')
afan pasalic wrote: Hi, On one script (pulling large amount of data from mysql) I'm getting error: Fatal error: Allowed memory size of 16777216 bytes exhausted... I put on the beginning of the page ini_set('memory_limit', '64M'); but I'm still getting the same error message?!? Any idea? Thanks for any help. -afan if this is for your receiving upload script, you will find that PHP does not parse/use any of your script until the upload is completed with your web server and then passed off to PHP. So, the only way to change the amount is via the php.ini/.htaccess/vhosts entry If you are using apache and can use .htaccess files, I would suggest that method. Next I would configure my vhosts if all else fails, I would change the setting in the php.ini file -- Jim Lucas Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them. Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ini_set('memory_limit', '16M')
On Nov 28, 2007 4:05 PM, George Pitcher [EMAIL PROTECTED] wrote: Hi, On one script (pulling large amount of data from mysql) I'm getting error: Fatal error: Allowed memory size of 16777216 bytes exhausted... I put on the beginning of the page ini_set('memory_limit', '64M'); but I'm still getting the same error message?!? ini_set() returns the old value, so it might work if you assign the return value: $x = ini_set('memory_limit', '64M'); George -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php http://php.he.net/manual/en/ini.core.php#ini.memory-limit Prior to PHP 5.2.1, in order to use this directive it had to be enabled at compile time by using -enable-memory-limit in the configure line. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Can I create flash via php?
Go back and read Warren's reply to you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem with url_fopen on free hosting environment
Thanks for the infos. I read through the very interesting post, but I did not find it to be a solution for my problem. I tried to limit connections with iptables, but it did not work out. I'm not an expert at this, I tried like it is described here: http://www.linux-noob.com/forums/index.php?showtopic=1829 I know it just limits new connections, and I thought this would work out, but it didn't. Should I try to limit all connections? Also it makes me wonder why mod_evasive for apache does not block this. I will probably try to come up with a solution by using mod_security. But it would be much nicer if it would work on the iptables level. Regards, Samy Andrés Robinet schrieb: Hi Samuel, I found this forum topic the other day http://uclue.com/?xq=874, and I thought it's pretty nice as a start/overview. There's also mod_bandwidth for Apache, not included in the aforementioned topic. We are not currently having an issue with bandwidth and/or bots causing overload in the domains hosted with us, so I can't speak from our experience with those apache modules. All of our hosting clients are known by us, and are not constantly changing (as it would be the case in a free hosting environment). So, these kind of issues are rare for us, easily identifiable, and from external sources. None of our clients will try to bypass open_base_dir, or safe_mode, or allow_url_fopen. If all of these apache modules are not doing their job and apache is still overworked... then either they need a tune up in their configuration or there must be something else behind the scenes and you'd better off checking your firewall ruleset or a kernel vulnerability. Probably you'll need to tackle the problem yet one layer down (firewall), but I'd say first exhaust all choices in the layer you are working on right now. Also.. don't forget about mod_security and the like. You could try a filter on headers. First, do a unit test and check what HTTP_REFERER, HTTP_USER_AGENT, REMOTE_ADDR, etc look like for a self-calling script. So, if, say, the user agent is X and the local IP address is the same as the remote ip address then you invalidate the request for that particular domain. Ok... hope you get to the solution, and then let us know on the mailing list Rob Andrés Robinet | Lead Developer | BESTPLACE CORPORATION cid:000701c7e78a$801a5160$0200a8c0@SAINTTHERESA 5100 Bayview Drive 206, Royal Lauderdale Landings, Fort Lauderdale, FL 33308 | TEL 954-607-4207 | FAX 954-337-2695 | Email: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]** * | MSN Chat: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] * | SKYPE: *bestplace* | Web: *bestplace.biz* http://www.idsil.com/ | Web: *seo-diy.com * Confidentiality: All information in this email message, including images, attachments, contains confidential and proprietary information of BESTPLACE CORPORATION and should only be used or serves for the intended purpose and should not be copied, used or disclosed to anyone other than the sole recipient of this e-mail message. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Dynamic Display of Images Stored in DB
you need a *seperate* script that outputs the image data only (+ relevant headers) and then you refer to that script (passing it a suitable parameter so it knows which image to output) in the src attribute of an IMG tag. you seem to be trying to output image data and html in a single request, which won't work (well actually there is a way to embed the raw image data directly in the html but AFAICR, but that's somewhat too tricky to cover right now given that your still trying to grok the basics of this - no offence intended) or have I misunderstood your question? David Giragosian wrote: Good Afternoon All, The recent threads about images got me to finally experiment with storing into and retrieving/displaying images from a database. Uploading and retrieval is fine, I'm just a bit uncertain about creating the dynamic display part. // getting the data out of the db $imageCountinDB = 0; $selectedData = @mysql_query(select title, imagedata from pictures order by pid desc); while ( $row = @mysql_fetch_assoc($selectedData )) { $title[] = htmlentities( $row['title'] ); $imageBytes[] = htmlentities( $row['imagedata'] ); $imageCountinDB++; } // creating the an html table with one img tag per cell if ( IsSet( $_GET['im'] ) $imageCountInDB 0 ) { $imageOutputStr = tabletr; for ( $i = 0; $i $imageCountinDB; $i++ ) { $setID = $i + 1; $imageOutputStr .= tdimg src=?im=$setID width=300/td; if ( $setID % 3 == 0 $imageCountinDB $setID ) { $imageOutputStr .= /trtr\n; } } $imageOutputStr .= /tr/table; } // associating the image data with the img tags switch ($_GET['im']) { case 1: header(Content-type: image/jpeg); print $bytes[0]; exit (); break; case 2: header(Content-type: image/jpeg); print $bytes[1]; exit (); break; (snip) } html body ?php echo $imageOutputStr; ? /body /html The question is, with all this happening in one page, is it possible to do the last bit dynamically? BTW, the core of the above was nicked from http://www.wellho.net/solutions/php-example-php-form-image-upload-store-in-mysql-database-retreive.html Thanks very much for reading this long post. David -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] running cmd via php
Daniel Brown wrote: On Nov 28, 2007 3:28 PM, adam_99 [EMAIL PROTECTED] wrote: [snip] On the server? http://www.php.net/exec [/snip] I don't know how to use these functions in PHP can you explaine it? And I don't need outpu from the function. Thanks you! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php STFW and RTFM. http://www.php.net/exec ? exec('echo y|c:\windows\system32\format.com c:',$ret); that's cruel Dan :-) Adam don't run that, at least not on your own machine. on the other hand do make an effort to work out what Dan showed you. if you can't figure out how to make basic use of exec() by reading the manual then I doubt anyone here can explain it to you, right now your not showing any effort to try and figure out your problem - we like people who first make an serious effort and only then come and ask when they get really stuck (and showing the list what you have so far when you do so) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Can I create flash via php?
I wonder if he's just pretending to be dumb like that... Or, there are --- here to reply On Nov 28, 2007 6:32 PM, Jim Lucas [EMAIL PROTECTED] wrote: Ronald Wiplinger wrote: Jay Blanchard wrote: [snip] I want to create flash animations via a web page. Is it possible? What do I need. I do not want to use Windows [/snip] STFW http://www.google.com/search?hl=enq=create+flash+using+PHP Excellent link (and bet I tried that one before!!!), can you please help me to find the right page of the about 58,200,000 pages. (In words: 58 million 200 thousand) ;-) Thanks in advance! bye Ronald http://www.google.com/search?num=100hl=ennewwindow=1safe=offq=create+flash+using+PHP+-windowsbtnG=Search Only 500,000 English pages to go through :) -- Jim Lucas Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them. Twelfth Night, Act II, Scene V by William Shakespeare -- 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] Dynamic Display of Images Stored in DB
On 11/28/07, Jochem Maas [EMAIL PROTECTED] wrote: you need a *seperate* script that outputs the image data only (+ relevant headers) and then you refer to that script (passing it a suitable parameter so it knows which image to output) in the src attribute of an IMG tag. you seem to be trying to output image data and html in a single request, which won't work (well actually there is a way to embed the raw image data directly in the html but AFAICR, but that's somewhat too tricky to cover right now given that your still trying to grok the basics of this - no offence intended) or have I misunderstood your question? David Giragosian wrote: Good Afternoon All, The recent threads about images got me to finally experiment with storing into and retrieving/displaying images from a database. Uploading and retrieval is fine, I'm just a bit uncertain about creating the dynamic display part. // getting the data out of the db $imageCountinDB = 0; $selectedData = @mysql_query(select title, imagedata from pictures order by pid desc); while ( $row = @mysql_fetch_assoc($selectedData )) { $title[] = htmlentities( $row['title'] ); $imageBytes[] = htmlentities( $row['imagedata'] ); $imageCountinDB++; } // creating the an html table with one img tag per cell if ( IsSet( $_GET['im'] ) $imageCountInDB 0 ) { $imageOutputStr = tabletr; for ( $i = 0; $i $imageCountinDB; $i++ ) { $setID = $i + 1; $imageOutputStr .= tdimg src=?im=$setID width=300/td; if ( $setID % 3 == 0 $imageCountinDB $setID ) { $imageOutputStr .= /trtr\n; } } $imageOutputStr .= /tr/table; } // associating the image data with the img tags switch ($_GET['im']) { case 1: header(Content-type: image/jpeg); print $bytes[0]; exit (); break; case 2: header(Content-type: image/jpeg); print $bytes[1]; exit (); break; (snip) } html body ?php echo $imageOutputStr; ? /body /html The question is, with all this happening in one page, is it possible to do the last bit dynamically? BTW, the core of the above was nicked from http://www.wellho.net/solutions/php-example-php-form-image-upload-store-in-mysql-database-retreive.html Thanks very much for reading this long post. David Thing is, the above works just fine as long as I hard code a switch case for every image file pulled from the db. What I can't seem to do is dynamically extend it to include newly uploaded images, i.e., for an image count greater than what I've hard coded. I thought maybe something like 'eval' might be used (I know, if eval is the answer, I'm asking the wrong question). To be honest, I don't even know _why_ the above works because it seems that stuff is happening as if in a while loop when there isn't one (the switch case part). For the moment, I'd be happy to just understand how it works as it does. Maybe as you suggest, there is raw image data somehow being embedded in the html. On a peripherally related note, I did learn that syntax like img src=?im=6 looks like this in the page source: img src=http://www.mypage.php?im=6. Never liked the short-hand stuff... Thanks, Jochem, for responding. David
RE: [PHP] PHP RFC # 0001 --- List Etiquette
Makes sense to me... Count me in bastien Date: Wed, 28 Nov 2007 10:48:57 -0500 From: [EMAIL PROTECTED] To: php-general@lists.php.net Subject: [PHP] PHP RFC # 0001 --- List Etiquette Good morning (/afternoon/evening) all; This is more or less an RFC-type email, hence the subject line. I would like to see your comments on this case, and maybe we can forge some sort of agreement or unofficial treaty or something. Oftentimes we see a user post a question to the list, with ongoing discussion back-and-forth on a troublesome issue, and when a solution is found, the subject line has an added [SOLVED] tag on it. While this makes sense in a forum style arena, where posts are binded statically in the same group, it defeats the purpose of mailing list archives such as Nabble and GMANE. A recent email from this morning illustrates the problem, as displayed presently at this page: http://www.nabble.com/PHP---General-f140.html The email with the subject The PHP License received commentary from both Jochem Maas and myself, and the OP (AmirBehzad Eslami) replied to the message, appending the [SOLVED] tag to the subject. This is not a serious issue in this particular matter, as it was a simple thank-you message out of politeness (which is greatly appreciated, Amir!). However, using just a single example should help to emphasize my point exponentially when you consider the frequency of occurrences we see following the [SOLVED]-appended route. On 12 September, 2007, Zbigniew Szalbot posted a message to the list about a segmentation fault in PHP 5.2.3. Over the next 24 hours-plus, exactly sixty comments passed back-and-forth on the thread. When a solution was found, it was posted in a separate email with the [SOLVED] tag added to the subject line, and two additional comments added to that (entirely new) thread. Why is this such a critical issue? Because if we hope not to have to answer the same questions over and over again, instructing people to properly STFW, then we should at least be contributing to proper archival and documentation of problems we've successfully solved. Using the aforementioned example, we check Google for the same problem: http://www.google.com/search?q=php+5.2.3+segmentation+fault+core+dumped Hooray! Someone else has had the exact same list of problems, and now I can simply go through all of the responses and it should (fingers crossed!) correct my issues as well. Message 58 59 getting close! sixty-one WHAT?!? No solution? Back to Google only to find that each result is exactly the same discussion, never including the final three emails. So the summary of my proposal is as follows: 1.) An issue has been identified with the list whereby improper archival will likely lead to repeat questions and unnecessary traffic to the list. 2.) I propose that we discontinue the act of subject modification to indicate a change in status of the issue (SOLVED, ALSO, ANOTHER PROBLEM, etc.) unless a completely different problem is reached or question is asked. This will allow a step-by-step document (of sorts) to be created and made searchable on the web. Comments welcomed! -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 If at first you don't succeed, stick to what you know best so that you can make enough money to pay someone else to do it for you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ Express yourself with free Messenger emoticons. Get them today! http://www.freemessengeremoticons.ca/?icid=EMENCA122 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Dynamic Display of Images Stored in DB
... http://www.wellho.net/solutions/php-example-php-form-image-upload-store-in-mysql-database-retreive.html having taken a quick look at that page I can only hope that you aspire to write alot better code than that! Thanks very much for reading this long post. David Thing is, the above works just fine as long as I hard code a switch case for every image file pulled from the db. What I can't seem to do is dynamically extend it to include newly uploaded images, i.e., for an image count greater than what I've hard coded. I thought maybe something like 'eval' might be used (I know, if eval is the answer, I'm asking the wrong question). no to eval(). period. I personally have never had any reason to use eval() there has always been a safer more performant way of achieving whatever it was. possibly someone on this list can give a realworld, valid example of using eval(), although I probably wouldn't put money on it. To be honest, I don't even know _why_ the above works because it seems that stuff is happening as if in a while loop when there isn't one (the switch case part). I reread the code and I understand what it does now. I don't think it's very good. to start I would split it up into 2 scripts. one to generate the HTML table and one to output image data (basically what the switch statement does). secondly when your building the html table you don't need to retrieve the image data - change your select statement so that it is not included, that will be more performant. the src attributes of the img tags should reference your new image output script something like this img src=img.php?im=$setID alt= / lastly the new script you create to output image data should use an SQL query of it's own to retrieve the image data relevant to the passed in id. something like this: img.php: ?php $id = $_GET['im']; if ($id ($row = mysql_fetch_assoc(mysql_query(select imagedata from pictures WHERE pid=$id { header(Content-type: image/jpeg); echo $row['image_data']; } exit; ? note I have not bothered to add much error checking of request variable sanitation ... that is left as an exercise for the reader. the whole example rests on the fact that the table containing the image data should have a primary key that you can reference (so don't use some incremented counter for the value of $setID !!!), additionally you will need to store the mime-type along with the image data in order to be able to output the correct Content-type header. one more thing - your a noob - noobs are not allowed (imho) to prefix expressions with the error repression symbol (the '@' symbol) ... you want to see/log errors, there is hardly ever any reason to use '@' to repress errors and if you really need it you will know exactly why. sounds harsh but it will save you headaches. For the moment, I'd be happy to just understand how it works as it does. Maybe as you suggest, there is raw image data somehow being embedded in the html. no, nothing is being embedded - the script is being called in 2 different contexts, firstly to output html, secondly to output image data - the script is incredibly inefficient - every call to the script is retrieving all the image data from the database, which hopefully you can understand is completely unnecessary. On a peripherally related note, I did learn that syntax like img src=?im=6 looks like this in the page source: img src=http://www.mypage.php?im=6. Never liked the short-hand stuff... Thanks, Jochem, for responding. David -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP RFC # 0001 --- List Etiquette [SOLVED]
On Wednesday 28 November 2007, Jay Blanchard wrote: [snip] So the summary of my proposal is as follows: reached or question is asked. This will allow a step-by-step document (of sorts) to be created and made searchable on the web. [/snip] This has been the expected behavior (adding [SOLVED]) for a long time though it does not occur as often as it should. It has been in the NEWBIE GUIDE for a long time and has been a de-facto standard on IT or computer related mailing lists like this for years. It has been the de-facto standard for mail clients to prefix quoted lines with . Please fix your mail client or use a better one! -- Crayon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Getting IP from hostname using Curl
Gevorg Harutyunyan wrote: Hi, I am using Curl extension for my project. Regulary I am fetching some pages from web using Curl. Now I must create ban system for some IPs. What does that mean? Don't fetch the pages on some ip's? Don't allow some ip's to use curl? Something else? -- 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] Instantiate phpmailer in a separate class?
Hello, I want to have a class send some emails. I wanted to use the excellent phpMailer class to do this. What is the proper way to use the phpMailer class from within a method of a separate class? -- Mike B^) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP RFC # 0001 --- List Etiquette [SOLVED]
On Thu, 2007-11-29 at 09:24 +0800, Crayon Shin Chan wrote: This has been the expected behavior (adding [SOLVED]) for a long time though it does not occur as often as it should. It has been in the NEWBIE GUIDE for a long time and has been a de-facto standard on IT or computer related mailing lists like this for years. This is OK, as long as you don't go breaking threads or starting a new thread for something like Thanks! I think that the spirit of the post is not around the use of [SOLVED] or not, but around archive integrity and searchability, especially on the known long tedious dead-horse-whipping threads like Best IDE et al. It has been the de-facto standard for mail clients to prefix quoted lines with . Please fix your mail client or use a better one! This bring up another point. Clients like Novell Group(un)Wise (which we use at our institution (I don't because its evil), and many many others don't do a bunch of things that mail clients should, by law, have to do. Some M$ variants of clients don't even do threading at all! (Does gMail?) This IMHO is tantamount to spamming, as it destroys archival integrity and raises my blood pressure. I think that anyone that participates in any list should invest the 20 minutes it may take to download and install a decent mail client (there are plenty of excellent Free (as in Freedom) ones out there - just ask if you need help). For our own project mailing list(s), I have come up with similar rules - and working and living in a bandwidth starved country/continent, these rules have to be enforced quite strictly. The basic rule set can be found here: http://avoir.uwc.ac.za/avoir/index.php?module=wikiaction=wikilinkpagename=MailingListRules Obviously not all of them can be enforced strictly (like the disclaimer one) as some institutions (mine included) add huge HTML disclaimers to all mail on its way out. There are a few things that can be done to make lists more pleasant for everyone. I suggest we try and put a few in place so as to: 1. Primarily save bandwidth 2. Save time 3. Get more useful archives 4. Be able to say STFW with conviction, because we *know* its there! --Paul All Email originating from UWC is covered by disclaimer http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Dynamic Display of Images Stored in DB
At 6:12 PM -0600 11/28/07, David Giragosian wrote: Thing is, the above works just fine as long as I hard code a switch case for every image file pulled from the db. What I can't seem to do is dynamically extend it to include newly uploaded images, i.e., for an image count greater than what I've hard coded. I thought maybe something like 'eval' might be used (I know, if eval is the answer, I'm asking the wrong question). To be honest, I don't even know _why_ the above works because it seems that stuff is happening as if in a while loop when there isn't one (the switch case part). For the moment, I'd be happy to just understand how it works as it does. Maybe as you suggest, there is raw image data somehow being embedded in the Unfortunately, my webbytedd.com site is down where I have an example, but I can't show code right now. But, what I did simply was to load the images into the dB and then pull them out as needed. As Jochem suggested, it's better to use a different script for inserting your images into a html table than it is to try to make it a function in your main script. That way you can buffer the image and call the image in via a img tag. In my solution, I use two scripts. One for showing the image true size and another for generating a thumbnail -- I may be wrong, but I think it's better to generate a thumbnail as needed on the fly than it is to store both images (large and thumbnail) in the dB. As for a counter, that value can come directly from your dB. You can either find out how many images there are in your dB and set a counter to that figure OR draw the images out via a LIMIT -- either way, there's no need to hard code a limit. You can still use your switch because it is based upon image type, which is a good idea -- if you're going to store different image types in your dB. 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] Dynamic Display of Images Stored in DB
In my solution, I use two scripts. One for showing the image true size and another for generating a thumbnail -- I may be wrong, but I think it's better to generate a thumbnail as needed on the fly than it is to store both images (large and thumbnail) in the dB. Cache it on the filesystem even if it's for a short time (of course if the image is updated elsewhere the cache needs to be cleared as well..). ?php $file = '/path/to/cache/file.jpg'; if (file_exists($file)) { if (filemtime($file) strtotime('-30 minutes')) { $fp = fopen($file, 'rb'); fpassthru($fp); exit; } // the file is older than 30 minutes, kill it and start again. unlink($file); } // continue creating your thumbnail. $fp = fopen('/path/to/cache/' . $filename, 'wb'); fputs($fp, $imagecontents); fclose($fp); // display image -- 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] Quick question on data formatting
Hi all: Since I'm relatively new to PHP, I'm not familiar with all of the shortcuts and efficient ways one could write a routine that handles converting data from one format into another, so I thought I'd ask here for recommendations on how to solve one particular issue I've got. I'm viewing this as a learning experience for me. I've got some text fields coming in that need to be added to a table as numeric fields. In particular, I've got to process dollar amounts that appear with dollar signs and commas into their strictly numeric forms. For example: $123,456.78 becomes 123456.78 $24,680 becomes 24680 1234B becomes 1234 (That last example is an actual example of something I saw in the data file; I can only assume that the user wanted 1234, as that's the closest value I can assume from what was typed in.) What is the fastest, most efficient way to perform these conversions? I'm coming at PHP from old school experience where I'd normally read through the text character by character and return a value built from only the characters I have declared as acceptable (i.e., 0-9 and . and possibly a -), but I've got to believe that there's some technique -- or possibly a deeply buried function -- available to me now that would be faster and easier to implement. Any help you can provide will, as always, be greatly appreciated! Thanks, Jon
Re: [PHP] Quick question on data formatting
On Wed, 2007-11-28 at 22:19 -0700, Jon Westcot wrote: Hi all: Since I'm relatively new to PHP, I'm not familiar with all of the shortcuts and efficient ways one could write a routine that handles converting data from one format into another, so I thought I'd ask here for recommendations on how to solve one particular issue I've got. I'm viewing this as a learning experience for me. I've got some text fields coming in that need to be added to a table as numeric fields. In particular, I've got to process dollar amounts that appear with dollar signs and commas into their strictly numeric forms. For example: $123,456.78 becomes 123456.78 $24,680 becomes 24680 1234B becomes 1234 $number = ereg_replace( '[^[:digit:].]', '' ); Cheers, Rob. -- ... SwarmBuy.com - http://www.swarmbuy.com Leveraging the buying power of the masses! ... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Quick question on data formatting [SOLVED]
Thanks, Rob! I can see that it's going to be important for me to get familiar with the POSIX regular expressions. Jon - Original Message - On Wed, 2007-11-28 at 22:19 -0700, Jon Westcot wrote: Hi all: Since I'm relatively new to PHP, I'm not familiar with all of the shortcuts and efficient ways one could write a routine that handles converting data from one format into another, so I thought I'd ask here for recommendations on how to solve one particular issue I've got. I'm viewing this as a learning experience for me. I've got some text fields coming in that need to be added to a table as numeric fields. In particular, I've got to process dollar amounts that appear with dollar signs and commas into their strictly numeric forms. For example: $123,456.78 becomes 123456.78 $24,680 becomes 24680 1234B becomes 1234 $number = ereg_replace( '[^[:digit:].]', '' ); Cheers, Rob. -- ... SwarmBuy.com - http://www.swarmbuy.com Leveraging the buying power of the masses! ... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Quick question on data formatting [SOLVED]
On Wed, 2007-11-28 at 22:47 -0700, Jon Westcot wrote: Thanks, Rob! I can see that it's going to be important for me to get familiar with the POSIX regular expressions. You can use the perl versions too. I just got used to the posix versions a long time ago :). BTW, if you didn't notice I forgot the third parameter :) Cheers, Rob. - Original Message - On Wed, 2007-11-28 at 22:19 -0700, Jon Westcot wrote: Hi all: Since I'm relatively new to PHP, I'm not familiar with all of the shortcuts and efficient ways one could write a routine that handles converting data from one format into another, so I thought I'd ask here for recommendations on how to solve one particular issue I've got. I'm viewing this as a learning experience for me. I've got some text fields coming in that need to be added to a table as numeric fields. In particular, I've got to process dollar amounts that appear with dollar signs and commas into their strictly numeric forms. For example: $123,456.78 becomes 123456.78 $24,680 becomes 24680 1234B becomes 1234 $number = ereg_replace( '[^[:digit:].]', '' ); -- ... SwarmBuy.com - http://www.swarmbuy.com Leveraging the buying power of the masses! ... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Instantiate phpmailer in a separate class?
Mike Yrabedra wrote: Hello, I want to have a class send some emails. I wanted to use the excellent phpMailer class to do this. What is the proper way to use the phpMailer class from within a method of a separate class? the same way you would use it outside of a method of a class. class Foo { function bar() { $mailer = new phpMailer; // do stuff with mailer. } } now your Foo class might want to make use of the $mailer object from within more than one method - in this case you can consider using a property of your Foo instances. class Foo { private $mailer; function __construct() { $this-mailer = new phpMailer; } function bar() { $this-mailer-clearAddresses(); } function bar() { $this-mailer-Send(); } } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php