Re: [PHP] Reducing size of htm output
Is it true that ob_start(ob_gzhandler) can cause problems on IE 5.5+? Since IE any-version is on the client side, it shouldn't cause any problems to ob_start(), in that case any other PHP function. In my experience output buffering functions can be bizzaire at times. Especially if you are using it with a register_shutdown_function. Be cautious and test your program thoroughly before moving it into any production site. Is there any function to do this (I'm using PHP 4.2) ? Or maybe some user has already done it? === I guess it is a matter of string parsing using something like str_replace(). I'm not sure! Cheers, Prathap -- Original Message --- From: Kirsten [EMAIL PROTECTED] To: php-general@lists.php.net Sent: Fri, 6 May 2005 14:59:15 -0300 Subject: [PHP] Reducing size of htm output I need to reduce the size of the HTM generated by a PHP script for faster transmission. I'm actually using ob_start(ob_gzhandler) but I also need some function to reduce the size of javascript blocks, deletion of unnecesary blanks, etc. For example, Code A: headscript function any(){ somecode; } /script /head body /body can be converted to Code B: headscript function any(){ somecode; }/script/headbody/body 1) Is there any function to do this (I'm using PHP 4.2) ? Or maybe some user has already done it? Thanks a lot, Kirsten -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- End of Original Message --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Barcodes [Solved]
Mike Smith wrote: On 4/18/05, Eric Wood [EMAIL PROTECTED] wrote: - Original Message - From: Mike Smith I'm using a script to generate the barcodes (3 of 9 or Code39): http://www.sid6581.net/cs/php-scripts/barcode/ This script seems to limit the input barcode to 15 characters... um... -eric woo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php The sample on the website will display image to small for 16 characters. There is an options to adjust the widthXheight of the generated image to display more I found the longest part number we had and based my image width on that (+5). There are other options (phpclasses, hotscripts), but this works for now. I may evaluate some other options as I get into it. -- Mike Hey, did you do any more testing with this? My company has gone through a lot of the parts identification process for our accounting system and we're eager to get barcoding set up as well. Our platform of choice is Windows (yeah, yeah) so it would be great to hear some feedback about that OS if you've tested on it... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Reducing size of htm output
Prathaban Mookiah wrote: Is it true that ob_start(ob_gzhandler) can cause problems on IE 5.5+? Since IE any-version is on the client side, it shouldn't cause any problems to ob_start(), in that case any other PHP function. That's not true. ob_gzhandler is extremely browser-dependant since it needs to check to see if the browser sent an appropriate accept-encoding header. Some of the early IE versions sent accept-encoding: gzip but didn't correctly implement it, so you can run into problems if you use ob_gzhandler with certain older browsers. It is fine for all the recent releases though. -Rasmus -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Socket connection reset by pear
OK, I found the error. Aparently, the message that I was sending didn't have a newline at the end, and so socket_read on the other end failed to complete it's task, and finds it self with a conection reset by pear when the client tries to write something else. I found out when looking at the Net_Socket Object in PEAR, and say that the was a write() and a writeLine() method in the class, an after trying it out, it worked! Sorry for the noise. :-) El Vie 06 May 2005 16:48, Martín Marqués escribió: El Vie 06 May 2005 01:50, Richard Lynch escribió: The client code is this: ?php ini_set (display_errors , On ); if (($socket = socket_create (AF_INET, SOCK_STREAM, SOL_TCP)) 0) { echo socket_create() failed: reason: . socket_strerror ($socket) . \n; } $result = socket_connect($socket, '127.0.0.1', 9100); var_dump($result); $msg = prueba de socket; $res = socket_write($socket, $msg, strlen($msg)); var_dump(socket_strerror(socket_last_error($socket))); exit; ? The daemon code is like this: #!/usr/bin/php ?php ini_set (display_errors , On ); error_reporting(E_ALL); /* Allow the script to hang around waiting for connections. */ set_time_limit(0); /* Turn on implicit output flushing so we see what we're getting * as it comes in. */ ob_implicit_flush(); $address = '127.0.0.1'; $port = 9100; if (($sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP)) 0) { echo socket_create() failed: reason: . socket_strerror($sock) . \n; } if (($ret = socket_bind($sock, $address, $port)) 0) { echo socket_bind() failed: reason: . socket_strerror($ret) . \n; } if (($ret = socket_listen($sock, 5)) 0) { echo socket_listen() failed: reason: . socket_strerror($ret) . \n; } do { if (($msgsock = socket_accept($sock)) 0) { echo socket_accept() failed: reason: . socket_strerror($msgsock) . \n; break; } var_dump($msgsock); do { if (false === ($buf = socket_read($msgsock, 2048, PHP_NORMAL_READ))) { echo socket_read() failed: reason: . socket_strerror($ret) . \n; break 1; } if (!$buf = trim($buf)) { continue; } if ($buf == 'quit') { break; } if ($buf == 'shutdown') { socket_close($msgsock); break 2; } } while (true); socket_close($msgsock); } while (true); socket_close($sock); ? But when I try to connect with the PHP client (even executing it with CLI interface) I get this message in the daemons output: Warning: socket_read() unable to read from socket [54]: Connection reset by peer in /root/printSocket.php on line 36 socket_read() failed: reason: Operation not permitted -- 16:32:53 up 35 days, 1:01, 2 users, load average: 0.70, 0.52, 0.59 - Martín Marqués| select 'mmarques' || '@' || 'unl.edu.ar' Centro de Telematica | DBA, Programador, Administrador Universidad Nacional del Litoral - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- 18:11:30 up 35 days, 2:40, 2 users, load average: 0.74, 0.72, 0.71 - Martín Marqués| select 'mmarques' || '@' || 'unl.edu.ar' Centro de Telematica | DBA, Programador, Administrador Universidad Nacional del Litoral - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Reducing size of htm output
preg_replace('/s+/', ' ', $html); but watch out, this js code will work: var v alert(v) this one will not: var v alert(v) Sure but now: how do I access the htm output of the current executing script before it is send to the user? Thanks again 1) Is there any function to do this (I'm using PHP 4.2) ? Or maybe some user has already done it? 2) Is it true that ob_start(ob_gzhandler) can cause problems on IE 5.5+? don't know. but you can detect these browsers and turn compression off -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Reducing size of htm output
Kirsten wrote: preg_replace('/s+/', ' ', $html); but watch out, this js code will work: var v alert(v) this one will not: var v alert(v) Sure but now: how do I access the htm output of the current executing script before it is send to the user? output buffering -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How do I link to the root directory of the server?
You could just use relative links, or use a full path link, without the http://www.mydomain.com part. Or, you could change application.php to use data from $_SERVER to figure out what URL you should be using. ?php var_dump($_SERVER);? and pick through that data. Somewhere in there you will find what you need to set up $CFG-wwwrot and $CFG-dirroot so that they always work, no matter what server you are on. On Thu, May 5, 2005 5:01 am, Shaun said: Hi, I have a file called application.php and in this file I define all of the directories in my site: class object {}; $CFG = new object; $CFG-wwwroot = http://www.mydomain.com; $CFG-dirroot = /usr/home/myaccount/public_html; $CFG-admindir = $CFG-wwwroot/admin; $CFG-claimsdir_adm = $CFG-admindir/claims; $CFG-clientsdir = $CFG-admindir/clients; $CFG-cssdir = $CFG-wwwroot/css; $CFG-expense_categoriesdir = $CFG-admindir/expense_categories; $CFG-projectsdir = $CFG-admindir/projects; $CFG-shoppingdir = $CFG-wwwroot/shopping; ... This works very well and means if I change a directory name or move a directory I only have to update this file. application.php is included on every page so all I have to do to link to another directory would be something like: pClick a href=?php echo $CFG-expense_categoriesdir; ??action=add_expense_categoryhere/a to add a category/p The problem with this is that the URL's include the http://www.mydomain.com/ and are therefore not relative links. Is there a way to link to the root directory from wherever I am within the directory structure? Thanks for your advice -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] multi dimensional arraySOLVED
On Thu, May 5, 2005 3:37 am, Angelo Zanetti said: this is quite weird but apparently on the one server if you user $user as a variable name thats what causes the problem. I simply renamed my variable to something else and it worked, I find it strange that it worked on 1 server and not the other, is it possible that the different apache versions are responsible for this situation?? This would indicate to me that you've got register_globals ON and that your EGPCS settings are clobbering your $user variable with data from, say the environment $_ENV I'm betting that if you do: echo ENV $_ENV[user]br /\n; echo GET $_GET[user]br /\n; echo POST $_POST[user]br /\n; echo SESSION $_SESSION[user]br /\n; echo COOKIE $_COOKIE[user]br /\n; in the script that was giving you trouble, you'll find that one of those is set. Actually, since they could be set to the empty string, you should be echo-in isset($_XXX['user']) in the above test. The correct solution, then, is to turn register_globals OFF. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Socket connection reset by pear
On Thu, May 5, 2005 5:20 am, Martín Marqués said: I'm trying to build some communication aside of the server thin client stuff, with a socket daemon and a socket client. The daemon is the same that everybody can find in the PHP docs (example 1). The client simply opens a connection to the daemon and writes data using the socket Object from PEAR (last stable version). The problem is that it fails to make a socket_read() with this message (on the daemon side): Warning: socket_read() unable to read from socket [54]: Connection reset by peer in /space/home/martin/programacion/siprebi-1.2/ext/impresion/printSocket.php on line 42 socket_read() failed: reason: Operation not permitted If I open a telnet conection to the daemon, everything works like a charme. It writes and quits OK. What can be going wrong? Operation not permitted would make me guess you've got a user read/write permissions problem. When you open that telnet connection, are you logged in as the same user as the PHP user that is running the client script? I'm guessing not... You have to clarify, for yourself, which user is doing what when to which files/devices/sockets, and what chown permissions are in effect. That generally makes you go Duh and fix the problem pretty quick. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Function shall receive Pointer to Array
On Wed, May 4, 2005 3:29 pm, Fred Rathke said: how can a function get a pointer to an array? This does not work. I use PHP4. Technically, in PHP, they are references, not pointers. There are no pointers in PHP. The difference is too subtle for me to understand it, but there is apparently some meaningful difference. $t = array(test = unchanged); echo brtestarray unchanged:\.$t['test'].\; changearray($t); echo brtestarray hopefully changed:\.$t['test'].\; function changearray($myarray) { $myarray['test'] = changed; } -bash-2.05b$ php -a Interactive mode enabled ?php $t = array(test = unchanged); echo brtestarray unchanged:\.$t['test'].\; changearray($t); echo brtestarray hopefully changed:\.$t['test'].\; function changearray($myarray) { $myarray['test'] = changed; } ? Content-type: text/html X-Powered-By: PHP/4.3.11 brtestarray unchanged:unchangedbrtestarray hopefully changed:changed -bash-2.05b$ So it works in 4.3.11 Exactly which version of PHP are you one -- minor version numbers included. The behaviour of changed several times over the course of PHP's history, which makes meaningful discussion difficult without precision in version information. Before I tried it on my own I read this page: http://de2.php.net/manual/en/language.references.whatdo.php Be so nice to search for this string: The second thing references do is to pass variables by-reference. This is done by making a local variable in a function and a variable in the calling scope reference to the same content. Example: The following example I used. I only tried to do it with an array instead of a variable. Actually, I would expect arrays to *ALWAYS* have worked in PHP... But maybe that's just my shoddy memory. Plus I rarely send arrays around in functions and try to alter their contents. Just a question of programming style, I guess. What I need to read again to find my own mistake? I know some of php's commands work with an internal copy of a content. foreach() does that for sure. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] multi dimensional array
On Thu, May 5, 2005 2:08 am, Angelo Zanetti said: [sorry for the double-post...] the other server. Its running Apache 1 and the server that works is running Apache 2. Are you sure it's not the broken server running Apache 2?... And possibly PHP 5? And MySQL 4.1? Which means you need mysqli instead of mysql? mysqli and mysql are different. I guess it could be Apache 1 with the PHP5/MySQL 4.1 needing mysqli, but that seems less likely than having Apahce2/PHP5/MySQL4.1 -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] sort by date
Hello, I made a mistake and stored date information to DB as varchar values (dd.mm.yyy). When I read the DB is it still possible to sort the data by date with SQL query (ORDER BY date ASC)? Or is it nessessary to have the date information to be stored as a date in the DB? Will it work or is the output going to be sorted randomly? Thanks -Will -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Finding out their server type
On Wed, May 4, 2005 4:44 am, Computer Programmer said: I asked a question at Apache.org mailing list about how to hide my server type; and now I'm asking here how can I know someone's server type using PHP? Search http://php.net for headers and remote and you'll find a function or two that will do it. If they have successfully implemented what you read on Apache, then you don't have any way to find out what somebody else is running. ... Well, at least not easily. You can search for files that end in .asp which usually would only be on Windows, and you can search for files that end in .cgi which would usually pre-dispose you to guess it's running Perl and Linux. You can attempt to access 404 pages and evaluate the output to maybe guess what they are running. There are any number of more malicious things that Bad Guys do, such as (I've been told) probing for known security holes, and if the box suddenly fails, well, then you know they were running the software version that was subject to that bug. As I recall, there was rumored to be a script that would run successive attacks against Windows boxes, and by knowing at what point the box died, you'd know exactly what version and service pack they had. Dunno if the Bad Guys still do that, nor if it's current, nor anything, really. This was years and years ago. Of course, you are running PHP *on* their server, your script could check any number of variables or use http://php.net/php_sapi_name Hope that helps. It would have been easier to answer your question if you explained more about what you were doing and why. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] XSL:FO + PHP
Have you tried this? It seems HTMLDoc is still free... I've used that tool also... pretty satisfied. http://www.htmldoc.org/software.php I have used htmldoc in the past for this, but feel its a workaround, htmldoc is purely for generating manuals, which is what it does best, i wonder if it handles docbook files itself ? However it doesnt render so well. FOP is dedicated for this and is cross platform. Htmldoc is commercial software now therefore I am the only one with the licence. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] if then else
On Wed, May 4, 2005 12:20 am, Anasta said: Can anyone help with a statement, ive tried but it never works. I need to show a value if it is set to a specific value ie: At the moment If a user is logs in a record is updated from 'away' to 'online'---so i want an echo statement to show a value from another table if they are set to online or else they show another value. (2 seperate tables). //This gets 'away' or 'online': //(Or something like it in your tables) $query = select status from whatever where username = '$username'; . . . //Choose a table based on their logged in status: if ($status == 'away'){ $table = 'away_table'; } else{ $table = 'online_table'; } //Now build a query with that table: $query = select stuff from $table where username = '$username'; This is just ONE way of doing it. Depending on your table structure, there could be other, better, faster ways to do it. We'd need to know more about the 'away' and 'online' table[s] and a bit more info to really help you... -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP's auto_prepend_file inside an Apache Directory container
On Tue, May 3, 2005 10:38 pm, Dan Trainor said: Hello, all - I've been tinkering around with PHP's auto_prepend_file, specifying this from inside an Apache VirtualHost container, something as such: VirtualHost 1.2.3.4 blah blah blah php_value auto_prepend_file /super_duper_file.php /VirtualHost THis works fine from within the VirtualHost container, directly inside it's root. However, this does not seem to work inside an Apache Directory container. I dunno what php_value settings work in Directory container, if any, or anything much about that... But you could just use .htaccess files, perhaps, if it turns out that it's just not gonna work inside the Directory container. I suppose another option would be to set up totally BOGUS VirtualHost settings for the directories you want to change, with just the php_value inside of them... No, that's only gonna kick in when people actually *SURF* to those BOGUS VirtualHosts... Well, maybe it could be useful to somebody some day for some weird setup, but probably not as a general solution. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] is_numeric
On Wed, May 4, 2005 3:51 am, pete M said: not a php expert but have filed this bug report re validating is_numeric('3e0'); http://bugs.php.net/bug.php?id=32943 Now tried function isnumeric($n) { if (ereg(^[0-9]{1,50}.?[0-9]{0,50}$, $n)) { return true; } else { return false; } } and that doent seem to work either.. any ideas.. need to validate anything without 0-9 and a dot within . is a special character in Regex, so your .? is going to match: any single character, or nothing You need \. for the Regular Expression, only you need \\ in PHP to get \ Plus $ would be interpreted as the start of variable inside of in PHP, so to be really clear, I'd escape that as well: ^[0-9]{1,50}\\.?[0-9]{0,50}\$ The 50-character limit seems rather arbitrary and silly, actually... Perhaps just a + and * instead of the {1,50} and {0,50} as well. You've also completely missed all the negative numbers, by the way. Maybe you want to read through the User Contributed notes at http://php.net/ereg and http://php.net/pcre and find a solution that more closely matches the real world. For that matter, Euler notation is quite common, and maybe it's really best if you just use the built-in function, and accept that the 'e' notation is valid. YMMV -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Access files
On Tue, May 3, 2005 10:57 am, Don said: I am using php 4.3.11 on a RedHat Linux server running Apache. I have a requirement where I need to take a flat file containing formatted data and produce an Access 97 MDB file. Does anyone know of a class or library that will enable me to do this? You can cheat and take the formatted data and turn it into tab-delimited or CSV, and then when they download it, get the filename to end in .xls and then when they open it up, it will fire up Excel, which will automatically import the delimited data. From they, they can save as Access, almost for sure. I don't think MS has published the Access 97 MDB file as an open standard, so you'd be hard-pressed to find what you asked for... Though I could be wrong, as I don't really give a rat's ass about MS products, least of all MS Access. Another possibility, if you have a Windows server running Access, would be to set that up to use ODBC, and then you can use PHP with ODBC to alter things in that database. You *might* even be able to CREATE DATABASE and then CREATE TABLE and cause Access to build the MDB file for you, all through ODBC. Expect to spend a fair amount of time fighting with DSN, ODBC and the PHP ODBC packages... This was non-trivial back in the day when I was doing it, and a fair amount of mis-information was out there about which ODBC drivers were better/faster/easier to use. NOTE: MS Access is simply NOT up to snuff for multi-user access. If you are expecting this to work for an occasional admin feature, used by only one user at a time, you'll probably be fine. But if every visitor to your site will be hitting MS Access, you can count on your application never scaling up well. MS Access will crash and burn when two users hit it at once. Sorry. YMMV -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Check for doubleposts
On Tue, May 3, 2005 9:48 am, Fredrik Arild Takle said: what is the easiest way to check if a person i registered twice in a mysql-table. Lets assume that I only check if the last name is in the table more than once. This is in mysql 4.0 (subquery not an option). Do I have to use arrays and in_array. Or is there a more elegant solution? If the GROUP BY and HAVING solution doesn't thrill you (and I thought it was quite nice and elegant) you could go with Ye Olde Standard Answer: select * from user_table as a, user_table as b where a.lastname = b.lastname and a.user_id != b.user_id You can use a.user_id b.user_id to see only the one duplication. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] sort by date
William Stokes wrote: Hello, I made a mistake and stored date information to DB as varchar values (dd.mm.yyy). When I read the DB is it still possible to sort the data by date with SQL query (ORDER BY date ASC)? Or is it nessessary to have the date information to be stored as a date in the DB? Will it work or is the output going to be sorted randomly? It would be sorted by day first, then month, then year. Add another column (DATE type) to the table and update it from the current column using SUBSTRING() function. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] sort by date
On Friday 06 May 2005 08:42, William Stokes wrote: Hello, I made a mistake and stored date information to DB as varchar values (dd.mm.yyy). When I read the DB is it still possible to sort the data by date with SQL query (ORDER BY date ASC)? Or is it nessessary to have the date information to be stored as a date in the DB? Will it work or is the output going to be sorted randomly? All RDBMS have date formatting functions. Use them. Thanks -Will -- Cyberly yours, Petar Nedyalkov Devoted Orbitel Fan :-) PGP ID: 7AE45436 PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436 pgpLxsPbcV9bg.pgp Description: PGP signature
[PHP] Re: sort by date
Ok tested this and it won't work. Next question is sql question but anyway... Can I use STR_TO_DATE() or GET_FORMAT(DATE,'EUR') to query and sort dates to web page as a date even if the data is just a string in the db? Probably with GET_FORMAT(DATE,'EUR') it wont work cause it's a varchar field in the DB. Any idea how to put STR_TO_DATE() in to the following SQL query: SELECT event_id,name,date,time,place,type,info FROM test_table WHERE (group = '$group') AND (type = 'Game' OR type = 'training') ORDER BY date ASC Thanks a lot -Will William Stokes [EMAIL PROTECTED] kirjoitti viestissä:[EMAIL PROTECTED] Hello, I made a mistake and stored date information to DB as varchar values (dd.mm.yyy). When I read the DB is it still possible to sort the data by date with SQL query (ORDER BY date ASC)? Or is it nessessary to have the date information to be stored as a date in the DB? Will it work or is the output going to be sorted randomly? Thanks -Will -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Array of objects
Hi there, I need help with arrays. What I want to do is to have an array of the following structure: $mod=array( name=new NameObject()); Then later in the page I want to go $Site = $mod[$_GET[module]] (or something like that) to instantiate a new object. The problem is, if done the way above it will try to instantiate the object right there and then in the array (defeating the purpose), if I put it in quotes and try to use something like: (object)eval($mod[$_GET[module]]) it does not instantiate the object. Is there a way to do this? Thanks Thomas SPIRAL EYE STUDIOS P.O. Box 37907, Faerie Glen, 0043 Tel: +27 12 362 3486 Fax: +27 12 362 3493 Mobile: +27 83 258 2669 Email: [EMAIL PROTECTED] Web: www.spiraleye.co.za
Re: [PHP] sort by date
OK. I found that out from MySQL manual. I just don't know how to insert the date formatting function to the query: I quessI need to put STR_TO_DATE() in to the following SQL query: SELECT event_id,name,date,time,place,type,info FROM test_table WHERE (group = '$group') AND (type = 'Game' OR type = 'training') ORDER BY date ASC I dont know how? Thanks a lot -Will -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php/osx and firebird
James wrote: I've attempted to access a firebird database living on an osx/apache/php machine. When I'm running the following script, ?php ini_set(magic_quotes_sybase, On); $host = 'localhost:/Library/Frameworks/Firebird.framework/Resources/examples/employee.fdb'; for portability and ease of use I recommend using aliases with firebird. firebird has a file named aliases.conf which should contain the following line: exampledb = /Library/Frameworks/Firebird.framework/Resources/examples/employee.fdb once you have restarted firebird you can write the host var like so: $host = 'localhost:exampledb'; $username = sysdba; $password = masterkey; $dbh = ibase_connect($host, $username, $password); if (!($dbh=ibase_connect($host, 'sysdba', 'yourpass', 'ISO8859_1', 0, 1))) die('Could not connect: ' . ibase_errmsg()); $stmt = 'SELECT * FROM employee'; $sth = ibase_query($dbh, $stmt); while ($row = ibase_fetch_object($sth)) { echo $row-full_name, \n; } ibase_free_result($sth); ibase_close($dbh); ? I get the following error: Call to undefined function ibase_connect() How do I enable those functions? I've looked at the php documentation (http://uk2.php.net/manual/en/ref.ibase.php ) To enable InterBase support configure PHP --with-interbase[=DIR], where DIR is the InterBase base install directory, which defaults to /usr/interbase. I've tried to add: --with-interbase=/Library/Frameworks/Firebird.framework/Resources to my php.ini and it didn't work. oh dear you are lost (no offence, I know the feeling!). configuring in this instance means configuring the 'build' before you compile php this may not even be necessary in your case (if you have the interbase extension already built) at any rate there should not be anything like '--with-interbase=' in your php.ini! instead you will need a line that goes something like: extension=php_interbase.dll (windows) only in your case the extension will be called something like php_interbase.so php_ibase.so php_ibase.dylib (I guess, could be wrong) Am I pointing to the wrong directory? What other configuration/setup do I have to do to enable php's interbase functions? you need to have a binary of the php interbase extension suitable for your php build AND you need to load the extension Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: sort by date
I strongly recommend that you convert the db column to the datetime datatype if at all possible. However if you do wish to do it this way, read: http://dev.mysql.com/doc/mysql/en/date-and-time-functions.html And if you can't get it to work, bear in mind that STR_TO_DATE() is available as of MySQL 4.1.1. -Original Message- From: William Stokes [mailto:[EMAIL PROTECTED] Sent: 06 May 2005 08:23 To: php-general@lists.php.net Subject: [PHP] Re: sort by date Ok tested this and it won't work. Next question is sql question but anyway... Can I use STR_TO_DATE() or GET_FORMAT(DATE,'EUR') to query and sort dates to web page as a date even if the data is just a string in the db? Probably with GET_FORMAT(DATE,'EUR') it wont work cause it's a varchar field in the DB. Any idea how to put STR_TO_DATE() in to the following SQL query: SELECT event_id,name,date,time,place,type,info FROM test_table WHERE (group = '$group') AND (type = 'Game' OR type = 'training') ORDER BY date ASC Thanks a lot -Will William Stokes [EMAIL PROTECTED] kirjoitti viestissä:[EMAIL PROTECTED] Hello, I made a mistake and stored date information to DB as varchar values (dd.mm.yyy). When I read the DB is it still possible to sort the data by date with SQL query (ORDER BY date ASC)? Or is it nessessary to have the date information to be stored as a date in the DB? Will it work or is the output going to be sorted randomly? Thanks -Will -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Gamma Global : Suppliers of HPCompaq, IBM, Acer, EPI, APC, Cyclades, D-Link, Cisco, Sun Microsystems, 3Com GAMMA GLOBAL (UK) LTD IS A RECOGNISED 'INVESTOR IN PEOPLE' AND AN 'ISO 9001 2000' REGISTERED COMPANY ** CONFIDENTIALITY NOTICE: This Email is confidential and may also be privileged. If you are not the intended recipient, please notify the sender IMMEDIATELY; you should not copy the email or use it for any purpose or disclose its contents to any other person. GENERAL STATEMENT: Any statements made, or intentions expressed in this communication may not necessarily reflect the view of Gamma Global (UK) Ltd. Be advised that no content herein may be held binding upon Gamma Global (UK) Ltd or any associated company unless confirmed by the issuance of a formal contractual document or Purchase Order, subject to our Terms and Conditions available from http://www.gammaglobal.com EOE ** ** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] multi dimensional arraySOLVED
thanks richard. In the PHP.ini its set to on but in the .htaccess file we've set it to OFF. could this still be causing the problem?? thanks again Angelo Zanetti Z Logic www.zlogic.co.za [c] +27 72 441 3355 [t] +27 21 469 1052 Richard Lynch wrote: On Thu, May 5, 2005 3:37 am, Angelo Zanetti said: this is quite weird but apparently on the one server if you user $user as a variable name thats what causes the problem. I simply renamed my variable to something else and it worked, I find it strange that it worked on 1 server and not the other, is it possible that the different apache versions are responsible for this situation?? This would indicate to me that you've got register_globals ON and that your EGPCS settings are clobbering your $user variable with data from, say the environment $_ENV I'm betting that if you do: echo ENV $_ENV[user]br /\n; echo GET $_GET[user]br /\n; echo POST $_POST[user]br /\n; echo SESSION $_SESSION[user]br /\n; echo COOKIE $_COOKIE[user]br /\n; in the script that was giving you trouble, you'll find that one of those is set. Actually, since they could be set to the empty string, you should be echo-in isset($_XXX['user']) in the above test. The correct solution, then, is to turn register_globals OFF.
Re: [PHP] sort by date
On Friday 06 May 2005 11:17, William Stokes wrote: OK. I found that out from MySQL manual. I just don't know how to insert the date formatting function to the query: I quessI need to put STR_TO_DATE() in to the following SQL query: What about DATE_FORMAT()? SELECT event_id,name,date,time,place,type,info FROM test_table WHERE (group = '$group') AND (type = 'Game' OR type = 'training') ORDER BY date ASC I dont know how? Thanks a lot -Will -- Cyberly yours, Petar Nedyalkov Devoted Orbitel Fan :-) PGP ID: 7AE45436 PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436 pgpogR2tuhWB3.pgp Description: PGP signature
Re: [PHP] sort by date
William Stokes wrote: OK. I found that out from MySQL manual. I just don't know how to insert the date formatting function to the query: I quessI need to put STR_TO_DATE() in to the following SQL query: SELECT event_id,name,date,time,place,type,info FROM test_table WHERE (group = '$group') AND (type = 'Game' OR type = 'training') ORDER BY date ASC I dont know how? something like; select my_date as STR_TO_DATE(date)... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] payment gateways slightly OT
Hi guys, I just want to find out from you which payment gateways you use and what experiences good and bad have you had with them. I'm looking for a reliable payment gateway to handle credit card processing Apologies for the OT post thanks in advance -- Angelo Zanetti Z Logic www.zlogic.co.za [c] +27 72 441 3355 [t] +27 21 469 1052 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Array of objects
Thomas Hochstetter wrote: Spiraleye.Studios Hi there, I need help with arrays. What I want to do is to have an array of the following structure: $mod=array( name=new NameObject()); ^ -- looks like your single quotes got mangled in my email client. class Test { function Test($str = '') { echo $str; } } $_GET['module'] = 'testmod'; $mod = array( 'testmod' = 'Test' ); if (isset($mod[$_GET['module']]) class_exists($c = $mod[$_GET['module']])) { $Site = new $c; // $Site = new $c('Testing'); } else { die ('Can't create module object'); } ... and if that doesn't give you the knowledge/inspiration/lighbulb-moment to fix whatever it is your trying to do then please mail the list again and explain what _and_ why you are trying to do whatever it is you're trying to do (this helps people to understand thereby having a better chance of offering some helpful advice!) Then later in the page I want to go $Site = $mod[$_GET[module]] (or something like that) to instantiate a new object. The problem is, if done the way above it will try to instantiate the object right there and then in the array (defeating the purpose), if I put it in quotes and try to use something like: (object)eval($mod[$_GET[module]]) it does not instantiate the object. well assuming no syntax error occurs (eval will return false is such a case) then I bet it actually does, only your eval statement isn't assigning the new object to anything!... besides which you are casting the return value of eval to an object which is pointless for 2 reasons: 1. casting NULL to an object gets you nowhere (atleast not in this case) 2. casting an object to an object get you... nowhere :-) so: $mod = array( 'name' = 'return new NameObject()'); $Site = eval($mod['name']); PS - do you know what a reference is? (in terms of [php] variables)? understanding references with regard to objects (especially if your using php4) is a really good addition to your coding arsenal (it will save you time hunting inexplicable bugs - often such 'bugs' are nog longer inexplicable! and allow you to increase the speed of your code) PPS - using eval() is hardly ever the only option, and given that eval() is very slow its best to avoid it at all costs (assuming there is another way to do what you want)... also eval() _can_ be a security risk, if you do something like: eval($_GET['command']) without santizing the contents of $_GET['command'], hopefully you can see why. Is there a way to do this? Thanks Thomas * **SPIRAL EYE STUDIOS *** P.O. Box 37907, Faerie Glen, 0043 Tel: +27 12 362 3486 Fax: +27 12 362 3493 Mobile: +27 83 258 2669 Email: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] Web: www.spiraleye.co.za http://www.spiraleye.co.za -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Objects in Arrays (without the READ prompt)
Mathieu Dumoulin wrote: Stuart Nielson wrote: Sorry to everyone about the stupid READ notification on the posting. I some people on this list see it as sport/duty to send a reply to all read-notifications from list posts... I wonder how many you got :-) completely forgot that it was enabled. This one shouldn't have that problem. I am using PHP version 4.3.4. I'm creating an authorization module that uses a users object, that includes the username, usertype, etc. I want to store this in a session variable (i.e. $_SESSION['objects']['auth'] = new Authorization();) so that I can keep the information from page to page. However, I get an error that it is an incomplete class everytime I try to access a function from the object like this: $_SESSION['objects']['auth']-Login();. It works fine when it's not stored in the array. Is this a PHP 4 issue? Or is there something I'm doing wrong? Any pointers would be helpful. If this doesn't work, I'll have to rework things to just store in arrays. very general pointer: google. e.g.: http://www.google.nl/search?q=php4+objects+in+session Stuart Objects can't be stored in sessions, what you could do is register a BULLSHIT. (or maybe you use a version of PHP thats before my time, like say 3.0) shutdown function using register_shutdown_function(functionname) and create a custom function that would use serialize() to serialize your object. When the system starts a new you could unserialize() this session variable back into an array. anything in the $_SESSION global will automatically be serialized. BUT in order for PHP to restore you object fully you MUST include the class definitions of all object you are storing in the session BEFORE you call session_start(). I'll bet that if you did a var_dump() of $_SESSION['objects']['auth'] without changing/moving the ness. include statements you will find that it is an object of type 'PHP_Incomplete_Object' (or something similar)... and that all the member variables are actually set - its just that no methods are defined for that object because the class definition was not available at the time the object was unserialized by php. Mathieu -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] newsgroup
Anyone know a good mysql newsgroup to compliment thid php newsgroup -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] is this the correct syntax
Mathieu Dumoulin wrote: Prathaban look carefully, we are here to give acurate info and you are giving mistaken information. The $id thing is wrong, you'll actually create a parse error X| a more correct answer would have been: there is not way to know for sure whether the syntax is correct ( lets assume the PO was referring to the SQL syntax). 1. because the DB engine used is not specified (ok so its probably mySQL!) 2. the values of the vars in the string that $query is set to are not mentioned (they could contain anything, i.e. something that breaks the SQL syntax) to-the-OP HAVE YOU TRIED RUNNING THE QUERY??? trying things out is 'sometimes' quite a good way of determining the validity of the syntax that you are unsure about. /to-the-OP BTW: its probably not worth mentioning that it was not really a php question to begin with right? ;-) ... Prathaban Mookiah wrote: It should be $id. Note that missing Prathap -- Original Message --- From: Ross [EMAIL PROTECTED] To: php-general@lists.php.net Sent: Thu, 5 May 2005 12:09:18 +0100 Subject: [PHP] is this the correct syntax Am trying to do an update of a record... Is this the correct syntax.. $query= UPDATE $table_name SET fname='$fname', sname='$sname' WHERE id= $id; R. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- End of Original Message --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] compiling dynamic extensions without root access
I was going to ask, without the need of requesting our admins to recompile php all the time is there a way in the meantime to compile extensions and load them dynamically without the need for root access to some of the php libraries ? I have always compiled in personally so have never tried it. But there a few things i'd like which would take forever to get requested. Let me know. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] newsgroup
Hey, Check out: http://lists.mysql.com/ Cheers, Ryan On 5/6/2005 1:49:18 PM, Anasta ([EMAIL PROTECTED]) wrote: Anyone know a good mysql newsgroup to compliment thid php newsgroup -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.308 / Virus Database: 266.11.5 - Release Date: 5/4/2005 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Array of objects
Thomas Hochstetter wrote: Hi Jochem, Thanks for that. The eval story was just a desperate attempt ... anyway, I know references a bit from my c++ times. I am not sure how that will help in this case though. Maybe you want to share with me your thoughts on that. well compare: $a = new Test; // $a is the new object $b = new Test; // $b is a copy of the new object $c = $b; // $c refers to the same object $d = $b;// $d is a seperate copy of $b by default in php4 every time you assign an object (new or otherwise) to a variable you are making a COPY, the same goes for when you pass an object to a function. There is shedloads of info around that explains the how why of references in detail, just google around a bit. I have no idea about c++ (the C++ book beside the bed is only half-read and hardly understood ;-) so whether your understanding of references in c++ is a help or hinderance I can guess at :-) Just for completion's sake: I want to have an array in a config file that holds all possible modules that can be loaded. The module name comes from the url string and if the string is not in that array I display a default page (so no tinkering can go on). The reason for doing what you helped me doing now is only a cosmetic reason. Instead of having to declare another block with if and else if statements to instantiate the objects as in: if( $Site == null ) { if ( $module==browse ) { $Site = new Browse(); } else if ( $module==details ) { $Site = new Details();} } I thought it would be cool to be able to instantiate the object when I check the array (on finding the right entry). I might have written that as a function e.g. function getModule( $modName ) { if (in_array($modName, $modules)) { $modClass = $modules[ $modName ]; return new $modClass(); } return new DefaultModule(); } or possible a switch statement, which would be a more concise way of writing a big if/else block switch ($_GET['module']) { case 'browse': $Site = new Browse(); break; case 'details': $Site = new Details(); break; default: $Site = new DefaultModule(); break; } ... or a combination of the two (examples above). btw, there is nothing implicitly wrong with the boring old if/else block... it just maybe doesn't have the coolness factor, regardless eval() really doesn't sound like the way to go here at all. which ever way you do it, the most important thing is to layout you code _neatly_ (don't be afraid of using a bit of space :-) and comment as much as possible so that maintainance of the code is as easy as possible. Good Luck! :-) PS - please reply to list as well - somebody might be interested (and learn something). Thanks again. Cheers Thomas -Original Message- From: Jochem Maas [mailto:[EMAIL PROTECTED] Sent: 06 May 2005 01:17 PM To: Thomas Hochstetter Cc: php-general@lists.php.net Subject: Re: [PHP] Array of objects Thomas Hochstetter wrote: Spiraleye.Studios Hi there, I need help with arrays. What I want to do is to have an array of the following structure: $mod=array( 'name'=new NameObject()); ^ -- looks like your single quotes got mangled in my email client. class Test { function Test($str = '') { echo $str; } } $_GET['module'] = 'testmod'; $mod = array( 'testmod' = 'Test' ); if (isset($mod[$_GET['module']]) class_exists($c = $mod[$_GET['module']])) { $Site = new $c; // $Site = new $c('Testing'); } else { die ('Can't create module object'); } ... and if that doesn't give you the knowledge/inspiration/lighbulb-moment to fix whatever it is your trying to do then please mail the list again and explain what _and_ why you are trying to do whatever it is you're trying to do (this helps people to understand thereby having a better chance of offering some helpful advice!) Then later in the page I want to go $Site = $mod[$_GET['module']] (or something like that) to instantiate a new object. The problem is, if done the way above it will try to instantiate the object right there and then in the array (defeating the purpose), if I put it in quotes and try to use something like: (object)eval($mod[$_GET['module']]) it does not instantiate the object. well assuming no syntax error occurs (eval will return false is such a case) then I bet it actually does, only your eval statement isn't assigning the new object to anything!... besides which you are casting the return value of eval to an object which is pointless for 2 reasons: 1. casting NULL to an object gets you nowhere (atleast not in this case) 2. casting an object to an object get you... nowhere :-) so: $mod = array( 'name' = 'return new NameObject()'); $Site = eval($mod['name']); PS - do you know what a reference is? (in terms of [php] variables)? understanding references with regard to objects (especially if your using php4) is a
Re: [PHP] payment gateways slightly OT
On 5/6/05, Angelo Zanetti [EMAIL PROTECTED] wrote: I just want to find out from you which payment gateways you use and what experiences good and bad have you had with them. I'm looking for a reliable payment gateway to handle credit card processing I've coded against Authorize.net (AIM and SIM), Verisign Payflow, Yourpay, and Linkpoint. I like Authorize.net the best. It's very solid, excellent docs and all. I use Curl for the AIM method, it's very easy. I found Yourpay to be the worst. The api was buggy, the control panel options were limited, and their 'test' mode leaves much to be desired. -- Greg Donald Zend Certified Engineer http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] newsgroup
Anasta wrote: Anyone know a good mysql newsgroup to compliment thid php newsgroup er... http://lists.mysql.com/ (google could have told you this) also [EMAIL PROTECTED] is a good list to ask questions specific to using DBs with php. that said you can often get away with posting mysql questions here (especially if you show that your 'doing' it in php) because this list is remarkably well endowed with compulsive ['newbie'**] helpers :-) of course we would prefer OT questions are not posted here, but hell will freeze over before everyone stops doing that :-) ** as in 'people who compulsively want to help newbies', rather than 'people that are newly infected by the helping virus' (of which there are many on this list also ;-). -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Array of objects
Thanks, will do ;-) (as of this mail) -Original Message- From: Jochem Maas [mailto:[EMAIL PROTECTED] Sent: 06 May 2005 03:08 PM To: Thomas Hochstetter Cc: [php] PHP General List Subject: Re: [PHP] Array of objects Thomas Hochstetter wrote: Hi Jochem, Thanks for that. The eval story was just a desperate attempt ... anyway, I know references a bit from my c++ times. I am not sure how that will help in this case though. Maybe you want to share with me your thoughts on that. well compare: $a = new Test; // $a is the new object $b = new Test; // $b is a copy of the new object $c = $b; // $c refers to the same object $d = $b;// $d is a seperate copy of $b by default in php4 every time you assign an object (new or otherwise) to a variable you are making a COPY, the same goes for when you pass an object to a function. There is shedloads of info around that explains the how why of references in detail, just google around a bit. I have no idea about c++ (the C++ book beside the bed is only half-read and hardly understood ;-) so whether your understanding of references in c++ is a help or hinderance I can guess at :-) Just for completion's sake: I want to have an array in a config file that holds all possible modules that can be loaded. The module name comes from the url string and if the string is not in that array I display a default page (so no tinkering can go on). The reason for doing what you helped me doing now is only a cosmetic reason. Instead of having to declare another block with if and else if statements to instantiate the objects as in: if( $Site == null ) { if ( $module==browse ) { $Site = new Browse(); } else if ( $module==details ) { $Site = new Details();} } I thought it would be cool to be able to instantiate the object when I check the array (on finding the right entry). I might have written that as a function e.g. function getModule( $modName ) { if (in_array($modName, $modules)) { $modClass = $modules[ $modName ]; return new $modClass(); } return new DefaultModule(); } or possible a switch statement, which would be a more concise way of writing a big if/else block switch ($_GET['module']) { case 'browse': $Site = new Browse(); break; case 'details': $Site = new Details(); break; default: $Site = new DefaultModule(); break; } ... or a combination of the two (examples above). btw, there is nothing implicitly wrong with the boring old if/else block... it just maybe doesn't have the coolness factor, regardless eval() really doesn't sound like the way to go here at all. which ever way you do it, the most important thing is to layout you code _neatly_ (don't be afraid of using a bit of space :-) and comment as much as possible so that maintainance of the code is as easy as possible. Good Luck! :-) PS - please reply to list as well - somebody might be interested (and learn something). Thanks again. Cheers Thomas -Original Message- From: Jochem Maas [mailto:[EMAIL PROTECTED] Sent: 06 May 2005 01:17 PM To: Thomas Hochstetter Cc: php-general@lists.php.net Subject: Re: [PHP] Array of objects Thomas Hochstetter wrote: Spiraleye.Studios Hi there, I need help with arrays. What I want to do is to have an array of the following structure: $mod=array( 'name'=new NameObject()); ^ -- looks like your single quotes got mangled in my email client. class Test { function Test($str = '') { echo $str; } } $_GET['module'] = 'testmod'; $mod = array( 'testmod' = 'Test' ); if (isset($mod[$_GET['module']]) class_exists($c = $mod[$_GET['module']])) { $Site = new $c; // $Site = new $c('Testing'); } else { die ('Can't create module object'); } ... and if that doesn't give you the knowledge/inspiration/lighbulb-moment to fix whatever it is your trying to do then please mail the list again and explain what _and_ why you are trying to do whatever it is you're trying to do (this helps people to understand thereby having a better chance of offering some helpful advice!) Then later in the page I want to go $Site = $mod[$_GET['module']] (or something like that) to instantiate a new object. The problem is, if done the way above it will try to instantiate the object right there and then in the array (defeating the purpose), if I put it in quotes and try to use something like: (object)eval($mod[$_GET['module']]) it does not instantiate the object. well assuming no syntax error occurs (eval will return false is such a case) then I bet it actually does, only your eval statement isn't assigning the new object to anything!... besides which you are casting the return value of eval to an object which is pointless for 2 reasons: 1.
Re: [PHP] newsgroup
check out www.mysql.com On 5/6/05, Anasta [EMAIL PROTECTED] wrote: Anyone know a good mysql newsgroup to compliment thid php newsgroup -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- bala balachandar muruganantham blog lynx http://chandar.blogspot.com web http://www.chennaishopping.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Valid email address syntax script?
JM wrote: Does anyone have a nice email address syntax checking script they'd like to share? Regular expression-based anyone? TIA. yes,yes,yes,cheers. the email regexp passes Richard Lynch's email addr (check the archives :-), have fun (sorry if the line wrapping craps out)... ?php /** * RegExp.class.php :: class wrapper for regexp stuff * * @author Jochem Maas [EMAIL PROTECTED] * @copyright Copyright 2003-2004, iamjochem ard biesheuvel * * @link http://www.iamjochem.com * * $Header: /var/cvs/pom_core/php/class/RegExp.class.php,v 1.24 2005/04/12 11:36:21 jochem Exp $ */ /* FTL License. Fuck The License */ class RegExp { /* basic */ const NOT_EMPTY = '^.{1,}$'; const DONT_CARE = '^.*$'; /* numeric related */ const UNSIGNED_INT = '^\d*$'; const SIGNED_INT= '^[-+]?\d*$'; const FLOATING_POINT= '^[-+]?(\d*\.)?\d+$'; const FLOAT_GTEQ1 = '^[+]?[1-9]\d*(\.\d+)?$'; // a 'float' greater than .99... const PERCENTAGE= '^100|[0-9]{1,2}$'; const TIMESTAMP = ''; // '^\d*$'; // what does the timestamp regexp look like?? const LANG_CHARS= '^en|nl|fr|de|it|es|vl|us$'; //const LANG_CHARS= '^en|nl|fr|de|it|es$'; const CURRENCY_ID = '^[a-zA-Z]{3}$'; /* boolean-ish */ const BOOLEAN = '^Y|N$'; const SEX_NL= '^M|V$'; const GENDER= '^M|F$'; /* contact-type info */ const EMAIL = '^(([0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*@(([0-9a-zA-Z])+([-\w]*[0-9a-zA-Z])*\.)+[a-zA-Z]{2,9}))?$'; const EMAIL_REQ = '^(([0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*@(([0-9a-zA-Z])+([-\w]*[0-9a-zA-Z])*\.)+[a-zA-Z]{2,9}))$'; const URL = '^(ht|f)tp(s?))\:\/\/)?(www.|[a-zA-Z].)[a-zA-Z0-9\-\.]+\.(com|edu|gov|mil|net|org|biz|info|name|museum|co\.uk|[a-zA-Z]{2})(\:[0-9]+)?)?(\/($|[a-zA-Z0-9\.\,\;\?\'\\+%\$#\=~_\-\[\]]+))*)?$'; //const URL = '^ht|f)tp(s?))\:\/\/)?(www.|[a-zA-Z].)[a-zA-Z0-9\-\.]+\.(com|edu|gov|mil|net|org|biz|info|name|museum|co\.uk|[a-zA-Z]{2})(\:[0-9]+)?(\/($|[a-zA-Z0-9\.\,\;\?\'\\+%\$#\=~_\-\[\]]+))*)?$'; const PHONE = '^\+?(\d+( *[.-]? *))*$'; const POSTCODE = '^.*$'; const POSTCODE_REQ = '^[0-9a-zA-Z]+([- ][0-9a-zA-Z]+)?$'; /* page layout - rather specific! */ const PAGE_LAYOUTS = '^(tb|bt|lr|rl|null)?$'; /* e.g. if ( RegExp::match(RegExp::FLOATING_POINT, '16.786541') ) { ... } */ static public function match($regexp, $value) { /* if (defined(RegExp::{$regexp})) { $regexp = constant(RegExp::{$regexp}); } */ return (boolean) preg_match(/$regexp/, $value); } } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] payment gateways slightly OT
On 5/6/05, Angelo Zanetti [EMAIL PROTECTED] wrote: Hi guys, I just want to find out from you which payment gateways you use and what use paypal experiences good and bad have you had with them. I'm looking for a reliable payment gateway to handle credit card processing Apologies for the OT post thanks in advance -- Angelo Zanetti Z Logic www.zlogic.co.za [c] +27 72 441 3355 [t] +27 21 469 1052 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- bala balachandar muruganantham blog lynx http://chandar.blogspot.com web http://www.chennaishopping.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php.ini uploads
this has got to be something easy but I was uploading to a folder on a windows PC c:\upload but I updated php and forgot to backup my ini file. I have tried with quotes without quotes as well as a relational address to the folder in my ini file and I cannot get any uploads into the folder. this is what I have tried c:\upload c:\upload\ c:\upload c:\upload\ c:/upload c:/upload/ c:/upload c:/upload/ ../upload ..\upload what am I doing wrong? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] array diff with both values returned
Hello, Is there a good way to get the difference in two arrays and have both values returned? I know I can use array_dif to see what is in one and not the other but...I need it to work a bit differently. I have: $array1=array(name=fred,gender=m,phone==555-); $array2=array(name=fred,gender=f,phone==555-); I want to compare these two and have it return: array(gender=array(m,f)); I want it to return all of the differences with the key and then the value from array 1 and 2. How? Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: php.ini uploads
Jon Aston wrote: this has got to be something easy but I was uploading to a folder on a windows PC c:\upload but I updated php and forgot to backup my ini file. I have tried with quotes without quotes as well as a relational address to the folder in my ini file and I cannot get any uploads into the folder. this is what I have tried c:\upload c:\upload\ c:\upload c:\upload\ c:/upload c:/upload/ c:/upload c:/upload/ ../upload ..\upload what am I doing wrong? Did you stop/start Apache after changing your php.ini configuration ? Mehdi -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: php.ini uploads
Yes I did restart apache after each setting change. - Original Message - From: Mehdi Achour [EMAIL PROTECTED] To: Jon Aston [EMAIL PROTECTED] Cc: php-general@lists.php.net Sent: Friday, May 06, 2005 9:38 AM Subject: Re: php.ini uploads Jon Aston wrote: this has got to be something easy but I was uploading to a folder on a windows PC c:\upload but I updated php and forgot to backup my ini file. I have tried with quotes without quotes as well as a relational address to the folder in my ini file and I cannot get any uploads into the folder. this is what I have tried c:\upload c:\upload\ c:\upload c:\upload\ c:/upload c:/upload/ c:/upload c:/upload/ ../upload ..\upload what am I doing wrong? Did you stop/start Apache after changing your php.ini configuration ? Mehdi -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] newsgroup
Jochem Maas wrote: ... ** as in 'people who compulsively want to help newbies', rather than 'people that are newly infected by the helping virus' (of which there are many on this list also ;-). Hey, I resemble that remark! :P -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: array diff with both values returned
http://uk2.php.net/manual/en/function.array-diff.php http://uk2.php.net/manual/en/function.array-diff-assoc.php Blackwater Dev wrote: Hello, Is there a good way to get the difference in two arrays and have both values returned? I know I can use array_dif to see what is in one and not the other but...I need it to work a bit differently. I have: $array1=array(name=fred,gender=m,phone==555-); $array2=array(name=fred,gender=f,phone==555-); I want to compare these two and have it return: array(gender=array(m,f)); I want it to return all of the differences with the key and then the value from array 1 and 2. How? Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] compiling dynamic extensions without root access
On 5/6/05, Dan Rossi [EMAIL PROTECTED] wrote: is there a way in the meantime to compile extensions and load them dynamically without the need for root access to some of the php libraries ? You can compile/install extensions anywhere and load them with dl(). -- Greg Donald Zend Certified Engineer http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php.ini uploads
On 5/6/05, Jon Aston [EMAIL PROTECTED] wrote: this has got to be something easy but I was uploading to a folder on a windows PC c:\upload but I updated php and forgot to backup my ini file. I have tried with quotes without quotes as well as a relational address to the folder in my ini file and I cannot get any uploads into the folder. this is what I have tried c:\upload check for the writing access for the web server user c:\upload\ c:\upload c:\upload\ c:/upload c:/upload/ c:/upload c:/upload/ ../upload ..\upload what am I doing wrong? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- bala balachandar muruganantham blog lynx http://chandar.blogspot.com web http://www.chennaishopping.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] compiling dynamic extensions without root access
On 5/6/05, Dan Rossi [EMAIL PROTECTED] wrote: I was going to ask, without the need of requesting our admins to recompile php all the time is there a way in the meantime to compile extensions and load them dynamically without the need for root access to some of the php libraries ? I have always compiled in personally so have never tried it. But there a few things i'd like which would take forever to get requested. Let me know. yes you can do if u have compiled apache to support apache dynamic extensions. -- bala balachandar muruganantham blog lynx http://chandar.blogspot.com web http://www.chennaishopping.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] array diff with both values returned
Is there a good way to get the difference in two arrays and have both values returned? I know I can use array_dif to see what is in one and not the other but...I need it to work a bit differently. I have: $array1=array(name=fred,gender=m,phone==555-); $array2=array(name=fred,gender=f,phone==555-); I want to compare these two and have it return: array(gender=array(m,f)); I want it to return all of the differences with the key and then the value from array 1 and 2. Well, if you can gaurantee that for every key will exist in both arrays, the following will work: ?php $array1=array(name=fred,gender=m,phone==555-); $array2=array(name=fred,gender=f,phone==555-); $array3 = fooFunc($array1, $array2); print_r($array3); function fooFunc($array1, $array2) { foreach ( $array1 as $k1 = $v1 ) { $v2 = $array2[$k1]; if ( $v1 != $v2 ) { $result_ary[$k1] = array($v1, $v2); } } return($result_ary); } ? Prints out: % php foo.php Array ( [gender] = Array ( [0] = m [1] = f ) ) Depending on how large of an array you're expecting back, you might want to pass that around as a reference as well to save a copy... or not... -philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php-snmp-4.3.11-2.5 for RH8?
We are experiencing the 'usmAES192PrivProtocol in Unknown' error in the Apache error log due to a conflict between Net-SNMP 5.2.1 and the php-snmp package. Well of course, Fedora 3 has an update available at (and detailed) here: https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=155975 Check out this thread on the Cacti forum: http://forums.cacti.net/viewtopic.php?p=30981#30981 Any chance that a package for RH8 will become available? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] need class to send email w/attachments
Any recommendations for PHP classes that will send email messages with attachments? Thanks, Dave HTC Disclaimer: The information contained in this message may be privileged and confidential and protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by replying to the message and deleting it from your computer. Thank you.
[PHP] Re: need class to send email w/attachments
Hello, on 05/06/2005 01:44 PM Dave Bosky said the following: Any recommendations for PHP classes that will send email messages with attachments? This one is very popular and lets you send messages with attachments from local or remote files or from dynamically generated strings, with automatic detection of file type and special support for working around any PHP settings that could cause file mangling or data corruption. It can send message using the mail function or other delivery methods (SMTP server, sendmail, qmail, postfix, exim, Windows pickup folder, etc..) http://www.phpclasses.org/mimemessage -- Regards, Manuel Lemos PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ PHP Reviews - Reviews of PHP books and other products http://www.phpclasses.org/reviews/ Metastorage - Data object relational mapping layer generator http://www.meta-language.net/metastorage.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Reducing size of htm output
I need to reduce the size of the HTM generated by a PHP script for faster transmission. I'm actually using ob_start(ob_gzhandler) but I also need some function to reduce the size of javascript blocks, deletion of unnecesary blanks, etc. For example, Code A: headscript function any(){ somecode; } /script /head body /body can be converted to Code B: headscript function any(){ somecode; }/script/headbody/body 1) Is there any function to do this (I'm using PHP 4.2) ? Or maybe some user has already done it? 2) Is it true that ob_start(ob_gzhandler) can cause problems on IE 5.5+? Thanks a lot, Kirsten -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: need class to send email w/attachments
* Dave Bosky [EMAIL PROTECTED]: Any recommendations for PHP classes that will send email messages with attachments? PEAR::Mail + PEAR::Mail_Mime -- Matthew Weier O'Phinney | WEBSITES: Webmaster and IT Specialist | http://www.garden.org National Gardening Association| http://www.kidsgardening.com 802-863-5251 x156 | http://nationalgardenmonth.org mailto:[EMAIL PROTECTED] | http://vermontbotanical.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] need class to send email w/attachments
Any recommendations for PHP classes that will send email messages with attachments? http://pear.php.net/package/Mail http://pear.php.net/package/Mail_Mime or http://phpmailer.sourceforge.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] need class to send email w/attachments
Try www.phpclasses.org/phpmailer I've never used it but it's mentioned quite a lot. On 5/6/05, Bosky, Dave [EMAIL PROTECTED] wrote: Any recommendations for PHP classes that will send email messages with attachments? Thanks, Dave HTC Disclaimer: The information contained in this message may be privileged and confidential and protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by replying to the message and deleting it from your computer. Thank you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] need class to send email w/attachments
You could try this link. I know that you will find something there: http://www.phpclasses.org/ Mark Cain - Original Message - From: Bosky, Dave [EMAIL PROTECTED] To: php-general@lists.php.net Sent: Friday, May 06, 2005 12:44 PM Subject: [PHP] need class to send email w/attachments Any recommendations for PHP classes that will send email messages with attachments? Thanks, Dave HTC Disclaimer: The information contained in this message may be privileged and confidential and protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by replying to the message and deleting it from your computer. Thank you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] compiling dynamic extensions without root access
yes you can do if u have compiled apache to support apache dynamic extensions. It doesn't matter how you compile apache. It's how you've configured PHP, and what type of server it's running on, how the server handles multiple clients. Zeus, and IIS don't AFAIK support dl(). I reckon it's safe to assume that you can't use dl() on Apache2 if you use the multithread MLM. -- bala balachandar muruganantham blog lynx http://chandar.blogspot.com web http://www.chennaishopping.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: need class to send email w/attachments
I have used PHPMailer. It is easy to use and works great. If you happen to be on a windows computer I did find that you may need to turn off the zend optimizer in your php.ini file. For some reason with the Zend turned on I was getting an error at the end of my script run but it had no affect on the actual function of the script. Dave Bosky [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Any recommendations for PHP classes that will send email messages with attachments? Thanks, Dave HTC Disclaimer: The information contained in this message may be privileged and confidential and protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by replying to the message and deleting it from your computer. Thank you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: php.ini uploads
It was as I suspected. Operator error. upload_tmp_dir = folder notice the space after the = as soon as I noticed and removed the space several of the variations that I had tried worked fine... Thanks for the suggestions. Jon Aston [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] this has got to be something easy but I was uploading to a folder on a windows PC c:\upload but I updated php and forgot to backup my ini file. I have tried with quotes without quotes as well as a relational address to the folder in my ini file and I cannot get any uploads into the folder. this is what I have tried c:\upload c:\upload\ c:\upload c:\upload\ c:/upload c:/upload/ c:/upload c:/upload/ ../upload ..\upload what am I doing wrong? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] need class to send email w/attachments
Ave, Try http://www.phpclasses.org/mimemessage I used it for my business application everyday, works great and is very efficient. Rahul S. Johari Coordinator, Internet Administration Informed Marketing Services Inc. 251 River Street Troy, NY 12180 Tel: (518) 266-0909 x154 Fax: (518) 266-0909 Email: [EMAIL PROTECTED] http://www.informed-sources.com - Original Message - From: Bosky, Dave [EMAIL PROTECTED] To: php-general@lists.php.net Sent: Friday, May 06, 2005 12:44 PM Subject: [PHP] need class to send email w/attachments Any recommendations for PHP classes that will send email messages with attachments? Thanks, Dave HTC Disclaimer: The information contained in this message may be privileged and confidential and protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by replying to the message and deleting it from your computer. Thank you.
Re: [PHP] Reducing size of htm output
Kirsten wrote: I need to reduce the size of the HTM generated by a PHP script for faster transmission. I'm actually using ob_start(ob_gzhandler) but I also need some function to reduce the size of javascript blocks, deletion of unnecesary blanks, etc. For example, Code A: headscript function any(){ somecode; } /script /head body /body can be converted to Code B: headscript function any(){ somecode; }/script/headbody/body If you are compressing it, the extra spaces really don't matter. Try it for yourself. Get an example file and hand-optimize it to remove the whitespace and compress it. Compare that to the size of the compressed file without the whitespace removed. You will most likely find that the size difference after compression is neglible. 2) Is it true that ob_start(ob_gzhandler) can cause problems on IE 5.5+? It should be fine. -Rasmus -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] multi dimensional arraySOLVED
Angelo Zanetti wrote: thanks richard. In the PHP.ini its set to on but in the .htaccess file we've set it to OFF. could this still be causing the problem?? run phpinfo() inside the directory thanks again Angelo Zanetti Z Logic www.zlogic.co.za [c] +27 72 441 3355 [t] +27 21 469 1052 Richard Lynch wrote: On Thu, May 5, 2005 3:37 am, Angelo Zanetti said: this is quite weird but apparently on the one server if you user $user as a variable name thats what causes the problem. I simply renamed my variable to something else and it worked, I find it strange that it worked on 1 server and not the other, is it possible that the different apache versions are responsible for this situation?? This would indicate to me that you've got register_globals ON and that your EGPCS settings are clobbering your $user variable with data from, say the environment $_ENV I'm betting that if you do: echo ENV $_ENV[user]br /\n; echo GET $_GET[user]br /\n; echo POST $_POST[user]br /\n; echo SESSION $_SESSION[user]br /\n; echo COOKIE $_COOKIE[user]br /\n; in the script that was giving you trouble, you'll find that one of those is set. Actually, since they could be set to the empty string, you should be echo-in isset($_XXX['user']) in the above test. The correct solution, then, is to turn register_globals OFF. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Reducing size of htm output
Kirsten wrote: I need to reduce the size of the HTM generated by a PHP script for faster transmission. I'm actually using ob_start(ob_gzhandler) but I also need some function to reduce the size of javascript blocks, deletion of unnecesary blanks, etc. For example, Code A: headscript function any(){ somecode; } /script /head body /body can be converted to Code B: headscript function any(){ somecode; }/script/headbody/body preg_replace('/s+/', ' ', $html); but watch out, this js code will work: var v alert(v) this one will not: var v alert(v) 1) Is there any function to do this (I'm using PHP 4.2) ? Or maybe some user has already done it? 2) Is it true that ob_start(ob_gzhandler) can cause problems on IE 5.5+? don't know. but you can detect these browsers and turn compression off -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Socket connection reset by pear
El Vie 06 May 2005 01:50, Richard Lynch escribió: On Thu, May 5, 2005 5:20 am, Martín Marqués said: I'm trying to build some communication aside of the server thin client stuff, with a socket daemon and a socket client. The daemon is the same that everybody can find in the PHP docs (example 1). The client simply opens a connection to the daemon and writes data using the socket Object from PEAR (last stable version). The problem is that it fails to make a socket_read() with this message (on the daemon side): Warning: socket_read() unable to read from socket [54]: Connection reset by peer in /space/home/martin/programacion/siprebi-1.2/ext/impresion/printSocket.php on line 42 socket_read() failed: reason: Operation not permitted If I open a telnet conection to the daemon, everything works like a charme. It writes and quits OK. What can be going wrong? Operation not permitted would make me guess you've got a user read/write permissions problem. Permissions where? On the file that is been executed? Everything looks OK. When you open that telnet connection, are you logged in as the same user as the PHP user that is running the client script? I'm guessing not... You have to clarify, for yourself, which user is doing what when to which files/devices/sockets, and what chown permissions are in effect. That generally makes you go Duh and fix the problem pretty quick. Well not really. I just tried running both scripts (daemon and client) from the same machine, both as root, and I still get a connection reset by pear. The client code is this: ?php ini_set (display_errors , On ); if (($socket = socket_create (AF_INET, SOCK_STREAM, SOL_TCP)) 0) { echo socket_create() failed: reason: . socket_strerror ($socket) . \n; } $result = socket_connect($socket, '127.0.0.1', 9100); var_dump($result); $msg = prueba de socket; $res = socket_write($socket, $msg, strlen($msg)); var_dump(socket_strerror(socket_last_error($socket))); exit; ? The daemon code is like this: #!/usr/bin/php ?php ini_set (display_errors , On ); error_reporting(E_ALL); /* Allow the script to hang around waiting for connections. */ set_time_limit(0); /* Turn on implicit output flushing so we see what we're getting * as it comes in. */ ob_implicit_flush(); $address = '127.0.0.1'; $port = 9100; if (($sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP)) 0) { echo socket_create() failed: reason: . socket_strerror($sock) . \n; } if (($ret = socket_bind($sock, $address, $port)) 0) { echo socket_bind() failed: reason: . socket_strerror($ret) . \n; } if (($ret = socket_listen($sock, 5)) 0) { echo socket_listen() failed: reason: . socket_strerror($ret) . \n; } do { if (($msgsock = socket_accept($sock)) 0) { echo socket_accept() failed: reason: . socket_strerror($msgsock) . \n; break; } var_dump($msgsock); do { if (false === ($buf = socket_read($msgsock, 2048, PHP_NORMAL_READ))) { echo socket_read() failed: reason: . socket_strerror($ret) . \n; break 1; } if (!$buf = trim($buf)) { continue; } if ($buf == 'quit') { break; } if ($buf == 'shutdown') { socket_close($msgsock); break 2; } } while (true); socket_close($msgsock); } while (true); socket_close($sock); ? But when I try to connect with the PHP client (even executing it with CLI interface) I get this message in the daemons output: Warning: socket_read() unable to read from socket [54]: Connection reset by peer in /root/printSocket.php on line 36 socket_read() failed: reason: Operation not permitted -- 16:32:53 up 35 days, 1:01, 2 users, load average: 0.70, 0.52, 0.59 - Martín Marqués| select 'mmarques' || '@' || 'unl.edu.ar' Centro de Telematica | DBA, Programador, Administrador Universidad Nacional del Litoral - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php