[PHP] STDIN/STDOUT in PHP
I've been looking for a way to work with stdin/stdout for a mod_rewrite's rewritemap. There's a working example in Perl, (just returning the input) #!/usr/bin/perl $| = 1; while () { print $_; } I've been trying to achieve this with fopen() read and write the php://stdin & php://stdout . #!/usr/local/bin/php -q But no success. In the apache man they say Avoid one common mistake: never do buffered I/O on stdout! This will cause a deadloop! Hence the ``$|=1'' in the above example Could sommone give some pointers how I could achieve the perl script above in php? TIA Jim. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP logo question
Hi coders, I've sent several mails to [EMAIL PROTECTED] regarding the limitations / rights to use the PHP logo. But I havent recieved any reply, does anyone know who answers that email? If so please send him/her an heads up to check his/hers inbox. Now you might think that I've been sending several mails within a few days and now cries for help... Thats no the case, I sent my first mail the 18th december and a copy of that mail was resent at the 8th of january 2004. Or if someone knows if that guy has a lot on his plate just send me an mail to let me know if he usually replies within the month or two months. Cheers Jimmy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Empty Reference to an Object
At 16:14 2004-01-13, you wrote: Hello Sebastian, Tuesday, January 13, 2004, 3:09:39 PM, you wrote: SO> I cannot believe that there is no way of making an object parameter SO> optional. function ($parameter1, $parameter2 = NULL) { // etc } If passed to your function, $parameter2 will be your object (or string or whatever you wanted), if not passed in it'll be null. this might work this is an ugly solution from the top of my head, not tested: $myObject =& (ifYour object exists)? $yourObject : new stdClass; foo("blaha",&$myObject); function foo($para1,&$param2){ if(get_class($param2) =='stdClass') $param2 = NULL; // get_class might return stdclass not sure } ?> / Jimmy -- Best regards, Richardmailto:[EMAIL PROTECTED] -- 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] ld: fatal: Symbol referencing errors.
Hi, I was wondewring if someone know the reason to the error below, I'm no Unix guru and my sysadm says he cant get ldap to work due to this, is there anyone who tell me what to tell him to get it to work? greetings Jimmy Lund Sweden //ERROR ENCLOSED BELOW. gcc -DSOLARIS2=260 -I/usr/local/src/php-4.0.0 -I/usr/local/src/php-4.0.0/Zend -I/usr/local/src/php-4.0.0/Zend -I/usr/local/src/php-4.0.0 `./apaci` -o httpd buildmark.o modules.o modules/php4/libphp4.a modules/extra/libextra.a modules/standard/libstandard.a main/libmain.a ./os/unix/libos.a ap/libap.a -R/usr/ucblib -R/usr/local/ldap-3.3/lib -R/usr/local/mysql-3.22.32/lib/mysql -L/usr/ucblib -L/usr/local/ldap-3.3/lib -L/usr/local/mysql-3.22.32/lib/mysql -Lmodules/php4 -L../modules/php4 -L../../modules/php4 -lmodphp4 -ldb -lpam -ldl -lmysqlclient -lresolv -lresolv -lm -ldl -lcrypt -lnsl -lsocket -lsocket -lsocket -lnsl -lldap -llber -lavl -lldbm -lldif -llthread -lphp4 Undefined first referenced symbol in file ldap_module modules.o ld: fatal: Symbol referencing errors. No output written to httpd collect2: ld returned 1 exit status -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] parse error is always on line 1 == error ?
Hi, I have a problem, that when I get a parse error it always says that it's on line 1 in this or that file. Where is the configuration option to set this right? I have on another server seen that it's possible to get it to state the actual error line. (it's PHP Version 3.0.15 on solaris) Please help me out on this one. Best wishes Jimmy Lantz Sweden
Re: [PHP] parse error is always on line 1 == error ?
Yes, thank you you're right this is exactly what it was, I used Dreamweaver on a mac to edit the files, but now if I encounter parse error I convert them with BBEdit. Thank you. Jimmy Lantz >I use BBEdit on the Mac, uploading PHP code to a Unix server, and I get >parse errors on line 1 unless I remember to set line breaks to Unix \n >(rather than Mac and Windows line endings, which use different >characters). You may be running into a similar problem. > >Jimmy Lantz wrote: > >> Hi, I have a problem, >> that when I get a parse error it always says that it's on line 1 in >> this or that file. >> Where is the configuration option to set this right? >> I have on another server seen that it's possible to get it to state >> the actual error line. > >John Platte > >"Truth binds the mind to what satisfies it, >but worldly thinking does not satisfy >and therefore ignites curiosity." > >-- St. Theophan the Recluse -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] How do I call_user_func_array() on 4.0.1pl2 ?
Hi, I wonder if there's a way to get the same result as with call_user_func_array()on 4.0.1pl2 . I need to do the following : foreach($formArray as $arrays){ foreach($arrays as $key => $value){ call_user_func_array($key, explode (",", $value)"); //Not working since I have 4.01 $key(explode (",", $value)); //This aint working either since explode returns an array, and I need to return //a list of vars to call. (different amount of vars each time!) }} Is there another way to do this using a function or something, I cant update since it's not my own server.ThanxJimmy from Sweden _IncrediMail - Email has finally evolved - Click Here
[PHP] How do I call_user_func_array() on 4.0.1pl2 ?
Hi, I wonder if there's a way to get the same result as with call_user_func_array() on 4.0.1pl2 . I need to do the following : foreach($formArray as $arrays){ foreach($arrays as $key => $value){ call_user_func_array($key, explode (",", $value)"); //Not working since I have 4.01 $key(explode (",", $value)); //This aint working either since explode returns an array, and I need to return a list of vars to call. (different amount of vars each time!) } } Is there another way to do this using a function or something, I cant update since it's not my own server. Thanx Jimmy from Sweden -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Going crazy again ...
Hej, jag hade nog inte använt åäö i case men det är bara en vana, kanske du kan använda en dold variabel via html-formuläret istället och använda den i case satsen? Men det svarar ju inte på din fråga men lycka till. / iImmy Martin Skjöldebrand wrote: > Going grey haired again. In this code only the first case is working > (adding stuff to tables). The second and third are producing - Warning: > Supplied argument is not a valid MySQL-Link resource in > /chroot/htdocs/diarium/settings.php on line 31 (which is $query_res /ms) > error: > > I've even copied and pasted the also clause which works from sendaction to > recaction but I get the same result. Anyone sees what going on? I don't. > And my deadline is tomorrow (or thursday). > > M. > > switch ($sendaction) { > case "Lägg till": > > $query="INSERT INTO employees (login, name)"; > $query .= "VALUES('$txtSend', '')"; > $query_res =mysql_query($query, $mysql_link) or die('error: >' . > mysql_error()); > if ($also=="Rec"){ > $query="INSERT INTO contacts (id, name)"; > $query .= "VALUES('$txtSend', '')"; > $query_res =mysql_query($query, $mysql_link) or >die('error: ' . > mysql_error()); > } > break; > } > > switch ($recaction) { > case "Lägg till": > $query="INSERT INTO contacts (id, name)"; > $query .= "VALUES('$txtRec', '')"; > $query_res =mysql_query($query, $mysql_link) or die('error: >' . > mysql_error()); > break; > } > > switch ($archaction) { > case "Lägg till": > $query="INSERT INTO archive (s_name, name) VALUES('$txtArch', '')"; > $query_res =mysql_query($query, $mysql_link) or die('error: >' . > mysql_error()); > > > break; > } > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] [PHP 4.2.0] Benchmarking file uploads?
Hi, I'm looking into the new version of PHP it says in the changelog "Highly improved performance with file uploads " Has there been any benchmarking done on this? / Jimmy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] [PHP 4.2.0] HTTP PUT method & $_FILES ?
Hi, I'm trying to get the PUT method working on a Apache server running PHP as module. Theese are the steps I've taken so far: - I see in my apache logs that I've got PUT requests "PUT /path/filename.html HTTP/1.1" OK - I've added Script PUT /put.php , And checked so that the requests are beeing transfered to this function. OK - I've tried to get the ENV VARS but none show more than the PATH_TRANSLATED (and it's beeing set) OK - Checked the vars $PHP_UPLOADED_FILE_NAME and $PHP_PUT_FILENAME But neither are being set to any tmpfile NOT OK! - Checked $HTTP_RAW_POST_DATA , not set either. Would'nt it be better to have the PUT valuables in the superglobal $_FILES ? Or at least in a $HTTP_PUT_FILE var. If someone could direct me to where I can fine the temporary file, I would be much obliged! Theres bugs referring to this as an "non working" function is this so? - Bug #10383 Receiving an HTTP PUT, rather than sending one - Bug #14298 PUT absent $PHP_PUT_FILENAME $PHP_UPLOADED_FILE_NAME I propose a solution like the following: $HTTP_PUT_FILE['request_uri'] Path of the proposed upload like /mytest/filename.htm $HTTP_PUT_FILE['path_translated'] The full path of the proposed upload like /usr/home/foo/bar/public_html/mytest/filename.htm $HTTP_PUT_FILE['size'] The size, in bytes, of the uploaded file. $HTTP_PUT_FILE['tmp_name'] Temp name something like /tmp/hfdhjfufd8733 My only bad is that I cant program in C otherwise I would have been there doing it already. / Jimmy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [[PHP] php problem]
"johnny1b1g" <[EMAIL PROTECTED]> wrote: ? Well I guess I could try to help you if you elaborate your question a bit further. / Jimmy Start with RTFM :-) -- 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] Sane path? Avoiding people climbing in directory structure ../../
Hi, I'm planning on using userinput as a part of path to read (horrific I know :) So to make this userinput a bit more secure I'm thinking to use $path = escapeshellarg($path); $path = str_replace("../","",$path); I'm thinking to use a basedir in a constant something like /usr/home/userdir (this also being set in php.ini) then add the userinput and then append that to the constant and then use opendir() on it. I want to avoid people putting in nice little strings like ../../../etc/ Any other pointers? / Jim Security is a state of mind not a sales arguement! *** Secret behind flying= Throw yourself at the ground and miss :-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Mcrypt: Blowfish or Twofish or no fish?
Hi, started playing with Mcrypt and just wanted to ask which encryption method makes the stronger encryption? (I can supply the necesary keylength). Should I go for MCRYPT_BLOWFISH or MCRYPT_TWOFISH? Or no fish at all :) So what do I need it for? I'm going to use it encrypting files, sizes varies between some 100 k's and 4-5 mb's. / Jim Paranoia + A system w/o users = Safe system :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Mcrypt: Blowfish or Twofish or no fish? Part 2
Thanx for the suggestions! Someone mentioned that I could use MD5 and then encrypt the hash, how would I ever decrypt that? Is'nt MD5 a 1-way thing only? Another question? Should I go for bigger keylength or bigger blocksize or both? What makes for the best encryption? / Jim (and before someone suggest that I read the book Applied cryptography it's already orderd and on it's way :-) ) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Mcrypt: Blowfish or Twofish or no fish? part 3
>I believe that twofish has been successfully broken, so use blowfish >instead. Typically, for encrypting files you will use an algorithm like >blowfish in cbc mode (as opposed to ebc mode) but I don't know if Mcrypt >supports this. Also, when creating the hash of the file, it is probably best >to use SHA-1 instead of MD5, as there appears to be some concern with MD5 >over it's compression function. >HTH >JH It helps :) I have been looking into Blowfish with cbc mode :) If I use SHA-1 it's still no way to dehash it during decryption of the file, so I fail to see the use of Hashing in fileencryption. Could someone enlighten me? / Jim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] (Unlink(file) == rm file) ? (ignore this mail):(explain diffs);
Hi, (Unlink(file) == rm file) ? (ignore this mail):(explain diffs); Does PHP unlink function handle deletion of files equally as the "rm" command on the system in my case FreeBSD. Or does it involve caching/handling files in any different way? / Jim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] readfile or fopen? (Passing file to user...)
Hi, I wonder if there's a better way (more effective, less resource consuming ) to pass a file to a user than the ones I put below. This might be quite large files more than 100 mb. Mind this might be all kind of files (binary and others) and must preserve the files state. //Sending approriate headers //snip --Is this better, faster less consuming $fd=fopen($completeFilePath,'r'); fpassthru($fd); exit; than this? Seems like it, or is there yet another, faster, better way? $data = readfile($completeFilePath); $i=0; while ($data[$i] != ""){ echo $data[$i]; $i++; } exit; TIA / Jimmy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Appropriate headers for Forcing download on IE/Mac and open with stuffit?
Hi, I know it has been discussed before but I havent seen any working solutions. My problem is that I need to force a dowload for Mac users / IE and preferably also automatically let them open the file with stuffit expander. (it works with files downloaded from a webpage/apache without PHP) So there must be a way to replicate this behaviour in PHP, right? I've tried endless combinations of orders for the headers and removing parts of them. What I've ended up using is the following: header("Content-type: application/octet-stream\n"); header("Content-disposition: attachment; filename=\"$filename\"\n"); header("Content-transfer-encoding: binary\n"); header("Content-length: " . $filesize . "\n"); But it doesnt result in the desired behaviour though. Any Ideas? Cheers Jimmy And yes I've RTFM more than twice! Btw, I use PHP 4.12 as an Apache module on FreeBSD. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Resume/recover uploads in PHP 4.2 ? WAS: RE: upload forms, how much was uploaded before upload fails..
Hi following up on the text below... Will there then be possible to recover uploads in 4.2? Maybe even resuming uploads? (wishfull thinking) ? Cheers Jimmy Rasmus Lerdorf wrote: Re: [PHP] upload forms, how much was uploaded before upload fails.. You'll probably need PHP 4.2 for uploads that big to work well. Before 4.2 uploads were buffered in ram, so no, you have no way to recover a broken upload. On Sun, 24 Mar 2002, Gerhard Hoogterp wrote: > Hello all, > > I'm still having problems uploading BIG files (15MB and more) Is there a way > to find howmuch data was uploaded before the connection was broken? > > For some weird reason no browser has a half decent user feedback if it come > to upload forms. > > Gerhard -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] mimeexplode counterpart in php?
Hi! I wonder if there's such a thing as a counterpart in PHP for MimeExplode in PERL? MimeExplode takes a email and splits the attachments and text so that you can save it automatically to a certain dir by using .forward files. Or something alike to it in PHP. I've been looking at IMAP functions but dont see how it would be possible to do the same thing. Cheers Jimmy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php