Re: [PHP] Re: unable to unset reference
2008. 02. 19, kedd keltezéssel 13.39-kor Shawn McKenzie ezt írta: Sylvain Rabot wrote: Hello, First of all I would like to know if one day we will be able to unset $this into a class in order to destroy the object. It could really be useful to prevent big memory usage. As it can't be done I tried to unset an object by unsetting a reference of this object but it has no effect on the object but only on the reference. Should unset destroy the reference itself and the object ??? if you don't think so can you think of something different to destroy both of them like I don't know, destroy($obejctsreference) Regards. Reproduce code: --- ? $x = new stdClass(); $x-a = 'ayayaye'; $b[0] = $x; unset($b[0]); var_dump($x); ? Expected result: NULL Actual result: -- object(stdClass)#1 (1) { [a]= string(7) ayayaye } So if you unset a reference you are dereferencing it. If you want to unset both, then unset the object, in this case $x. I think he should unset all references to the object, $x and $b[0] as well. greets Zoltán Németh -Shawn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] More than one values returned?
Nick Stinemates wrote: Nathan Rixham wrote: Robert Cummings wrote: On Mon, 2008-02-18 at 21:09 -0600, Larry Garfield wrote: On Monday 18 February 2008, Nick Stinemates wrote: I have found, however, that if I ever need to return /multiple/ values, it's usually because of bad design and/or the lack of proper encapsulation. You mean you've never had a function like getCoordinates()? Or getUsers(), or any other of a zillion perfectly valid and reasonable functions that return multiple values as an array? Wow, how odd! Cheers, Rob. getCoordinates() would return a Point object getUsers() would return a Group object... Not rocket science ;) I wouldn't consider an array of user objects to be multiple things. I consider it a single aggregate thing, and return arrays all the time. That's conceptually different from wanting two separate return values from a function, which is indeed conceptually icky. Yes, an aggregate is comprised of multiple things usually. Hence when decomposing the concept you are indeed returning multiple values-- both points of view are valid. If you receive a parcel of 100 pens. I can say, has the parcel arrived yet (one entity) or have the pens arrived yet (multiple entities). At any rate, the O.P. wanted to return multiple values called $x and $y. It seems quite reasonable to assume he was returning something akin to coordinates but didn't know how to do so by binding them in an aggregating structure such as an array, or if you wish, an object. Cheers, Rob. seriously, whats wrong with returning an array? half the standard php functions return array's, therefore at least half of php has been designed badly..? ps: when working with co-ordinates / GIS data you should really be using wkb data instead, it's much faster. [unpack] What's wrong with it? Hmm.. Half of PHP functions DO return arrays, I'll grant you that. The reason? It's untyped. If PHP were a typed language, and it still returned arrays for a lot, I definitely think it would be designed poorly. At any rate, returning an array from your Objects increases the burden and shifts it to the client of your API. For instance, if we take an example mentioned above *getUsers()* which returned an arbitrary number of User objects you could potentially use it like this. userupdater.php ?php $x = Users::getUsers($somefilter) foreach ($x as $user) { $user-update(); } ? Keep in mind. You'll have to rewrite that functionality in multiple areas. As opposed to: ?php $x = Users::getGroup($somegroup); // returns a group of users $x-update(); // can be reused wherever instead of having to loop through every user on the client side. ? I hope you can see past my (basic) example to understand where I am headed with this. I would, and do, use this magic :) Users::GetGroup($somegroup)-update(); Simple, Even less typing then yours :p -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] System errno in PHP
Hello Nick I have read http://php.net/fopen from top to bottom, but I could not find how to get system error number. With set_error_handler I can get string for example fopen(hmc_configuration.cfg) [function.fopenhttp://ds63450.mspr.detemobil.de/%7Emmaras/HMC/function.fopen]: failed to open stream: Permission denied but I need integer number not string, because string error messages depends on locale setting. Of course, I can test some conditions before fopen, but it is not enough for me. By On 19/02/2008, Nick Stinemates [EMAIL PROTECTED] wrote: Michal Maras wrote: I am now using filesystem functions fopen, fread, fclose, ... On 19/02/2008, Stut [EMAIL PROTECTED] wrote: Michal Maras wrote: Coud somebody tell me if it is possible to get integer value of variable which name in C is errno end in perl $!. I am PHP beginner so I am sorry if question is 'stupid'. What function are you calling where you expect to get a system error? Check the manual page for that function - it will tell you how to detect errors. -Stut -- http://stut.net/ http://php.net/fopen -- == Nick Stinemates ([EMAIL PROTECTED]) http://nick.stinemates.org AIM: Nick Stinemates MSN: [EMAIL PROTECTED] Yahoo: [EMAIL PROTECTED] == -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Converting tab delimited file to CSV
On Feb 20, 2008 3:05 AM, Richard Lynch [EMAIL PROTECTED] wrote: On Mon, February 18, 2008 12:08 pm, Graham Cossey wrote: proceed accordingly... My biggest gripe with tab delimited files is that they are quite a bit bigger than comma delimited files so I may have to split the large files I receive into smaller 'chunks' to allow them to be uploaded. This is not making sense... A tab-delimited file wil have a TAB character \t instead of comma , A tab WITHIN the data then needs escaping as \t or somesuch. But commas to not need escaping with quotes. And quotes don't need escaping with double-quotes. So tab-delimited should be a TINY bit smaller or the same size. Perhaps your users are just uploading more data. One thing I have noticed is that the files I create in my PHP script (The script breaks a large file into smaller files of 25,000 records/rows each.) when opened in Excel (by double-clicking the file in Windows Explorer) came up with an unrecognised file format message for all files except the first. If you ignore this message the tab delimited files open OK but the comma separated ones do not. The except the first made me think that there may be something hidden at the beginning of the file to say what type of data follows. Some CSV files include a header line with the names of the fields in the first line. This is less common in tab-delimited, but not unheard of. If it's any help the data I'm getting comes out of a third party Cognos environment. The data opened into Textpad looks like this : Column One Column Two Column ThreeColumn Four Column Five Column Six Column Seven ABCDE XX99DCS HORSE 1 200602 ABFED XX99DCS HORSE 1 200602 JHGNF XX99DCS HORSE 1 200602 HNDGE XX99DCS HORSE 1 200602 Tab delimited no? This file is 385KB. If I open it into Excel just by double-clicking on it it opens fine. I then do File Save As, change Unicode Text (*.txt) to CSV (Comma Delimited)(*.csv) and give it a name then Save. This new file is now 193KB and looks like this in Textpad : Column One,Column Two,Column Three,Column Four,Column Five,Column Six,Column Seven ABCDE,XX99,DCS,HORSE,1,2006,2 ABFED,XX99,DCS,HORSE,1,2006,2 JHGNF,XX99,DCS,HORSE,1,2006,2 HNDGE,XX99,DCS,HORSE,1,2006,2 Double-clicking on this newly created file opens fine into Excel. Back to my 'original' problem/question, if I '$f = fopen($file, r)' and 'while ($data = fgets($f))' on the above first format and do a $data = str_replace(\t,,,$data); the resulting file looks like the second example above when opened into Textpad but will not open into separate columns when opened with Excel. I thought these were supposed to be simple, basic flat text formats that were universally accepted, guess I'm just naive ;-) I'm on the verge of simply giving in, and continuing to Open Save As the 100+ files I have to process in the next week or so :-( -- Graham -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] unable to unset reference
Chris [EMAIL PROTECTED] a écrit dans le message de news: [EMAIL PROTECTED] Sylvain Rabot wrote: Hello, First of all I would like to know if one day we will be able to unset $this into a class in order to destroy the object. It could really be useful to prevent big memory usage. I doubt the php-dev's will ever allow something like that, seems rather dangerous to me. Why ? It would be nice to stop thinking PHP developpers are idiots who don't know how to code. I don't mean unset($this) is the best wy to allow an object to destroy itself. I just say we miss something to auto destroy objects. We could also think about a magic method like __destroy(). As it can't be done I tried to unset an object by unsetting a reference of this object but it has no effect on the object but only on the reference. Should unset destroy the reference itself and the object ??? No, it's not meant to (and I doubt it will change). Why do you want it to do that? What is the original problem you're trying to solve? I put SQL resources into an objects and I would like to destroy objects when calling method free() but obviously I can't. -- 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] System errno in PHP
Michal Maras wrote: I have read http://php.net/fopen from top to bottom, but I could not find how to get system error number. With set_error_handler I can get string for example fopen(hmc_configuration.cfg) [function.fopenhttp://ds63450.mspr.detemobil.de/%7Emmaras/HMC/function.fopen]: failed to open stream: Permission denied but I need integer number not string, because string error messages depends on locale setting. Of course, I can test some conditions before fopen, but it is not enough for me. What exactly are you trying to do? Why do you need the specific reason why it failed? It's pretty-much always a case of file not found or insufficient permissions, both of which you can check for before going near fopen. -Stut -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Converting tab delimited file to CSV
I have a suspision the files I receive are in unicode which is causing the problems. How can I categorically determine if a file uses unicode? Am I correct in believing PHP4 doesn't work with unicode files? -- Graham -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] base url and SEF
Hi all, I'm currently parsing the variable $_SERVER['PHP_SELF'] to get the base url of a site. Example: http://www.example.com/~eric/program/index.php?option=abc What I'm interested in getting is http://www.example.com/~eric/program/;, which I am able to get currently. Questions 1) Are there security implications in using $_SERVER['PHP_SELF'], and if so, how do I mitigate it? 2) Is using this method safe for all sorts of browsers/servers that run php? 3) If I install an SEF software so that my url looks like http://www.example.com/~eric/program/a/b/c ,what will $_SERVER['PHP_SELF'] show? Thanks. Eric -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] System errno in PHP
Hi Hmm.. I know I can check such sings as if file exists or has right permission before fopen. But it does not mean that file will still exists with right permission a moment later when fopen will be issued. And I can't check everything. I can't image how to check whether file is locked, or if it is on read only filesystems or if limit of opened fil was reached ... Similar problem can be with fseek, fread,... By On 20/02/2008, Stut [EMAIL PROTECTED] wrote: Michal Maras wrote: I have read http://php.net/fopen from top to bottom, but I could not find how to get system error number. With set_error_handler I can get string for example fopen(hmc_configuration.cfg) [function.fopen http://ds63450.mspr.detemobil.de/%7Emmaras/HMC/function.fopen]: failed to open stream: Permission denied but I need integer number not string, because string error messages depends on locale setting. Of course, I can test some conditions before fopen, but it is not enough for me. What exactly are you trying to do? Why do you need the specific reason why it failed? It's pretty-much always a case of file not found or insufficient permissions, both of which you can check for before going near fopen. -Stut -- http://stut.net/
RES: [PHP] Thread Safety
Tom, That did not do it either. I'm sure I'm missing something stupid, just can't find out what. PHPInfo: System Linux debian 2.6.18-4-486 #1 Mon Mar 26 16:39:10 UTC 2007 i686 Build Date Feb 20 2008 05:43:08 Configure Command './configure' '--with-oci8-instant-client=/oracle/instantclient/' '--with-apxs2=/usr/bin/apxs2' '--disable-zts' Server API Apache 2.0 Handler Virtual Directory Support enabled Configuration File (php.ini) Path /usr/local/lib/php.ini PHP API 20020918 PHP Extension 20020429 Zend Extension 20050606 Debug Build no Zend Memory Manager enabled Thread Safety enabled Registered PHP Streams php, http, ftp Apache: debian:/usr/src/php-4.4.8# apache2ctl -V Server version: Apache/2.2.3 Server built: Jan 27 2008 18:13:21 Server's Module Magic Number: 20051115:3 Server loaded: APR 1.2.7, APR-Util 1.2.7 Compiled using: APR 1.2.7, APR-Util 1.2.7 Architecture: 32-bit Server MPM: Prefork threaded: no forked: yes (variable process count) Server compiled with -D APACHE_MPM_DIR=server/mpm/prefork -D APR_HAS_SENDFILE -D APR_HAS_MMAP -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled) -D APR_USE_SYSVSEM_SERIALIZE -D APR_USE_PTHREAD_SERIALIZE -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT -D APR_HAS_OTHER_CHILD -D AP_HAVE_RELIABLE_PIPED_LOGS -D DYNAMIC_MODULE_LIMIT=128 -D HTTPD_ROOT= -D SUEXEC_BIN=/usr/lib/apache2/suexec -D DEFAULT_PIDLOG=/var/run/apache2.pid -D DEFAULT_SCOREBOARD=logs/apache_runtime_status -D DEFAULT_LOCKFILE=/var/run/apache2/accept.lock -D DEFAULT_ERRORLOG=logs/error_log -D AP_TYPES_CONFIG_FILE=/etc/apache2/mime.types -D SERVER_CONFIG_FILE=/etc/apache2/apache2.conf -Mensagem original- De: Tom Rogers [mailto:[EMAIL PROTECTED] Enviada em: terça-feira, 19 de fevereiro de 2008 20:40 Para: Thiago Pojda Cc: php-general@lists.php.net Assunto: Re: [PHP] Thread Safety Hi, Wednesday, February 20, 2008, 3:00:28 AM, you wrote: TP Not quite sure if this is the right list, but here I am... TP TP I'm trying to use zend platform and it requires the Thread Safety TP option set to off. TP TP I just compiled php and I can't find what argument to build php that TP way, what am I missing? TP TP PHP 4.4.8 TP TP TP Thanks! --disable-zts should do it -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] unable to unset reference
Sylvain R. wrote: Chris [EMAIL PROTECTED] a écrit dans le message de news: [EMAIL PROTECTED] Sylvain Rabot wrote: Hello, First of all I would like to know if one day we will be able to unset $this into a class in order to destroy the object. It could really be useful to prevent big memory usage. I doubt the php-dev's will ever allow something like that, seems rather dangerous to me. Why ? It would be nice to stop thinking PHP developpers are idiots who don't know how to code. I don't see how that reply implies that opinion. I don't mean unset($this) is the best wy to allow an object to destroy itself. I just say we miss something to auto destroy objects. We could also think about a magic method like __destroy(). An object that destroys itself is a really bad idea from an architectural point of view. I, as a consumer of your class, need to have control over the lifetime of any instances I create. In my opinion if you have a need for a class to destroy itself then you have a fundamental design flaw. As it can't be done I tried to unset an object by unsetting a reference of this object but it has no effect on the object but only on the reference. Should unset destroy the reference itself and the object ??? No, it's not meant to (and I doubt it will change). Why do you want it to do that? What is the original problem you're trying to solve? I put SQL resources into an objects and I would like to destroy objects when calling method free() but obviously I can't. I don't understand why you need to destroy the class instance to clear up member variables. Or am I not understanding your diction? -Stut -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RES: [PHP] Help on running external command
You're using single quotes (') and therefore variables within will not be resolved. try either: exec(su - vpopmail -c \/var/qmail/bin/maildirmake/home/vpopmail/domains/wwlib.lan/\ . $username); exec('su - vpopmail -c /var/qmail/bin/maildirmake/home/vpopmail/domains/wwlib.lan/' . $username'); try echoing the result before exec'ing: echo('su - vpopmail -c /var/qmail/bin/maildirmake/home/vpopmail/domains/wwlib.lan/ . $username'); cheers, Thiago Henrique Pojda Desenvolvimento Web +55 41 3033-7676 [EMAIL PROTECTED] Excelência em Softwares Financeiros -Mensagem original- De: Mário Gamito [mailto:[EMAIL PROTECTED] Enviada em: quarta-feira, 20 de fevereiro de 2008 11:32 Para: PHP General list Assunto: [PHP] Help on running external command Hi, I need to run an eternal command from a PHP page. My code is: $username= 'lixo'; $username = 'lixo'; exec('su - vpopmail -c /var/qmail/bin/maildirmake/home/vpopmail/domains/wwlib.lan/ . $username'); But I get the error: /var/qmail/bin/maildirmake/home/vpopmail/domains/wwlib.lan/: Not a directory Which means that the $username variable isn't being appended to the string. Any help would be appreciated. Warm Regards, Mário Gamito -- 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] Help on running external command
On Wed, 20 Feb 2008, Mário Gamito wrote: Hi, I need to run an eternal command from a PHP page. My code is: $username= 'lixo'; $username = 'lixo'; exec('su - vpopmail -c /var/qmail/bin/maildirmake/home/vpopmail/domains/wwlib.lan/ . $username'); try: exec('su - vpopmail -c /var/qmail/bin/maildirmake/home/vpopmail/domains/wwlib.lan/'.$username); But I get the error: /var/qmail/bin/maildirmake/home/vpopmail/domains/wwlib.lan/: Not a directory Which means that the $username variable isn't being appended to the string. Any help would be appreciated. Warm Regards, Mário Gamito -- 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] Help on running external command
2008. 02. 20, szerda keltezéssel 14.31-kor Mário Gamito ezt írta: Hi, I need to run an eternal command from a PHP page. My code is: $username= 'lixo'; $username = 'lixo'; exec('su - vpopmail -c /var/qmail/bin/maildirmake/home/vpopmail/domains/wwlib.lan/ . $username'); But I get the error: /var/qmail/bin/maildirmake/home/vpopmail/domains/wwlib.lan/: Not a directory Which means that the $username variable isn't being appended to the string. you're putting . and a variable inside a string delimited by ' which will never work. to avoid confusion like this, why not build the string first, then exec() it? that way you can always echo out the string to check what might be the problem. $cmd = 'su - vpopmail /var/qmail/bin/maildirmake/home/vpopmail/domains/wwlib.lan/' . $username; exec($cmd); greets Zoltán Németh Any help would be appreciated. Warm Regards, Mário Gamito -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Converting tab delimited file to CSV
On Feb 20, 2008 3:54 AM, Graham Cossey [EMAIL PROTECTED] wrote: If it's any help the data I'm getting comes out of a third party Cognos environment. The data opened into Textpad looks like this : Column One Column Two Column ThreeColumn Four Column Five Column Six Column Seven ABCDE XX99DCS HORSE 1 200602 ABFED XX99DCS HORSE 1 200602 JHGNF XX99DCS HORSE 1 200602 HNDGE XX99DCS HORSE 1 200602 Tab delimited no? It looks liked fixed-width instead of tab-delimited to me. Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Help on running external command
Hi, I need to run an eternal command from a PHP page. My code is: $username= 'lixo'; $username = 'lixo'; exec('su - vpopmail -c /var/qmail/bin/maildirmake/home/vpopmail/domains/wwlib.lan/ . $username'); But I get the error: /var/qmail/bin/maildirmake/home/vpopmail/domains/wwlib.lan/: Not a directory Which means that the $username variable isn't being appended to the string. Any help would be appreciated. Warm Regards, Mário Gamito -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] More than one values returned?
On Wed, Feb 20, 2008 at 1:38 AM, Robert Cummings [EMAIL PROTECTED] wrote: Actually, using foreach on an array has less overhead than an iterator on an object. yes they are; see my experiment results here, http://nathan.moxune.com/arrayVsArrayIteratorReport.php and i hear what youre saying rob; at least i think so, namely, why try to build in a set of operations into the group class for every single possibility, even though they are centralized, you wouldnt want the developer of the group class having to write a new method every time one of the clients wanted something new; thats just madness. and frankly impractical, because we all know how these release cycles can be :) anyway, there are plenty of options for the group class. 2 come to mind immediately, the first allows you to apply a callback to every element of the group; this is something like you would see in a functional language, but it works pretty well w/ the php callback pseudo type as well. and in fact, spl is incorporating this in 5.3, according to marcus. the next option is to subclass the group object for your particular operation. then you could have a number of specialized child classes, that each, are, the parent class and exhibit the specialized functionality. and the best part is, the group class writer gets to chill in both scenarios :D nick is right to an extent; reproducing the same client code in multiple places is not good. however, rob is right too; you cant think of every conceivable operation and build it into the group class. fortunately we have callbacks and inheritance; and there are other elegant solutions as well, just that none pop into my head in under a second :) my thought is that *sometimes* returning an array is appropriate, and *sometimes* returning an object is appropriate. it depends upon the scenario; this is such a generic, common issue that you cant say one is better than the other in all cases, because frankly neither is better in all cases. -nathan
Re: [PHP] base url and SEF
At 8:14 PM +0800 2/20/08, Eric Boo wrote: Hi all, I'm currently parsing the variable $_SERVER['PHP_SELF'] to get the base url of a site. Example: http://www.example.com/~eric/program/index.php?option=abc What I'm interested in getting is http://www.example.com/~eric/program/;, which I am able to get currently. Questions 1) Are there security implications in using $_SERVER['PHP_SELF'], and if so, how do I mitigate it? 1a) Yes, it's insecure because it's an outside source. Never trust the user for anything. 1b) Use hard coded absolute references OR check that what you receive from $_SERVER['PHP_SELF'] is what you expect. As to parsing it, look into basename() examples. 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] Help on running external command / Partially solved
On Feb 20, 2008 9:59 AM, Mário Gamito [EMAIL PROTECTED] wrote: Of course the code is: $username = 'lixo'; exec(su -c - vpopmail \/var/qmail/bin/maildirmake /home/vpopmail/domains/wwlib.lan/\$username); Oh, yes, of course it is! That still doesn't mean that Apache has the right privileges. Change the above to this: ? $username = lixo; exec('su -c - vpopmail /var/qmail/bin/maildirmake /home/vpopmail/domains/wwlib.lan/'.$username.'',$ret,$err); echo pre /\n; print_r($ret); echo /pre\n; echo isset($err) ? Error: .$err : null; ? -- /Dan Daniel P. Brown Senior Unix Geek ? while(1) { $me = $mind--; sleep(86400); } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help on running external command / Partially solved
Hi, Thank you for your answers. I got it working with: //$username = 'lixo'; exec(su -c - vpopmail \/var/qmail/bin/maildirmake /home/vpopmail/domains/wwlib.lan/\$username); Now, if I run it from the shell, it creates the directory. From a page on the web server it doesn't. Directory /home/vpopmail/domains/wwlib.lan/ is owned by vpopmail.vchkpw (as well as my .php page) with 700 permission. I even tried chmoding 777 to my page, but still, it doesn't create the directory. Any ideas ? Warm Regards, Mário Gamito -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help on running external command / Partially solved
Of course the code is: $username = 'lixo'; exec(su -c - vpopmail \/var/qmail/bin/maildirmake /home/vpopmail/domains/wwlib.lan/\$username); Mário Gamito wrote: Hi, Thank you for your answers. I got it working with: //$username = 'lixo'; exec(su -c - vpopmail \/var/qmail/bin/maildirmake /home/vpopmail/domains/wwlib.lan/\$username); Now, if I run it from the shell, it creates the directory. From a page on the web server it doesn't. Directory /home/vpopmail/domains/wwlib.lan/ is owned by vpopmail.vchkpw (as well as my .php page) with 700 permission. I even tried chmoding 777 to my page, but still, it doesn't create the directory. Any ideas ? Warm Regards, Mário Gamito -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help on running external command / Partially solved
On Feb 20, 2008 9:52 AM, Mário Gamito [EMAIL PROTECTED] wrote: Now, if I run it from the shell, it creates the directory. From a page on the web server it doesn't. Chances are, the user as which the HTTP server (probably Apache) is running does not have permission to write/create in that directory. Check into using a suExec patch if possible. -- /Dan Daniel P. Brown Senior Unix Geek ? while(1) { $me = $mind--; sleep(86400); } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] More than one values returned?
On Mon, Feb 18, 2008 at 9:06 PM, Nick Stinemates [EMAIL PROTECTED] wrote: Thats a good example, and a good reason for passing values by Reference instead of by Value. I have found, however, that if I ever need to return /multiple/ values, it's usually because of bad design and/or the lack of proper encapsulation. and this is what i was responding to earlier, nick, although you didnt criticize pass-by-reference directly you essentially said use of it indicates bad design, which i disagree with. check my post where i show a method with a boolean return value that has a pass-by-reference parameter to return data; that is a perfectly reasonable use case for pass-by-reference and it does not indicate bad design. nor would it, if there were more pass-by-reference parameters in that method. and here is another reason you might have to return more than on value from a method; a function needs to return data of different types. now php is loosely typed, so packaging these into an array is a joke, but in other languages, that are strongly typed, its not quite that simple. any way, when i think about a method returning a class, what if for whatever reason, a method were to return objects of 2 classes ? do you then create another class just for the purpose of packaging those 2 objects for this method to return a single value? well ill let you be the judge of that, but i would probly toss them in a small array, or, depending on the scenario, use pass-by-reference, especially if i wanted to return a boolean value from the method ;) -nathan
Re: [PHP] base url and SEF
On Feb 20, 2008 7:14 AM, Eric Boo [EMAIL PROTECTED] wrote: Hi all, I'm currently parsing the variable $_SERVER['PHP_SELF'] to get the base url of a site. [snip!] Questions 1) Are there security implications in using $_SERVER['PHP_SELF'], and if so, how do I mitigate it? 2) Is using this method safe for all sorts of browsers/servers that run php? 3) If I install an SEF software so that my url looks like http://www.example.com/~eric/program/a/b/c ,what will $_SERVER['PHP_SELF'] show? 1.) No more than any other predefined superglobal.[1] 2.) Yes, though the browser has nothing to do with PHP. 3.) It will show what should be in PHP_SELF: the name of the parent script.[2] FOOTNOTES: [1] $_SERVER is what's called a SUPERGLOBAL in PHP. The same as $_POST, $_GET, $_REQUEST, $_COOKIE, $_FILES, $_ENV, and $_SESSION. Moreover, $GLOBALS shows all globals within the scope of a script. For more information, check out: http://php.net/manual/en/language.variables.predefined.php [2] PHP_SELF is a reserved and predefined variable. Check out the scope of $_SERVER right here: http://php.net/manual/en/reserved.variables.php#reserved.variables.server -- /Dan Daniel P. Brown Senior Unix Geek ? while(1) { $me = $mind--; sleep(86400); } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] More than one values returned?
At 9:24 PM -0800 2/19/08, Nick Stinemates wrote: Not once did I knock By Reference value passing or pointers. I said, simply, returning an array of objects was usually an indication of poor design. And the difference between a variable, an object, an array, and a pointer is? Look, they all are segments of memory -- passing one or the other is not an indication of good or poor design and it's just plain silly to say so. 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] Help on running external command / Partially solved
Hi, ? $username = lixo; exec('su -c - vpopmail /var/qmail/bin/maildirmake /home/vpopmail/domains/wwlib.lan/'.$username.'',$ret,$err); echo pre /\n; print_r($ret); echo /pre\n; echo isset($err) ? Error: .$err : null; ? No output at all and I have display_errors = On in php.ini Still no directory creation. If I run the file as user vpopmail it asks me for a password: # su - vpopmail $ php /home/www/hash.php Output: [EMAIL PROTECTED] ~]$ php /home/www/hash.php Password: Any ideas ? Warm Regards, Mário Gamito -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help on running external command / Partially solved
On Feb 20, 2008 10:30 AM, Mário Gamito [EMAIL PROTECTED] wrote: Please keep the replies on-list, Mario. It helps others out, and ensures that you'll get better advice from a larger group of talented people. ? $username = lixo; exec('su -c - vpopmail /var/qmail/bin/maildirmake /home/vpopmail/domains/wwlib.lan/'.$username.'',$ret,$err); echo pre /\n; print_r($ret); echo /pre\n; echo isset($err) ? Error: .$err : null; ? No output at all and I have display_errors = On in php.ini Still no directory creation. If I run the file as user vpopmail it asks me for a password: # su - vpopmail $ php /home/www/hash.php Output: [EMAIL PROTECTED] ~]$ php /home/www/hash.php Password: It's because you can't automate su - without using an intermediary such as 'expect'. -- /Dan Daniel P. Brown Senior Unix Geek ? while(1) { $me = $mind--; sleep(86400); } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] unable to unset reference
Stut [EMAIL PROTECTED] a écrit dans le message de news: [EMAIL PROTECTED] Sylvain R. wrote: Chris [EMAIL PROTECTED] a écrit dans le message de news: [EMAIL PROTECTED] Sylvain Rabot wrote: Hello, First of all I would like to know if one day we will be able to unset $this into a class in order to destroy the object. It could really be useful to prevent big memory usage. I doubt the php-dev's will ever allow something like that, seems rather dangerous to me. Why ? It would be nice to stop thinking PHP developpers are idiots who don't know how to code. I don't see how that reply implies that opinion. I didn't mean to be rude but how a language structure could be dangerous ? You use it if you know how to otherwise you don't. I don't understand why we should not implement something because it could be bad used by some persons as far it useful for others. I don't mean unset($this) is the best wy to allow an object to destroy itself. I just say we miss something to auto destroy objects. We could also think about a magic method like __destroy(). An object that destroys itself is a really bad idea from an architectural point of view. I, as a consumer of your class, need to have control over the lifetime of any instances I create. In my opinion if you have a need for a class to destroy itself then you have a fundamental design flaw. I want the object to be destroyed when a specific method of this object is called because when it has been called, the object has no reason to exist anymore. It's like a SQL resource, when you have freed it, you don't need it anymore. As it can't be done I tried to unset an object by unsetting a reference of this object but it has no effect on the object but only on the reference. Should unset destroy the reference itself and the object ??? No, it's not meant to (and I doubt it will change). Why do you want it to do that? What is the original problem you're trying to solve? I put SQL resources into an objects and I would like to destroy objects when calling method free() but obviously I can't. I don't understand why you need to destroy the class instance to clear up member variables. Or am I not understanding your diction? I would like to implement it in order to delete automaticly from memory useless objects. It can be really useful for example to make schedulers in PHP in order to avoid max memory usage exceeded errors. -Stut -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Session destruction problem
At 2:45 PM -0800 2/19/08, Adil Drissi wrote: Hi, Below you'll find my code. I think now that the problem is in my algorithm, because the is created anytime the page is refreshed. But i don't know how to check if the client was logged out or it is a real new connexion to the page. As you will see one can click on logout, then press the back button of the browser, and then refresh the page, but he is still connected. I would like to help me fixe that. Here is the code: You received an answer, but fail to understand. Unless you use javascript to manipulate the browser's history you are going to continue to have problems with the user browser's back button. But, explain why the user using the back button is a problem. If he logs in, he's in. If he logs out, he's out. If he hits the back button after logging out and cancels his log out -- so what? What problems does that present? 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] www. not working
On Feb 19, 2008 10:42 PM, Larry Garfield [EMAIL PROTECTED] wrote: On Tuesday 19 February 2008, Daniel Brown wrote: On Feb 19, 2008 4:43 AM, Christoph [EMAIL PROTECTED] wrote: Don't do that. Some sites may or may not use www. for whatever reason... Usually screwed-up A-name records by incompetent sysadmins, but there it is... Really? So games.yahoo.com blogreport.salon.com mirror1.downloads.com are examples of screwed up records by incompetent sysadmins? No, they're properly-configured FQDNs. They're just irrelevant examples to the context in which Rich was relaying to the OP. Picture a server where the A records or CNAMEs don't exist for the www. alias. Or, conversely, where the only way to access the domain is by using the www. alias. Those, Christoph, are some of the things incompetent sysops do and on a surprisingly frequent basis. I see, so because I have garfieldtech.com and www.garfieldtech.com pointing to two entirely different servers in different states because I want them to do different things, I'm an incompetent sysop. Thanks, good to know. Back off, Garfield, my answer couldn't cover everything! ;-P Besides, without fully-quoting the rest of my message, you're taking it all completely out of context. DNS was used for a lot of things long before the web came around, ya know. You're full of it. Al Gore never would've invented DNS if he didn't have plans to let people get on the AOL to go to eBay. Jocularity aside, DNS was invented in 1983 (shortly after TCP/IP), whereas the WorldWide Web was first invented in 1990. However, if you remember ENQUIRE (on ARPANET), which was created by Tom Berners-Lee (I had to look up his name, I couldn't remember it), the same guy who went on to create the Web, you may remember it existed before DNS. So essentially, even though it wasn't yet known as the WorldWide Web, a form of it did exist before the Domain Name System. Just taking a trip down memory lane. ;-) -- /Dan Daniel P. Brown Senior Unix Geek ? while(1) { $me = $mind--; sleep(86400); } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] More than one values returned?
Jim Lucas wrote: Nick Stinemates wrote: Nathan Rixham wrote: Robert Cummings wrote: On Mon, 2008-02-18 at 21:09 -0600, Larry Garfield wrote: On Monday 18 February 2008, Nick Stinemates wrote: I have found, however, that if I ever need to return /multiple/ values, it's usually because of bad design and/or the lack of proper encapsulation. You mean you've never had a function like getCoordinates()? Or getUsers(), or any other of a zillion perfectly valid and reasonable functions that return multiple values as an array? Wow, how odd! Cheers, Rob. getCoordinates() would return a Point object getUsers() would return a Group object... Not rocket science ;) I wouldn't consider an array of user objects to be multiple things. I consider it a single aggregate thing, and return arrays all the time. That's conceptually different from wanting two separate return values from a function, which is indeed conceptually icky. Yes, an aggregate is comprised of multiple things usually. Hence when decomposing the concept you are indeed returning multiple values-- both points of view are valid. If you receive a parcel of 100 pens. I can say, has the parcel arrived yet (one entity) or have the pens arrived yet (multiple entities). At any rate, the O.P. wanted to return multiple values called $x and $y. It seems quite reasonable to assume he was returning something akin to coordinates but didn't know how to do so by binding them in an aggregating structure such as an array, or if you wish, an object. Cheers, Rob. seriously, whats wrong with returning an array? half the standard php functions return array's, therefore at least half of php has been designed badly..? ps: when working with co-ordinates / GIS data you should really be using wkb data instead, it's much faster. [unpack] What's wrong with it? Hmm.. Half of PHP functions DO return arrays, I'll grant you that. The reason? It's untyped. If PHP were a typed language, and it still returned arrays for a lot, I definitely think it would be designed poorly. At any rate, returning an array from your Objects increases the burden and shifts it to the client of your API. For instance, if we take an example mentioned above *getUsers()* which returned an arbitrary number of User objects you could potentially use it like this. userupdater.php ?php $x = Users::getUsers($somefilter) foreach ($x as $user) { $user-update(); } ? Keep in mind. You'll have to rewrite that functionality in multiple areas. As opposed to: ?php $x = Users::getGroup($somegroup); // returns a group of users $x-update(); // can be reused wherever instead of having to loop through every user on the client side. ? I hope you can see past my (basic) example to understand where I am headed with this. I would, and do, use this magic :) Users::GetGroup($somegroup)-update(); Simple, Even less typing then yours :p :P. I use that method, too. It really sucks for debugging though, because what if GetGroup($somegroup) returns a null or unexpected value? Yeah, it sucks. But, doesn't occur enough to be too annoying ;) -- == Nick Stinemates ([EMAIL PROTECTED]) http://nick.stinemates.org AIM: Nick Stinemates MSN: [EMAIL PROTECTED] Yahoo: [EMAIL PROTECTED] == -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Protected ZIP file with password
On Feb 19, 2008 9:52 PM, Richard Lynch [EMAIL PROTECTED] wrote: For ultimate geekiness, you can install a custom PHP extension I wrote to print out the error message matching 127: http://l-i-e.com/perror :-) Hmm that could come in handy. I'm going to take advantage of your generosity on this one, Lynch. Thanks! -- /Dan Daniel P. Brown Senior Unix Geek ? while(1) { $me = $mind--; sleep(86400); } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] www. not working
Daniel Brown wrote: Jocularity aside, DNS was invented in 1983 (shortly after TCP/IP), whereas the WorldWide Web was first invented in 1990. However, if 1989 actually. you remember ENQUIRE (on ARPANET), which was created by Tom Berners-Lee (I had to look up his name, I couldn't remember it), the That would be Tim. In fact it's Sir Tim if you want to be pedantic. same guy who went on to create the Web, you may remember it existed before DNS. So essentially, even though it wasn't yet known as the WorldWide Web, a form of it did exist before the Domain Name System. A form of the web existing long before that depending on your definition of the web. To me it's a way for people to share information. That would cover the BBS world which pre-dates LANs by some distance. Anyhoo, back to work. -Stut -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] www. not working
A form of the web existing long before that depending on your definition of the web. To me it's a way for people to share information. That would cover the BBS world which pre-dates LANs by some distance. Spider webs have existed for many a year... -- Richard Heyes http://www.websupportsolutions.co.uk Knowledge Base and Helpdesk software hosted for you - no installation, no maintenance, new features automatic and free -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] www. not working
Richard Heyes wrote: A form of the web existing long before that depending on your definition of the web. To me it's a way for people to share information. That would cover the BBS world which pre-dates LANs by some distance. Spider webs have existed for many a year... Yeah, but when was the last time you saw porn on one of them?!! -Stut -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] www. not working
On Feb 20, 2008 12:07 PM, Stut [EMAIL PROTECTED] wrote: Richard Heyes wrote: A form of the web existing long before that depending on your definition of the web. To me it's a way for people to share information. That would cover the BBS world which pre-dates LANs by some distance. Spider webs have existed for many a year... Not long before the eggs hatched. -- /Dan Daniel P. Brown Senior Unix Geek ? while(1) { $me = $mind--; sleep(86400); } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] More than one values returned?
Nathan Nobbe wrote: On Mon, Feb 18, 2008 at 9:06 PM, Nick Stinemates [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Thats a good example, and a good reason for passing values by Reference instead of by Value. I have found, however, that if I ever need to return /multiple/ values, it's usually because of bad design and/or the lack of proper encapsulation. and this is what i was responding to earlier, nick, although you didnt criticize pass-by-reference directly you essentially said use of it indicates bad design, which i disagree with. check my post where i show a method with a boolean return value that has a pass-by-reference parameter to return data; that is a perfectly reasonable use case for pass-by-reference and it does not indicate bad design. nor would it, if there were more pass-by-reference parameters in that method. If I said passing by reference was a bad design, C/C++ programmers all over the world would call me an idiot. Coming from a C background, I would definitely agree with them. Passing by reference and returning an array of objects out of convenience, I think, are completely separate. As for that specific quote, I don't see how it criticizes by reference arguments. If you took it that way, I can only assure you I will (try to) speak more coherently ;) and here is another reason you might have to return more than on value from a method; a function needs to return data of different types. now php is loosely typed, so packaging these into an array is a joke, but in other languages, that are strongly typed, its not quite that simple. any way, when i think about a method returning a class, what if for whatever reason, a method were to return objects of 2 classes ? do you then create another class just for the purpose of packaging those 2 objects for this method to return a single value? Of course, it _always_ depends. This is why in all of this argument i said it was an *indication* not 100% of the time. My only argument is, if you need 2 classes, or 2 sets of data, and you'll need it in more than 1 place (ever) then it would be in your interest to group them. Let's take, for example, the getGroup method I've been using. If I make a change to the update() method (in an extreme example, adding a parameter to it that wasn't there before,) I am going to have to go back through all of my code, and ensure it's being used properly. Instead, if I had a Group object that managed bulk operations on Users, I would only need to update 1 area, and the maintenance on the client code decreases drastically. well ill let you be the judge of that, but i would probly toss them in a small array, or, depending on the scenario, use pass-by-reference, especially if i wanted to return a boolean value from the method ;) -nathan If it calls for passing and object or 2 by reference, I think that's great. -- == Nick Stinemates ([EMAIL PROTECTED]) http://nick.stinemates.org AIM: Nick Stinemates MSN: [EMAIL PROTECTED] Yahoo: [EMAIL PROTECTED] == -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] www. not working
On Feb 20, 2008, at 11:41 AM, Daniel Brown wrote: On Feb 19, 2008 10:42 PM, Larry Garfield [EMAIL PROTECTED] wrote: On Tuesday 19 February 2008, Daniel Brown wrote: On Feb 19, 2008 4:43 AM, Christoph [EMAIL PROTECTED] wrote: Don't do that. Some sites may or may not use www. for whatever reason... Usually screwed-up A-name records by incompetent sysadmins, but there it is... Really? So games.yahoo.com blogreport.salon.com mirror1.downloads.com are examples of screwed up records by incompetent sysadmins? No, they're properly-configured FQDNs. They're just irrelevant examples to the context in which Rich was relaying to the OP. Picture a server where the A records or CNAMEs don't exist for the www. alias. Or, conversely, where the only way to access the domain is by using the www. alias. Those, Christoph, are some of the things incompetent sysops do and on a surprisingly frequent basis. I see, so because I have garfieldtech.com and www.garfieldtech.com pointing to two entirely different servers in different states because I want them to do different things, I'm an incompetent sysop. Thanks, good to know. Back off, Garfield, my answer couldn't cover everything! ;-P Besides, without fully-quoting the rest of my message, you're taking it all completely out of context. DNS was used for a lot of things long before the web came around, ya know. You're full of it. Al Gore never would've invented DNS if he didn't have plans to let people get on the AOL to go to eBay. Jocularity aside, DNS was invented in 1983 (shortly after TCP/IP), whereas the WorldWide Web was first invented in 1990. However, if you remember ENQUIRE (on ARPANET), which was created by Tom Berners-Lee (I had to look up his name, I couldn't remember it), the same guy who went on to create the Web, you may remember it existed before DNS. So essentially, even though it wasn't yet known as the WorldWide Web, a form of it did exist before the Domain Name System. Just taking a trip down memory lane. ;-) I actually read about that in some history books regarding DNS... Man Brown... You must be old if you actually remember it rather then reading it! :P DNS as we know it used to be done by editing the hosts file on individual computers. There was a central list that was published, and people had to redownload it to get their system to resolve the different and new domains. -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 3251 132nd ave Holland, MI, 49424 www.raoset.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] www. not working
On Feb 20, 2008 11:47 AM, Stut [EMAIL PROTECTED] wrote: Daniel Brown wrote: Jocularity aside, DNS was invented in 1983 (shortly after TCP/IP), whereas the WorldWide Web was first invented in 1990. However, if 1989 actually. Without putting too much issue into semantics, it wasn't called the WorldWide Web until sometime around Christmas, 1990. There's probably still an archived version of that first conversation on USENET. you remember ENQUIRE (on ARPANET), which was created by Tom Berners-Lee (I had to look up his name, I couldn't remember it), the That would be Tim. In fact it's Sir Tim if you want to be pedantic. I believe the word I'm looking for is D'oh! And considering the fact that I explained that I had to look his name up at that moment makes it all the worse, so perhaps the word should be shouted at the top of my lungs. same guy who went on to create the Web, you may remember it existed before DNS. So essentially, even though it wasn't yet known as the WorldWide Web, a form of it did exist before the Domain Name System. A form of the web existing long before that depending on your definition of the web. To me it's a way for people to share information. That would cover the BBS world which pre-dates LANs by some distance. Again, it's all in semantics, but I completely agree. Anyhoo, back to work. Yup unfortunately -- /Dan Daniel P. Brown Senior Unix Geek ? while(1) { $me = $mind--; sleep(86400); } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] www. not working
Jason Pruim wrote: On Feb 20, 2008, at 11:41 AM, Daniel Brown wrote: On Feb 19, 2008 10:42 PM, Larry Garfield [EMAIL PROTECTED] wrote: On Tuesday 19 February 2008, Daniel Brown wrote: On Feb 19, 2008 4:43 AM, Christoph [EMAIL PROTECTED] wrote: Don't do that. Some sites may or may not use www. for whatever reason... Usually screwed-up A-name records by incompetent sysadmins, but there it is... Really? So games.yahoo.com blogreport.salon.com mirror1.downloads.com are examples of screwed up records by incompetent sysadmins? No, they're properly-configured FQDNs. They're just irrelevant examples to the context in which Rich was relaying to the OP. Picture a server where the A records or CNAMEs don't exist for the www. alias. Or, conversely, where the only way to access the domain is by using the www. alias. Those, Christoph, are some of the things incompetent sysops do and on a surprisingly frequent basis. I see, so because I have garfieldtech.com and www.garfieldtech.com pointing to two entirely different servers in different states because I want them to do different things, I'm an incompetent sysop. Thanks, good to know. Back off, Garfield, my answer couldn't cover everything! ;-P Besides, without fully-quoting the rest of my message, you're taking it all completely out of context. DNS was used for a lot of things long before the web came around, ya know. You're full of it. Al Gore never would've invented DNS if he didn't have plans to let people get on the AOL to go to eBay. Jocularity aside, DNS was invented in 1983 (shortly after TCP/IP), whereas the WorldWide Web was first invented in 1990. However, if you remember ENQUIRE (on ARPANET), which was created by Tom Berners-Lee (I had to look up his name, I couldn't remember it), the same guy who went on to create the Web, you may remember it existed before DNS. So essentially, even though it wasn't yet known as the WorldWide Web, a form of it did exist before the Domain Name System. Just taking a trip down memory lane. ;-) I actually read about that in some history books regarding DNS... Man Brown... You must be old if you actually remember it rather then reading it! :P DNS as we know it used to be done by editing the hosts file on individual computers. There was a central list that was published, and people had to redownload it to get their system to resolve the different and new domains. -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 3251 132nd ave Holland, MI, 49424 www.raoset.com [EMAIL PROTECTED] so far off topic it's great :) 1: the garfieldtech and www. pointing to two different servers is in my mind perfectly logical - but also not a great practise due to this www. thing we all have, everybody (99.9%) assume domain.ext and www.domain.ext have the same endpoint. 2: www is rediculous and so un-needed it's unreal - every body types in a whole extra 3 letters (4 including the period) for no reason. 3: wants to find a way to ban www. (have done for years) ~idunno can't wait for 14th March :D Nath -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] More than one values returned?
Nick Stinemates wrote: Jim Lucas wrote: Nick Stinemates wrote: Nathan Rixham wrote: Robert Cummings wrote: On Mon, 2008-02-18 at 21:09 -0600, Larry Garfield wrote: On Monday 18 February 2008, Nick Stinemates wrote: I have found, however, that if I ever need to return /multiple/ values, it's usually because of bad design and/or the lack of proper encapsulation. You mean you've never had a function like getCoordinates()? Or getUsers(), or any other of a zillion perfectly valid and reasonable functions that return multiple values as an array? Wow, how odd! Cheers, Rob. getCoordinates() would return a Point object getUsers() would return a Group object... Not rocket science ;) I wouldn't consider an array of user objects to be multiple things. I consider it a single aggregate thing, and return arrays all the time. That's conceptually different from wanting two separate return values from a function, which is indeed conceptually icky. Yes, an aggregate is comprised of multiple things usually. Hence when decomposing the concept you are indeed returning multiple values-- both points of view are valid. If you receive a parcel of 100 pens. I can say, has the parcel arrived yet (one entity) or have the pens arrived yet (multiple entities). At any rate, the O.P. wanted to return multiple values called $x and $y. It seems quite reasonable to assume he was returning something akin to coordinates but didn't know how to do so by binding them in an aggregating structure such as an array, or if you wish, an object. Cheers, Rob. seriously, whats wrong with returning an array? half the standard php functions return array's, therefore at least half of php has been designed badly..? ps: when working with co-ordinates / GIS data you should really be using wkb data instead, it's much faster. [unpack] What's wrong with it? Hmm.. Half of PHP functions DO return arrays, I'll grant you that. The reason? It's untyped. If PHP were a typed language, and it still returned arrays for a lot, I definitely think it would be designed poorly. At any rate, returning an array from your Objects increases the burden and shifts it to the client of your API. For instance, if we take an example mentioned above *getUsers()* which returned an arbitrary number of User objects you could potentially use it like this. userupdater.php ?php $x = Users::getUsers($somefilter) foreach ($x as $user) { $user-update(); } ? Keep in mind. You'll have to rewrite that functionality in multiple areas. As opposed to: ?php $x = Users::getGroup($somegroup); // returns a group of users $x-update(); // can be reused wherever instead of having to loop through every user on the client side. ? I hope you can see past my (basic) example to understand where I am headed with this. I would, and do, use this magic :) Users::GetGroup($somegroup)-update(); Simple, Even less typing then yours :p :P. I use that method, too. It really sucks for debugging though, because what if GetGroup($somegroup) returns a null or unexpected value? Yeah, it sucks. But, doesn't occur enough to be too annoying ;) You built it, make sure it doesn't return anything other than what you want! -- 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] What community software package gets your vote? PHPfox etc...
There are lots out there and the free ones like PHP Nuke (perhaps the grand daddy of em all) have all suffered from security issues. The price is free (http://www.phpnuke.org), but the risk is that because hackers can get the same free source, they can identify weeknesses and exploit them, making themselves seem to be more clever than they really are (Hacking is an ego trip I think, and what seems like a shortcut to coding fame, in a world where hard work is considered for suckers). Many of the original really bad exploits have been resolved, but a few remain. Sites that allow anyone to register, and then post content, like comments on articles or actual articles, is a gold mine to SEO mavins, and you will find content being posted with comments containing site reference pointers to porn sites designed to improve search engine rankings of these same sites. If you don't want to deal with this, you want to stay away from community sites, or find some way to make the communities very private. My 2 cents, Warren Vail -Original Message- From: TS [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 19, 2008 6:42 PM To: php-general@lists.php.net Subject: [PHP] What community software package gets your vote? PHPfox etc... Hello everyone. I'm not sure what the budget is but, obviously inexpensive would be nice. Someone turned me on to PHPfox. Yet I don't have any others to compare it to. If you all would be so kind as to put a shout out and vote on your favorite, I'd be very grateful. Extendability would also be nice along with customization in terms of design. Much Appreciation, T -- 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] What community software package gets your vote? PHPfox etc...
On Tue, Feb 19, 2008 at 9:41 PM, TS [EMAIL PROTECTED] wrote: Hello everyone. I'm not sure what the budget is but, obviously inexpensive would be nice. Someone turned me on to PHPfox. Yet I don't have any others to compare it to. If you all would be so kind as to put a shout out and vote on your favorite, I'd be very grateful. Extendability would also be nice along with customization in terms of design. Much Appreciation, dude, you gotta scope this out; http://cmsmatrix.org/ -nathan
Re: [PHP] www. not working
On Wed, 2008-02-20 at 17:07 +, Stut wrote: Richard Heyes wrote: A form of the web existing long before that depending on your definition of the web. To me it's a way for people to share information. That would cover the BBS world which pre-dates LANs by some distance. Spider webs have existed for many a year... Yeah, but when was the last time you saw porn on one of them?!! Well after the money shot the big one ate the little one. Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Php warning message
On Feb 20, 2008, at 4:29 PM, Yuval Schwartz wrote: Hello and thank you, Another question, I get a message: *Warning*: feof(): supplied argument is not a valid stream resource in * /home/content/t/h/e/theyuv/html/MessageBoard.php* on line *52* ** And I've tried troubleshooting for a while; I'm pretty sure I'm opening the file handle correctly and everything but I can't get feof or similar functions like fgets to work. Here is my code if you're interested (it's so that I color every 2nd line in the text): *$boardFile = MessageBoard.txt; $boardFileHandle = fopen($boardFile,r); for ($counter = 1; !feof($boardFileHandle); $counter += 1) { $colorLine = fgets(boardFilehandle); if ($counter % 2 == 0) { I may be showing my ignorance here... But on your if ($counter % 2 ==0) line what does the % do? Was that possibly a typo? Also, it might be good to point out what line 52 is :) echo font color='00ff00'$colorline/font; } else { echo $colorline; } } fclose($boardFileHandle);* Thank you -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 3251 132nd ave Holland, MI, 49424 www.raoset.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Php warning message
*$boardFile = MessageBoard.txt; $boardFileHandle = fopen($boardFile,r); for ($counter = 1; !feof($boardFileHandle); $counter += 1) { $colorLine = fgets(boardFilehandle); if ($counter % 2 == 0) { echo font color='00ff00'$colorline/font; } else { echo $colorline; } } fclose($boardFileHandle);* Looks like you're missing a $ on line 4: $colorLine = fgets(boardFilehandle); Should be $colorLine = fgets($boardFilehandle); [snip] I may be showing my ignorance here... But on your if ($counter % 2 ==0) line what does the % do? Was that possibly a typo? [/snip] It's the modulus operator; he's trying to make every other line a different color. :) -- Greg
[PHP] Php warning message
Hello and thank you, Another question, I get a message: *Warning*: feof(): supplied argument is not a valid stream resource in * /home/content/t/h/e/theyuv/html/MessageBoard.php* on line *52* ** And I've tried troubleshooting for a while; I'm pretty sure I'm opening the file handle correctly and everything but I can't get feof or similar functions like fgets to work. Here is my code if you're interested (it's so that I color every 2nd line in the text): *$boardFile = MessageBoard.txt; $boardFileHandle = fopen($boardFile,r); for ($counter = 1; !feof($boardFileHandle); $counter += 1) { $colorLine = fgets(boardFilehandle); if ($counter % 2 == 0) { echo font color='00ff00'$colorline/font; } else { echo $colorline; } } fclose($boardFileHandle);* Thank you
RE: [PHP] Php warning message
-Original Message- From: Jason Pruim [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 20, 2008 4:39 PM To: Yuval Schwartz Cc: php-general@lists.php.net Subject: Re: [PHP] Php warning message On Feb 20, 2008, at 4:29 PM, Yuval Schwartz wrote: Hello and thank you, Another question, I get a message: *Warning*: feof(): supplied argument is not a valid stream resource in * /home/content/t/h/e/theyuv/html/MessageBoard.php* on line *52* ** And I've tried troubleshooting for a while; I'm pretty sure I'm opening the file handle correctly and everything but I can't get feof or similar functions like fgets to work. Here is my code if you're interested (it's so that I color every 2nd line in the text): *$boardFile = MessageBoard.txt; $boardFileHandle = fopen($boardFile,r); for ($counter = 1; !feof($boardFileHandle); $counter += 1) { $colorLine = fgets(boardFilehandle); if ($counter % 2 == 0) { I may be showing my ignorance here... But on your if ($counter % 2 ==0) line what does the % do? Was that possibly a typo? Also, it might be good to point out what line 52 is :) echo font color='00ff00'$colorline/font; } else { echo $colorline; } } fclose($boardFileHandle);* Thank you -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 3251 132nd ave Holland, MI, 49424 www.raoset.com [EMAIL PROTECTED] % is the modulus (= remainder most of the time) operator. 8 % 2 == 0, 9 % 4 == 1, etc You are missing a $ at fgets(boardFilehandle); (should be fgets($boardFilehandle);). Are you sure the file handle is valid anyway? // $boardFileHandle = fopen($boardFile,r); If ($boardFileHandle) { die(very bad things happen these days); } // Regards, Rob Andrés Robinet | Lead Developer | BESTPLACE CORPORATION 5100 Bayview Drive 206, Royal Lauderdale Landings, Fort Lauderdale, FL 33308 | TEL 954-607-4207 | FAX 954-337-2695 | Email: [EMAIL PROTECTED] | MSN Chat: [EMAIL PROTECTED] | SKYPE: bestplace | Web: bestplace.biz | Web: seo-diy.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] unable to unset reference
I don't mean unset($this) is the best wy to allow an object to destroy itself. I just say we miss something to auto destroy objects. We could also think about a magic method like __destroy(). An object that destroys itself is a really bad idea from an architectural point of view. I, as a consumer of your class, need to have control over the lifetime of any instances I create. In my opinion if you have a need for a class to destroy itself then you have a fundamental design flaw. I want the object to be destroyed when a specific method of this object is called because when it has been called, the object has no reason to exist anymore. It's like a SQL resource, when you have freed it, you don't need it anymore. $my_object = new Blah(); $my_object-DoStuff(); unset($my_object); As long as you don't have any references (as in these sort: http://www.php.net/manual/en/language.references.php) to $my_object then the memory will be freed. I would like to implement it in order to delete automaticly from memory useless objects. It can be really useful for example to make schedulers in PHP in order to avoid max memory usage exceeded errors. Sprinkle your code with memory_get_usage() calls and see where your memory is being used and concentrate on the areas with big jumps first. php can definitely support long running scripts with an even amount of memory used (mine run for 3-4 hours on a prod machine and use no more than 6-10meg depending on data). Another approach would be to use xdebug and profile your scripts and concentrate on the areas that use the most cpu time because they'll probably be the most called code. http://xdebug.org/docs/profiler -- 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] Php warning message
I may be showing my ignorance here... But on your if ($counter % 2 ==0) line what does the % do? Was that possibly a typo? % is the modulus operator, so basically that will alternate between a line having a font tag and not having a font tag. http://www.php.net/operators.arithmetic -- 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] Converting tab delimited file to CSV
On Wed, Feb 20, 2008 at 9:50 PM, Chris [EMAIL PROTECTED] wrote: Back to my 'original' problem/question, if I '$f = fopen($file, r)' and 'while ($data = fgets($f))' on the above first format and do a $data = str_replace(\t,,,$data); the resulting file looks like the second example above when opened into Textpad but will not open into separate columns when opened with Excel. Look up http://www.php.net/fgetcsv and pass \t as the field separator. I give up :-( My script was using fgetcsv() with ',' as delimiter quite happily for 3 years before the 3rd party changed to Cognos. I have a problem with file encoding and I really don't understand enough about that. The files are (I'm told) sent to me in UTF-8 multibyte. My PHP scripts can't read them correctly so I tried using utf8_encode which made slight progress (individual fields recognised in delimited file) but then comparing a utf8_encoded string with one obtained from MySQL then causes problems, such that utf8_encoded PRIVATE does not equal MySQL sourced PRIVATE. The amount of time I'm 'wasting' with this problem will soon exceed that required to manually convert my 100+ files so it's going on teh to do list and maybe I'll revisit it at a later date. -- Graham -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Php warning message
On Wed, Feb 20, 2008 at 4:38 PM, Jason Pruim [EMAIL PROTECTED] wrote: I may be showing my ignorance here... But on your if ($counter % 2 ==0) line what does the % do? Was that possibly a typo? If the line is divisible by 2. Also, it might be good to point out what line 52 is :) He did it's the line on which you'll find foef(). ;-P Yuval, Change your code to: ? $filename = ./MessageBoard.txt; $handle = fopen($filename,r); for($counter=1;!feof($handle);$counter++) { $colorline = fgets($handle); if ($counter % 2 == 0) { echo font color=\#00ff00\ /.$colorline./font\n; } else { echo $colorline; } } fclose($handle); ? -- /Dan Daniel P. Brown Senior Unix Geek ? while(1) { $me = $mind--; sleep(86400); } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help on running external command / Partially solved
Daniel Brown wrote: On Feb 20, 2008 10:30 AM, Mário Gamito [EMAIL PROTECTED] wrote: Please keep the replies on-list, Mario. It helps others out, and ensures that you'll get better advice from a larger group of talented people. ? $username = lixo; exec('su -c - vpopmail /var/qmail/bin/maildirmake /home/vpopmail/domains/wwlib.lan/'.$username.'',$ret,$err); echo pre /\n; print_r($ret); echo /pre\n; echo isset($err) ? Error: .$err : null; ? No output at all and I have display_errors = On in php.ini Still no directory creation. If I run the file as user vpopmail it asks me for a password: # su - vpopmail $ php /home/www/hash.php Output: [EMAIL PROTECTED] ~]$ php /home/www/hash.php Password: It's because you can't automate su - without using an intermediary such as 'expect'. You can use sudo to allow specific commands to be run. http://www.sudo.ws/sudo/man/sudoers.html#examples Though I highly recommend you just dump this stuff to a database or something and have a cron job running every 5 minutes to check for new accounts to create etc. -- 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] Converting tab delimited file to CSV
Back to my 'original' problem/question, if I '$f = fopen($file, r)' and 'while ($data = fgets($f))' on the above first format and do a $data = str_replace(\t,,,$data); the resulting file looks like the second example above when opened into Textpad but will not open into separate columns when opened with Excel. Look up http://www.php.net/fgetcsv and pass \t as the field separator. -- 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] Php warning message
At 11:29 PM +0200 2/20/08, Yuval Schwartz wrote: Hello and thank you, Here is my code if you're interested (it's so that I color every 2nd line in the text): Try something like this instead. In your html: tr class=row?php echo($j++ 1 );? In your css: .row0 { background-color: #B3C6FF; /* blue */ } .row1 { background-color: #FFDD75; /* yellow */ } You're welcome and goodbye. 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 warning message
On Feb 20, 2008, at 1:29 PM, Yuval Schwartz [EMAIL PROTECTED] wrote: Hello and thank you, Another question, I get a message: *Warning*: feof(): supplied argument is not a valid stream resource in * /home/content/t/h/e/theyuv/html/MessageBoard.php* on line *52* ** And I've tried troubleshooting for a while; I'm pretty sure I'm opening the file handle correctly and everything but I can't get feof or similar functions like fgets to work. Here is my code if you're interested (it's so that I color every 2nd line in the text): *$boardFile = MessageBoard.txt; $boardFileHandle = fopen($boardFile,r); for ($counter = 1; !feof($boardFileHandle); $counter += 1) { $colorLine = fgets(boardFilehandle); if ($counter % 2 == 0) { echo font color='00ff00'$colorline/font; } else { echo $colorline; } The loop looks ugly :/ $colored = false; while (!feof($boardFileHandle)) { $line = fgets($boardFileHandle); if ($colored) echo 'span class=colored', $line, '/spanbr /'; else echo $line, 'br /'; $colored = !$colored; } } fclose($boardFileHandle);* Thank you -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Php warning message
Yuval Schwartz wrote: Hello and thank you, Another question, I get a message: *Warning*: feof(): supplied argument is not a valid stream resource in * /home/content/t/h/e/theyuv/html/MessageBoard.php* on line *52* ** And I've tried troubleshooting for a while; I'm pretty sure I'm opening the file handle correctly and everything but I can't get feof or similar functions like fgets to work. Here is my code if you're interested (it's so that I color every 2nd line in the text): *$boardFile = MessageBoard.txt; $boardFileHandle = fopen($boardFile,r); for ($counter = 1; !feof($boardFileHandle); $counter += 1) { $colorLine = fgets(boardFilehandle); if ($counter % 2 == 0) { echo font color='00ff00'$colorline/font; } else { echo $colorline; } } fclose($boardFileHandle);* Thank you I might do something like: if(($lines = file(MessageBoard.txt))) { foreach ($lines as $num = $line){ if($num % 2 == 0) { echo font color='00ff00'$line/fontbr /; } else { echo $linebr /; } } } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [PHP-DEV] string operators for assigning class constants
this is a php generals type of question. Sebastian schreef: hi, why isn't it possible to assign class constants like this: class test { const DIR='dirname'.DIRECTORY_SEPARATOR.'anotherdirname'.DIRECTORY_SEPARATOR; } is there some performance issue? classes are defined at compile time, so are their const declarations - it's not possible to evaluate an expression at compile time. with define('FOO', 'bar'.QUX); you can do it because the define occurs at run time. anyone ever tried this or was there a discussion about it? i would find this very useful. find another way to do 'it' :-) greetings -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Php warning message
Yuval Schwartz schreef: Hello and thank you, Another question, I get a message: *Warning*: feof(): supplied argument is not a valid stream resource in * /home/content/t/h/e/theyuv/html/MessageBoard.php* on line *52* ** And I've tried troubleshooting for a while; I'm pretty sure I'm opening the file handle correctly and everything but I can't get feof or similar functions like fgets to work. you pretty sure? your code doesn't check that the file handle is valid. Here is my code if you're interested (it's so that I color every 2nd line in the text): *$boardFile = MessageBoard.txt; do you know what the current working directory is? my guess is that whatever it is the text file is not in that directory. try setting an absolute path to the text file e.g. $boardFile = /path/to/my/MessageBoard.txt; and then do something like ... $boardFileHandle = fopen($boardFile,r); if (!$boardFileHandle) die ('no messages, or something equally annoying!'); for ($counter = 1; !feof($boardFileHandle); $counter += 1) { $colorLine = fgets(boardFilehandle); if ($counter % 2 == 0) { echo font color='00ff00'$colorline/font; the font tag is evil - go read alistapart for the next 6 hours ;-) } else { echo $colorline; } } fclose($boardFileHandle);* Thank you -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Session destruction problem
thank you tedd, I understood what you explained to me last time. I was wondering if there is another method to prevent that. Thanks --- tedd [EMAIL PROTECTED] wrote: At 2:45 PM -0800 2/19/08, Adil Drissi wrote: Hi, Below you'll find my code. I think now that the problem is in my algorithm, because the is created anytime the page is refreshed. But i don't know how to check if the client was logged out or it is a real new connexion to the page. As you will see one can click on logout, then press the back button of the browser, and then refresh the page, but he is still connected. I would like to help me fixe that. Here is the code: You received an answer, but fail to understand. Unless you use javascript to manipulate the browser's history you are going to continue to have problems with the user browser's back button. But, explain why the user using the back button is a problem. If he logs in, he's in. If he logs out, he's out. If he hits the back button after logging out and cancels his log out -- so what? What problems does that present? 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 Never miss a thing. Make Yahoo your home page. http://www.yahoo.com/r/hs -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sending SMS via PHP
Let me try and answer your questions. Do you need to receive SMS? If you need to receive SMS, you will need to host your own GSM device or modem so that people can send you SMS. If not, you can just use internet SMS gateways like clickatell to do the work, and post to them by HTTP, XML or email. The cost is about 6-8 cents per SMS. There are cheaper services, but not always reliable. If you need to host your own GSM device, you can use software like http://www.kannel.org (GPL Open Source) or http://www.visualgsm.com. Regards, SMS Gateway Expert http://www.visualtron.com AmirBehzad Eslami-3 wrote: Hi, How can i send SMS messages via PHP? How can i set SMS-headers (UDH)? Does anyone know some article/class/package about this issue? Thank you in advance, -b -- View this message in context: http://www.nabble.com/Sending-SMS-via-PHP-tp14475937p14681701.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] Sending SMS via PHP
johnlin wrote: Let me try and answer your questions. Do you need to receive SMS? If you need to receive SMS, you will need to host your own GSM device or modem so that people can send you SMS. If not, you can just use internet SMS gateways like clickatell to do the work, and post to them by HTTP, XML or email. The cost is about 6-8 cents per SMS. There are cheaper services, but not always reliable. If you need to host your own GSM device, you can use software like http://www.kannel.org (GPL Open Source) or http://www.visualgsm.com. Regards, SMS Gateway Expert http://www.visualtron.com AmirBehzad Eslami-3 wrote: Hi, How can i send SMS messages via PHP? How can i set SMS-headers (UDH)? Does anyone know some article/class/package about this issue? Thank you in advance, -b I know of an open source package which uses services hosted by VeriSign and MBlox. These cost a pretty penny, though, and may not be what you're after. The services give you a private channel for your users to interact with you, and for you to (potentially) respond to them. You're looking for SMPP packages. -- == Nick Stinemates ([EMAIL PROTECTED]) http://nick.stinemates.org AIM: Nick Stinemates MSN: [EMAIL PROTECTED] Yahoo: [EMAIL PROTECTED] == -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sending SMS via PHP
HI, The vast majority of carriers have a free to use email to sms gateway for their clients phones. There is a list of each carriers format for the email address. Have someone select the carrier in the form when entering the phone number then you have it sent to the email as specified by the carrier. On Thu, Feb 21, 2008 at 12:01 AM, Nick Stinemates [EMAIL PROTECTED] wrote: johnlin wrote: Let me try and answer your questions. Do you need to receive SMS? If you need to receive SMS, you will need to host your own GSM device or modem so that people can send you SMS. If not, you can just use internet SMS gateways like clickatell to do the work, and post to them by HTTP, XML or email. The cost is about 6-8 cents per SMS. There are cheaper services, but not always reliable. If you need to host your own GSM device, you can use software like http://www.kannel.org (GPL Open Source) or http://www.visualgsm.com. Regards, SMS Gateway Expert http://www.visualtron.com AmirBehzad Eslami-3 wrote: Hi, How can i send SMS messages via PHP? How can i set SMS-headers (UDH)? Does anyone know some article/class/package about this issue? Thank you in advance, -b I know of an open source package which uses services hosted by VeriSign and MBlox. These cost a pretty penny, though, and may not be what you're after. The services give you a private channel for your users to interact with you, and for you to (potentially) respond to them. You're looking for SMPP packages. -- == Nick Stinemates ([EMAIL PROTECTED]) http://nick.stinemates.org AIM: Nick Stinemates MSN: [EMAIL PROTECTED] Yahoo: [EMAIL PROTECTED] == -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Leonard Burton, N9URK http://www.jiffyslides.com [EMAIL PROTECTED] [EMAIL PROTECTED] The prolonged evacuation would have dramatically affected the survivability of the occupants.
Re: [PHP] Sending SMS via PHP
On Wed, 2008-02-20 at 21:01 -0800, Nick Stinemates wrote: Do you need to receive SMS? If you need to receive SMS, you will need to host your own GSM device or modem so that people can send you SMS. If not, you can just use internet SMS gateways like clickatell to do the work, and post to them by HTTP, XML or email. The cost is about 6-8 cents per SMS. There are cheaper services, but not always reliable. If you need to host your own GSM device, you can use software like http://www.kannel.org (GPL Open Source) or http://www.visualgsm.com. The thing with SMS is volume. Most commercial (bulk SMS) service providers do provide a return path at a price, but this can get really expensive especially at low volumes. What you need to do is ask yourself whether you are going to do high volume SMS or not, and look at when do the commercial providers become more economical? What a lot of people do, is sign up for an account and end up sending only 50 or so SMS a month, which is silly, when for the same price as a month or two's subscription, you could buy your own GSM modem and a prepaid SIM card and do it for half the price yourself. --Paul All Email originating from UWC is covered by disclaimer http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] fail on preg_match_all
Does anyone know why a server would simply fail on this line? $num = preg_match_all($regex, $theData, $match, PREG_SET_ORDER); if i know the file handle is valid (i grabbed it using 'or die'), and the regex is valid hamy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] fail on preg_match_all
Hamilton Turner wrote: Does anyone know why a server would simply fail on this line? $num = preg_match_all($regex, $theData, $match, PREG_SET_ORDER); if i know the file handle is valid (i grabbed it using 'or die'), and the regex is valid What file handle? preg_match doesn't work on resources, it works on data. What do you mean by die? return no results? segfaults the server? ? -- 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] fail on preg_match_all
Hamilton Turner wrote: Does anyone know why a server would simply fail on this line? $num = preg_match_all($regex, $theData, $match, PREG_SET_ORDER); if i know the file handle is valid (i grabbed it using 'or die'), and the regex is valid hamy Wow, what a lack of information! If I was holding an Easter Egg basket right now, could you tell me how many eggs I had in it? Why don't you provide some useful code examples! Namely: 1. Show us some context 2. What is in $regex 3. Show us the code that generates the data in $theData -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] What community software package gets your vote? PHPfox etc...
Hey party people. I have to say I’m a little surprised no hooting and hollering on this topic. I don’t think I heard a single positive comment which worries me. I’m jealous of myspace and facebook too but, someone has to have good news for one of these not so mainstream community appz. W3RD ^ PEOPLE From: Nathan Nobbe [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 20, 2008 1:51 PM To: TS Cc: php-general@lists.php.net Subject: Re: [PHP] What community software package gets your vote? PHPfox etc... On Tue, Feb 19, 2008 at 9:41 PM, TS [EMAIL PROTECTED] wrote: Hello everyone. I'm not sure what the budget is but, obviously inexpensive would be nice. Someone turned me on to PHPfox. Yet I don't have any others to compare it to. If you all would be so kind as to put a shout out and vote on your favorite, I'd be very grateful. Extendability would also be nice along with customization in terms of design. Much Appreciation, dude, you gotta scope this out; http://cmsmatrix.org/ -nathan
Re: [PHP] fail on preg_match_all
On Wed, 2008-02-20 at 23:34 -0600, Hamilton Turner wrote: if i know the file handle is valid (i grabbed it using 'or die'), and ^ This is probably your problem, you are trying to match on a resource handle, not a string or something. Check out http://www.php.net/preg_match_all the regex is valid Won't really matter if the data is in the wrong format! --Paul -- . | Chisimba PHP5 Framework - http://avoir.uwc.ac.za | :: All Email originating from UWC is covered by disclaimer http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] fail on preg_match_all
Just a follow-up on this, the problem was 'Fatal error: Allowed memory size of 8388608 bytes exhausted' After some nice help, I found that this is actually a common problem with intense regexes in php. Quick fix is using ini_set() to increase your memory_limit to something massive, like '400M'. This gives your script access to that much memory for its life-time. If you have this problem, then you probably also have to do this set_time_limit(0); //remove any max execution time Hamilton PS - for anyone confused, here was the script . . . i didnt think it was that confusing, sorry guys! function parse_access($file_name) { // read file data into variable $fh = fopen($file_name, 'r') or die(cant open file for reading); $theData = fread($fh, filesize($file_name)); fclose($fh); // perform regex $regex = '!(\d{0,3}\.\d{0,3}\.\d{0,3}\.\d{0,3}) - - \[(\d{2})/(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Aug|Oct|Nov|Dec)/(\d{4}):(\d{2}):(\d{2}):(\d{2}) -\d+] {1,4}GET ([._0-9\-%a-zA-Z/,?=]+) ([.0-9a-zA-Z%/\-,_?]+) (\d{3}) (\d+) \[(.+?)] \[(.+?)] \[(.+?)] (\d+) (\d+) (\d+) (\d+) (\d+) (\d+)!'; //echo $regex . 'brbrhrbr'; $num = preg_match_all($regex, $theData, $match, PREG_SET_ORDER); //echo after regex - we are still alive!; //go on to do some boring stuff, like write this to an array, perform stuff, graph stuff, blah blah }