Re: [PHP] XML Parser misbehaves with &
The data contains escaped ampersands -> & Which is as far as I know the way one represents ampersands in their data. In my post below, the value of $data the second time is "&" because it has been evaluated by the xml parser. And btw xmllint has no problems with & On Mon, 2003-08-18 at 12:41, Justin Farnsworth wrote: > This is normal. You have illegal XML there, as it should be > in . I have run across this, and have > to clean it up with an awk script. Ampersand is a no-no. > > Just running xmllint on the file will tell you about the problem(s). > > _justin > > Jeff Bearer wrote: > > > > I've come across this frustrating behavior with the XML parser when it > > reads an escaped ampersand (&) > > > > If the xml being evaluated is: Blue, Green & Red > > > > it calls the character data handler 3 times: > > the first time the $data is "Blue, Green " > > the second time is "&" > > and the third time is " Red" > > > > Needless to say this is screwing up my parser, and the stuff I'm doing > > won't make it easy to add this allowance. I'm hoping somebody can point > > out a way to turn off this behavior. If this is the proper operation, > > is it documented anywhere? I've been unable to find it. > > > > -- > > Jeff Bearer, RHCE > > Webmaster, PittsburghLIVE.com > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php -- Jeff Bearer, RHCE Webmaster, PittsburghLIVE.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] XML Parser misbehaves with &
I've come across this frustrating behavior with the XML parser when it reads an escaped ampersand (&) If the xml being evaluated is: Blue, Green & Red it calls the character data handler 3 times: the first time the $data is "Blue, Green " the second time is "&" and the third time is " Red" Needless to say this is screwing up my parser, and the stuff I'm doing won't make it easy to add this allowance. I'm hoping somebody can point out a way to turn off this behavior. If this is the proper operation, is it documented anywhere? I've been unable to find it. -- Jeff Bearer, RHCE Webmaster, PittsburghLIVE.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Replacing Unicode characters
I'm working on an application where I need to replace some Unicode characters with a PHP shell script. The problem I'm having is matching multibyte characters. One character in particular is Unicode 2014 an m-dash '—' To get the decimal code to identify the character I've tried two methods, one was with a little script like this: I took the multiple decimal codes returned and tried a replacement like: echo str_replace(chr(226).chr(128).chr(148),"-hyphen",$data); But that didn't match it I figured my method of finding the decimal value wasn't correct. Next I thought if I UTF-8 encoded the character and took the ord() and used that decimal to compare against a utf-encoded version of my string. but when I tried getting the ord() of all the characters I wanted to watch for it always gave me the same decimal, 195. So that idea wasn't going to work either. I'm out of ideas, any input would be appriciated. Thanks. -- Jeff Bearer, RHCE Webmaster, PittsburghLIVE.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Redirecting STDOUT to a file pointer
Argh, I was thinking about the problem backwards, redirect the fp to stdout is the way to do it. if(!$argv[1]) $argv[1] = "php://stdout"; $fp = fopen($argv[1], "w"); fputs($fp,"blah\n"); fclose($fp); On Fri, 2003-02-28 at 15:11, Jeff Bearer wrote: > I'm working on a shell script in php. The script has an option to write > to standard output, or to a file. If the filehandle is opened I'd like > to redirect standard output to the file pointer. This would allow me > not to have to handle every output statement twice, once with an echo > and again with an fputs. > > Can this be done in PHP? > > > -- > Jeff Bearer, RHCE > Webmaster, PittsburghLIVE.com > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- Jeff Bearer, RHCE Webmaster, PittsburghLIVE.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Redirecting STDOUT to a file pointer
I'm working on a shell script in php. The script has an option to write to standard output, or to a file. If the filehandle is opened I'd like to redirect standard output to the file pointer. This would allow me not to have to handle every output statement twice, once with an echo and again with an fputs. Can this be done in PHP? -- Jeff Bearer, RHCE Webmaster, PittsburghLIVE.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Exotic Assign operators what do they do.
The PHP manual neglects to tell us what these assignment operators are, can somebody point me to what they mean? &= |= ^= ~= <<= >>= just curious that's all -- Jeff Bearer, RHCE Webmaster, PittsburghLIVE.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] strtotime bug? end of the month.
Actually I only needed date("Y-m") so my solution works fine, and I didn't consider the problems with hard coding 1 into it. But thanks for the replies. On Thu, 2002-10-31 at 11:33, Jeff Bearer wrote: > date("Y-m-d",strtotime("+1 month")) > > returns December 1st! This happens when you add 1 month to any day that > doesn't exist in the next month. Quite annoying that you have to handle > it like this: > > date("Y-m-d",strtotime("+1 month",strtotime(date("Y-m-1" > > > -- > Jeff Bearer, RCHE > Webmaster, PittsburghLIVE.com > Winner 2002 Eppy Award, Best U.S. Newspaper Website > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- Jeff Bearer, RCHE Webmaster, PittsburghLIVE.com Winner 2002 Eppy Award, Best U.S. Newspaper Website -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] strtotime bug? end of the month.
date("Y-m-d",strtotime("+1 month")) returns December 1st! This happens when you add 1 month to any day that doesn't exist in the next month. Quite annoying that you have to handle it like this: date("Y-m-d",strtotime("+1 month",strtotime(date("Y-m-1" -- Jeff Bearer, RCHE Webmaster, PittsburghLIVE.com Winner 2002 Eppy Award, Best U.S. Newspaper Website -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Banner Ad Serving...
You can also checkout OASIS http://oasis.sourceforge.net/ It's pretty good software, but i'm unable to use it here because it doesn't have as man features as OAS from RealMedia which my manager is used to. http://www.realmedia.com It's expensive and doesn't really integrate into PHP. but it's very indepth. On Tue, 2002-07-23 at 23:47, Dave at Sinewaves.net wrote: > Is there any way of automatically adding a certain bit of code to every page > on a web server (or within a given directory)? > > As in, is there any kind of Apache-specific PHP stuff that will add a banner > ad or copyright notice to pages (without editing the actual pages themselves > and without changing their file names)? I've looked around a bit, and I > can't seem to brainstorm how it could be done. > > Any help will be greatly appreciated (with good karma to boot). :) > > Dave > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- Jeff Bearer, RHCE Webmaster, PittsburghLIVE.com 2002 EPpy Award Winner, Best Newspaper Website -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Security Advisory: Vulnerability in PHP versions4.2.0 and4.2.1
IIRC, just about every upgrae has security fixes, you may be hard pressed to find an older version that doesn't have any big holes in it. On Mon, 2002-07-22 at 10:55, Ilia A. wrote: > On July 22, 2002 10:12 am, 1LT John W. Holmes wrote: > > [snip] > > > > >PHP Security Advisory: Vulnerability in PHP versions 4.2.0 and 4.2.1 > > > > [/snip] > > > > Looks like everyone will be using the new super globals, now... :) > > > > Well, I guess I'm still assuming that in a perfect world, people will > > upgrade because of security issues... > > > > ---John Holmes... > > As the Advisory suggests, the security fault affects only the 2 latest > versions of PHP, all the people running older PHPs are not affected, so > unless you've had the very latest stuff running this won't affect you and > there will be no need to upgrade. > If anything this will only convince people looking for 'stable' PHP to wait > even longer before upgrading their releases because of potential bugs such as > this one creeping up in 'new' releases. > > Ilia > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- Jeff Bearer, RHCE Webmaster, PittsburghLIVE.com 2002 EPpy Award Winner, Best Newspaper Website -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] saving a jpeg via HTTP
What is the best way using only PHP to grab a image file off a website a d save it locally? I know I can use wget and this would be a piece of cake, but in this case I don't want to rely on external programs. I'm trying to read it with fsockopen and writing it with fopen to the file but the file is no good when it's saved, I saw that it saved the http headers in there so I cut those out but still, the image wan't viewable. I was using fsockopen instead of file because I want to use the timeout feature of fsockopen. any help is appriciated. -- Jeff Bearer, RHCE Webmaster, PittsburghLIVE.com 2002 EPpy Award, Best Online U.S. Newspaper -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Intermediate "Searching..." screen.
I have a part of my site that searches a large database and sometimes it takes more than a few seconds to return the results. When searches take longer, people get antsy and search again. To let them know that the search is working so they don't double efforts I'd like to have an intermediate "Searching..." screen. I don't have a good idea on how to do this and I'm looking for some ideas or directions. How do I show one thing while the search is running and another when the search is complete and also not loose the returned record set? -- Jeff Bearer, RHCE Webmaster PittsburghLIVE.com 2002 EPpy Award, Best Online U.S. Newspaper -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] specifying a different php.ini at webserver start
solved, that doesn't appear possible, so I used a virtual host with different php_flag and php_value options. On Thu, 2002-05-23 at 10:02, Jeff Bearer wrote: > How do you tell apache/php module to use a different php.ini file? > > I want to start a second instance of apache with a different php > configuration. > > > -- > Jeff Bearer, RHCE > Webmaster > PittsburghLIVE.com > 2002 EPpy Award, Best Online U.S. Newspaper > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- Jeff Bearer, RHCE Webmaster PittsburghLIVE.com 2002 EPpy Award, Best Online U.S. Newspaper -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] specifying a different php.ini at webserver start
How do you tell apache/php module to use a different php.ini file? I want to start a second instance of apache with a different php configuration. -- Jeff Bearer, RHCE Webmaster PittsburghLIVE.com 2002 EPpy Award, Best Online U.S. Newspaper -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ini_set('display_errors',1) not working.
Update, I can see the errors if I make a fatal error. but not if it's a parse error. in the php.ini I'm using the default error_reporting: E_ALL & ~E_NOTICE I sill have no explanation as to why. On Wed, 2002-05-22 at 11:24, Jeff Bearer wrote: > I have the following in my php.ini file: > > display_errors=Off > log_errors=On > error_log="filename" > > I want to turn on display_errors for developers, I'm attempting to use > ini_set to do this. I made a script like: > > ini_set('display_errors',1); > ini_set('log_errors',0); > ini_set('error_log',null); > > phpinfo(); > ?> > > (I added log_errors and error_log lines in an attempt to get this > working) > > The phpinfo() shows that the local values for the variables I set as I > just set them, and the master values are those of the php.ini file. > Everything looks how I what it. If I add an error: > > echo "asdfadf"asdfa; > > The script behaves as it would in the php.ini, it displays no error and > writes it to the log. Does anybody have any ideas on why this isn't > working? > > -- > Jeff Bearer, RHCE > Webmaster > PittsburghLIVE.com > 2002 EPpy Award, Best Online U.S. Newspaper > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- Jeff Bearer, RHCE Webmaster PittsburghLIVE.com 2002 EPpy Award, Best Online U.S. Newspaper -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] ini_set('display_errors',1) not working.
I have the following in my php.ini file: display_errors=Off log_errors=On error_log="filename" I want to turn on display_errors for developers, I'm attempting to use ini_set to do this. I made a script like: (I added log_errors and error_log lines in an attempt to get this working) The phpinfo() shows that the local values for the variables I set as I just set them, and the master values are those of the php.ini file. Everything looks how I what it. If I add an error: echo "asdfadf"asdfa; The script behaves as it would in the php.ini, it displays no error and writes it to the log. Does anybody have any ideas on why this isn't working? -- Jeff Bearer, RHCE Webmaster PittsburghLIVE.com 2002 EPpy Award, Best Online U.S. Newspaper -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] display errors for developers only?
In the php.ini file I have display_errors = Off, how would I configure the server, or the application to display the errors for specific hosts, the developers? -- Jeff Bearer, RHCE Webmaster PittsburghLIVE.com 2002 EPpy Award, Best Online U.S. Newspaper -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] variable for $_GET or $_POST
$_REQUEST, sorry didn't see it the first time. On Tue, 2002-05-14 at 14:04, Jeff Bearer wrote: > Quick question if I'm programming with register globals off, and want to > get a variable that is allowed to be set with either a GET or POST > method, is there 1 variable that will contain the value? Or do I have > to find it like with something like this? > > if($_GET[test]) $test=$_GET[test]; > else $test=$_POST[test]; > > Thanks > > > -- > Jeff Bearer, RHCE > Webmaster > PittsburghLIVE.com > 2002 EPpy Award, Best Online U.S. Newspaper > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- Jeff Bearer, RHCE Webmaster PittsburghLIVE.com 2002 EPpy Award, Best Online U.S. Newspaper -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] variable for $_GET or $_POST
Quick question if I'm programming with register globals off, and want to get a variable that is allowed to be set with either a GET or POST method, is there 1 variable that will contain the value? Or do I have to find it like with something like this? if($_GET[test]) $test=$_GET[test]; else $test=$_POST[test]; Thanks -- Jeff Bearer, RHCE Webmaster PittsburghLIVE.com 2002 EPpy Award, Best Online U.S. Newspaper -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Diffrence between ob_gzhandler and zlib compression
I was looking through the new php.ini file and was enabling the output handler of ob_gzhandler then I saw the line about zlib.output_compression. What's the diffrence between the two? -- Jeff Bearer, RHCE Webmaster PittsburghLIVE.com 2002 EPpy Award, Best Online U.S. Newspaper -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Using caching to reduce database queries
Does anybody know of a class, module, extension that caches database output? I've asked this before, and I've looked high and low to no avail. I've used APC cache to do caching and it works great, but it doesn't save database queries, which easily becomes the bottleneck with highly dynamic site. It's a pretty big itch for me and I'm sure other's and I'm surprised that there isn't anybody scratching that itch. Just hoping something new is out there. Thanks -- Jeff Bearer, RHCE Webmaster PittsburghLIVE.com 2002 EPpy Award, Best Online U.S. Newspaper -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] apps that need register globals 'on' and others require 'off' onsame server
I have a server where I'm running some third party apps. until now I've had register globals 'on', now I have a new app that requires register globals 'off' for it to work, if I change the php.ini to off then it breaks some of the other applications. Is there a way to turn register globals on or off in the script at runtime? -- Jeff Bearer, RHCE Webmaster PittsburghLIVE.com 2002 EPpy Award, Best Online U.S. Newspaper -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] chechking to see if a directory already exists
In the spirit of sharing I'll supply a link to tfm http://www.php.net/manual/en/function.is-dir.php http://www.php.net/manual/en/function.file-exists.php sometimes it's hard to rtfm if you don't even know what you are looking for. On Thu, 2002-04-11 at 16:42, Jason Wong wrote: > On Friday 12 April 2002 05:36, Someone Somewhere wrote: > > How can I check to see if a directory already exists. > > rtfm > > -- > Jason Wong -> Gremlins Associates -> www.gremlins.com.hk > Open Source Software Systems Integrators > * Web Design & Hosting * Internet & Intranet Applications Development * > > /* > No one wants war. > -- Kirk, "Errand of Mercy", stardate 3201.7 > */ > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- Jeff Bearer, RHCE Webmaster PittsburghLIVE.com 2002 EPpy Award, Best Online U.S. Newspaper -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] pages compressed with zlib
It will only send compressed pages to browsers that support it so that's not a problem. Pro's are that pages load much faster. especially if your HTML output is big, images are already compressed so they stay the same. cons are minor, since the page is gzipped when loading on a browser it doesn't "cascade" onto your screen, it appears all at once when the transfer is complete, so the total load time is faster, but it's a little longer before the user see's anything. I'd also guess that gzipping every page will make the processor work harder. but I've never had a problem with that. test it out, we noticed big differences on modems to our site. On Thu, 2002-04-11 at 13:57, Levy Alves Carneiro Jr. wrote: > > Hello, > > inside php.ini file there's a special configuration: > > ; Transparent output compression using the zlib library > ; Valid values for this option are 'off', 'on', or a specific > ; buffer size to be used for compression (default is 4KB) > zlib.output_compression = On > > this way pages will be parsed, compressed, and then sent to the > browser. Does anybody know of pros & cons of using this > configuration? Which browsers support zlib compression? > > Thanks, > Levy > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- Jeff Bearer, RHCE Webmaster PittsburghLIVE.com 2002 EPpy Award, Best Online U.S. Newspaper -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] RPM apache+php v. source apache+php
This is a tough question to ask because I know there will be a fare share of people who just want to flame Red Hat, but this just might start a healthy discussion. What is your opinion of using Red Hat's Apache and PHP binaries instead of compiling from source? If Red hat is too specific for this list we can expand it, but that is the binary that I'm interested in seeing how it stacks up. Red Hat compiles a bunch of stuff into both apache and php but most of it is modular so it shouldn't have enormous amounts of overhead. On the other hand, it sure is easy to keep up to date, and when you have a lot of servers that is a big plus. If you need a feature in php that is not included in the RH configure you are better off using source, I've tried building the php source RPM adding some new options and didn't come close to getting it to work, but I'm not an expert in building RPM's and maybe it was all my fault. If there was a performance difference you would assume that the source install would have it, has anybody compared performance of the two and is there any measurable difference? For those of you that are of the mindset that everyone should compile everything from source, that's duly noted, but I'd rather hear from people who weigh out the benefits of using one or the other and go with the best choice. Thanks for you time. Here is the configure from the Red Hat binary: --prefix=%{_prefix} \ --with-config-file-path=%{_sysconfdir} \ --disable-debug \ --enable-pic \ --disable-rpath \ --enable-inline-optimization \ $* \ --with-bz2 \ --with-db3 \ --with-dom \ --with-exec-dir=%{_bindir} \ --with-gd \ --with-gdbm \ --with-gettext \ --with-jpeg-dir=%{_prefix} \ --with-mm \ --with-openssl \ --with-png \ --with-regex=system \ --with-ttf \ --with-zlib \ --with-layout=GNU \ --enable-debugger \ --enable-ftp \ --enable-magic-quotes \ --enable-safe-mode \ --enable-sockets \ --enable-sysvsem \ --enable-sysvshm \ --enable-track-vars \ --enable-yp \ --enable-wddx \ --without-mysql \ --without-unixODBC \ --without-oracle \ --without-oci8 \ --with-xml \ --with-expat-dir=/usr And it's split into the following packages: php devel imap ldap manual mysql pgsql odbc mcal xslt oci8 (oracle) so those are part you can leave out if you don't need them. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] simple function question.
this is a very simple question. I'm trying to figure out if there is a one line way to do this: I want to pass a variable to the function only if it matches a certin value, I know I can do this: if($a=='H') my_function($bob,'Y'); else my_function($bob); but If it's possible I'd like to do it with one line something that I'd think it would be like this. my_function($bob,if($a=='H') return 'Y'; ); I know that return doesn't work, and echo wouldn't work either, can you even put a if statement inside a function call? -- Jeff Bearer, RHCE Webmaster PittsburghLIVE.com 2002 EPpy Award, Best Online U.S. Newspaper -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] header("Location:") problem with Netscape
I'm working on a app that uses the header("Location") is the middle of the file, but since I'm using output buffering it shouldn't matter. The application works fine in Mozilla, Konqueror, and IE, but not in Netscape 4 or 6. I don't get the error that the "headers have already been written" error, it just loads the page as if the header("Location:") was commented out. Some of my thoughts on the subject. I'm redirecting to $PHP_SELF is Netscape trying to be extra smart and think it doesn't have to refresh? I'm using gzip compression in output buffering, maybe there is a situation where Netscape 4 & 6 may not use the gzip compression, hence causing the output buffering not to work correctly? But if that was the case I should see the error about headers already been written. Any suggestions would be great, thanks. -- Jeff Bearer, RHCE Webmaster PittsburghLIVE.com 2002 EPpy Award, Best Online U.S. Newspaper -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Upgrading PHP
One issue I've come across is if you have a site up and running, make php and install php and make and install apache, php won't be upgraded. You need to stop apache before you install the new apache so. after you make apache, stop the running apache, install apache, and then start apache up again. On Thu, 2002-02-28 at 16:32, Frank Miller wrote: > All, > I have a question about upgrading php. With the CERT > advisory coming yesterday and the quick response from the PHP website I > thought today would be a good day to upgrade my PHP. I initially > installed the php 4.03 src in /usr/src and built it as an apache module > DSO. To upgrade I deleted the old source still in /usr/src and untarred php > 4.1.2 . I then configured it and ran make and make install. Everything went > well until I run the phpinfo() test script I made, I did stop and start > Apache. It still shows me as using PHP 4.0.3 . Can someone tell me what I > need to do to get rid of the older version of PHP and upgrade to the new? > > Thanks in advance - Frank > > Frank Miller > Computer Specialist and Webmaster > Technology and Distance Education > Texas A&M University-Texarkana > 2600 North Robison Rd > Texarkana, Texas 75501 > > Phone: 903-223-3156 > Fax: 903-223-3139 > Office: 165 > > > > --- > Outgoing mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.325 / Virus Database: 182 - Release Date: 2/19/2002 > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -- Jeff Bearer, RHCE Webmaster PittsburghLIVE.com 2002 EPpy Award, Best Online U.S. Newspaper -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] using a mysql temporary table.
DOH, I always figure it out after I post to the mailing list, the user didn't have create table privileges, that's why it didn't persist in my first attempt to do this with separate queries. On Mon, 2002-02-25 at 10:34, Jeff Bearer wrote: > Hello, > > I'm trying to use a temporary table in mySQL with PHP. First I tried to > create a temporary table and then query it in the same script. But the > table didn't persist to the second query in the PHP script. > > I found this knowledge base entry: > http://www.faqts.com/knowledge_base/view.phtml/aid/445 > > Where it shows to do all the querying in one swoop. The problem I'm > having now is that PHP is throwing an error at the first semi-colon. It > appears that it doesn't want to run multiple query statements in 1 query > function. > > I'm using the mySQL pear class in my application, I wouldn't think that > it would have any effect on the problem. > > Here is an example of the query I'm attempting. > > CREATE TEMPORARY TABLE tmp_events SELECT event_id, event_title FROM > events; INSERT INTO tmp_events SELECT event_id, event_title FROM > special_events; SELECT event_id, event_title FROM tmp_events ORDER BY > event_title; > > But I get an error like: > 1064: You have an error in your SQL syntax near '; INSERT INTO > tmp_events' > > > If I echo my SQL statement and paste it into mySQL the query works fine. > Any suggestions that you can offer would be great. > > > > > -- > Jeff Bearer, RHCE > Webmaster > PittsburghLIVE.com > 2002 EPpy Award, Best Online U.S. Newspaper > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- Jeff Bearer, RHCE Webmaster PittsburghLIVE.com 2002 EPpy Award, Best Online U.S. Newspaper -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] using a mysql temporary table.
Hello, I'm trying to use a temporary table in mySQL with PHP. First I tried to create a temporary table and then query it in the same script. But the table didn't persist to the second query in the PHP script. I found this knowledge base entry: http://www.faqts.com/knowledge_base/view.phtml/aid/445 Where it shows to do all the querying in one swoop. The problem I'm having now is that PHP is throwing an error at the first semi-colon. It appears that it doesn't want to run multiple query statements in 1 query function. I'm using the mySQL pear class in my application, I wouldn't think that it would have any effect on the problem. Here is an example of the query I'm attempting. CREATE TEMPORARY TABLE tmp_events SELECT event_id, event_title FROM events; INSERT INTO tmp_events SELECT event_id, event_title FROM special_events; SELECT event_id, event_title FROM tmp_events ORDER BY event_title; But I get an error like: 1064: You have an error in your SQL syntax near '; INSERT INTO tmp_events' If I echo my SQL statement and paste it into mySQL the query works fine. Any suggestions that you can offer would be great. -- Jeff Bearer, RHCE Webmaster PittsburghLIVE.com 2002 EPpy Award, Best Online U.S. Newspaper -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem while loop.
Well, I found the problem. it wasn't happening where I thought it was. which brings up another question I'll have to ask in a new subject about output buffering. On Sun, 2002-02-24 at 18:00, Jeff Bearer wrote: > It's all returning proper dates and the proper timestamps when I check > them inside the loop. I'm formatting the dates in -MM-DD format and > strtotime is returning the proper timestamps. I'm curious how can you > say it's a problem with the dates when the if statement comparing the > same expression as the while loop works properly? > > > > On Sun, 2002-02-24 at 13:09, Steven Walker wrote: > > Jeff, > > > > The problem is most likely with incrementing $event_data. It's hard to > > say without seeing the rest of the code. > > > > Steven J. Walker > > Walker Effects > > www.walkereffects.com > > [EMAIL PROTECTED] > > > > > I have a problem while loop that isn't terminating when it's supposed > > > to. I can't figure out what the problem is, if I run a comparison > > > inside the while loop it matches as it should, but for some reason the > > > same comparison isn't working as the while loop expression. I get an > > > infinite loop when I run this code. > > > > > > while(strtotime($event_date) <= strtotime($end_date)){ > > > # test to see if the loop should of stopped. > > > if(strtotime($event_date) <= strtotime($end_date)) > > > echo "GO!!\n"; > > > else echo "STOP!!!\n"; > > > > > > /* omitted code that finds the next $event_date */ > > > } > > > > > > > > > > > > > > > -- > > > Jeff Bearer, RHCE > > > Webmaster > > > PittsburghLIVE.com > > > 2002 EPpy Award, Best Online U.S. Newspaper > > > > > > -- > > > PHP General Mailing List (http://www.php.net/) > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > -- > Jeff Bearer, RHCE > Webmaster > PittsburghLIVE.com > 2002 EPpy Award, Best Online U.S. Newspaper > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- Jeff Bearer, RHCE Webmaster PittsburghLIVE.com 2002 EPpy Award, Best Online U.S. Newspaper -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem while loop.
It's all returning proper dates and the proper timestamps when I check them inside the loop. I'm formatting the dates in -MM-DD format and strtotime is returning the proper timestamps. I'm curious how can you say it's a problem with the dates when the if statement comparing the same expression as the while loop works properly? On Sun, 2002-02-24 at 13:09, Steven Walker wrote: > Jeff, > > The problem is most likely with incrementing $event_data. It's hard to > say without seeing the rest of the code. > > Steven J. Walker > Walker Effects > www.walkereffects.com > [EMAIL PROTECTED] > > > I have a problem while loop that isn't terminating when it's supposed > > to. I can't figure out what the problem is, if I run a comparison > > inside the while loop it matches as it should, but for some reason the > > same comparison isn't working as the while loop expression. I get an > > infinite loop when I run this code. > > > > while(strtotime($event_date) <= strtotime($end_date)){ > > # test to see if the loop should of stopped. > > if(strtotime($event_date) <= strtotime($end_date)) > > echo "GO!!\n"; > > else echo "STOP!!!\n"; > > > > /* omitted code that finds the next $event_date */ > > } > > > > > > > > > > -- > > Jeff Bearer, RHCE > > Webmaster > > PittsburghLIVE.com > > 2002 EPpy Award, Best Online U.S. Newspaper > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > -- Jeff Bearer, RHCE Webmaster PittsburghLIVE.com 2002 EPpy Award, Best Online U.S. Newspaper -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] problem while loop.
I have a problem while loop that isn't terminating when it's supposed to. I can't figure out what the problem is, if I run a comparison inside the while loop it matches as it should, but for some reason the same comparison isn't working as the while loop expression. I get an infinite loop when I run this code. while(strtotime($event_date) <= strtotime($end_date)){ # test to see if the loop should of stopped. if(strtotime($event_date) <= strtotime($end_date)) echo "GO!!\n"; else echo "STOP!!!\n"; /* omitted code that finds the next $event_date */ } -- Jeff Bearer, RHCE Webmaster PittsburghLIVE.com 2002 EPpy Award, Best Online U.S. Newspaper -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Date Question: finding 1st Monday of sept.
Nevermind, I figured it out, didn't see that you could pass a timestamp to strtotime. Thanks. On Fri, 2002-02-22 at 14:22, Jeff Bearer wrote: > Hello, > > I'm trying to find out how to calculate some dates, and the part I'm > having problems with is finding the date of the first Monday in > September. > > I'm looking into the strtotime() function which works some great magic > with dates, but I can't figure out how to use the day of the week syntax > start from a date other than today. > > You can use releative dates with units of days: > strtotime("2002-09-01 +2 weeks"); > > But I can't seem to get it to work with the weekdays, I'd assume it > would be something like this. > strtotime("2002-09-01 first monday") > > Is there a syntax that I'm missing or is there a way of fooling the > function to thinking it is September 1st so when I ask for next Monday > it will give me the correct date? > > > -- > Jeff Bearer, RHCE > Webmaster > PittsburghLIVE.com > 2002 EPpy Award, Best Online U.S. Newspaper -- Jeff Bearer, RHCE Webmaster PittsburghLIVE.com 2002 EPpy Award, Best Online U.S. Newspaper -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Date Question: finding 1st Monday of sept.
Hello, I'm trying to find out how to calculate some dates, and the part I'm having problems with is finding the date of the first Monday in September. I'm looking into the strtotime() function which works some great magic with dates, but I can't figure out how to use the day of the week syntax start from a date other than today. You can use releative dates with units of days: strtotime("2002-09-01 +2 weeks"); But I can't seem to get it to work with the weekdays, I'd assume it would be something like this. strtotime("2002-09-01 first monday") Is there a syntax that I'm missing or is there a way of fooling the function to thinking it is September 1st so when I ask for next Monday it will give me the correct date? -- Jeff Bearer, RHCE Webmaster PittsburghLIVE.com 2002 EPpy Award, Best Online U.S. Newspaper -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Caching in php?
There is Zend Cache, it expensive and you have to pay per processor. That drove folks to develop APC (Alternitive PHP Cache) which is open source. http://apc.communityconnect.com/ They take the PHP source and compile it into machine code and stores that code, which saves porcessor overhead when the page is loaded again. APC worked well for me, but that's not where my bottleneck is, mine is with database access so I wanted to cache database queries. I couldn't find any application that did what I wanted so I wrote a class that handles caching queries. In programming it I wanted it to be a transparent as possible and make using it just like using the PEAR mysql module so I could add it to my site with minor modifications. Here is a little on how it works. It checks to see if the query is cached, if not it queries the database. It takes the data returned from the query and stores it in a xml file, which I have on a RAM disk for speed. It returns a result object similiar to the result object from the PEAR mysql stuff. And that object has a FetchRow function just like the mysql result object so it drops right into existing code. It's new and I haven't truely tested it's proformance yet but if you are interested in it. Let me know, I'm positive that people will be able to improve the code in the class which would be cool. On Wed, 2002-02-06 at 09:23, Erick Papadakis wrote: > hello, > > i used asp and it seems there is an application object > which can help in caching of data. (e.g., > http://www.aspfaqs.com/aspfaqs/ShowFAQ.asp?FAQID=142). > > > is this possible using php? what can i do to use > caching on my website which is totally database > driven? > > thanks/erick > > __ > Do You Yahoo!? > Send FREE Valentine eCards with Yahoo! Greetings! > http://greetings.yahoo.com > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- Jeff Bearer, RHCE Webmaster PittsburghLIVE.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Q: while loop on an array
check out the foreach control structure it may be exactly waht you need. http://www.php.net/manual/en/control-structures.foreach.php On Wed, 2002-01-23 at 10:17, Joe Rice wrote: > > Hello, > > I would like to know how i can know when i'm at the > end of an array during a while loop? > > reset($new_answers); > while (list($new_qID,$new_aID) = each ($new_answers)) { >$sql .= "qID=\"$new_qID\ ||" "; > } > $sql .= ") AND uID = \"$uID\""; > > i would like to know how to stop putting the " || " at > the end of $sql in the middle of the while loop. > > any help would be appreciated. > > thanks, > joe > > > > -- > 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] > -- Jeff Bearer, RHCE Webmaster PittsburghLIVE.com -- 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] How should I cache database data for php?
DN, Yes the db server and the webserver are on the same box, local connections are much faster than network ones according to mysql. When the site is busy the percent of the system being used by mysql and that being used by PHP/Apache, I estemate would be around 90%-10% so if I get the db load down I'll have smooth sailing. I'm not attempting to elimate the compalition of PHP, I just want to eliminate some database queries. I don't particually care for the idea if writing static html files. I've had really bad experiences with stale files our old system. The way I'm exploring now is to build a caching layer between the php application and mysql. I want the app to query the caching layer just about the same way it queries the database, but add a few other details, time to live, cache name etc. The caching layer will check to see if the query is cached, make sure it's not expired, and return the data just like a result set from the db query. If it is expired, or doesn't exist then it will query and create the cache file for next time. I'm leaning toward storing the data in XML, and kicking around the idea of storing it on a ram disk so it would have killer fast access time. I expected to get tons of links to libraries or other apps that have data caching, I'm quite supprised that I haven't yet. On Mon, 2002-01-21 at 14:20, DL Neil wrote: > Jeff's original post mentioned reducing load on the db server - are the db and web >servers on the same physical > device - and thus his concern? > - or perhaps if there are other apps needing to 'compete' with the web server to >gain access to the db > concurrently? > -- Jeff Bearer, RHCE Webmaster PittsburghLIVE.com -- 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] How should I cache database data for php?
> Well, if you're caching but having your content updated twice a day > wouldn't you be better off letting the db take the strain? I don't see > how else you are going to make sure people are seeing the latest content > as opposed to cached pages that are out of date. Let your db do the > work, that's what it's for :) But at 300,000 page views a day, even if the caches only have a ttl of 1 hour I'm still saving over %90 of the traffic from having to query the database. During our busy times I have a bottle neck with the database maxing out the CPU's, so If I can cut the queries the server won't be working as hard, plus file I/O is faster than Database I/O so the site will be faster even when it's not busy. > One of the 'home grown' solutions I saw was to 404 page to trigger the > creation of a static html page made from the results of the first query > on the db. The problems I saw though were: What about browser compat > issues and what a pain that would be to have to wipe the 'cached' static > dir every time you updated your content. > It seemed well suited to articles that wouldn't alter much over time > though. (I think the piece was on www.devshed.com) OK I'll look into it,those are the kind of ideas I'm looking for, eventhough I agree, that one doesn't sound like much fun. and I'm not worried about ppl getting errors, I'm worried about them getting the page fast. now it can be slow, but no errors. > > > - -- > > Nick Wilson > > Tel: +45 3325 0688 > Fax: +45 3325 0677 > Web: www.explodingnet.com > > > > -BEGIN PGP SIGNATURE- > Version: GnuPG v1.0.6 (GNU/Linux) > > iD8DBQE8TDtzHpvrrTa6L5oRAu+rAJ0bArR4ohvbvCE4kC6DzqtMe3CvRQCfbBHl > Sqy+StTmXNzDgHwZ7PabIH0= > =xj8f > -END PGP SIGNATURE- > > -- > 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] > -- Jeff Bearer, RHCE Webmaster PittsburghLIVE.com -- 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] How should I cache database data for php?
On Mon, 2002-01-21 at 10:30, Nick Wilson wrote: > > I have a PHP content management application that I've developed. I'm > > looking to add data caching to it so the database doesn't get pounded > > all day long, the content on the site changes slowly, once or twice a > > day. > > On that basis caching may not be ideal, certainly not a 'home grown' > solution and especially if the db is really going to take a 'pounding' > all day. How so? the whole idea of caching the data is so the database stops taking the pounding. > > Does anyone know of where I can look to find an application that does > > this? I've searched and have yet to find anything that does the same > > kind of thing. I'll take anything, a module or library that does it, or > > even some other application that does the same thing that I can look at. > > I think Zend do something that you should look at. > www.zend.com (I think it's called 'Zend Cache') > APC (Alternitive PHP Cache) and afaik Zend Cache don't cache the database data, they cache the execution instructions of PHP code so the PHP intrepreter doesn't have to recompile the code every time, but if there is a query it still queries the DB every time. I've experienced this first hand with APC. At first I thought it would cache the entire PHP output, which would include the data, not just the execution instructions. But I was wrong. -- Jeff Bearer, RHCE Webmaster PittsburghLIVE.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] How should I cache database data for php?
Hello, I have a PHP content management application that I've developed. I'm looking to add data caching to it so the database doesn't get pounded all day long, the content on the site changes slowly, once or twice a day. Does anyone know of where I can look to find an application that does this? I've searched and have yet to find anything that does the same kind of thing. I'll take anything, a module or library that does it, or even some other application that does the same thing that I can look at. Ideally I think it would be cool if it would be a PEAR module that the application connects to just like the database, and it manages chaches and querying the database for data in the module. -- Jeff Bearer, RHCE Webmaster PittsburghLIVE.com -- 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] Version Contol for PHP site
Hello, I'm trying to come up with a workable solution to implement version control for our site. I have developers that use windows, and don't know too much about the unix command line, so I'd prefer to use a windows client to work on the site if possible. I'm looking into CVS for the version control and I've found some directions on how to use it with websites. But it only talks about static HTML development, it doesn't say how developers would debug PHP, CGI, etc. This solution would not give them any ability to debug their code before checking it back in. I suppose if I could get them all comfortable with the UNIX command line, they could work on the development server, checking out the files to a working directory that is also a virtual host. A new idea that I just came up with would be to have the developers use VNC viewer to connect to an X server on the development box. The deveopers could use a X GUI for CVS to check it out, and edit files etc. and keep the working directory a virtual host like above. Is anybody doing something like this with their PHP development? Any direction from a working implementation would be great. And what do you think about the VNC idea that I just came up with? -- Jeff Bearer, RHCE Webmaster PittsburghLIVE.com -- 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] Re: Fatal error: Call to undefined function: imagecreate()
Thanks for pointing me to phpinfo(), the field for the ./configure command is my old one, I guess I'll go back and start from scratch, must of forgot a step. On Thu, 2001-11-15 at 21:06, Johan Holst Nielsen wrote: > > I know it's probabally overkill but in the configure messages, it says > > yes for everything gd, jpeg, png, and zlib. Any suggestions? If anybody > > wants to see the configure messages let me know. > > What do PHP tells you about the GD lib extension. > Try making a phpinfo() file and send the output in the GD lib section. > > Regards, > Johan > > -- > 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] > -- Jeff Bearer, RHCE Webmaster PittsburghLIVE.com -- 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] Fatal error: Call to undefined function: imagecreate()
I'm getting this error with my php installation, I first assumed that it was because I didn't have GD and friends installed. So I configured and installed PHP with these options and I'm still getting the same error. ./configure --enable-apc --with-mysql --with-apache=../apache_1.3.22 --enable-inline-optimization --with-pspell --with-gd --with-jpeg --with-jpeg-dir=/usr --with-png --with-png-dir=/usr --with-zlib --with-zlib-dir=/usr I know it's probabally overkill but in the configure messages, it says yes for everything gd, jpeg, png, and zlib. Any suggestions? If anybody wants to see the configure messages let me know. -- Jeff Bearer, RHCE Webmaster PittsburghLIVE.com -- 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] register_shutdown_function and a MySQL query keeping connection with browser.
I've been working with register_shutdown_function() to have the browser kick of a long running script and move on to other tasks. I was having problems where the browser would sit and spin untill the function was done running, then would display the page. I tinkered with flush and fflush (i'm writing to a file also) but that didn't work either. Flush showed me the screen, but the browser still keeps the connection open untill the function was done running. It seems to be caused by the mysql query or result and the loop of the result set. Below is some of the test script I put together. I'm using the PEAR DB_mysql class. I'm using the sleep where the part of the real script takes some time to run. Has anyone dealt with this before, does anyone have any ideas? The only idea I've thougt of so far is to load the record set into a 2D array and then flush the result set. That might allow the browser to disconnect before the time comsuming job starts. Any suggestions will be appriciated. connect($dsn); echo "hello"; register_shutdown_function("tester"); exit; function tester(){ global $db; $sql="SELECT * FROM table"; $result = $db->query($sql); while($row = $result->fetchRow(2)){ sleep(5); } } ?> -- Jeff Bearer, RHCE Webmaster PittsburghLIVE.com -- 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] encryption
ble to protect my own > > password. > > > > I'm not sure if that information if helpful at all, but I haven't been > > able > > > > to figure out how to do it. > > > > > > > > Tom > > > > > > > > -Original Message- > > > > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] > > > > Sent: Thursday, July 19, 2001 3:21 PM > > > > To: Sheridan Saint-Michel > > > > Cc: php-general > > > > Subject: Re: [PHP] encryption > > > > > > > > Ahh, well then, another solution could be to use SSL, depends on your > > > > application weather you can get away with using an unsigned certificate > > > > (free) or > > > > weather you will need to pay a company like verisign to prove your > > identity. > > > > > > > > With an unsigned certificate the browser will warn the user that the > > > > certificate says > > > > it's you, but it's not proven by a CA so it might not be you. > > > > > > > > The JavaScript MD5 tenique is an interesting way of doing it, but i > > don't > > > > think it's > > > > any more secure. If a hacker sniffs the md5 hash how is that any > > diffrent > > > > than him > > > > sniffing a plain text password? You're comparing hashes, so as long as > > he > > > > has the hash > > > > he's in. > > > > > > > > On Thu, Jul 19, 2001 at 01:58:43PM -0500, Sheridan Saint-Michel wrote: > > > > > The problem he is addressing is that the password is sent plaintext to > > the > > > > > server before it ever gets to MySQL. > > > > > > > > > > I would suggest using a JavaScript program like this > > > > > http://pajhome.org.uk/crypt/md5/md5src.html > > > > > > > > > > and then using the PHP md5 function on the server side and comparing > > the > > > > two > > > > > results. > > > > > That way the only thing that ever gets transmitted is an md5 hash =P > > > > > > > > > > Sheridan > > > > > > > > > > - Original Message - > > > > > From: Jeff Bearer <[EMAIL PROTECTED]> > > > > > To: Tom Malone <[EMAIL PROTECTED]> > > > > > Cc: PHP Users <[EMAIL PROTECTED]> > > > > > Sent: Thursday, July 19, 2001 12:17 PM > > > > > Subject: Re: [PHP] encryption > > > > > > > > > > > > > > > > I'd use the password function in mysql to store encrypted passwords, > > > > I'd > > > > > be interested to hear > > > > > > if anyone has a reason that doing this is not a good idea. > > > > > > > > > > > > > > > > > > > > > > > > On Thu, Jul 19, 2001 at 12:52:55PM -0400, Tom Malone wrote: > > > > > > > Hello! > > > > > > > > > > > > > > I have a small problem. On my website there is some information I > > > > would > > > > > like > > > > > > > to protect. Right now I am using .htaccess to password-protect the > > > > > > > directory, but I was thinking about using php and a form with > > > > > > > usernames/passwords in a MySQL database. Thankfully, I read the > > > > > following in > > > > > > > the manual right before I was about to use the crypt() function to > > > > > encrypt > > > > > > > my password and compare it to the encrypted hash in the DB: > > > > > > > > > > > > > > "It seems that a lot of people don't understand the point of using > > > > > one-way > > > > > > > encryption. More importantly, a lot of web designers forget that > > PHP > > > > > > > encryption is done entirely on the web server, not the client. > > > > > > > > > > > > > > > > > > > > > > > > > > > > Point being, if your form has a password input option and the user > > > > > clicks > > > > > > > SUBMIT, the password is then sent _as plain text_ over the > > Internet to > > > > > the > > > > > > > web server where it is then encrypted for comparison a
Re: [PHP] Hack on Server.
Must of been some ome hacker to find an httpd.conf on an IIS server :) On Fri, Jul 20, 2001 at 10:12:25AM +1000, Brian White wrote: > Maybe the hacker got into the httpd.conf and set the auto-prepend setting > to a file that contained the message. > > Brian > > At 00:34 20/07/2001 +0300, [EMAIL PROTECTED] wrote: > >Hi Jean-Francois! > >On Thu, 19 Jul 2001, Jean-Francois Jauvin wrote: > > > > > Hi, my server with php on it has been "hacked" or something., what > > > appened is every PHP pages displayed a certain message like "Hacked by blah > > > blah blah...". > > > None of the HTML pages were affected, only the PHP ones > > > but the scripts were not altered, I've shut down IIS, reinstalled PHP, and > >Ah, IIS, the magic word. > > > >Maybe you have been hacked by the Bady worm, I saw it in action in the > >test lab :) > > > >-- teodor > > > >-- > >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] > > - > Brian White > Step Two Designs Pty Ltd - SGML, XML & HTML Consultancy > Phone: +612-93197901 > Web: http://www.steptwo.com.au/ > Email: [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] -- Jeff Bearer, RHCE Webmaster PittsburghLIVE.com -- 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] encryption
Ahh, well then, another solution could be to use SSL, depends on your application weather you can get away with using an unsigned certificate (free) or weather you will need to pay a company like verisign to prove your identity. With an unsigned certificate the browser will warn the user that the certificate says it's you, but it's not proven by a CA so it might not be you. The JavaScript MD5 tenique is an interesting way of doing it, but i don't think it's any more secure. If a hacker sniffs the md5 hash how is that any diffrent than him sniffing a plain text password? You're comparing hashes, so as long as he has the hash he's in. On Thu, Jul 19, 2001 at 01:58:43PM -0500, Sheridan Saint-Michel wrote: > The problem he is addressing is that the password is sent plaintext to the > server before it ever gets to MySQL. > > I would suggest using a JavaScript program like this > http://pajhome.org.uk/crypt/md5/md5src.html > > and then using the PHP md5 function on the server side and comparing the two > results. > That way the only thing that ever gets transmitted is an md5 hash =P > > Sheridan > > - Original Message - > From: Jeff Bearer <[EMAIL PROTECTED]> > To: Tom Malone <[EMAIL PROTECTED]> > Cc: PHP Users <[EMAIL PROTECTED]> > Sent: Thursday, July 19, 2001 12:17 PM > Subject: Re: [PHP] encryption > > > > I'd use the password function in mysql to store encrypted passwords, I'd > be interested to hear > > if anyone has a reason that doing this is not a good idea. > > > > > > > > On Thu, Jul 19, 2001 at 12:52:55PM -0400, Tom Malone wrote: > > > Hello! > > > > > > I have a small problem. On my website there is some information I would > like > > > to protect. Right now I am using .htaccess to password-protect the > > > directory, but I was thinking about using php and a form with > > > usernames/passwords in a MySQL database. Thankfully, I read the > following in > > > the manual right before I was about to use the crypt() function to > encrypt > > > my password and compare it to the encrypted hash in the DB: > > > > > > "It seems that a lot of people don't understand the point of using > one-way > > > encryption. More importantly, a lot of web designers forget that PHP > > > encryption is done entirely on the web server, not the client. > > > > > > > > > > > > Point being, if your form has a password input option and the user > clicks > > > SUBMIT, the password is then sent _as plain text_ over the Internet to > the > > > web server where it is then encrypted for comparison against a password > > > database. > > > > > > > > > > > > Do _not_ use these types of functions to add security to a form unless > > > you're using an SSL or TLS (etc.) encrypted session. The only potential > way > > > around this issue is for you to write a JavaScript program that does the > > > hashing on the client side before being sent over the Internet (which > would > > > make this function unnecessary)." > > > > > > I am pretty new to PHP and absolutely clueless as far as > > > encryption/algorithims are concerned. Could anyone possibly point me to > a > > > viable solution for this problem? > > > > > > Thanks in advance! > > > > > > Tom Malone > > > -- Jeff Bearer, RHCE Webmaster PittsburghLIVE.com -- 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] Using GnuPG with PHP
For anybody who cares I found the problem with the command below, the environment of the webserver user was set to the environment of the user who started it, so it could not find the ~/.gnupg directory so I added the --homedir switch and all is fine. Thanks for the imput however I'll examine popen further. On Thu, Jul 19, 2001 at 10:50:18AM -0400, Jeff Bearer wrote: > I saw examples of how to encrypt data with GnuPG in the list archives > but I'm having problems that aren't mentioned. I've installed the public > key in the web server users key ring, and if I run the command as the > web server user it works just fine. But when the script runs it I get > nothing returned and no errors. > > > $command="echo \"$plain\"|gpg -e -a --always-trust --no-secmem-warning --batch -r >public_key"; > $encrypted=`$command`; > > > I've tried with and without the --always-trust, --no-secmem-warning --batch > in just about any order. If i try to write it to a file with -o the script > does not create the file and there is still no error. > > I'm assuming that STDOUT is returned to $encrypted with the backtick operator, > how to I see what STDERR of gpg command is? I figure there has to be something > there. The only thing I can figure is that the environment for the web server > is different than when you su to the web server user. and that's messing things up. > > Any help is appreciated, Thanks. > > > -- > Jeff Bearer, RHCE > Webmaster > PittsburghLIVE.com > > -- > 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] -- Jeff Bearer, RHCE Webmaster PittsburghLIVE.com -- 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] encryption
I'd use the password function in mysql to store encrypted passwords, I'd be interested to hear if anyone has a reason that doing this is not a good idea. On Thu, Jul 19, 2001 at 12:52:55PM -0400, Tom Malone wrote: > Hello! > > I have a small problem. On my website there is some information I would like > to protect. Right now I am using .htaccess to password-protect the > directory, but I was thinking about using php and a form with > usernames/passwords in a MySQL database. Thankfully, I read the following in > the manual right before I was about to use the crypt() function to encrypt > my password and compare it to the encrypted hash in the DB: > > "It seems that a lot of people don't understand the point of using one-way > encryption. More importantly, a lot of web designers forget that PHP > encryption is done entirely on the web server, not the client. > > > > Point being, if your form has a password input option and the user clicks > SUBMIT, the password is then sent _as plain text_ over the Internet to the > web server where it is then encrypted for comparison against a password > database. > > > > Do _not_ use these types of functions to add security to a form unless > you're using an SSL or TLS (etc.) encrypted session. The only potential way > around this issue is for you to write a JavaScript program that does the > hashing on the client side before being sent over the Internet (which would > make this function unnecessary)." > > I am pretty new to PHP and absolutely clueless as far as > encryption/algorithims are concerned. Could anyone possibly point me to a > viable solution for this problem? > > Thanks in advance! > > Tom Malone > > > -- > 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] -- Jeff Bearer, RHCE Webmaster PittsburghLIVE.com -- 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] d
-- Jeff Bearer, RHCE Webmaster PittsburghLIVE.com -- 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] Using GnuPG with PHP
I saw examples of how to encrypt data with GnuPG in the list archives but I'm having problems that aren't mentioned. I've installed the public key in the web server users key ring, and if I run the command as the web server user it works just fine. But when the script runs it I get nothing returned and no errors. $command="echo \"$plain\"|gpg -e -a --always-trust --no-secmem-warning --batch -r public_key"; $encrypted=`$command`; I've tried with and without the --always-trust, --no-secmem-warning --batch in just about any order. If i try to write it to a file with -o the script does not create the file and there is still no error. I'm assuming that STDOUT is returned to $encrypted with the backtick operator, how to I see what STDERR of gpg command is? I figure there has to be something there. The only thing I can figure is that the environment for the web server is different than when you su to the web server user. and that's messing things up. Any help is appreciated, Thanks. -- Jeff Bearer, RHCE Webmaster PittsburghLIVE.com -- 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]