[PHP] Re: Connecting binary & php together
Not exactly sure what you mean here. Do you mean you'd like to get a C or C++ library to work inside PHP, or get PHP to work inside of a C or C++ app/library? If it's the former, then you want to build an extension to PHP. There are lots of examples in the ext directory. If it's the latter, then look at sapi/embed, which lets you cram the PHP interpreter into any sort of application or library. It's still experimental, but it's a step in the right direction. J Stephan Seidt wrote: > Hi > > I'm thinking about the best way to connect a c(++) > binary with the php interpreter. I thought the best > solution is to use a shared library which has been > built by php. Is libphp4.so always the same or are > the libraries for apache / apache2 / roxen / etc > different ? I think the parameter --with-apxs > or whatever is just given so that php knows > what it has to do, right ? > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Decrypting mcrypted strings on Windows desktop
Why not set up some kind of public/private key system? Each customer has a public key that you can encrypt with, send them the data and have them decrypt it with their private key. PGP would be the obvious choice, or GnuPG for that matter. J Geoff Caplan wrote: > Hi folks, > > Bit OT but I am hoping someone on the list can help. > > I need to encrypt short strings in PHP, using mcrypt by preference, > email it to the customer, and have him decrypt the string on the > Windoze desktop. > > But all the Windows encryption utilities I can find use proprietary > file formats - none can decrypt the string output by mcrypt. Can > anyone help me out here - I am running out of time. Either an open > source or a commercial solution would be fine. > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: stripping spaces from a string
Regular expressions would be overkill. Try $newString = str_replace(" ", "", $oldString); J Jule Slootbeek wrote: > Hi, > > What's the best and easiest way to strip all the spaces from a string? > do i use regular expressions for it? > > TIA, > J. > Jule Slootbeek > [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Encrypt and decrypt cookie
Note that IVs only affect block cipher modes other than ECB mode. ECB mode ignores IVs completely. J Titu Kim wrote: > Hi, >I am using libmcrypt-2.5.3 to do encryption in php. > I use exactly the steps provided in mcrypt_module_open > available on php website > http://php.benscom.com/manual/en/function.mcrypt-module-open.php > > I can encrypt and decrypt a string correctly. However, > if i encrypt a cookie to write to user's browser, the > decryption is incorrect when i try to decrypt this > cookie when user comes again. I found out the main > cause is the function mcrypt_module_open. This > function return a different resource everytime it is > called. Eventually it cause the decryption on cookie > to be incorrect. Can someone give me suggestion on how > to encrypt and decrypt a cookie? > > Thanks very much. > > Kim > > __ > Do you Yahoo!? > Yahoo! Mail Plus - Powerful. Affordable. Sign up now. > http://mailplus.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mcrypt
As I've said a bunch of times, I hate plugging my own software, but you can try cryptopp-php, which should provide all the encryption you need, and it works on both UNIX and Windows. http://www.tutorbuddy.com/software/ J Alex Piaz wrote: > As far as I know, there is no mcrypt windows version. You´ll have to try > to compile it yourself. And don´t ask me how because I don´t know:-) > > A sugestion: If you can, change to linux. It´s better and it´s Free. > > Regards > > Alex > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Creating an extra library
Since there's no PHP XSLT extension RPM from Red Hat (as far as I can tell), the easiest way to build it would probably be... 1. download the PHP source code. 2. in the ext/xslt directory, run phpize. This is assuming the Red Hat RPM installed PEAR and it's utilities. 3. Run ./configure, make, make install, etc. on the XSLT directory to build your xslt.so shared object. 4. Modify php.ini to load the new extension, or use the dl() function in your scripts. Of course, you'll also have to install Sablotron and such as well... J Tom Vandeplas wrote: > Hi all, > > this question may have been asked a couple of times already, unfortunately > I can't find the answer. > > I have a complete PHP-webserver system up and running, based on a standard > redhat PHP distribution. The only thing that is missing are the XSLT > funtions. I managed to build php on a different system with xslt enabled, > but then again it lacks all the nice standard features that come with the > redhat distribution. > > The thing I would like to do is to build "xslt.so" so I can add it to the > existing setup. I know it should be possible since this is the way RedHat > distributes additional libraries. Unfortunately it's not clear to me how > to build these "so" files or how to add them to a setup. > > Any help on this would be greatly appreciated. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: occasional mcrypt problems
Try using a different block cipher mode. When encrypting with ECB, as you said, your plaintext must have a length that is a multiple of the blocksize for the cipher. If it's anything less, you're going to get some garbage at the end of the decrypted ciphertext. I believe that mcrypt uses zeroes padding for ECB mode. You might want to try one of the other block cipher modes, like CBC or CFB. This will require that you use random IVs for each encryption, but it's much more secure than using ECB mode. Even though you create an IV in your code below, ECB mode ignores it -- if you encrypt the same plaintext multiple times using the same key, you'll end up with the same ciphertext. With random IVs and the proper mode, this wouldn't happen. This will require that you store the IV for each encryption along with the ciphertext, but that's fine, as storing the IV along with the ciphertext is not a security problem. I'm not sure what mcrypt uses for padding on it's various block cipher modes, but it might help. It'll be more secure than ECB, at any rate. J Steve Yates wrote: > Hello, > > I recently implemented a database using MySQL that is storing selected > fields encrypted. However on a very small number of records the decrypted > result is not correct for some fields, for example for this credit card > number: > > -99-ÏF¡hßxø > > It appears in fact the same way as the problem I first experienced, when > the database field was not big enough to store the encrypted text (which I > discovered takes a multiple of the blocksize, so it is usually bigger than > the original string). However the blocksize is 8 and to provide a safety > margin all the fields to be encrypted have 10 extra characters in them > (varchar fields). > > So far this happens on at most one field in a record, perhaps on less than > 5% of the records. At first I was thinking maybe the addslashes() was > adding text but MySQL should be stripping that out before entering it into > the database, right? Also I can't seem to duplicate this by entering the > same values in the form again. > > Any suggestions? Here is my encryption code: > > $hrkey = '$R^a$nd()M%'; // changed text > $td = mcrypt_module_open(MCRYPT_TRIPLEDES,'', MCRYPT_MODE_ECB, ''); > $iv = mcrypt_create_iv(mcrypt_enc_get_iv_size($td), 99); > //changed the number > $ks = mcrypt_enc_get_key_size ($td); > $key = substr(md5($hrkey), 0, $ks); > mcrypt_generic_init($td, $key, $iv); > $CreditCardNumber = addslashes(mcrypt_generic($td, > $_POST['Credit_Card_Number'])); > (...post to database here...) > mcrypt_module_close($td); > > Decryption code: > > function mydecrypt($enc) { > global $td; > return rtrim(mdecrypt_generic($td, $enc), "\0"); > } > > Thanks for any insight! > > - Steve Yates > - ASCII stupid question, get a stupid ANSI. > > ~ Taglines by Taglinator - www.srtware.com ~ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: occasional mcrypt problems
Steve Yates wrote: > > "This function encrypts data. The data is padded with "\0" to make sure > the length of the data is n * blocksize. This function returns the > encrypted data. Note that the length of the returned string can in fact be > longer then the input, due to the padding of the data." > > I am storing the encrypted, padded string. I wasn't sure on the padding scheme that mcrypt uses, so if it is indeed zeroes, you're probably fine. That might not always be the case depending on the padding scheme used (such as not having a padding scheme at all), but since mcrypt obviously does, things should be fine. As to the garbage that's being appended, could it possibly be due to some thread-safety issues? libmcrypt is thread-safe, but I believe there's an additional configuration parameter needed for safety. (Not entirely sure on that. Are you using a threaded web server?) > However changing now will mean handling some historical data > differently > somehow. :( And storing an IV for each record would of course increase > the data size. > It wouldn't be that hard to convert. Just write a script that converts the old data to the new cipher mode and shove it back in the database. Storing the IVs would naturally increase the storage size by a few bytes per record, but the increased security might be worth it. J -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: str_replace an include
I'd recommend looking at the output buffering functions. Something like this would probably work... ob_start(); include("links.php"); $file = ob_get_contents(); ob_end_clean(); The result of parsing and executing links.php will be in $file. Do with it what you will. J Jesse wrote: > Hello all, > > I'm trying to replace a tag with an include in a template scenario. For > example: > > str_replace("
[PHP] Re: forking scripts
PHP can fork scripts. Refer to the pcntl extension. http://www.php.net/manual/en/ref.pcntl.php You'll be wanting to use pcntl_fork()... J Senn wrote: > Hi, > > Since php does not have child -> parent forking methods, can anybody > suggest a method to achieve this. > > Thanks. > > Senn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Extending PHP
Look at PEAR's PECL project: http://cvs.php.net/cvs.php/pear/PECL J Mh wrote: > I am looking for 3d party extensions of PHP like PHPTurbine. Anything > will > do, I am just curious whats available. Anyone know of any sites dedicated > to PHP extensions that I can look at? > > Thanks > Mh -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: 4.3 Install on Solaris
Weston Houghton wrote: > > All, > > I seem to be getting a silly error on Solaris when trying to do a PHP > 4.3 make. I get an error that looks to me like the liner arguments are > just too long. to be honest, I'm a bit stupified as to why this is > happening or how to fix it. FWIW, I have compiled 4.23 just fine on > that box. > > Thanks, > Wes > > > p.s. here's the last bit of the error: > > /bin/sh libtool --silent --mode=link gcc -export-dynamic -g -O2 > -avoid-version -module -L/usr/ucblib > -L/usr/local/lib/gcc-lib/sparc-sun-solaris2.6/2.8.1 > -L/export/home/oracle/OraHome/lib -R /usr/ucblib -R > /usr/local/lib/gcc-lib/sparc-sun-solaris2.6/2.8.1 -R > /export/home/oracle/OraHome/lib ext/ctype/ctype.lo ext/ftp/php_ftp.lo > ext/ftp/ftp.lo ext/mysql/php_mysql.lo ext/mysql/libmysql/libmysql.lo Install GNU sed. The standard Solaris sed can't handle input that long. (I believe it has a character limit of 4096 characters or something to that effect.) GNU's sed doesn't have that limit. Installing the package from www.sunfreeware.com will put GNU sed in /usr/local. Make sure that make can find the GNU sed before it finds Sun's sed by putting /usr/local/bin before /usr/bin in your $PATH. J -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: php_mcrypt.dll
If all you need is some PHP encryption and don't necessarily need the mcrypt library, you can try cryptopp-php, which does pretty much the same thing. A Windows DLL that was compiled for PHP 4.3.0 is available at http://www.tutorbuddy.com/software/ It should work with PHP 4.3.1, too, as I don't think the PHP module API changed between the two versions. (I know, it's a shameless plug and I hate doing it, but it might help...) J Daniel Guerrier wrote: > I'm trying to use the mcrypt function on winXP using > php 4.3.1 and IIS 5. First the dll would not load but > I got past that by placing the libmcrypt.dll in my > system32. Now it loads but when I try to use mcrypt I > get > > Warning: mcrypt_encrypt(): Module initialization > failed in > E:\IIS\wwwroot\savehiphop\admin\access\encrypt.php on > line 6 > > I don't think it's the code, it's pretty simple. > $key = "longencrytionkey"; > $text = "danny"; > echo($text . ""); > > $newtext = mcrypt_encrypt("MCRYPT_BLOWFISH",$key, > $text, "ecb"); > echo($newtext); > > > How do I get mycryt extension to work properly on > windows? > > > __ > Do you Yahoo!? > Yahoo! Tax Center - forms, calculators, tips, more > http://taxes.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Does PHP supports threads?
Actually, there's a threads extension in PECL: http://cvs.php.net/cvs.php/pear/PECL/threads J Justin Garrett wrote: > PHP does not support threading. Depending on what you're trying to do you > may find the process control functions useful > http://www.php.net/manual/en/ref.pcntl.php > > Justin Garrett > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Help with Extending PHP
This might help: http://www.tutorbuddy.com/software/phpcpp/phpcpp/ J Michel M. Dos Santos wrote: > > > Hi, > > I have a doubt about extending functions in PHP. I want to use C++ > language rather than C pure. I saw that dotnet module has cpp file. Is it > possible ? > > Thanks a lot, > > Michel M. dos Santos -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Search/Regular Expression problem
If you're splitting them up with preg_split(), you can combine them with implode(). Something like $foo = ".*" . implode(".*", $words); Or don't use an array at all. Just replace anything that's not a valid search character... $regex = preg_replace("/[^A-Za-z]/", ".*", $search); J Kelvin Poon wrote: > Hi, > > I am sorry if this problem is too easy but I just can't figure out a way > to do this. > > I am making a search engine and I would have the user to type a sentence > to search for. > > Let's say it is stored in $search. > > My search enginue will bring up a result IF and only if ALL of the words > in > $search exist in the result. For example > if > > $search = Vax Useful Commands > > Then the result is only true if (eregi(".*Vax.*Useful.*Commands.*", > 'possible result')) is true > > Now, I don't know how many words there are in $search initially. How do I > do a search like that? I mean if I know $search is 3 words then I can do > > $words = preg_split("/ /", $search); > > if (eregi(".*words[0].*words[1].*words[2].*", 'possible result')) { > . > } > > > Even if I know how many words there are, everytime the number of words in > $search can be different. > > Can anybody give me any ideas? > Thanks a lot > > Kelvin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mcrypt
If all you need is some generic encryption that doesn't require mcrypt, you might want to take a look at a crypto extension I wrote called cryptopp-php. It does everything that the mcrypt extension does and might be a touch easier to use as far as syntax and such goes. (Plus, it works on Windows if you're into that sort of thing.) It's fairly stable at the moment, and doesn't have the memory allocation problems. See http://www.tutorbuddy.com/software/, and http://www.tutorbuddy.com/software/cryptopp/ for the manual. (I hate the shameless plugging, but the more people who use my extension the easier it is for me to debug...) J Purushotham Komaravolu wrote: > Hi, > Thanks for the prompt answer. But I am still getting the same error. > > / > original: meet at secret place > encrypted: d40d72f1b224b9bf86a7dbc52402c1d02a5cf90adb9050f0 > > Warning: mcrypt_generic_init: Memory allocation error in > /mount/marsellus/gwolfe/puruclient/staging/vhosts/partnersdev.sec.yaga.com/h > tml/time/cancelsubscription/new.php on line 29 > > Warning: mdecrypt_generic(): 2 is not a valid MCrypt resource in > /mount/marsellus/gwolfe/puruclient/staging/vhosts/partnersdev.sec.yaga.com/h > tml/time/cancelsubscription/new.php on line 30 > > Warning: mcrypt_generic_end(): 2 is not a valid MCrypt resource in > /mount/marsellus/gwolfe/puruclient/staging/vhosts/partnersdev.sec.yaga.com/h > tml/time/cancelsubscription/new.php on line 31 > decrypted: > > > /// > > > Regards, > > Purushotham Komaravolu > Software Engineer > Yaga, Inc. - "advanced payment services" > Direct: 415-901-7343 > Fax: 415-901-1586 > http://www.yaga.com > > > > - Original Message - > From: "Tech Support" <[EMAIL PROTECTED]> > To: "Purushotham Komaravolu" <[EMAIL PROTECTED]> > Sent: Tuesday, July 30, 2002 11:34 AM > Subject: Re: [PHP] mcrypt > > >> Rather than tease you with hints I'll give you some working code ;-) >> >> Documentation for practical usage of mcrypt is weak. I agree. >> >> > // crypto.inc >> $key = "secret key crap"; >> >> function hex2bin($data) >> { >> $len = strlen($data); >> return pack("H" . $len, $data); >> } >> >> function encrypt($string, $key) >> { >> // version 2.4.x of lib mcrypt >> $td = mcrypt_module_open (MCRYPT_TripleDES, "", MCRYPT_MODE_ECB, >> ""); $iv = mcrypt_create_iv (mcrypt_enc_get_iv_size ($td), >> MCRYPT_RAND); mcrypt_generic_init ($td, $key, $iv); >> $crypted = mcrypt_generic ($td, $string); >> mcrypt_generic_end ($td); >> return bin2hex($crypted); >> } >> >> function decrypt($string, $key) >> { >> //version 2.4.x of lib mcrypt >> $string = hex2bin($string); >> $td = mcrypt_module_open (MCRYPT_TripleDES, "", MCRYPT_MODE_ECB, >> ""); $iv = mcrypt_create_iv (mcrypt_enc_get_iv_size ($td), >> MCRYPT_RAND); mcrypt_generic_init ($td, $key, $iv); >> $decrypted = mdecrypt_generic ($td, $string); >> mcrypt_generic_end ($td); >> return trim($decrypted); >> } >> ?> >> >> >> usage: >> > include ("path/to/crypto.inc"); >> $secret = "meet at secret place"; >> $encrypted = encrypt($secret, $key); >> print "original: " . $secret . ""; >> print "encrypted: " . $encrypted . ""; >> $decrypted = decrypt($encrypted, $key); >> print "decrypted: " . $decrypted . ""; >> ?> >> >> Note: if you are encrypting really secret crap like credit card numbers >> or something of that nature then NEVER include the key anywhere in your >> code. Make a form where you have to type it in or something in order to >> display the results. >> >> >> Jim Grill >> Support >> Web-1 Hosting >> http://www.web-1hosting.net >> - Original Message - >> From: "Purushotham Komaravolu" <[EMAIL PROTECTED]> >> To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> >> Sent: Tuesday, July 30, 2002 12:52 PM >> Subject: [PHP] mcrypt >> >> >> Hello, >> I am getting some odd errors trying to get an encrypt/decrypt >> process to >> work. Looking at the manual examples and some other literature, I > have >> tried >> the two approaches listed below. For each, I get a sometimes-works, >> sometimes fails result. The manual entry has a string of user notes >> with >> problem like mine, but I still have problems. >> >> >> >> Server API Apache >> >> >> >> mcrypt >> mcrypt support enabled >> version 2.4.x >> Supported ciphers twofish rijndael-128 rijndael-192 > rijndael-256 >> saferplus rc2 xtea serpent safer-sk64 safer-sk128 cast-256 loki97 > gost >> threeway cast-128 des tripledes enigma arcfour panama wake >> Supported modes ofb cfb nofb cbc ecb stream >> >> >> --] >> >> >> >> The first attempt used the following code: >> >> >> --> >> > $key = "this is a secret key"; >> $input = "Let us meet at 9 o'clock at the secret place."; >> >>
[PHP] Re: ADVANCED PHP (SOCKETS)
Although pcntl and fork() were mentioned, you might want to look at socket_select() as an alternative. Using socket_select(), you can set up a multiplexer to handle multiple sockets at the same time. (Or roughly the same time...) J Gustavo Almeida wrote: > > > I would like to know, what I have to do to make my application handle > multiple connections? > > My current application only handle one user per time. > > Sorry about my English, but i live in Brazil, if anybody could help me > answer me [EMAIL PROTECTED] . > > Thanky you -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: good read on regular expressions
"Mastering Regular Expressions", by Jeffery E.F. Friedl, published by O'Reilly. It's the regex bible, and although doesn't do much in the way of PHP specifically, the idea is the same. (And the Perl examples can be used without too much modification with PHP's preg_*() functions.) J [EMAIL PROTECTED] wrote: > What is a good read on general expressions that a php programmer should > check out? > > I am trying to familiarize myself with them so that I can pars the silly > ms word html pages. > > - Vic > > > > __ > Post your ad for free now! http://personals.yahoo.ca -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: assoc array question
Perhaps something like... $i = 1; while (list($key, $val) = each($info)) { if ($i == 1 || $i == count($info)) doThis; else doThat; ++$i; } ? J Alexander Ross wrote: > I have this: (note that $info is an Assoc Array > > while (list ($key, $val) = each ($info)) > { >do stuff > } > > I would like to do slightly different stuff if I'm at the very first, or > very last item in the array. How do I do this. Below is the pseudo code > which would be ideal: > > while (list ($key, $val) = each ($info)) > { > if(onFirstKey or onLastKey) > do fun stuff >else > do other stuff > } > > Please help. Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Experiences with Zend Safe Guard?
The suits at work are looking at the Zend Safe Guard and I'm just wondering if anybody had any experience with this new tool. Is it worth the purchase, and has it been worth the price? We already have a Zend Encoder license, so we're getting a bit of price break for the Safe Guard, but it's still (like most Zend products, it seems) a bit pricey. I know to most big mammoth shops the price isn't a bit concern, but I like to stay thrifty, so if I start hearing horror stories I'll look into something else. On the whole, I like the idea, and I've been looking forward to it's release ever since I found out about the tool. (About a year ago plus change.) Anyways, experiences? Good? Bad? Worth it? Thanks. J -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Protecting files in PHP
[EMAIL PROTECTED] wrote: > > Hello, > > I have some files off of the web root which I'd like to be able to serve > up to users (*.doc, *.xls). I know I can do this with header(), but how do > I reference a file that's outside of the webroot? Thanks! Try using filesystem links or the PHP function readfile(). J -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP crypto extension news
Since I just finished a pretty major source overhaul of the cryptopp-php extension, I figured I should make a little announcement, as this is oh-so-exciting news. Recently, Wei Dai released Crypto++ 5.0, which was pretty much a complete re-write of the public domain Crypto++ cryptography suite. In turn, I updated the cryptopp-php extension, hopefully for the better. The changes to this version, 0.0.9, are numerous, but the highlights are... - new padding schemes on block ciphers. In previous versions of cryptopp-php, you didn't get to choose your padding scheme -- you were stuck with whatever the default was for the block cipher mode. Now you can pick from PKCS#5, zeroes, one and zeroes or no padding at all. New functions to control this new ability were added: cryptopp_set_padding(), cryptopp_get_padding() and cryptopp_get_padding_name(). - keyed hash message authentication code algorithms were added. Basically, a HMAC is just a hash that uses a secret key. New HMAC algorithms include MD5-HMAC, RIPEMD-160-HMAC, etc. New functions to set HMAC keys were thusly added: cryptopp_set_hmac_key(), *get_hmac_key(), *set_hmac_key_length() and *get_hmac_key_length(). - a modified ARC4 algorithm was added. - the MD4 hash algorithm was added, although it should only be used when you really, really need it, such as for compatbility with other programs, as it is known to be cryptographically weak. - changes in the Crypto++ library itself have forced me to remove the Sapphire stream cipher and hash algorithms, but since I doubt they were used much, that shouldn't be much of a problem. - everything is for the most part backwardly and forwardly compatible with previous versions of cryptopp-php, with exceptions being noted in the manual. The only real differences you need to worry about are the block cipher padding schemes you're using and the SKIPJACK changes and SAFER-* changes. As always, cryptopp-php works on most UNIX-like systems as well as Microsoft Windows systems, and has been tested with Linux (kernel 2.4.18 and 2.4.9), Solaris 8 (SPARC) and Windows 2000 Professional. Source code and Windows DLLs are available under a BSD-like license at http://www.tutorbuddy.com/software/ This version should be considered somewhat unstable, so if you're worried about that, use version 0.0.8. There are a few known bugs in Crypto++ 5.0 that have been fixed in CVS -- they shouldn't affect cryptopp-php in any way, but there may be bugs in my code that haven't been weeded out yet, as this version hasn't been tested and is a near-total re-write from 0.0.8. Any bugs reports or comments would be appreciated. J -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: php IDE for linux
Quanta is for KDE, too, not GTK. J Henrik Hansen wrote: > [EMAIL PROTECTED] (Pedro Jorge Dias Cardoso) wrote: > > > please tell me a good PHP editor for linux, wich one you prefer. > > or a package for PHP in Xemacs. > > I saw recently that phpedit comes out on linux now thats a good > editor (it costs). Else try Kate for KDE and Quanta for GTK. > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: An idea for a PHP tool
If anybody out there is using Konqueror, try setting up an item in the Enhanced Browsing dialog with a shortcut like "php" and the search URI set to "http://www.php.net/manual-lookup.php?pattern=\1";. Now you can go to the location textbox and enter something like "php:fsockopen" to bring up the manual page for fsockopen(). J Mike Eheler wrote: > Like google has it's toolbar, why not have a PHP Manual toolbar? That > would be *great*. Just type in the function name and hit "go" and the > manual comes up. > > One for Moz & one for IE I'm sure would be appreciated. > > I'd do it myself, but I have not the ability to code in C (or C++ for > that matter), nor the time. So I donate this idea to the PHP community > in hopes that someone out there has the knowledge and the ambition to > make it happen. > > Mike -- 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] Re: PHP and security (like fopen)
It sounds like you're on a UNIX-like system. Ever hear of user/group file permissions? Just set the proper permissions on your directories and files and you're fine. There are many ways to do this sort of thing, so I won't get into it, but it would be much easier to focus on permissions than hacking the PHP source code for something so simple. Hint: A good place to start would be to look at the user that Apache runs as (or whatever web server you're using). J Yves Reveillon wrote: > Hello, > > this is my security problem with PHP > have a free web hosting server and i permit users to use PHP and some > functions like fopen ! > The problem is that i would like to denied fopen to works with my own web > file of my website > users: /home/user/www/ > Me: /var/www/html/ > > One solution consist to forbidden the user of fopen (i dont want this for > their file ...) > 2nd: all extension for my own php scripts are for exemple phx > Can i accept the commande fopen with file php but forbid > fopen("any_file.phx") ??? > 3: Or, can i accept some function ONLY if they are execute from my own > subnet ? > The final alternative will be to modify directly the code source of php > and recompile but any help will be welcoming ! > > Thanks ! -- 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] Re: Running php in background?
For this sort of thing, it may be easier to run the job from a shell. Try compiling php as the CGI/CLI executable. Then you can run your scripts like, say, a Perl script or whatever. Just add the ampersand at the end of the command to run it in the background. (I'm assuming a UNIX-like system with some sort of sh/bash-like shell.) Also remember to set the timeout to 0 at the beginning of the script using set_time_limit(0); You might also want to surpress output to stdout for background jobs, which is generally preferable for UNIX background processes. If you still want to do it via the browser, just use set_time_limit(0). Even if you hit stop or the connection is broken, I think the script will still execute, unless you've registered a shutdown function, but I'm not 100% positive on that one. J James Hudnall wrote: > I wrote a php program that has to do a lot of processing on a couple large > mySQL tables that can take hours, so often the page will time out or kick > back a cannot find server errir. But it seems by checking the DB that > records are still being updated. IS it possible the job runs in background > even though it fails to delive the final results in the browser? I don't > need the final results, it just says when the job is completed. > > Ideally, I would like to run the job in the background anyway. Can that be > done? -- 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] me and my CRON JOB
Quick tip -- locate and whereis are your friends in the shell. They make finding executables like php are a snap. As for emailing from php/cron, it depends on how your system is set up. Many email servers bounce any emails they receive from IPs that they can't reverse map or otherwise identify. If your machine is on a LAN for instance, the emails will probably get bounced. Another thing to check is that your user account can actually use your system's SMTP service. Email sent with php's mail() function are usually sent by the owner of the script (or the web server's user). J Mehmet Kamil Erisen wrote: > hi, > thanks for the tip. I was wondering about it too > I do not have access to everywhere on the server. > I tried /usr/bin/php and it worked.. :) > > I tested the following script for connection to database, > executing my functions etc... > everything seems to work but mail. > any ideas? > > Thanks for the help. > erisen > > btw: at last, I added the die to my mail command, and fair > enough, I got the Can not send this as output. > > So, now the question is, how can I send mail with php / > cron config. > > please note that the script worked fine on the browser. > thx. > > code: > #!/usr/bin/php -q > > > > include ("application.php"); > > $subject="Cron Job has run"; > $body="test.php is running now"; > $sendtome = "[EMAIL PROTECTED]"; > mail("[EMAIL PROTECTED]", $subject, $body,$sendtome) > or die ('Can not send this'); > echo $sendtome; > echo "hello world"; > > echo turk_now() ; > > $array = get_user_stat($CONF) ; > while (list($key,$value)=each($array)) { > echo "$key $value"; > } > > > ?> > > -- 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] Re: Using a HTML button
PHP is a server-side language (i.e. Perl when used with mod_perl), not a client-side language (i.e. JavaScript). All of the processing is done on the server BEFORE it is sent to the user. Therefore, you can't call a PHP function directly from a web page after the user has received it, since all of the processing has already been done. J Morten Nielsen wrote: > Hi, > > I am rather new to PHP so I hope somebody can help me. > > I have a normal button (HTML code). Then I have made a function > > function multiply($X) > { > return 2*$X; > } > > The button has an OnClick, which calls my function. > > > > I then writes $X to the screen. > > > > The problem is I dont even have to press the button. When the page loads > it already has calculated 2*$X. Why is that. I would like to only call my > function when I press my button. > > Please help > Morten -- 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] Search Engine
PHP isn't totally bad for a search engine. Here's my story. I was in a bit of a predicament when I first started work, because I had to develop a search engine for online video objects. My company is essentially a video re-purposing venture, where we take reams of analog, tape-based videos, encode them into something like MPEG or ASF or whatever, create clip indexes (i.e. a 30 minute clip is broken up into 10x 3-minute clips, with each clip described and categorized) and provide a search engine and interface to watch clips or videos on the web via a broadband connection. (An added bonus is that you can create your own "video" via personal playlists -- you can take 10 different clips from 10 different videos and run them together into one playlist, all online. In a few months, you'll be able to create your own clips if you don't like our predefined ones.) Anyways, the search engine thing was my deal. I'm the only programmer (*period*) on our team, and I basically had to write a search engine, web site backend, admin interface and all that jazz for our app alone. I was hired March 6, 2001 or so, and I had until, oh, April 15, 2001 to do it. Plus there were a few conditions -- like, it should be portable and inexpensive. PHP seemed like a good choice -- it was portable (Win32, *ix, whatever), it was cheap ($0) and it isn't too bad for rapid development. So off I was. I did manage to finish the search engine and back end by April 15, but it was a mess. It wasn't exactly a stellar search engine, but more of a proof of concept, which was the whole point of the project -- to show that we could provide high quality streaming video through a browser with a relatively good interface. After the proof-of-concept project, we started to get serious, and I dropped most of the code base and started again from scratch. Pretty much the entire search engine now is in PHP, with the sole exceptions being the keyword indexer (Perl, as PHP was a lot slower doing the indexing) and a few extensions to the PHP engine. The search engine itself is fairly fast -- it can do a keyword search on a collection of nearly 8,000 video objects in an average of 0.02 to 0.20 seconds or so, depending on the complexity of the query. It's features include: * "Boolean"-type searches. Okay, not really, as in you can't use AND, OR and NOT, but you can use +/- style prefixes like in mnoGoSearch and whatnot. Words are automatically OR'ed, +'d words are AND'ed and -'d words are NOT'ed. * Decent search times. On a PIII 500 with 128 MB of RAM, it still averages less than 0.20 seconds for a collection of 8,000 video objects and over 100,000 keywords. * Filtering. We're mostly an education-based site, so you can filter by things like subject (Physics, Chemistry, etc.) and grades (Kindergarden, grade 10, college, etc.) * Spellchecking and somewhat fuzzy searches. Spellchecks work okay, but the fuzzy searches is kind of lame. (Porter stemming.) I might shoehorn in something like Metaphone-type stuff eventually. * Search ranking. Yes, keywords are given weights, everything is ranked and all that jazz. You know, inverse document frequencies, collection distribution, all that stuff. In the end, video objects returned in a search are given a ranking of 1 to 4 based on how well they match your query. It's not terribly advanced, and could use some tuning, but it's surprising how well it works. * XML-based. The search engine itself runs as it's own daemon on either it's own server or along side the web site, and just waits for connections via a UNIX domain socket or a TCP socket. When it receives a query, and sends back an XML document containing the search results. This is especially nice -- you can use it with anything for any purpose, not just a web site, i.e. you can build an native app for Windows and you can still use the search engine, and just format the results via an XSL or whatever. There are a lot of other nifty features, like being able to do remote admin via telnet or whatever. But in the end, it's still just a decent search engine and definitely not Google or even htdig. It's very focused on our specific task, the searching of online educational videos, so something using something like htdig would have required a lot of hacking to get it to where we wanted it. So the morale I guess is, sure, you can make a half-decent search engine out of PHP. Ours gets the job done. But remember, I only had, like, a scant few months to write one, plus a web-based app to go around it, and I was alone on this one. PHP was great for RAD, and the damn thing even works to boot. My search engine could handle a web site easily enough, maybe even a group of sites, but it would totally suck ass as a WWW indexer/spider-type search engine. So there ya go. J Greg Schnippel wrote: > >> * On 15-01-02 at 12:09 >> * Yogesh Mahadnac said >> >>> Hi all! I want to develop a search engine in
[PHP] Re: Redirect?
If this isn't in the PHP FAQ (I couldn't find it), it definitely should be, because somebody asks this question at the very least once a week on this list. J Henrik Johansson wrote: > Hi! > How do I do a redirect to a different location in PHP? > > Regards > Henrik Johansson -- 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] encrypting passwords etc..
We have a similar set up at our work, but we still encrypt our users' passwords. That way not even the dba knows what passwords other people use, although the s/he can still change the password for any user on our site. A lot of people use the same password for everything they do, and it would be possible for the dba to get ahold of all of those passwords and usernames from the database if they were in clear text, which could be bad. Of course, I'm the dba, and I wouldn't do that sort of thing, but I've encrypted the passwords anyway with a one-way md5 hash. At least the users can feel a bit more secure that their passwords are safe from prying eyes, even from the dba. Makes it a bit of a hasstle when somebody asks for their forgotten password -- I can't exactly decrypt the 128-bit hash any time soon, can I? I can set their passwords to something else, of course, but sometimes they just want their old password J Anas Mughal wrote: > We had a client who wanted us to encrypt their > passwords. Our argument was that maybe their database > is not well protected. Only the dba and the > application should have access to the database. > No-one else should be able to view their data anyways. > We didn't see any need to encrypt the passwords. > > Any thoughts... > > -- 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] Re: printing an XML node
You might want to check out php's XML extensions... http://www.php.net/manual/en/ref.xml.php J Thomas Gagne wrote: > dumpmem works great for entire documents, but what is the strategy for > printing the contents of a single node? It is impossible to use dumpmem > on a node since the code looks for a 'doc' property that doesn't exist in > nodes. > > -- > .tom -- 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] Re: create xml document with PHP
The only real difference between HTML and XML (besides the obvious standards and formats and such) is the MIME type, I believe. HTML has a "text/html" MIME type, while XML can have a whole bunch, depending on what the XML is supposed to do. (I.e. text/xml, application/xml, application/xml-dtd, etc.) Try outputing the XML using "text/xml" as the MIME type by using header("Content-type: text/xml"); at the beginning of your script. (Or at least as the first bit of output -- nothing should come before the headers. J Rodrigo Peres wrote: > Hi list, > > I'm new to the xml world, and I need to create a page with data retrieved > from my database using PHP. The process is the same of create an html > page?? I mean I can use echo to output the xml tags and values?? Since > this page will be dinamically generated what kind of headers I need to use > to this page become an xml??? > I saw many docs in web but all about parse an xml, but not in how to build > one. -- 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] Re: Ereg/replace/i/ or something ??
Try ereg("^[0-9]{10}$", $cust_tel); Quick explanation (I get the feeling you're new at regexes): ^ - beginning of string [0-9] - any number between 0 and 9 inclusive {10} - exactly ten times $ - end of string There ya go. J B. Verbeek wrote: > Hello, > > I want to check the data from a form-field if it excists only of digits > (0-9) and nothing else. > > How do I use the ereg()-function for this? > > >> ereg("[0-9]",$cust_tel, $cust_tel); << > > It is also to turn it around but then the pattern will get larger because > it has to contain: > / "'.,-)(*&^%# a-z A-Z and so on... > > The field has to be 10 digits long and has to contain only digits!!! > > > Can anyone help me? > > Regards, > > Bart -- 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] Re: Installing PHP 4.1.1 on Redhat w/ RPMs
Personally, I'd recommend compiling from source it is at all possible. You'll likely get improved performance, and it's nice to know you can set things up exactly as you see fit. Another thing you could try if that seems daunting or you need to install the RPMs onto several machines that all have the same set up (serverS, right?) would be to grab a source RPM and rebuild it on one machine. Basically, a command like this should work: # rpm --rebuild php-x.x.x.src.rpm The RPM should unbundle, configure, and compile, install itself, then place a fresh RPM in /src/redhat/RPMS/something (depending on your architecture). The new RPM will install on any system that has the same setup and libraries as the one you just performed the rebuild on. In some cases, there may be times when you'll need to edit a file or two in the RPM to get it to compile. There should be howtos on this at redhat.com. J Darren Gamble wrote: > Good day, > > This isn't strictly a PHP question, but, I am hoping someone on this list > has gone through this already and can provide some assistance. > > I'd like to upgrade to PHP 4.1.1 on our Redhat 7.2 servers, and so I've > downloaded all of the PHP RPMs from Rawhide. I would really, really like > to do this with RPMs if at all possible. > > When I go to install, I find out that: > > > error: failed dependencies: > libcrypto.so.3 is needed by php-4.1.1-1 > > > OK, no problem so far. I just need to get the new openssl packages. > > But, after downloading them and adding them to the install list, I then > find that libcrypto.so.2 (which would be replaced by libcrypto.so.3) is > needed by > dozens of packages on the system. I really can't upgrade them all. > > I am just going from openssl-0.9.6b-8 to openssl-0.9.6c-2 . It appears to > me that openssl must have changed the API for their library between an > extremely minor version number (is that even supposed to happen?), which > is what I think is causing me the problem. > > I'm not quite sure how to proceed. Has anyone else on the list done this > yet? > > Thanks to all who reply, > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Multi Threading in PHP
Technically that would be multiplexing and not really multithreading, but it's a good idea. (One I had a few months ago -- I wrote a search engine for work in PHP that works prety much exactly as you both describe.) The sockets extension for PHP will allow such functionality using socket_select(). J John Lim wrote: > Hi Bart > > This can be simulated using non-blocking sockets. However this is one time > when using > Perl or Python might be a better solution (sigh). > > Bart Frackiewicz <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hi, > > a few days ago i saw here a thread about multi threading, but this didn´t > answer my question. > > I have a page, that must search the best price in multiple databases/plain > text files and perhaps one day xml-interfaces, some of them can be located > on extern hosts, every search can be a single function/object method. > > In my dreams i call this in multi thread (with a timeout functionality) to > handle lost connections or anything else that would cause endless queries, > and return after this to print out the results. Is this possible with any > function today? Or will this be possible in future? > > Best Regards, > > Bart Frackiewicz -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Writing PHP files from inside a PHP file
include() and require() were suggested, but you may also want to look into eval(), which parses a string as PHP code and returns the parsed PHP. Sounds like what you're looking for. (I.e. storing PHP code in a database, right?) J Georgie Casey wrote: > I want to extract information from a database table and create a > half-static, half-dynamic PHP page from the info. I want to store the > template for the new page in an external file with tags in the places > where I want variables to be printed. What;s the best of achieving this?? > > I tried "fread" but that just printed "" to the > static page instead of replacing it with the value. > > Any suggestions? > -- > Regards, > Georgie Casey > [EMAIL PROTECTED] > > *** > http://www.filmfind.tv > Ireland's Online Film Production Directory > *** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Work in New York
I must be lucky or something, 'cause the place that hired me basically said, "we're developing this, you're coding it, get it done." I was actually told that we'd be going with PostgreSQL and not MS SQL or Oracle or whatever, which was cool to begin with, but the rest of the details (web server platform, etc.) were left up to me. So I kind of went with PHP right off the bat because I needed something that lent itself to quick coding. I had never really developed much in PHP before hand, but now we've got enough lines of PHP code to choke a camel. Last week I looked at some VBScript/ASP code that I kind of need to port to PHP. I was mortified. J Erik Price wrote: > > I suppose that's a matter of opinion. One thing's for sure: where I > work, ASP is the "official" scripting language. If my boss really knew > the difference, I'd have to use ASP instead. I get around it by not > bringing the subject up and by keeping my head down. > > I was talking with John "Maddog" Hall last week and he shared another > story of some guys he knew (back in the mid-90s) who had the same > situation as me -- they basically were told to set up a server. No > other instructions. So they set up a Linux box, recognizing its virtues > and technical prowess. When Maddog asked them what their boss thought > about that, they sheepishly replied that he didn't know -- they figured > they'd wait a YEAR before telling him so that they'd have a good point > if it came down to an argument. > > Much as I'd love to evangelize my open source philosophy and the merits > of my Linux/MySQL/PHP installation, it's going to have to wait until I'm > done with this project. > > Erik > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP & GD - Nevermind! Thanks!
For a site I work for, I've found two decent uses: 0. Our logo is dynamically created on demand. The logo features a random "DNA-blot" distibution and a random wave-like pattern, some like what you'd see in a graphic equalizer on a stereo display. Each time our logo is viewed, it's slightly different, even though they all look more or less the same. (The pattern of blots and the wave nodes is slightly different, but the lettering and such is the same.) 1. We can create graphs and such for our site logs on demand, i.e. we track usage stats for users and can display a ton of statistics through a handful of PHP scripts on a per-demand basis. There's a lot of stuff you can do with the GD extension. Check out some of the slide shows on http://conf.php.net, like Rasmus' Spinal Injection or whatever the hell it's called. Has a few good examples in it. J Spyproductions Support Team wrote: > > Thank you to anyone looking into my question, but it is moot; seems the > two > scripts I was given initially are just buggy. I found one that isn't, and > it works fine. > > Anyone have any idea what would be a practical application of GD nowadays? > Doesn't seem to be practical to me. > > -Mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Is this possible?
It's possible, but it might be easier to set up virtual hosts or something. If you're using apache, you can set this up in httpd.conf, using something like NameVirtualHost * ServerName www.domain1.com Redirect permenent / http://www.domain.com/domain1 ServerName www.domain2.com Redirect permenent / http://www.domain.com/domain2 Or you can use mod_rewrite and set up rules to act similarly. Of course, if you're not using Apache, go with the PHP solution someone else provided. Might be a bit easier to use the virtual hosts, though, 'cause then you don't have to worry about a bunch of PHP code and just let the web server itself handle everything. J Leif K-Brooks wrote: > I would like to have multiple domains and have them forwarded to different > folders, so I'd only need one hosting account. Example: > www.domain1.com goes to www.domain.com/domain1 > www.domain2.com goes to www.domain.com/domain2 > I would like to do this in php. Of course, to do this, I'd need to get > the > url the user is requesting into the script. If this possible? > Thanks in advance, Leif K-Brooks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: center text on image
If you're using GD2, try looking at ImageTTFBox() and ImageFTBox(). They'll give you the coordinates for a bounding box around the text. Use them in relation to the image to center it properly. J Adrian Murphy wrote: > I was wondering if it's possible to centre text precisely on > an image.I'm thinking I need to get the width of of > the string in pixels?,take this away from imagesx(image) and > devide by 2 to get x value. > so has anyone achieved this? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] good practice
Using "global" in the global scope (i.e. "global $Config;") does nothing. If something is declared in the global scope of a file and then included into another file, it's still global. You don't need to actually say "global $whatever" unless you're in a function. Also, if you're including a file named "CONFIG.inc" from the same directory as the script itself, please, please tell me you have your web server set up not to serve CONFIG.inc to the outside world. (i.e. you have a .htaccess file or something to send DENY to a request for CONFIG.inc or something.) Otherwise somebody could just grab http://example.com/CONFIG.inc and see it's contents without restriction. J Peter J. Schoenster wrote: > Yeah, seems hokey doesn't it :) ... I think about the same thing in > the code I use with PHP but I think it's the nature of the beast. But > a "Best Practices" sounds like a great idea that has passed me by > or I forgot if I've seen it. > > I've been doing PHP for about a month now and here's how what I'm > doing: > > > > include_once ( "./CONFIG.inc"); // Config file > global $Config; > > $question_search_snippet = > $Config["Snippets"]->Get("question_search_snippet"); $AskUs = > $Config["Snippets"]->Get("AskUs"); $Slow_question_search_snippet = > $Config["Snippets"]->Get("Slow_question_search_snippet"); > > $body = << Data Here > > > HTML; > > > $Config["PageBuilder"]->Build($PHP_SELF,$body); > > > ?> > > Most pages are either like "modules/cgi-script" or a just a page like > this one. > > I really hate globals so I cheat and make an array global :). > > > My CONFIG.inc makes connections to all "classes" , sets paths > etc. > > Here is how I handle my input date (not my confusion with & for > references): > > $input= &ProcessFormData($GLOBALS); > > function &ProcessFormData(&$GLOBAL_INPUT) { > $FormVariables = array(); > $input = $GLOBAL_INPUT[HTTP_GET_VARS] ? > $GLOBAL_INPUT[HTTP_GET_VARS] : > $GLOBAL_INPUT[HTTP_POST_VARS]; > foreach($input as $Key=>$Value) { > if(is_array($Value)) { > foreach($Value as $SubKey=>$SubValue) { > $FormVariables[$Key.$SubKey] = $SubValue; > } >}else { >$FormVariables[$Key] = $Value; >} > } # End of foreach($input as $Key=>$Value) > return $FormVariables; > > } # End of function DisplayArrayVariables > > > Peter > http://www.readbrazil.com/ > Answering Your Questions About Brazil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] good practice
Or put them outside of the web server's document hierarchy. I'd feel safer with that than naming them with a .php extension. If they can still be executed by PHP using a GET request, then something could still be output to a user's browser. (Likely unintentionally, of course, but still...) Plus, if they're large enough include files that include a whack of other files, then why bother wasting CPU cycles on something that doesn't need to be processed in the first place? Just send back a DENY and get it over with. Personally, I stick 'em in an include directory and set up a .htaccess with something like Order allow,deny Deny from all I like having everything like that in the web server's directory if possible. Makes distributing stuff easier when you don't have to tell users, "Now copy all .inc files to /some/path and set PHP's include_path to /some/path, and make sure the server can read that directory..." J Michael Kimsal wrote: > > > On that same topic, *why* do people name files with both .inc and .php? > Your .inc file has PHP code in it, right? Why not just call it .php and > spare the server reconfiguration. If knowing which files are "include" > files (long time since I've made that distinction!) just prepend > them with inc_ or put them all in an includes/ directory. > > You hit a raw nerve there J Smith. :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: center text on image
Not off-hand, but if you know the general size of the font and how many pixels y, j, etc. extend below the baseline, you could just offset the text a bit to compensate. J Adrian Murphy wrote: > cool, only i can't get it exactly centred in the y position > cos the numbers are baseline relatedi.e the letter 'y' goes under the > line. any ideas? > - Original Message - > From: "J Smith" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Thursday, February 14, 2002 6:48 PM > Subject: [PHP] Re: center text on image > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] good practice
It does to a certain extent. If you're writing code that you're expecting others to see and use, you should try to be consistent and follow convention. If you write up a large project in C++ and suddenly start naming header files with a ".doc" extension, somebody's going to get confused. Of course, if nobody's using your code but yourself, then whatever. But for the purposes of consistency, portability and common sense, following a common coding standard is a good thing. J Philip J. Newman wrote: > WHo really cares, if it works it don't matter what they call it. > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] good practice
The only real security problem is that if the file isn't parsed and it's in the web server's document path, somebody can just go to http://www.example.com/include/config.inc and see the entire contents in plaintext -- passwords and config options galore. However, sticking those .inc files outside of the web server's document path or otherwise cutting off access to those files makes things a lot safer. When I met Rasmus at a seminar a few months ago, he mentioned that he kind of started the whole ".inc" thing with included files, but he was astonished how so many people followed his convention without realizing that somebody could look into the .inc file so easily. When he was going it, he always explicitly denied access to those files through a directive in Apache's httpd.conf file, which nobody else bothered to do. So if you want people to view those files and all of the code in them, go nuts. Otherwise, you'd better somehow cut off access to them. (Personally, I use an include directory and use a .htaccess file to limit access.) J Erik Price wrote: > > On Friday, February 15, 2002, at 10:50 AM, Michael Kimsal wrote: > > Maybe I don't understand the security implications of .inc -- I thought > that it was perfectly safe. Since my php.ini is not configured to parse > files with '.inc' extensions, I thought that I was better off using a > separate extension than '.php': so that the code cannot be "executed out > of context". I got this idea from a post by Rasmus Lerdorf on this very > list, only a month ago. > > Erik > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP and HTTPS
Sourceforge has a bit on this, too. Basically, they have a checkbox that lets you drop out of SSL after you login, so your username and password aren't sent over the wire in plaintext. However, after that, everything is plaintext, no SSL at all. Useful if you want to keep your password safe during transmission, but it sucks that everything can't be encrypted. I haven't had any problems yet myself, but I've included that option in the stuff I work on just in case. I'm using apache 1.3.22, PHP 4.1.1 and mod_ssl 1.3.22. Seems to work so far, at least. (Although getting Konqueror to work it under KDE 2.2.2 is another story...) J Michael Kimsal wrote: > Wm wrote: > > > We've worked with this several times - it's an issue with IE under > Windows. The claim is that it only affect 'high security' (SGP or > something) but my own experience is that it's always affected. IE > just won't work right with SSL if the web server isn't IIS. You pretty > much have no choice but to live with it or move to IIS as a server > platform. > > > Michael Kimsal > http://www.tapinternet.com/php > 734-480-9961 > aim:mgkimsal -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: got the code
Could you please leave the subject alone when you're following up on a thread. It's hard to follow what you're talking about when we can't see the references to the other parts of the thread. As for your problem, try removing the semi-colon after the "if ($inst == '2')" statement. It's a simple logic error. J John Gurley wrote: > > here is a larger chunk of the code: > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Timed Redirect
As far as I know, you can't do this directly through a header. Try using a meta tag, i.e. http://www.example.com/";>, where x is the delay in seconds. J Steven Walker wrote: > Is there way to have a page automatically redirect the user to another > page, but with a timed delay? > > I'm working on a purchasing system. After a successful purchase, a thank > you page is shown, and then I want to take the user to a download page a > few seconds afterward. > > Thanks! > > Steven J. Walker > Walker Effects > www.walkereffects.com > [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Crashing a webserver
I'd start out by using ab, the apache benchmarker. Look for $APACHE_PATH/bin/ab. You can start hammering away at the site by setting the number of connections to try, conncurrent connections, etc. in ab, which will spit out a bunch of interesting stats, like the number or errors produced, pages served per second, etc. J Ruben Vermeersch wrote: > I have got the task to down our webserver, to see how stable she is, and > how easy/hard it is to get it on it's knees ;) > > Does anyone have some ideas how to do it? > > phpinfo() kan be found here: > > http://devel.basm.be/phpinfo.php > > Thanks Already, > Witch -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Timed Jobs.
Suggestion: - When the user triggers the event, store their user name, email or whatever along with a timestamp in your site's database (if it has one) or in some text file some place. - Write a cron script that runs every five minutes, every minute, every hour, whatever. When this script runs, it reads the aforementioned database, text file, etc. and checks the timestamps and the user data. - If the data found by the above script (the timestamp and the user data) matches a certain criteria (i.e. the timestamp is 5 hours old, or whatever your delay is) and sends out the email appropriately, then deletes or otherwise updates that record, so it doesn't try again when it runs the next time. J Webmaster Mbtradingco wrote: > Hi: > > > > I was wondering if it is posible to make in PHP a cron job, that will > trigger an event (i.e. send an e-mail) long after the process of the > data has taken place, like programming an e-mail to go out, on an > specified date. > > > > My question is, since the script is run and triggered by the user, how > can u trigger the later sending of the mail? > > > > Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] .inc over .php
3) Block downloads on .inc files, like using a directive in httpd.conf or a .htaccess file in apache. (Or whatever on another web server.) Now, even if a user tries to view that file, it won't execute at all, thus perhaps saving you some memory and clock cycles. (And it's generally more secure than treating them as php files since the includes might do something to, say, a database that you don't want them to do unless they're included into a valid php file request.) J Jason Wong wrote: > > There are two ways to counter this: > > 1) have the .inc files in a directory outside the scope of the webserver > directory. > > 2) set the webserver to treat .inc files as php files. > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP + Microsoft Access
AFAIK, there is no unix app for using Access databases. You could try WINE or some sort of virtual desktop running Windows and use Access through that, but that would probably be even less stable than Windows itself. Running Windows 2000 with service pack 2 for the db server should probably be stable enough, anyways. I've been using it for a few months and although I'm no Windows fan, at least it hasn't died on me yet. J Tom Mikulecky wrote: > Hello > > I have to interface an MSAccess database and Apache server on a linux > box thru PHP. The only way I found to do that is to use ODBC with some > specific drivers (I tried Openlink). This solution needs sort of server > running on a Windows station, it serves requests to the Access database > file. > > The problem is that I would like to do this WITHOUT any Windows station, > to achieve good reliability (we can't have a Windows station running > just for that). Also the database can't be ported to any other format > because there are some programs written in VB-Access that need it as is. > > So what I need is sort of sql driver for accessing mdb files on a > unix/linux box. Does-it exist? I searched a lot on the web but with no > succes. > > Any suggestions are welcome > Thanx in advance > > Some details: > - The Access database file (mdb) is located on a Unix box in a shared > folder > > Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Second opinion needed - javascript blocker
Try looking at htmlspecialchars() and htmlentities() instead. They'll convert things like < and > to > and < and ampersands to &. J Leif K-Brooks wrote: > I am trying to block javascript from ares of my site that users can > change. > I am going to use the following code. Can someone give me a second > opinion on whether it will work? > > function stopjavascript($text){ > //Stop people from using &whatever; tags, in case they can smuggle > javascript in with that > $text = str_replace("&","&",$text); > //Stop the onmouseover, etc. parameters > $text = eregi_replace("on","o-n",$text); > //Stop script tags, as well as links to javascript: > $text = eregi_replace("script","sc-ript",$text); > //Return the edited string > return $text; > } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: AW: [PHP] Re: Second opinion needed - javascript blocker
Then I'd suggest using the strip_tags() function and define which tags you'd like to leave untouched. J Red Wingate wrote: > He might want to use this function but doing so no links or bold underline > Tags will be destroyed as well. > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Interesting Links, can be not PHP
The # is used to point to an anchor on a page. Usually, you need the anchor name after the hash symbol, i.e. http://www.example.com/#anchor. However, in this case, odds are it's a JavaScript thing. In some older browsers, like pre-Netscape 4.7, I believe, when you created a link that had an onClick event in it, you still had to provide a real link to make it work. By using the hash symbol on the same page as the one you're on, you don't have to reload the page, and the JavaScript still executes. At least, I seem to remember having to do that a few times... J Mantas Kriauciunas wrote: > Hey PHP General List, > > Well i have seen some strange links last few months earlyer i > didn't look at them because i didn't care... and now i am curious... > how to understand link like this Http://www.foo.com/# and thats > it... links ends and as it sayes for example it links to Our Works > page on that website... how to understand that # ? can anybody > expain? or give link to explanation ? > > :--: > Have A Nice Day! > Mantas Kriauciunas A.k.A mNTKz > > Contacts: > [EMAIL PROTECTED] > Http://mntkz-hata.visiems.lt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: What's wrong with the PHPSESSID?????
Are you using the just-released PHP 4.2.0? A problem has been found with the sessions extension; it should be fixed soon, likely via a patch. J Scott Fletcher wrote: > Hi! I have the PHPSESSID working on every web page except one and it > baffle > me. Have anyone have this problem before? Anyone know of a way around > the problem? > > Here is what happen. On the HTML post, I use the Post String, > > -- clip -- > ACTION='network_option_transunion.php?&type=' > METHOD="POST"> > -- clip -- > > Then on the next page, after executing hte post by clicking hte submit > button. The next page failed to show the PHPSESSID on screen. But at the > top of the browser's window where hte url address and stuffs are located. > It said, > > --clip-- > > https://test.ecbi.com/transunion/network_option_transunion.php?PHPSESSID=ACD > 2BF215C0513AADDDC70AAC598EE3E&type=credit > > --clip-- > > But when I use the php echo, it spit out nothing. What I don't understand > is that it work on many other web pages except just this one webpage. > Anyone know why? > > THanks, > Scott -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: DOM XML
I'm assuming it's that stray dollar sign you have in front of domxml_root. J Sebastian A. wrote: > Hello, > > I have been recently doing experiments with the DOM XML function and I am > (not surprisingly) having some problems with it. When I try to run the > code below, I get an error saying I am trying to use and endefined > function. To me it seems that the DOM XML extension is working fine, > because I get no error from xmldoc(), but I am still not sure what the > problem is. I am running PHP 4.2 > > Code: > $str = "Anyname"; > $dom = xmldoc($str); > $root = $domxml_root($dom); > echo $root->name; > ?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Load Balancing and PHP Sessions
A better way to set this up might be to use a reverse proxy in front of www1.test.com and www2.test.com. Users would go to www.test.com and the reverse proxy would forward communications between the front-end and the servers in the back, thereby balancing the load. Cookies should still work fine, regardless of the server that actually sets them. (I'm not sure if PHP's built-in sessions would work...) Since I'm assuming you're using Apache here, you'd most likely want to look into using Squid, which is a kick-ass proxy. Setting up the re-director is a bit of a hastle, since you basically have to write one from scratch, but it isn't too difficult. (There are lots of pre-made ones that can handle things like round-robins, randomness, all that jazz.) J Baumann Reto wrote: > Is it possible to have sessions (via cookie) on a load balanced > environment? Therefore having > www1.test.com > and www2.test.com > > and share the same sessions? The systems can access the same file-system, > but it seems that the session is not passed. Could this have something to > do with session.cookie_domain? > > Thanks for any help > > Reto -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: php command line
Check out your php.ini file and look for some lines that read something along the lines of zend_extension=/path/to/ZendOptimizer.so zend_optimizer.optimization_level=15 Then either: a. Get rid of those lines; or b. Get the Zend Optimizer and put it some place where PHP can see it can modify the zend_extension line in your php.ini file accordingly. J Ezra Nugroho wrote: > I was trying to compile php command line and got some problem. > Maybe some of you can help. > > version: 4.1.2 > I did: > ./configure --with-ldap --with-oracle --with-oci8 > --with-mysql=/usr/src/mysql-3.23.43-pc-linux-gnu-i686 --enable-track-vars > --disable-debug --prefix=/usr/local/apache/php > --with-config-file-path=/usr/local/apache/lib --with-gd > > when tested, it gave: > Failed loading /usr/local/apache/libexec/ZendOptimizer.so: > /usr/local/apache/libexec/ZendOptimizer.so: cannot open shared object > file: No such file or directory > > I couldn't find ZendOptimizer.so anywhere. > Any clue? > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Variable Help.
Even better would be to write the URL as http://www.example.com/charts.php/wk0001-etc and look in $_SERVER["PATH_INFO"]. This way, you can do without the "?" and have a search engine-friendly URL. J Stuart Dallas wrote: > On 1 May 2002 at 18:39, Randum Ian wrote: >> I want to link to a page like this: >> >> http://www.danceportal.co.uk/charts.php?wk0001-fri-18-jan-2002 >> >> How do I get the information into a script? > > The variable $_SERVER["QUERY_STRING"] will contain > "wk0001-fri-18-jan-2002". > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Variable Help.
It isn't terribly hard to fix -- just use $_SERVER["DOCUMENT_ROOT"] in the links that need them. J Miguel Cruz wrote: > On Wed, 1 May 2002, J Smith wrote: >> Even better would be to write the URL as >> >> http://www.example.com/charts.php/wk0001-etc >> >> and look in $_SERVER["PATH_INFO"]. This way, you can do without the "?" >> and have a search engine-friendly URL. > > ...and all your relative URLs get broken so you have to either have an > implementation-specific BASE HREF or use (ugh) absolute URLs. > > miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: case-insensitive str_replace
preg_replace() can be used with arrays. J Reuben D Budiardja wrote: > > Hi, > I am in need of a case-insensitive str_replace. I've tried the search the > archive and documentation, but the mostly suggested thing is to use > eregi_replace. But this does not really solve the problem for me since the > argument for eregi_replace can't be an array. > > The feature that I use in str_replace is to put the 'search' and 'replace' > argument as an array, as described in the documentation for php >= 4.0.5 > Some people suggested some functions in the archive and documentation, but > I cannot find anything that can receive arrays as the arguments. > > So I am wondering if anyone has a function that is fully compatible with > str_replace for php > 4.0.5, but case-insensitive (something like > stri_replace). I don't really want to reinvent the wheel here. > > Thanks in advance. > Reuben D. Budiardja -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: function over loading?
Sort of. Look at the extension "overload" in the ext directory of the PHP source. Enable it and check out the docs: http://www.php.net/manual/en/ref.overload.php J Kris Vose wrote: > Can you practice function over-loading in php? > > Kris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: rand(0,1) does seem to get more often 1
Running the code with such a small number of trials will likely cause skewed results one way or the other. I ran this code and consistently got around the 50-50 split you'd expect: J Andy wrote: > Hi there, > > I am wondering if it is possible that this function tends to be more often > 1. I do get 8 of 10 times 1. > > srand((double)microtime()*100); > if (rand(0,1) == 1){ > code... > > it looks ok to me. > > Thanx for any help, > > Andy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: error-catching
You can write your own error handlers using set_error_handler(). Then, depending on the error code, you can decide whether you should display the error message, email it to you, log it, whatever. http://www.php.net/manual/en/function.set-error-handler.php If you just want to hide the error message, there's nothing wrong with using @. J Gert Mellak wrote: >> $db_connect = mysql_connect($db_server, $db_user, $db_pass) or > die('Couldn't >> connect to database'); >> >> $db_open = mysql_select_db($db_name, $db_connect) or die('Couldn't select >> database'); > > well, I tried this out and if the mysql-server is down, I get the > "Warning: Unable to connect to mysql-server"-stuff. > > The only way I've found was to connect by @mysql_connect - but that's not > the fine style, yeah? > > Gert. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: multi-dimensional array
You can't set an array subscript using an array; it should be a numerical value or a string. What you want to do is $division[$div_id] = $array; Better yet, try: $divison[$div_id] = mysql_fetch_array($result, MYSQL_ASSOC); J Steve Buehler wrote: > I am trying to learn some new things in the hopes that it would help me > with my mysql/PHP programming. The following code gives me an error: " > Warning: Illegal offset type in z.php on line 25 ". > > $result=mysql_query("SELECT * FROM division"); > while(($row=mysql_fetch_object($result))){ > $div_id=$row->div_id; > $array=array("sub1" => $row->sub1, > "sub1d" => $row->sub1d, > "sub2" => $row->sub2, > "sub2d" => $row->sub2d, > "sub3" => $row->sub3, > "sub3d" => $row->sub3d, > "sub4" => $row->sub4, > "sub4d" => $row->sub4d, > "sub5" => $row->sub5, > "sub5d" => $row->sub5d, > "game_length" => $row->game_length); > // The following is the line 25 > $division[$div_id][$array]=array(); > } > > What I am trying to do is to be able to later call > $division[$div_id][sub5] > etc... I sure hope that this can be done. If not, I will just have to > stick with temporary tables. > > Thanks > Steve -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: array of objects???
Might just be a typo, but in the function prototype for AddUser(), you have $oUser, but the array_push() argument says $objUser. J J. Anderson Scarbrough wrote: > I have two classes. Organization and users. > > In the organization class I am try to keep an array of user objects but it > does not seem to be taking. Can any help? See code below. > > class Organization > { > var $users = array(); > > function AddUser($oUser) > { > array_push($this->users, $objUser); > } > > function numberOfUsers() > { > return count($this->users); > } > > } > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP and mySQL
Actually, "elseif" and "else if" are both valid. J Craig Vincent wrote: > > }else if(!$submit){ > > > Acthough you didn't show 75 lines of code my guess would be your problem > lies here. The else and the if shouldn't have a space between them. > > } elseif(!$submit){ > > See how that works for you =) > > Sincerely, > > Craig Vincent -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Compatiblity: Zend-1.20 + PHP4.2.1
The change to register_globals doesn't affect the Zend Optimizer or any other extension afaik. That's a non-issue. What is of issue are changes to the Zend Engine itself, which underlies PHP. Changes have been made to ZE that affect binary compatibility, so ZO 1.20 doesn't work with PHP 4.2.1. Here's the error message you'll likely receive if you try: "Zend Optimizer requires Zend Engine API version 20010710. The Zend Engine API version 20020429 which is installed, is newer." J David J Jackson wrote: > Is my hosting company trying to "pull the wool over my eyes"? > There response to upgrading to 4.2.1, was that it isn't > compatible with Zind optomizer 1.20? > > The only *issue* I seen with 4.2.x is of course register_globals! > (which of course be changed in php.ini) > I don't have a problem with them holding off, but I do have a > problem with them trying to "blow smoke up my ***". > > Thanks, > David -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Compatiblity: Zend-1.20 + PHP4.2.1
Basically, the Zend Engine is kind of like a macro scripting engine that PHP runs on top of. You can actually remove the Zend Engine and use it in other applications, like a macro engine for a work processing app, for instance. The Zend Optimizer isn't a part of the Zend Engine or PHP; it's an extension that you can download from www.zend.com. It isn't part of the standard PHP build or distribution. To duplicate the error I posted, get PHP 4.2.1 and the Zend Optimizer. Install both, then follow the directions that accompany the ZO to enable the Optimizer. (It basically involves making a few changes to your php.ini file -- I believe the ZO setup script does this for you now.) After installing, start up PHP from a shell and you should get the error. If you're using PHP with a web server, check the server's error log. J David Jackson wrote: > J -- > Thanks your reply, I 'm a little confused as to the relationship between > PHP and Zend? > I thought all request were processed by Zend? Or is Zend Optimizer > something different from > Zend that built as part of PHP4.2.x? Who would a duplicate the error > below on my Linux box. > > Thanks for your time. > David > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Making Multiple Pages
You should also add an ORDER BY clause in there, as the SQL standard doesn't guarantee the order that rows are retrieved in. There's a chance that you'll get, say, 20 rows on the first page, go to the second page and get some of the rows you've already seen on the first page. If you use an ORDER BY, you'll at least guarantee that you'll get them in the same order each time. J Kevin Stone wrote: > $query = "SELECT * FROM mytable LIMIT $i, 20"; > > Where 20 is the number of rows to retrieve and $i is the starting row. > > By incrementing $i + 20 you can do next, prev buttons, or parse the total > number of rows into page links (prev - 1, 2, 3, 4, 5, 6.. 10.. 20 - next). > > Search www.mysql.com for more information about using LIMIT in your > queries. > > -Kevin > -- 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 4
I always hate mentioning this 'cause I feel like an attention whore or something, but nevertheless, I can't get the thing tested thouroughly without a bit of whoring... I've been working on a crypto extension for PHP for a while now, and since you guys seem into the crypto thing, you might like to check it out. It's not really meant to be a replacement for mcrypt/mhash or anything, just as an alternative. (One advantage is that it works on Windows as well as UNIX, and I believe the native, non-cygwin win32 port of libmcrypt/libmhash are no longer maintained.) Anyways, if you're at all interested, see http://www.tutorbuddy.com/software/ It supports pretty much all of the algorithms mcrypt and mhash do, plus a few more. (30-some block and stream ciphers, the usual block cipher modes, and 17 hash/checksum algorithms altogether.) Again, I hate the self-promotion, but as you all probably know, cryptography is useless unless it's been tested, studied and proven to be effective. J -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Session's is slowing the page ??
It might have something to do with the way the session extension in PHP performs garbage collection. There's a setting in php.ini that basically controls how often garbage collection is performed. The value is a percentage, and determines how often the GC should be done over a random number of session_start() requests. If GC is invoked, the garbage collector will start to delete all of the expired session files in your session directory. If there's a lot of them, it might take longer to load the page that the garbage collection was started on. Since the garbage collector is called at random based on the aforementioned setting, not every page will be affected. The problem could probably be cut down by increasing the value of the GC setting, as fewer files would need to be deleted with each GC sweep, as more GC sweeps will be called overall. That's just a guess, though. J Dima Dubin wrote: > Hello, > I have very wierd problem : > I use session to manage users and I have this structure of the page : > - > include("db.php"); > include("header.php"); > bla bla > include("footer.php"); > - > > in the db.php I have : > > > session_start(); > #some mysql connect stuff > > > I use session with the $_SESSION array (cheking if > registered[isset($_S...)] and registering...) > and all work fine > but sometimes the page loading is very very very slow (and its a really > really fast host) and when I removing session_start(); from the top of the > page, the page load normaly. > > the PHP version is 4.1.1, someone have an idea ? > thanks in advance, > Dima. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Thread safe
You could use a transaction block if your database supports it, or just use some sort of auto-numbering field, such as SERIAL in Postgres, auto_increment in MySQL, etc. Then you wouldn't have to worry about retrieving the next cno before inserting a new row. J R wrote: > Hi, > In java servlets I used to use a "synchronised" block of code to make sure > it was thread safe...how do i do this in PHP? > > Heres what should be thread safe > > { > $r=select max(cno)+1 from MyTable; > (then i insert into the table the new cno plus my name) > insert into mytable ($r,'myname'); > } > How to do this and make sure its thread safe? > > Any help appreciated, > -Ryan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Newbie question...
Try wget if it's installed. If not, lynx, a shell-based web browser, is installed on quite a few machines. J Ben Turner wrote: > This may be a bit off topic but I am trying to install the pdflib package > for Linux so I can make pdfs through php and I was wondering if anyone > might know the command to download a file via CRT from an http source. > > I apologize to the OT but I cant seem to get much of anything to work for > me. > > Thanks! > Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] is there an "in" qualifier in PHP?
That will result in a parse error. I think you mean if (in_array($row['id'], $selected_users)) { /* execute */ } J Stewart G. wrote: > if ($row['id'] in_array ($selected_users)) { // execute } > > =S. > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: hmm.. more trouble with telnet.
It means bash can't find the file called "mysql". If it could, it would show you a path to the file, like $ whereis mysql mysql: /usr/bin/mysql If your server has locate or slocate, try them instead. (This assumes they have an up to date locate database. If not, you may have to run "updatedb", if you have the proper permissions.) J Sean Kennedy wrote: > Hello, > > When I type in 'whereis mysql' it says 'mysql:' so what does that mean? > > -Sean -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP-Based Authentication Security?
An easier way to do it might be to use HTTP authentication with apache using .htaccess and .htpasswd files, which can be placed in the secure directories. (Or use one global .htpasswd file and have all .htaccess files point to it.) Another possibility would be to set up two PHP scripts, one being some kind of form to enter a username, password, etc., and another to check the input and act as a pass-thru for the file to be downloaded. The second script could look something like this (obviously simplified): if ($authenticated) { header("Content-type: whatever/text"); readfile($filename); } else { print "You can't download this." } Which you would call as something like: http://www.example.com/path/download.php?filename=somefile.txt Obviously, you need to take care of a few security problems, like making sure they don't do something like http://www.example.com/path/download.php?filename=/etc/passwd And you'd have to make sure the file exists and such before sending it out. And determine the MIME type of the file. (I usually do this by extension.) But overall, it would work. I have a similar script, minus the authentication feature. J John Coggeshall wrote: > > Hey all.. > > I've got a question -- I'd like to restrict access to entire directories > based on if the user has been authenticated or not. Basically, I'd like > to set up a auto-include *FROM APACHE* to run a PHP script prior to > sending any documents what-so-ever and only send the requested document > if the PHP script allows it. So.. > > Request Made -> PHP Script Runs -> PHP Checks Authentication -> PHP says > OK -> Apache sends file normally > > Or.. > > Request Made -> PHP Script Runs -> PHP Checks Authentication -> PHP says > NO -> Apache stops dead in it's tracks or displays a HTTP error > > Is this possible? It has to work for any document or MIME type and be > restrictable by directory... (i.e. I just want this happening in a > /secure/ directory) > > John > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: PHP-Based Authentication Security?
I wouldn't say .htaccess and .htpasswd files are pointless. They might not be applicable to your situation, fine, but they're not totally useless. And .htaccess/passwd files do provide directory-level security -- the directory they're in, plus any subdirectories if need be. But there are a million solutions to your problem. .htaccess was just one of them. It would also have been possible to forget about individual .htaccess files and just define everything in access.conf. Anyways, just glad you found a solution. J John Coggeshall wrote: > > .htaccess and pw files are pointless, who wants to maintain potentially > 10 or 20 of these things? Furthermore, it's gotta do more than just > serve a single file at a time -- that's simple... I needed > directly-level security. > > The solution I came up with was to use a module called mod_auth_any, > which (with a little minor adjustment) can execute a PHP script from the > console and rely on it's response to grant authentication or not. That > gives me Apache-level security without Apache-authentication. > > John > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP Server platform
Linux is a form of Unix, one that is available free, as in it costs nothing, you are free to copy it and use it on as many computers as you like, and you can, if you are so inclined, make changes to the operating system as the full source code for the kernel is available to you. There are many forms of Unix, such as Sun's Solaris, HP's HP-UX, Digital UNIX, any of the *BSD systems, and Linux. Linux is just another form of Unix-like system. There are other freely available Unix systems, like the BSD systems (OpenBSD, NetBSD, FreeBSD), while other ones you usually have to pay for, and likely won't get complete access to the source. (Some are in-between, like Solaris, which you can download for free under certain circumstances, and you can get the source code, but you can't really distribute changes to the OS.) As for the most common Unix, these days it feels like Linux, 'cause it's all the rage, but the most common on the big-ass servers are the proprietary Unices, like Solaris. Apache isn't a Unix system at all, it's just a web server, like Microsoft's IIS. Apache can be used on pretty much any Unix system, and can even be used on Windows platforms. (Although it's generally more stable and faster on Unix systems.) If you're really new to Unix systems (and it sounds like you are) pick up a Linux distribution like Mandrake, RedHat, or SuSE, as they're generally the easiest to install. Once you get used to Unix-like systems, you can generally move between them fairly easily, although there is a learning curve. (For instance, while Solaris and Linux are both Unices, there are quite a few differences, but if you can get used to one, it makes learning the other relatively easy, versus only knowing Windows or whatever.) IMHO, of course. J Dani wrote: > Hi, > > > I'm new to server issue, I would like to know what is the difference > between Linux and Unix? > > If I want to setup a server which one is the most commond one and good > one? Lunix or Unix or Apache? > > sorry if this sounds like a silly question, but I don't know about it > and I would like to learn. I hope someone could help me. > > thanks > > Regards, > Dani -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Keeping PHP out?
What are the permissions like on that directory? Does the user/group that runs your PHP process have read permissions on that directory? J Spyproductions Support Team wrote: > > Does anyone know if there is such a thing, maybe by writing in perl or > even writing in a configuration file, as keeping PHP out of a certain > directory or directory structure? > > I'm trying to figure out why PHP is not working in one of my directories; > I can tell you there is a good amount of perl/cgi in it. > > Thanks, > > -Mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP & Dynamic XML Pages
I use pretty much the same idea, but PHP isn't used to parse the returned XML. Rather, it just fetches the XML and sends it off to an XSLT processor. Look at the XSLT extension for PHP. You'll likely need to get Sablotron from www.gingerall.com. You'll also have to write an XSL stylesheet to convert the XML to HTML. Of course, this is all done with PHP4. I haven't used PHP3, so I can't say if it would work properly with it. (Is there even an XSLT extension for PHP3?) J Alex Kirk wrote: > I've got a client who wants me to build a form-based user interface for an > application that will allow people to sign up for ISP service. Each form > will post to a remote server, which will give me an XML reply upon which > to base the response page for the user. > > Being very much new to PHP, I'm not sure if this is even possible. I know > PHP can parse XML and act appropriately thereupon, but every example I've > looked up shows PHP just parsing a static XML page. > > As best I can tell, the sequence of events if this did work would be: > > 1. User posts HTML form to PHP script. > 2. PHP script submits appropriately encoded query string to remote server. > 3. PHP script parses returned XML. > 4. PHP script generates HTML to send to the user. > > Do I have this roughly right? Can such a thing even happen? If not, is > there a language I can do it in? Oh, and probably very importantly, would > having PHP3 (the version their server is running) pose problems? > > Thanks, > Alex Kirk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: variable scoping...
Namespaces aren't available yet, but should be with PHP 5 (?) when the Zend Engine 2.0 is ready. J Aric Caley wrote: > Is it possible to keep the variable name-space separate between, say, two > files (one included into the other) to avoid name collisions? I'm trying > to > get two scripts to work together on the same page. Each script defines > some classes that have the same names but work differently (ex., class > Template). All I need is to embed the output of one script into the other. > > Now, I could do this by just getting the output from a URL but that seems > really inefficient. Or I could run the script from the CGI version of PHP > using exec() but that also seems like it could be really slow and clunky. > > Is there some efficient way of doing this? > > It would be cool if you could just put the include() inside of a function > and have all the classes and variable names be local inside that function > but that didnt seem to work... plus the scripts explicitly access global > variable names. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What does &var mean ?
Bas Jobsen wrote: >> What does the "&" (ampersand) before the variable name mean ? > > a pointer to the address (mem) of the variable PHP doesn't have pointers and memory can't be directly accessed this way like you can in C, or C++ or whatever. The ampersand is for passing values via reference rather than value. PHP has no notion of pointers. J -- 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] ereg help
Something like this will work: eregi("^id \{([a-z]*),([a-z]+),([a-z]+)\} \[(.+)\]$", $str, $regs); $regs will be an array containing: [0] => "id {name,title,nick} [http://www.php.net]"; [1] => "name" [2] => "title" [3] => "nick" [4] => "http://www.php.net"; If course this isn't very foolproof or generic. For instance, this regex assumes that you have exactly three comma-delimited substrings between those curly braces and anything goes in the brackets. (It could be a URL, but it could also be anything else.) This is assuming there are three items between those curly braces, however. To handle multiple configurations within the curly braces, you'd probably, as the boundaries would cause items in the array to be overwritten during matching. Something like this may work half-decent... if (eregi("(id) \{(.*)\} \[(.*)\]$", $str, $regs)) { $p[0] = $regs[1]; $p[1] = explode(",", $regs[2]); $p[2] = $regs[3]; } $p should now look like the following: [0] => "id" [1][0] => "name" [1][1] => "title" [1][2] => "nick" ) [2] => "http://www.php.net"; That should do it. Of course, the regex again isn't foolproof, as you could have crazy stuff for a URL, and it doesn't bother to check if there's anything after a comma in the curly braces, but will handle any number of items between the braces, and it's enough to get you started. J Valentin V. Petruchek wrote: > > - Original Message - > From: "Valentin V. Petruchek" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Monday, December 03, 2001 6:35 PM > Subject: [PHP] ereg help > > >> I'm not new for php, but have no experience working with ereg functions. > My >> problem is the following: >> >> i have string.. for example >> $s="id {name,title,nick} [http://www.php.net]";; >> i want to break it in several parts: >> $p[0]="id"; >> $p[1][0] ="name"; >> $p[1][1] ="title"; >> $p[1][2] ="nick"; >> $p[2]="http://www.php.net";; >> >> The part in [] is not neccessary, count of {} elements is not less than 1 >> I can do it with string fucntions, but it seemes to me it's better to use >> regular functions. >> >> Could anybody help me to solve this problem and advise resource for > studying >> regular expresions? >> >> Zliy Pes, http://zliypes.com.ua >> >> -- 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] header("Location:blah...") - passing variables
I'd recommend urlencoding those variables if you're going to do it that way, otherwise you may get some non-sense characters resulting in a bad URL. J Jim wrote: > > There are many different ways to do this ... > > 1. Have the same PHP script that validates generate the login page. > This way the script always has the correct data and you don't need to > pass anything. > > 2. Header("Location: login.php?err=$err&user=$user&pass=$pass"); > This will work, but the bad password will be visible in the query string. > > 3. Start a session at the login page and register the variables you > need to use on the login page. > > Jim > > -- 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] Re: Extract data
For a split this simple, I'd recommend using explode("|", $data). split() uses a regex for the first character (and as others have said, the pipe is a metacharacter in a regex, so you'll need to use "\|" instead of "|"), whereas explode() is simply literal. explode() will probably be slightly faster, too, since it doesn't need to compile the regex, etc., although the difference will probably be infintesimal. J Dan wrote: > Hello guys > > I'm making poll script that stores data like this: > > 0|0|0|0|0 > > > > > But i'm getting this error all the time: > > Warning: unexpected regex error (14) in c:\program files\apache > group\apache\htdocs\eztatic\poll.php on line 25 > > 25: list(q1,q2,q3,q4,q5)= split ("|", $answer, 5); > > > Could any help > > Thank you very much in advance > > -- 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] Re: Shell scripting
Add the -q argument to the php command, i.e. $ php -q or edit the first line of your script to something like this: #!/path/to/php -q There are some other arguments to the cgi executable. Use the -h argument for details. J Dan McCullough wrote: > I am setting up a shell script to provide a menu for some tasks that our > server admin would like to do via script rather then vi'ing the file, now > I am almost finished but I would like to get rid of this ugly part of the > output. > > X-Powered-By: PHP/4.0.4pl1 > Content-type: text/html > > Is there away that I can get the echo to stay off for that part. > > dan > -- 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] Re: PHP 4.1.0 actually out this time -- questions about zend products
We have the developer suite at my work, and as far as I know, the Optimizer, Debug Server, Encoder, etc. don't work with 4.1.0 at all. When you try using the Optimizer, for instance, it spits out a line in your Apache log (or whatever log) saying that "this version of the Optimizer is for Zend Engine blah blah, go to Zend.com to upgrade", or something to that effect. Hopefully when you buy the suite you get access to updated versions of the software that are compatible with 4.1.0, otherwise, it's going to suck for us, since we use some of the new features in 4.1.0 in the app we're writing. It would seem like a waste of money in our case, as we're dropping 4.0.6, and that's all the Developer Suite we have covers at the moment. We used to use 4.0.6 on an older version of this thing we're developing, but there were enough nicities in 4.1.0 that I decided to start using the dev versions and RCs for 4.0.7/4.1.0, just so we'd be up-to-date when 4.1.0 actually came out. J Mike Eheler wrote: > Does anyone here subscribe to the Zend developer's suite? We have the > optimizer and debugger installed with a 4.0.5 installation and are > looking into upgrading to 4.1.0 but being a production machine, we don't > want to do anything that would jeopardize the stability of the machine. > Has anyone here had experience using PHP 4.1 with the optimizer and > debugger? > > Mike -- 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] Re: PHP 4.1.0 actually out this time -- questions about zend products
Seconds after I write this, I see on zend.com that the Optimizer has a new version for 4.1.0. Don't see anything about the Debug Server. I'm going to give the Optimizer a whirl and see if stuff encoded with our old Encoder word with 4.1.0... J J Smith wrote: > > We have the developer suite at my work, and as far as I know, the > Optimizer, Debug Server, Encoder, etc. don't work with 4.1.0 at all. When > you try using the Optimizer, for instance, it spits out a line in your > Apache log (or whatever log) saying that "this version of the Optimizer is > for Zend Engine blah blah, go to Zend.com to upgrade", or something to > that effect. > > Hopefully when you buy the suite you get access to updated versions of the > software that are compatible with 4.1.0, otherwise, it's going to suck for > us, since we use some of the new features in 4.1.0 in the app we're > writing. It would seem like a waste of money in our case, as we're > dropping 4.0.6, and that's all the Developer Suite we have covers at the > moment. We used to use 4.0.6 on an older version of this thing we're > developing, but there were enough nicities in 4.1.0 that I decided to > start using the dev versions and RCs for 4.0.7/4.1.0, just so we'd be > up-to-date when 4.1.0 actually came out. > > J > > -- 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] Re: replacing Carriage Return
You could use "\r\n" (or combinations thereof) as others have mentioned, but just to save you some frustration, make sure you don't put quotation marks around the chr(13) if that regex, otherwise you'll be looking for the literal string "chr(13)" and not what you'd expect, i.e. what the function chr() returns when given 13 as an argument. J Phantom wrote: > I solicit information from a text field and save the data in mysql to be > pulled out later and displayed as text on a webpage. > > However, Carrage Returns in the text field do not appear in the webpage > text. > > With ereg_replace() I can replace the Carriage Returns with "\n", so > what is this the character I need to find in the text field to replace? > chr(13) ??? > > ereg_replace("chr(13)", "\n", $TextFieldData) > > Thanks. -- 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] Re: PHP command for issuing UNIX command???
http://www.php.net/manual/en/ref.exec.php J Scott Fletcher wrote: > Hi! > > I wanted to know if there is a PHP code or function that would allow > the > PHP to issue the UNIX command. > > What I'm doing here is I'm trying to tell PHP to create a file by > issuing hte UNIX command then I can use the PHP to open the file to enter > the data. Once I'm done with the file, I can use the UNIX to run the > script > in the file to communicate with the modem by executing the file. When I'm > done then I can open an another file to grab the data that had be received > by the modem and do the PHP things to do something with hte data. When > done, then I can use the PHP to tell UNIX to delete the file and Voila! > > Thanks, > Scott -- 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] Re: Socket functions
I've been using them for months without any major problems. (There was a slight bug in socket_select() that caused some undesireable behaviour, as it wouldn't allow for indefinite blocking, but I submitted some patches and it was eventually fixed.) I have a search engine running that was built using these functions and it works fine, either on a TCP socket or locally on a UNIX domain socket. I don't know how well it works on Windows (I doubt the UNIX sockets would work, 'cause Windows uses named pipes or something like that rather than true UDS) but the TCP stuff probably works. J David wrote: > Hi, just wondering if anyone have tried the socket functions in php > http://www.php.net/manual/en/ref.sockets.php > > does it work on win32(apache)? i tried the simple TCP/IP example on that > page but it does\'nt work for me. I\'m using 4.1.0 and enabled that > entension already. -- 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] Re: PHP 4.1.0 patch for Quanta IDE, The Sequel
I sumbitted a similar patch to the Quanta team about a week ago. It may appear in an upcoming release, possibly Quanta 3, which will come with KDE 3.0. A few other additions I made: - highlighting is now case-insensitive for everything. I believe older versions were case-sensitive for keywords, like function, class, etc. - support for ASP-style opening and closing tags (<% and %> instead of http://sourceforge.net/tracker/index.php?func=detail&aid=495239&group_id=4113&atid=304113 > > Download the attached file, and run > > patch -p1 -i quanta-2.0.1-php-4.1.0.diff > > That will patch your source tree.. then just configure, make, install. > > I've actually tested this one, so go nuts people. :) Please let me know > if you find any functions that should be keywords or keywords that > shouldn't be keywords, or functions/keywords that just plain aren't in > the list. > > Mike -- 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] Store PHP Code in MySQL?
Try looking at the eval() function. It's pretty similar to the eval keyword in perl. http://www.php.net/manual/en/function.eval.php J Smith code, dba and linux guy Tutorbuddy Inc. The Magic Lantern Group mailto:[EMAIL PROTECTED] "Joseph Koenig" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I've been playing a little bit trying to store some PHP code in MySQL > and get it to execute. However, it behaves just like expected in that it > just displays the code, and doesn't execute it. Essentially, i want to > do this: > > while($data = mysql_fetch_array($result)) { > echo $data["text"]; > } > ?> > > With $data["text"] containing: > echo $var; > ?> > > Anybody know a way to actually make this work? Thanks, > > Joe >
Re: [PHP] Store PHP Code in MySQL?
Try looking at the eval() function. It's pretty similar to the eval keyword in perl. http://www.php.net/manual/en/function.eval.php J Smith code, dba and linux guy Tutorbuddy Inc. The Magic Lantern Group mailto:[EMAIL PROTECTED] "Joseph Koenig" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I've been playing a little bit trying to store some PHP code in MySQL > and get it to execute. However, it behaves just like expected in that it > just displays the code, and doesn't execute it. Essentially, i want to > do this: > > while($data = mysql_fetch_array($result)) { > echo $data["text"]; > } > ?> > > With $data["text"] containing: > echo $var; > ?> > > Anybody know a way to actually make this work? Thanks, > > Joe >
Re: [PHP] Code check please
Your code is [mostly] fine, except for two things: 1. Although you connected to your database with mysql_connect() and mysql_select_db(), you didn't do anything with connection. Try using mysql_query() to send a query to the db, i.e. mysql_query($sql). 2. Your SQL is a bit out of whack. The "SET" clause is used for UPDATEs, not INSERTs. Instead, try: $sql = "INSERT INTO tabell (fornamn, efternamn, email) VALUES (" . "'$fornamn', '$efternamn', '$email');"; Hope that works. J "Andreas Skarin" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I've tried to get this working for over an hour > now, and it still won't. I don't even get an error > message to help me find the problem so I was > hoping that someone could check my code for me. > > I'm fooling around with a basic form that is > supposed to send one's name, surname and e-mail > address to "receive.php". "receive.php" is then > supposed to take the information and add it to a > table called "tabell" in a database called > "databas", but it doesn't work. I think there > might be something wrong with my MySQL query. > > - - - - - - - - - - - FORM - - - - - - - - - - - - > - - > > > Förnamn: > size="25"> > Efternamn: > size="25"> > E-mailadress: > size="25"> > value="Log in"> > > > - - - - - - - - - - - - - - - - - - - - - - - - - > - - - > > - - - - - - - - - - - RECEIVE.PHP - - - - - - - - > - - - > > > // connection to MySQL > $connection = mysql_connect("localhost", > "username", "password"); > if (!$connection) { > echo ("Unable to connect to the database > server at this time." ); > exit(); > } > > //select database > if (! @mysql_select_db("databas") ) { > echo ("Unable to locate the database at > this time."); > exit(); > } > > // MySQL query > $sql = "INSERT INTO tabell SET" . > "fornamn ='$fornamn'," . > "efternamn='$efternamn'," . > "email='$email';"; > ?> > > - - - - - - - - - - - - - - - - - - - - - - - - - > - - - > > Thanks in advance! > > // Andreas > > > -- > 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]
Re: [PHP] Parse PHP inside a variable
Try eval(): http://www.php.net/manual/en/function.eval.php i.e. J "Claus Heiko Niesen" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hello > > I'm having a variable that contains HTML with embedded PHP code. When I > echo it then the PHP code does not get executed. Is there a way I can > parse/print the content of my variable? > > Thanks >Claus > > > -- > 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]