[PHP] Re: PHP_AUTH_USER failing, please help me...
Just a quick guess that register_globals is probably turned off (check with a phpinfo() to be sure) and therefore $PHP_AUTH_USER and $PHP_AUTH_PW are not being set. Or, try $_SERVER[PHP_AUTH_USER], etc... On Mon, 25 Nov 2002, Larry Brown wrote: > I just built a new server and loaded with RH8. I copied my php files over > to the new apache server and modified the links. I couldn't find any > mention of php in the httpd.conf so I figured it must me compiled into httpd > so I tested it. The PHP files load, however, the php_auth_user and > php_auth_pw don't work. They prompt the user yet with : > > > if (isset( $PHP_AUTH_USER ) && isset($PHP_AUTH_PW)) { > > echo $PHP_AUTH_USER; > echo $PHP_AUTH_PW; > } if ( ! $auth ) > { > header( 'WWW-Authenticate: Basic realm="Private"' ); > header( 'HTTP/1.0 401 Unauthorized' ); > echo 'Authorization Required.'; > echo $PHP_AUTH_USER; > echo $PHP_AUTH_PW; > echo "OK?"; > exit; > > } > else > { > echo $PHP_AUTH_USER; > echo $PHP_AUTH_PW; > } > > The prompt comes up and asks for a password three times. After the three it > prints... Authorization Required.OK? > So it appears as though it is not returning the variables. The php version > is 4.2.2 and apache is 2.0.4 (redhat). > > > > > > Larry S. Brown > Dimension Networks, Inc. > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Comment Threading
Your best bet would be to look at how some of the other apps do it :) (taking licensing issues into account that is :) This might help as well.. not sure how efficient it is on a really long list, but it works for my little stuff... http://stuff.adhesivemedia.com/php/heirarchial-sorting.php On Tue, 3 Dec 2002, Beth Gore wrote: > Hello, > > I'm trying to work out how to do some simple comment threading using > PHP. I've overridden the blockquote tag in CSS so that it only indents > from the left. > > At the moment comments are simply displayed in reverse chronological > order as all the replies to a particular post. > > I just can't get my head around how to do the threading. > > I could add an extra column in the comments table, i.e, "repliedto" > which would contain the comment ID of the comment the user replied to, > but that would seem to require some sort of recursion to check whether > or not a comment has a reply, which I'd rather avoid if I can (mainly > because I don't think I'm good enough to pull it off) > > The other idea would be to have a threadID.. hmm... > > table thread: threadID, rootCommmentID, replyCommentID > > Then perhaps every time a user replies to a comment, it adds a row to > the database? > > How can I somehow take the data in the comments and/or thread table and > sort an array of comment data which I can then use to layout the page, > i.e, adding a different level of indent for each "thread"? > > ie: > > originalpost > -comment1/thread1(reply to post) > > --comment2/thread2(reply to comment1) > > ---comment3/thread3(reply to comment 2) > > comment3/thread4(reply to comment 3) > > --comment5/thread1(reply to comment1) > > ---comment3/thread5(reply to comment 2) > > --comment6/thread2(reply to comment1) > > -coment7/thread1(reply to post) > > Thanks for any help/examples. I really just can't get my head around it. > > Beth Gore > -- > http://bethanoia.dyndns.org > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: understanding headers
Where/How do you set $data? Everything else looks fine, but without knowing that we can't help much. On Wed, 11 Dec 2002, Colin Bossen wrote: > Hello: > > I am trying to use the header function to enable users to download > files. I am able to get files to download. Unfortunately, the wrong file > keeps downloading. Instead of downloading the file I want the php source > file is getting downloaded. Here is the posting code: > > $output = " href=\"download.php?name=".$filename."&size=".$size."\">Click here to > download ".$filename.""; > > echo $output; > > Here is the download code: > > if ($name) { > > header("Content-type: application/x-macbinary"); > header("Content-length: $size"); > header("Content-Disposition: attachment; filename=$name"); > header("Content-Description: PHP Generated Data"); > echo $data; > } > ?> > > Any help anyone might have would be much appreciated. > > Colin > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Re: understanding headers
Then you're getting exactly what you should be getting. fopen will read the text file as it appears on *disk* not what the output on your browser is. ?? -philip On Wed, 11 Dec 2002, Colin Bossen wrote: > I add mention that the contents of the download.php file are the > contents of the file I am trying to download... > > > On Wednesday, December 11, 2002, at 06:31 PM, Colin Bossen wrote: > > > Opps... $data is set on the download page. It is set like this: > > > > $path .= "export/".$name; > > $fp = fopen($path, "rb"); > > $data = fread($fp, $size); > > fclose($fp); > > > > Colin > > > > On Wednesday, December 11, 2002, at 06:21 PM, Philip Hallstrom wrote: > > > >> Where/How do you set $data? Everything else looks fine, but without > >> knowing that we can't help much. > >> > >> On Wed, 11 Dec 2002, Colin Bossen wrote: > >> > >>> Hello: > >>> > >>> I am trying to use the header function to enable users to download > >>> files. I am able to get files to download. Unfortunately, the wrong > >>> file > >>> keeps downloading. Instead of downloading the file I want the php > >>> source > >>> file is getting downloaded. Here is the posting code: > >>> > >>> $output = " >>> href=\"download.php?name=".$filename."&size=".$size."\">Click here to > >>> download ".$filename.""; > >>> > >>> echo $output; > >>> > >>> Here is the download code: > >>> > >>> >>> if ($name) { > >>> > >>> header("Content-type: application/x-macbinary"); > >>> header("Content-length: $size"); > >>> header("Content-Disposition: attachment; filename=$name"); > >>> header("Content-Description: PHP Generated Data"); > >>> echo $data; > >>> } > >>> ?> > >>> > >>> Any help anyone might have would be much appreciated. > >>> > >>> Colin > >>> > >>> > >>> -- > >>> PHP General Mailing List (http://www.php.net/) > >>> To unsubscribe, visit: http://www.php.net/unsub.php > >>> > >> > >> > >> -- > >> PHP General Mailing List (http://www.php.net/) > >> To unsubscribe, visit: http://www.php.net/unsub.php > >> > > > > > > -- PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: A little regex help
Why not... $url = ereg_replace("See ([^ ]*) for", "See \1 for", $original_string) or something close to that. On Fri, 13 Dec 2002, Gareth Hastings wrote: > Hi, > > I'm trying to work out the regex needed to split either one of the > following lines > > Windows 2000 Hotfix (Pre-SP4) See Q322842 for more information > Windows XP Hotfix (SP2) See Q327696 for more information > > Into one of these > > Windows 2000 Hotfix (Pre-SP4) See href='http://support.microsoft.com/default.aspx?scid=kb;en-us;Q322842'>Q > 322842 for more information > Windows XP Hotfix (SP2) See href='http://support.microsoft.com/default.aspx?scid=kb;en-us;Q327696>Q3 > 27696 for more information > > I can work out half of the expression but not the other half lol, I've > used a combination of ereg and split but I'm sure this can be done with > 1 ereg statement. Here is my code > > $ms = "http://support.microsoft.com/default.aspx?scid=kb;en-us;";; > > > if (ereg("(\[See )([Q|q][0-9]+)( for more information\])", $name)) > { > $sp = split("\[See ", $name); > ereg("([Q|q][0-9]+)( for more information\])", $sp[1], $qb); > > $url = $sp[0] . "See target='_blank'>" . $qb[1] . " for more information"; > > } > > Any ideas? > > Gareth > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: query join 2 databases? or match up arrays?
Any chance you can do a somewhat frequent export from informix into mysql or the other way around so all your stuff is in one database? -philip On Fri, 3 Jan 2003, Jeff Bluemel wrote: > ok - here's my problem. I have some data in mysql, and other data in > informix. > > here is my application. this is for distributors of prepaid phone cards. > prepaid phone cards have 3 numbers they can be identified by pin number > (which is unique), or by batch & serial number. the batch number is > basically the type of card, and the serial number & batch number for another > unique identifier when used together. > > now - a batch can be given to several different distributors. therefore, > when then are pulling various types of information on the batch they should > only be able to see it for their cards, and not all of the cards in the > batch. > > piece of cake right? well - the permissions information is kept in mysql, > and the batch information its self is kept in an informix database. there > is no way around this for me. > > the only way I can think of to work around this problem is to query 1 card > at a time, and sum the info etc. together. however, there could be 400,000+ > records, and this would be a slow tedious process. plus for each card I'd > have to query the mysql database for permissions, and then in turn query the > informix database in turn. this could take a long time to display the > webpage. > > clear as mud??? recommendations? > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: query join 2 databases? or match up arrays?
Hmm... what about querying the informix database for the set of rows you want all at once, putting that into a temporary mysql table with a timestamp and then doing the rest of your work from there. Then the next time it happens check the timestamp on that mysql table and if it's out of date, delete it and go and fetch updated rows from informix, otherwise just use what's in that mysql table. This would act as a sort of replicated table, but only taking into account the records that are actually being hit... maybe? On Fri, 3 Jan 2003, Jeff Bluemel wrote: > well - the informix database will be running on another server (a telecom > billing system). this is a web based front end, and I really want to leave > the other system alone 100%. if I were to modify anything I would make the > mysql permissions table inside of informix, but there are liability reason > which would keep me from doing so. > > still - you bring up an interesting point. a php script file that ran on > crontab may not be a bad answer. however, again I would run into a problem > of volume. there are an average of 3-4 million card in the informix server > so I couldn't do this in a export & import. too may records, and info has > to be accurate within 15 minutes. shear volume I believe is going to kill > that idea. I would be back to 1 record at a time running every 15 minutes. > I would think too much load, and more practical to do it 1 record at a time > upon request which won't be too frequent. > > hoping there's another solution I'm not aware of, or over looked. > > Jeff > > "Philip Hallstrom" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > Any chance you can do a somewhat frequent export from informix into mysql > > or the other way around so all your stuff is in one database? > > > > -philip > > > > On Fri, 3 Jan 2003, Jeff Bluemel wrote: > > > > > ok - here's my problem. I have some data in mysql, and other data in > > > informix. > > > > > > here is my application. this is for distributors of prepaid phone > cards. > > > prepaid phone cards have 3 numbers they can be identified by pin number > > > (which is unique), or by batch & serial number. the batch number is > > > basically the type of card, and the serial number & batch number for > another > > > unique identifier when used together. > > > > > > now - a batch can be given to several different distributors. > therefore, > > > when then are pulling various types of information on the batch they > should > > > only be able to see it for their cards, and not all of the cards in the > > > batch. > > > > > > piece of cake right? well - the permissions information is kept in > mysql, > > > and the batch information its self is kept in an informix database. > there > > > is no way around this for me. > > > > > > the only way I can think of to work around this problem is to query 1 > card > > > at a time, and sum the info etc. together. however, there could be > 400,000+ > > > records, and this would be a slow tedious process. plus for each card > I'd > > > have to query the mysql database for permissions, and then in turn query > the > > > informix database in turn. this could take a long time to display the > > > webpage. > > > > > > clear as mud??? recommendations? > > > > > > > > > > > > -- > > > PHP General Mailing List (http://www.php.net/) > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: query join 2 databases? or match up arrays?
> actually - I believe that may be a workable solution. you were mentioning > checking the timestamp on a mysql table. how would I check the timestamp on > a mysql table? see the timestamp data type. > even with this I'm betting it would be more time consuming to create the > table then it would to pull the info from informix, and process validation 1 > record at a time from mysql. that would be a simple query instead of an Yeah, but only the first time... if you get a lot of repeat traffic on the same set of rows only the first "hit" will be slow since after that it will all be in mysql... > insert. this would also all take place on the server it's self instead of > pulling it from another server. I could load it up with ram & let it run. > > at any rate that gives me a lot of option to think about, and I'll probably > has to work with some samples of the stuff from here to see what way is > going to be the fastest. it would probably depend if the user was pulling > this info in a session. if it was once, or several times. all something to > think about. > > the other option I'm thinking about is just not giving the distributors > access to this information, but restricting it to users with permissions to > the entire batch only. > > thanks, > > Jeff > > "Philip Hallstrom" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > Hmm... what about querying the informix database for the set of rows you > > want all at once, putting that into a temporary mysql table with a > > timestamp and then doing the rest of your work from there. > > > > Then the next time it happens check the timestamp on that mysql table and > > if it's out of date, delete it and go and fetch updated rows from > > informix, otherwise just use what's in that mysql table. > > > > This would act as a sort of replicated table, but only taking into account > > the records that are actually being hit... > > > > maybe? > > > > On Fri, 3 Jan 2003, Jeff Bluemel wrote: > > > > > well - the informix database will be running on another server (a > telecom > > > billing system). this is a web based front end, and I really want to > leave > > > the other system alone 100%. if I were to modify anything I would make > the > > > mysql permissions table inside of informix, but there are liability > reason > > > which would keep me from doing so. > > > > > > still - you bring up an interesting point. a php script file that ran > on > > > crontab may not be a bad answer. however, again I would run into a > problem > > > of volume. there are an average of 3-4 million card in the informix > server > > > so I couldn't do this in a export & import. too may records, and info > has > > > to be accurate within 15 minutes. shear volume I believe is going to > kill > > > that idea. I would be back to 1 record at a time running every 15 > minutes. > > > I would think too much load, and more practical to do it 1 record at a > time > > > upon request which won't be too frequent. > > > > > > hoping there's another solution I'm not aware of, or over looked. > > > > > > Jeff > > > > > > "Philip Hallstrom" <[EMAIL PROTECTED]> wrote in message > > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > > Any chance you can do a somewhat frequent export from informix into > mysql > > > > or the other way around so all your stuff is in one database? > > > > > > > > -philip > > > > > > > > On Fri, 3 Jan 2003, Jeff Bluemel wrote: > > > > > > > > > ok - here's my problem. I have some data in mysql, and other data > in > > > > > informix. > > > > > > > > > > here is my application. this is for distributors of prepaid phone > > > cards. > > > > > prepaid phone cards have 3 numbers they can be identified by pin > number > > > > > (which is unique), or by batch & serial number. the batch number is > > > > > basically the type of card, and the serial number & batch number for > > > another > > > > > unique identifier when used together. > > > > > > > > > > now - a batch can be given to several different distributors. > > > therefore, > > > > > when then are pulling various types of information on the batch they > > > should > &
[PHP] Re: HEEELP...please
Is register_globals on or off? If it's off on the new machine that explains why $DOCUMENT_ROOT is evaluating to "" which would produce the error message you are getting... On Thu, 9 Jan 2003 [EMAIL PROTECTED] wrote: > I absolutely cannot understand the include_path directive. > Can somebody, please, explain this? > I have a situation that I find absolutely incomprehensible: I moved my > experimental web-site from FreeBSD 4.5 running php4 v. 4.0 (or something), > apache 1.13 where thesite worked just fine to another box with FreeBSD 4.7 > running php4 v. 4.2.3, apache 1.13.27_1. > All of a sudden, I get the message: > Warning: Failed opening '/../lib/somefile.conf' for inclusion > (include_path='.:/usr/local/lib/php') in /usr/local/www/html/index.php on > line 6 > > I can find nothing in the httpd.conf files that could account for this; > there is no configuration in them for include_path. > > Obviously, the php file is being parsed correctly, but there is a problem > with the line : > include "$DOCUMENT_ROOT/../lib/somefile.conf". > > It works on one machine, but not on the latest version of php4 an apache. > > I see there are others on the net who have had this problem, but I have not > yet found an explanation or a cure. > > HELP please, > > PJ > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Persistent global data ?
http://www.php.net/manual/en/ref.shmop.php On Tue, 14 Jan 2003, Mathias Rockel wrote: > Hi all ! > > It seems I did not state exactly enough what I need ... if I use the > $_SESSION functions or write the stuff myself makes no difference, actually > then I can just leave it in the database and read it every time ... but that > is just slow ... I want to create it persistant in the system memory so > every script can access the contents without having to recreate the whole > tree each time ... > > mathias rockel > > - Original Message - > From: "Rick Emery" <[EMAIL PROTECTED]> > To: "Mathias Rockel" <[EMAIL PROTECTED]>; > <[EMAIL PROTECTED]> > Sent: Tuesday, January 14, 2003 3:30 PM > Subject: Re: Persistent global data ? > > > > Write persistent data to a file on server side > > > > - Original Message - > > From: "Mathias Rockel" <[EMAIL PROTECTED]> > > To: <[EMAIL PROTECTED]> > > Sent: Tuesday, January 14, 2003 8:12 AM > > Subject: Re: Persistent global data ? > > > > > > Hi! > > > > I'm not sure if that would be a good idea in respect to performance, also > > AFAIR cookies cannot save objects (can they?), and there are size > > limitations on cookies, so I probably cannot use them because they could > not > > contain all the data ... and also, if I have the complete file structure > > saved on the client side its very easy to modify the data, possibly > getting > > access to stuff that is not meant to be seen ... no cookies =). > > > > thanks anyway ! > > > > mathias rockel > > > > - Original Message - > > From: "Rick Emery" <[EMAIL PROTECTED]> > > To: "Mathias Rockel" <[EMAIL PROTECTED]>; > > <[EMAIL PROTECTED]> > > Sent: Tuesday, January 14, 2003 3:06 PM > > Subject: Re: Persistent global data ? > > > > > > > cookies? > > > > > > - Original Message - > > > From: "Mathias Rockel" <[EMAIL PROTECTED]> > > > To: <[EMAIL PROTECTED]> > > > Sent: Tuesday, January 14, 2003 7:33 AM > > > Subject: Persistent global data ? > > > > > > > > > Hi all ! > > > > > > I am currently writing some kind of Document/File-Library in a LAMP > > > environment. > > > > > > As the library should be able to handle various file types, and most > file > > > types have to be handled differently internally, I would like to use > > > Objects/Classes to make the code for the Library iself independent from > > the > > > stuff that is individual to the different file types. > > > > > > Now I noticed early that when I use Objects in PHP and have to create > many > > > for them each time a script runs it slows the system down considerably. > It > > > seems you can now save objects in sessions which AFAIR was not possible > > last > > > time I tried. But then I would have to read the whole file index (which > is > > > actually a tree) into a session variable for each user, and I don't know > > if > > > thats a good idea performancewise. It would be a rather large > > > multi-dimensional array. > > > > > > So I would like to know if there is any possibility in PHP to create my > > own > > > persistent superglobal, a variable which can be read by any script > > running. > > > I think something similiar is available as the "Application" Object in > ASP > > > under IIS. I know I have to take care of locking and stuff (although the > > > end-user scripts would only need read access to it), but if I could > write > > > some functions which just would check if the tree is already in memory > or > > > not (after a server shutdown or whatever), and if not just read it in > from > > > the database to make it available in every other script. > > > > > > The only thing I've found so far which I think may be a possibility is > the > > > shared memory stuff that PHP supports, but I don't know anything about > > that > > > on the system level, and its not explained in much detail in the PHP > > manual. > > > Is that something I should follow, or can't I use it ? Can I somehow use > > the > > > underlying Apache ? Are there better options ? > > > > > > any help/suggestions/hints are greatly appreciated ! > > > > > > mathias rockel > > > > > > > > > -- > > > PHP General Mailing List (http://www.php.net/) > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP receiving e-mail
You could use fetchmail to get the mail and pipe it into your php script which would see it as standard input... Or look on zend.com for a POP class... On Tue, 14 Jan 2003, David Russell wrote: > Hi all, > > I want to develop a script that can read an e-mail from a pop account, > and then perform actions on that e-mail based on characteristics of the > e-mail (e.g. header information, attachments, etc) > > Does anyone know of a way to receive e-mails via php, and then to parse > them easily. My assumption would be that there should be a class out > there somewhere that handles it well. > > Thanks > > David Russell > IT Support Manager > Barloworld Optimus (Pty) Ltd > Tel: +2711 444-7250 > Fax: +2711 444-7256 > e-mail: [EMAIL PROTECTED] > web: www.BarloworldOptimus.com > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Acessing $DOCUMENT_ROOT
$_SERVER[DOCUMENT_ROOT] On Fri, 17 Jan 2003, Don wrote: > Hi, > > How do I access $DOCUMENT_ROOT when register_gobals is set off? I think > there's an array, something like $HTTP_ENV_VARS['DOCUMENT_ROOT'] but I can't > find it in the documentation. > > Thanks, > Don > > > --- > Outgoing mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.443 / Virus Database: 248 - Release Date: 1/10/2003 > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Cannot show reuploaded image file on page unless manual refresh
I wonder if appending time() would be better... granular to a second and you save the filesystem lookup effort?? On Mon, 20 Jan 2003, Jim Lucas wrote: > I would add the modification time of the file in question with > > filetime($filename); > > that way you will be sure to get a unique argurment. > > Jim > > - Original Message - > From: <[EMAIL PROTECTED]> > To: "Chris Shiflett" <[EMAIL PROTECTED]> > Cc: "Phil Powell" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>; > <[EMAIL PROTECTED]> > Sent: Monday, January 20, 2003 10:48 AM > Subject: Re: Cannot show reuploaded image file on page unless manual > refresh > > > > > > Aha! Something I can chime in on. I happened across the same scenario a > > few months back. The list helped me then so I'll give back. > > > > Call the image using a random identifier. > > > > $rand = rand(1000, ); > > > > echo "http://someurl.com/image.jpg?$rand";; > > > > Since the browser will more than likely not have the image file identified > > by the random number it must request it again from the server. Works > > great where I need it! > > > > Ed > > > > On Mon, 20 Jan 2003, Chris Shiflett wrote: > > > > > --- Phil Powell <[EMAIL PROTECTED]> wrote: > > > > I am using the following header() functions to force > > > > view.php to not cache: > > > > > > > > header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); > > > > header("Last-Modified: " . gmdate("D, d M Y H:i:s") . > > > > " GMT"); > > > > header("Cache-Control: no-store, no-cache, > > > > must-revalidate"); > > > > header("Cache-Control: post-check=0, pre-check=0", > > > > false); > > > > header("Pragma: no-cache"); > > > > > > :-) > > > > > > I think you killed it. > > > > > > > However, when a user reuploads a file in manage.php, it > > > > does a form post onto manage.php and reuploads the file > > > > (which I verified works). However, when redirected via > > > > header() to view.php, they still see their OLD image > > > > file, NOT the new one! Unless I manually refresh the > > > > page, they never see it, until they manually refresh the > > > > page, then the new image file appears! > > > > > > Right. > > > > > > I think you are forgetting that the image is not really > > > part of the PHP resource. Meaning, this is the series of > > > events for a PHP script that refernces a single image > > > called bar.jpg using the tag: > > > > > > 1. HTTP request sent for foo.php (Web client -> Web server) > > > 2. HTTP response sent that includes the output of foo.php > > >(Web server -> Web client) > > > 3. Web client (browser) notices tag referenced in > > >the HTML. > > > 4. HTTP request sent for bar.jpg (Web client -> Web server) > > > 5. HTTP response sent that includes bar.jpg > > > > > > So, the headers that you are setting only matter for the > > > resource returned in step 2. Meaning, the HTML output of > > > foo.php is not cached. The image, since it is returned by > > > the Web server and not your PHP script, is cached. > > > > > > Chris > > > > > > -- > > > PHP General Mailing List (http://www.php.net/) > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: fscanf
Why not: $array = split("[ ,]", $line); ? On Wed, 22 Jan 2003, Kris wrote: > Hi > > I'm having dramers with fscanf > I have a line: > text, text, text > > I can't work out how to scan removing the comma and whitespace. > the text can be absolutle anything. > > at the moment I have > $array = fscanf ($fp, %s%[^,] %s%[^,] %s%[^,]); > > Thanks > > Kris > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Need Coding Help With getdate()
Replace your last line with this... $date = $month . $mday . $year Or take a look at the date() command... something like: $date = date("mdy", time()); would do the same thing (check the man page for sure). On Fri, 24 Jan 2003, Guru Geek wrote: > Hello, > > I'm trying to use getdate() and then create a numeric value based on > putting the month (numeric), the date, and the year all together, side > by side in one variable. > > Here's my code: > $today = getdate(); > $month = $today['mon']; > $mday = $today['mday']; > $year = $today['year']; > > $date = $today['mon'.'mday'.'year']; > ?> > > But all I get is a blank when I look at $date in the browser. Any idea > why that is? > > Thanks in advance, > Roger > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: linux cpu usage
does it hog the CPU and stop other things from running or is it just using 100% of the CPU? If the latter, that's fine. If the former, read the man page for nice or renice (it's renice on freebsd) -philip On Fri, 24 Jan 2003, Gareth Thomas wrote: > Hi all, > > I have a command line PHP script that is in a continous loop to monitor a > particular database event. I am running RedHat 8 and the only problem I am > finding is that it hogs the CPU. I developed the script originally on > Windows and it worked better there. Is there a way to limit CPU resource for > a PHP command line script in Linux? > > Gareth > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: multiple entry forms !!
Use several smaller forms and store the results of each into a session variable. Also store a "got-results-for-form-1" (through 7) that gets set for each of the 7 forms. Once all 7 are set you can do the final processing. Set the action of each form to say "save.php" and pass in a "saving_what" field". save.php can then do a switch on the saving_what field to determine what needs checking/storing/etc. Works good for me. On Mon, 27 Jan 2003, scott wrote: > hi > > looking for some advice > > I have a site in progress. user to it have to enter a LOT of information (it > will contain a club directory) > > in order to try and make it a less unpleasant experience for the user, I > want to give them 7 smaller input forms, each one following the other > > what would be the correct way to do this, one very large, complex coded php > conditional form that does everything, or several smaller ones ? > > if I use one form, it will conatin rather a lot of code, but execution would > all be handled by the form itself > > but if I use multiple smaller forms, each form would need to process the > previous forms input, and then display it's inputs for entry > > I am also using sessions, which adds a little to complexity > > any general good coding practice tips/links would be helpful > > thanks > > _scott > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: output of fread() is blank
I could be wrong, but I'd guess that filesize fails for remote files. If all you're doing is spitting out the text, why not use readfile()? -philip On Mon, 27 Jan 2003, Guru Geek wrote: > Hello, > > I'm a recent convert from CGI/Perl and so am still getting my feet wet > in PHP. > > Here's my code: > $filename = "http://www.myserver.com/include/sometext.txt";; > $handle = fopen ($filename, "rb"); > $contents = fread ($handle, filesize ($filename)); > fclose ($handle); > echo $contents; > exit; > > The problem is nothing shows up, it's a blank browser window. I'm sure > this is a stupid questions and very easily fixed. > > Also, if the text file I'm trying to read is multi lined, shouldnt I be > placing the contents into an array? or is that old cgi habits coming > through? > > Thanks, > Roger > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: mail () format
Something like... $body = "blah blah blah\n"; $body .= "Name = $name\n"; $body .= "Address = $address\n"; $body .= "Comments = $comments\n"; mail("[EMAIL PROTECTED]", "subject", $body); would do it. On Tue, 28 Jan 2003, Bruce Levick wrote: > I have a number of field entries that I am trying to send through to the > body of an email. > > How can I format the mail() command to send these multiple fields. > > EG $name, $address, $comments. All to go into the body of an email. > > Cheers > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP vs Perl for system scripts (non-web)
Unless you've got a compelling reason to switch to Perl, I wouldn't. I like Perl, but like you have used PHP a lot more often in the last couple of years. Where I find it really nice is when my cron scripts need to use the same libraries as my web scripts... -philip On Mon, 27 Jan 2003, Paul Chvostek wrote: > > I have to write a swath of code to manage system-related stuff based on > database content. Scripts will be run as root by cron, and determine > what they have to do via user interaction and SQL lookups. Functions > will include manipulation of system configuration files, legacy text > file configs, and some signalling with posix_kill. On some of the > machines in question, there won't even be an httpd installed, so I'd be > building a php as a standalone binary, and running it with shell magic > and a -q option. I've done this kind of stuff in the past in smaller > environments, and it seems to work nicely. > > I'm more comfortable writing stuff in PHP. I use PHP alot more, and I > find the resultant code more readable and easier to maintain. Aside > from Perl's ubiquity and the dubious advantage of future flexibility by > using Perl's DBI interface to talk to different SQL servers (I'm using > MySQL at the moment), are there any compelling reasons I should write > system stuff in Perl rather than PHP? > > Thanks. > > -- > Paul Chvostek <[EMAIL PROTECTED]> > Operations / Abuse / Whatever > it.canada, hosting and development http://www.it.ca/ > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: __PHP_Incomplete_Class Object
I don't see where you include() your class definition in that second file... add include("nycmgMail.php") right before the session_start() line and see if that makes a difference. -philip On Thu, 30 Jan 2003, Weston Houghton wrote: > > Ok, now I'm frustrated. > > I'm trying to register an object in the session, and access that object > from 2 different pages. > > I start off in the first file, and do: > include("nycmgMail.php"); > session_start(); > $myMailer = new nycmgMail(); > $myMailer->buildRecipients(); > $_SESSION['myMailer'] = $myMailer; > ?> > > If I print_r the $_SESSION on that page, everything looks fine. So I > then move to my second page, and use: > > session_start(); > > $myMailer = &$_SESSION['myMailer']; > if ($myMailer) { > $addressArray = $myMailer->getRecipients(); > } else { > $addressArray = null; > } > > ?> > > Now when I do this, if I look at the $_SESSION object I see that that > class is now listed as: > [myMailer] => __PHP_Incomplete_Class Object > ( > [__PHP_Incomplete_Class_Name] => nycmgmail > ... > > and in the error log I see: > [29-Jan-2003 23:58:09] PHP Fatal error: Unknown(): The script tried to > execute a method or access a property of an incomplete object. Please > ensure that the class definition nycmgmail of the object you are > trying to operate on was loaded _before_ the session was started in > /.../.../.../.../admin/addresses.php on line 6 > > I swear I have done all of this before, but it is just not working now, > and for the life of me I can't see anything right in front of me. > > Help! Please? > > thanks, > Wes > > > > > --- > The selection and placement of letters on this page was > determined automatically by a computer program. Any > resemblance to actual words, sentences, or paragraphs is > pure coincidence, and no liability will be assumed for > such coincidences. > > --- > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: php question - query string
You've got it right... look at the man page for parse_str() for more info on the QUERY_STRING stuff as well as the register_globals configuration option. Looking at the script below, there is nothing special about setting $addjoke to 1. It's just important that it is set to *something* (because of the isset($addjoke) call. You could set it to whatever you want, but setting it to 1 is commonly done to indicate "trueness" or "it's on". You could set it to "yes" if you wanted and the script would work the same. Hope this helps. -philip On Thu, 30 Jan 2003, Anthony Ritter wrote: > The following script is from Kevin Yank's book on page 59-60. (Sitepoint) > > I'd like to get some clarification about the line: (almost next to last line > in the script) > > ... > echo("Add a Joke!"); > > > > He has a link called "Add a Joke!". > > When the user clicks on the link, the same page loads - with the form this > time - and the query string passes the value -1 - to the variable $addjoke. > > Am I on the right track? > > If so, why does 1 - as opposed to 2 or something else - have to be the > name/value pair if the user is adding another joke? > > Thank you. > TR > .. > > > > The Internet Joke Database > > >if (isset($addjoke)): // If the user wants to add a joke > ?> > > > Type your joke here: > > > > >else: // Default page display > > // Connect to the database server > $dbcnx = @mysql_connect("localhost", "root", "mypasswd"); > if (!$dbcnx) { > echo( "Unable to connect to the " . > "database server at this time." ); > exit(); > } > > // Select the jokes database > if (! @mysql_select_db("jokes") ) { > echo( "Unable to locate the joke " . > "database at this time." ); > exit(); > } > > // If a joke has been submitted, > // add it to the database. > if ($submitjoke == "SUBMIT") { > $sql = "INSERT INTO Jokes SET > JokeText='$joketext', > JokeDate=CURDATE()"; > if (@mysql_query($sql)) { > echo("Your joke has been added."); > } else { > echo("Error adding submitted joke: " . > mysql_error() . ""); > } > } > > echo(" Here are all the jokes in our database: "); > > // Request the text of all the jokes > $result = @mysql_query("SELECT JokeText FROM Jokes"); > if (!$result) { > echo("Error performing query: " . mysql_error() . ""); > exit(); > } > > // Display the text of each joke in a paragraph > while ( $row = mysql_fetch_array($result) ) { > echo("" . $row["JokeText"] . ""); > } > > // When clicked, this link will load this page > // with the joke submission form displayed. > echo("Add a Joke!"); > > endif; > > ?> > > > > -- > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: exec() in safe mode
Add the directory that contains the script you want to run to safe_mode_exec_dir (check the docs to confirm this) -philip On Tue, 4 Feb 2003, [ISO-8859-2] Bc. Radek Krejèa wrote: > Hello, > > I need use function exec or backtick operator, but i have PHP in > safe mode. I need use it only for one virtual host in Apache. > > How can I do it without disabling safe mode. > > Thanks > Radek > > -- > Regards, > Bc. Radek Krejèa > Starnet, s. r. o. > [EMAIL PROTECTED] > http://www.ceskedomeny.cz > http://www.skdomeny.com > http://www.starnet.cz > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Bi-weekly pay period
> I'm writing a quick little thing to act as a time clock since people are > writing out by hand and it's not so accurate. It's basically click a button > to clock in and click a button to clock out. > > What I also want to do is create a report (well I've already created the > report) but I want to limit it to the current pay period. Our pay periods > are biweekly. I was trying to think of a smart way to have php figure out > what the current pay period is and I'm having a hard time figuring out if > this is even possible or should I just tell it a years worth of pay period > ranges for now. > > I figure something like, if the week # is even, use this past Sunday as the > start date. If the week # is odd use the Sunday of the week before. Then > figure out what date is 2 saturdays after whatever Sunday was selected. That seems very doable... look at the date() function, in particular the options to return week number, day of week (0-6), etc. Then it's just some conditionals, and substractions to get back to the right sunday, and then add 14 (or is it 13?) days to get the right saturday. Just remember to do it all the math as the number of seconds since 1970 (look at time() and strtotime()) and you'll be fine. -philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: reading file into a keyword-indexed array
You could just serialize $param and write it out to a file then read it back in and unserialize it... simpler in PHP... not sure whether it's more efficient or not. On Tue, 4 Feb 2003, Durwood Gafford wrote: > I would like to read and write user-settings to a keyword-value file and be > able to extract it. The following code works fine but i wondered if there > was a more elegant/direct way of doing this. > > -Durwood > > $file = "user_settings.txt"; > > // Read user settings from file if it exists, otherwise set to defaults and > // save them ... a separate method exists for users to change their > settings. > if ($is_readable($file)) { > $parm = read_defaults($file); > } else { > $parm['method'] = "bsort"; > $parm['tsize'] = 200; > $parm['per_row'] = 5; > $parm['sortby'] = "last_name"; > $parm['order'] = "ascending"; > write_defaults($file, $parm); > } > > // Read keyword-value pairs from file into array > function read_defaults($default_file) { > $fp = file($default_file); > foreach ($fp as $line) { > $line = trim($line); > list ($key, $value) = explode(" ", $line); > $param[$key] = $value; > } > return $param; > } > > // Write keyword-value pairs from array > function write_defaults($default_file, $param) { > $fp = fopen($default_file, "w"); > while (list($key, $value) = each ($param)) > fwrite ($fp, "$key $value\n"); > fclose($fp); > } > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: How do I force a 'timeout' in a loop for that itteration, orconversley how to timeout a 'ping" request?
Not sure on linux, but on freebsd ping's man page says: -t timeout Specify a timeout, in seconds, before ping exits regardless of how many packets have been recieved. On Fri, 7 Feb 2003, Daevid Vincent wrote: > I'm trying to automate finding pingable domains given an IP or a domain. > The problem is that some domains don't actually return "pings", and on > Linux, it just sits there forever (ugh!). So... Can someone tell me how > to 'abort' or 'timeout' an itteration of a loop. Maybe start a timer and > then check if a number of millis has gone by? But it seems that won't > work b/c PHP isn't threaded, it will just hang at the exec() command > right? Converseley, anyone know how to force a /bin/ping to > automatically timeout (sans hitting CTRL+C)? I 'man ping' but it didn't > seem to have that option. > Here is the code I'm using... > > $typeArray = array ( 'www' => false, > 'ftp' => false, > 'mail' => false, > 'exchange' => false, > 'owa' => false, > 'dns' => false, > 'dns1' => false, > 'dns2' => false, > 'dns3' => false, > 'router' => false, > 'firewall' => false, > 'fw' => false, > 'fw1' => false, > 'sql' => false, > 'db' => false, > 'database' => false, > 'crm' => false > ); > > reset($typeArray); > while ( list($key, $val) = each($typeArray) ) > { > $testDomain = $key.".".$domain; > $pingtest = exec("/bin/ping -c 1 -q ".$testDomain); > //echo "pingtest of ".$testDomain." = > ".$pingtest."\n"; > if ( strstr($pingtest,"rtt min") ) > { > $typeArray[$key] = gethostbyname($testDomain); > echo " VALUE='".$typeArray[$key]."' CHECKED>".$testDomain." > (".$typeArray[$key].")\n"; > $ipCounter++; > } > //sleep(3); > } > if ($ipCounter == 0) > echo "No pingable domains found in our test > list"; > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Array sorting
never done it, but check out: http://www.php.net/manual/en/function.array-multisort.php On Sat, 8 Feb 2003, Zydox wrote: > My question is if anyone have any idé on how to sort this array so that the > names and ages are sorted after Close Friend, Friend, Wife and last > Family... > > $A[] = array ("Nils", "23", "Friend"); > $A[] = array ("Emma", "21", "Friend"); > $A[] = array ("Cassie", "21", "Wife"); > $A[] = array ("Zydox", "23", "Friend"); > $A[] = array ("Patrick", "24", "Close Friend"); > $A[] = array ("Kalle", "40", "Family"); > $A[] = array ("John", "10", "Close Friend"); > $A[] = array ("Anna", "12", "Friend"); > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Anyone? more info...
That is the right answer though... along with the various magic_quotes flags in the configuration. You need to look at your existing settings and then create a simple test where you type in something such as: x'x"x\x and then spit it out and save it and generally see at what point slashes are being added. There's a couple of ways to do it... put slashes in automatically, strip them on display don't do it automatically, add them before insertion to a database but which one is easiest for you depends on your sites configuration and what code you've already written, etc... -philip On Mon, 10 Feb 2003, Shawn McKenzie wrote: > Is more info needed, or was everyone just going post replies like: > > "see stripslashes() and htmlentities()" > > *** > > I have a form and I want the user to be able to enter html in a text area. > This will then be stored in an array in a config file. Example > $htmlstuff[1] = '
[PHP] Re: $$ Variable?
Check the manual for sure, but assuming: $cookie = array("foo" => "bar", "red" => "blue") once this is done you'll have the following variable defined: $foo = "bar"; $red = "blue"; I think that's how it works anyway. On Wed, 12 Feb 2003 [EMAIL PROTECTED] wrote: > I'm trying to piece apart someone's code to see exactly what it is they're > trying to do - This code was written for PHP 3.x, so it's not quite as > nice as 4 (with $_POST, $_GET, $_SESSION, etc). There's this one part in > particular that I have no idea what's trying to be done: > > if (isset ($cookie)) { >while (list ($name, $value) = each ($cookie)) { > $$name = $value; > } > } > > I'm assuming the $cookie array has cookie info stored in it, and it's > trying to pull the data out of the array. The 2 parts of this I don't > really understand are lines 2 and 3, 3 in particular. I'm guessing it's > assigning $name the index, $value the element - What's really stumping me > here though is the $$name = $value. What is a variable with $$ in front > of it signify, and what is this trying to do? Any thoughts on this one? > Thanks. > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: MD5 Password Login Driving me Crazy
see the trim() function... not sure if that will solve your problem, but that's the function you're looking for. On Mon, 17 Feb 2003, Vernon wrote: > For what ever reason I cannot seem to get a user to login using MD5. The > user creates the password on log and it works fine, password encrypted and > all. I test to see if the process is working ok on creation by using the > > UPDATE penpals SET password = MD5(password) > > and the encrypted passwords match. > > When the user goes to login into the page though I have the encrypted > password echo to the page and they match except a 52 on the end of it which > I am assuming is a space or something being picked up on submit or > something. I recall there is a way to trim the field so that it doesn't pick > up spaces but can't recall what it is. Anyone know what it is and if it > could be that? > > Thanks > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: sending uploaded images as mail attachments
http://www.phpguru.org/mime.mail.html makes it pretty easy. On Wed, 19 Feb 2003, David Feldman wrote: > I'm working on a script that allows the user to upload several images, > then base64 encodes them and attaches them to an email to me. I'm > having trouble getting the images readable on the other end. I've > managed to get all the MIME types and message parts straight enough to > be recognized as separate parts and as files of the proper types > (though mostly by trial and error, and it's not quite working 100% > yet), but the images aren't readable. Can anyone help? Is there an > example somewhere? I'm guessing I'm just not formatting the email or > inserting the encoded images quite right. > > Thanks. > > --Dave > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Date/Time Logic
Store the timestamp of their first login to a database. Also store the number of days (3, 90, 365) that there account is valid. Setup a script to nightly go through the database and for any records where: first_login_timstamp + number_of_days < right_now is true invalidate their login and send notifications. Pretty easy to do with the date/time functions in any database. Of if you can't use a database like that, store it all as numbers (timestamps - number of seconds since 1970...) and just do the math with 86400 seconds equalling one day. good luck! On Wed, 19 Feb 2003, Pushpinder Singh Garcha wrote: > Hello Everyone, > > My php/mysql application needs to keep track of the first time that a > User logs on to the site. Afterwards the User should be allowed either > 3 days / 3 months/1 year of access to the site. Once the stipulated > time period is over the system should invalidate the login of the user. > The Admin/ User should get email notification about this. The > notification part is easy the hard part to figure out is how to be able > to keep and tab on the Time Period stipulated for a user. > > Thanks in advance > Pushpinder Singh Garcha > _ > Web Architect > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Getting PHP to handle other HTTP methods
If you're using apache you can do it by twiddling with the Action and Handler configuration options... -philip On Thu, 20 Feb 2003, Sam Minnee wrote: > Hi, > > I want to get PHP to handle the HTTP methods PROPFIND, PUT, DELETE, MKCOL, > RENAME, MOVE, and COPY. I've coded up a WebDAV server in PHP to do things > that mod_dav cannot (store content in a database or filesystem, call event > handlers, filtering the file list, more sophisticated permission > configuration on new folders and files) > > Currently it's running as a standalone app, using xinetd, but I want to try > and get it to run within apache so that I can use the same port, and for > efficiency and security reasons. > > I figured that if I have rewrite rule that changed /dav/(anything) into > /dav/mydav.php?uri=(anything) I would be on my way. However, seems to only > sends the GET and POST methods to the script. I'm using mod_php, not the > standalone w/ a handler. > > Is is possible to send the extra WebDAV methods to the PHP script? > > Thanks, > Sam > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Derive bottom-most dir from string???
see the basename() function On Thu, 20 Feb 2003, Shawn McKenzie wrote: > Is there an easy way to derive the bottom-most directory from a string > containing a path? > > Example: $somepath = "html/testsite/templates/shopping"; > > Becomes: "shopping" > > TIA > -Shawn > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Forms and MySql date
You could use the TO_DATE function to convert that text string into a date, or reformat it in PHP to -mm-dd which mysql will take automatically (at least I think so) On Thu, 20 Feb 2003, Mike Tuller wrote: > I have a form that I want to enter a date into a MySql database. I > currently have the column in the database set as Date, and can't seem > to get the date I enter into the text field to go into the database > using the format yymmdd. I could change the column to varchar, and then > it would enter, but this will be a database that I want to keep track > of purchases, and if it is entered in as text, I wouldn't be able to do > calculations such as showing how old something is. > > How can I have a text field where a person enters the date and have > that information entered into the database? > > Mike > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: $_POST arrays not evaluated in sql statement -- why?
Try sql = ".'" . $_POST['jersey_id'][$x] . "',. Also make sure you're form is being submitted with POST and not GET... -philip On Tue, 25 Feb 2003, CF High wrote: > Hey all. > > Got a problem with this sql statement -- php vars are evaluated (e.g. the > $date var), but not the $_POST arrays.. > > All of the arrays return correct values -- What am I missing here? > > $sql = "INSERT into rosters (school_id, sport_id, date, jersey_id, first, > last, position, grade, town, state, country, height, weight, DOB) > VALUES > ('1','1','$date','$_POST['jersey_id'][$x]','$_POST['first'][$x]','$_POST['la > st'][$x]','$_POST['position'][$x]','$_POST['grade'][$x]', > > '$_POST['town'][$x]','$_POST['state'][$x]','$_POST['country'][$x]','$_POST[' > height'][$x]', >'$_POST['weight'][$x]','$DOB[$i]')"; > > I still have some hair left on my head.. > > --Noah > > -- > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: date, "first of next month"?
> On Wed, 26 Feb 2003, 1LT John W. Holmes wrote: > > |You would think strtotime("first of next month") would work, but it doesn't. > |This does: > | > |$t = mktime(0,0,0,date('m')+1,1,date('Y')); > | > |Gives you timestamp of first day, next month. Format accordingly with > |date(). > > Thats great, worked perfectly! Thank you very much :) > > Heres a tough one, is there such a say to now get the date of the first > weekday after that date? Use the w option of date() and loop through adding 86400 to $t until you get to a number between 1 and 5. w - day of the week, numeric, i.e. "0" (Sunday) to "6" (Saturday) -philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Restate: using php to rotate ad banners
> > The other problem is that if I open two browser > > windows to your site, one after the other, and see > > two banners, and then click on the first one, am > > I going to go to the site for the second one? > > Yes, that is one of the main problems. Would using > sessions help end this? No, since sessions is usually just a cookie that points to somewhere with more data... The easiest thing would be to use PHP to dynamically re-write the page so both the image and link reference the same "thing". You can use an iframe to do this pretty easily... good luck. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Bitwise operator question
Here's how I think about it... CREATE_RECORDS = 1 in decimal and 0001 in binary. ALTER_RECORDS = 4 in decimal and 0101 in binary. that line returns a binary string where *any* of the bits are 1, so line them up: 0001 | 0101 = 0101 which is 5. On Mon, 3 Mar 2003, Dan Sabo wrote: > Hi, > > I'm reading the description of Bitwise Operators on page 81 of "Professional > PHP 4", the Wrox book. In the highlighted example on that page, the line of > code... > > $user_permissions = CREATE_RECORDS | ALTER_RECORDS; > > the description in the book says that this line is building a set of user > permissions out of the previously created constants with the OR operator (I > understand what OR means). The value of $user_permissions is set to either > 1 or 4, which is in fact 5 (0101). But how is this single line doing that? > The explanation was cryptic (to me). > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] RE: Bitwise operator question
Yes. Oops. -philip On Mon, 3 Mar 2003, Dan Sabo wrote: > Hi Phillip, > > Don't U mean > > 0001 > | 0100 > = 0101 > > ? > > Dan > > -Original Message- > From: Philip Hallstrom [mailto:[EMAIL PROTECTED] > Sent: Monday, March 03, 2003 2:33 PM > To: Dan Sabo > Cc: [EMAIL PROTECTED] > Subject: Re: Bitwise operator question > > > Here's how I think about it... > > CREATE_RECORDS = 1 in decimal and 0001 in binary. > ALTER_RECORDS = 4 in decimal and 0101 in binary. > > that line returns a binary string where *any* of the bits are 1, so line > them up: > >0001 > | 0101 > = 0101 > > which is 5. > > On Mon, 3 Mar 2003, Dan Sabo wrote: > > > Hi, > > > > I'm reading the description of Bitwise Operators on page 81 of > "Professional > > PHP 4", the Wrox book. In the highlighted example on that page, the line > of > > code... > > > > $user_permissions = CREATE_RECORDS | ALTER_RECORDS; > > > > the description in the book says that this line is building a set of user > > permissions out of the previously created constants with the OR operator > (I > > understand what OR means). The value of $user_permissions is set to > either > > 1 or 4, which is in fact 5 (0101). But how is this single line doing > that? > > The explanation was cryptic (to me). > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: query strings
Spaces usually get converted to %20 when passed around in urls... take a look at the urldecode() and parse_str() functions... http://www.php.net/manual/en/function.urldecode.php http://www.php.net/manual/en/function.parse-str.php On Mon, 3 Mar 2003, Sunfire wrote: > i have a might i say a very very large/long query string i have to run to > pass variable values from one page to another with a button... the button > works and the query string are passing variables right but at the end of the > query string (it passes like 21 variable values) the last variable content > that gets passed gets messed up.. i mean if i have like this: > page.php?.&edit_company=$company > so lets say company has the value of "hi world" in it.. the value is > supposed to be passed with "hi world" but for some reason i keep getting > "hi%20world" instead of "hi world" > > any reason for that.. if you need i can post my query string and button code > > > > > --- > Outgoing mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.458 / Virus Database: 257 - Release Date: 2/24/2003 > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] RE: RE: Bitwise operator question
Yes... it is the | operator that is doing it. >From the man pages: $a & $b And Bits that are set in both $a and $b are set. $a | $b Or Bits that are set in either $a or $b are set. So, let's say: $a = 5; # 0101 $b = 3; # 0011 Then: $a & $b 0101 & 0011 = 0001 (1) and $a | $b 0101 & 0011 = 0111 (7) does that help? It's not *summing* the values... although in your case it looks like it is... it's OR'ing them. On Mon, 3 Mar 2003, Dan Sabo wrote: > Thanks Philip, > > OK I understand the binary thing but that line, I just don't see it, It's > not the or operator that's summing up the two binary values is it? > > Dan > > -Original Message- > From: Philip Hallstrom [mailto:[EMAIL PROTECTED] > Sent: Monday, March 03, 2003 3:53 PM > To: Dan Sabo > Cc: [EMAIL PROTECTED] > Subject: RE: Bitwise operator question > > > Yes. Oops. > > -philip > > On Mon, 3 Mar 2003, Dan Sabo wrote: > > > Hi Phillip, > > > > Don't U mean > > > > 0001 > > | 0100 > > = 0101 > > > > ? > > > > Dan > > > > -Original Message- > > From: Philip Hallstrom [mailto:[EMAIL PROTECTED] > > Sent: Monday, March 03, 2003 2:33 PM > > To: Dan Sabo > > Cc: [EMAIL PROTECTED] > > Subject: Re: Bitwise operator question > > > > > > Here's how I think about it... > > > > CREATE_RECORDS = 1 in decimal and 0001 in binary. > > ALTER_RECORDS = 4 in decimal and 0101 in binary. > > > > that line returns a binary string where *any* of the bits are 1, so line > > them up: > > > >0001 > > | 0101 > > = 0101 > > > > which is 5. > > > > On Mon, 3 Mar 2003, Dan Sabo wrote: > > > > > Hi, > > > > > > I'm reading the description of Bitwise Operators on page 81 of > > "Professional > > > PHP 4", the Wrox book. In the highlighted example on that page, the > line > > of > > > code... > > > > > > $user_permissions = CREATE_RECORDS | ALTER_RECORDS; > > > > > > the description in the book says that this line is building a set of > user > > > permissions out of the previously created constants with the OR operator > > (I > > > understand what OR means). The value of $user_permissions is set to > > either > > > 1 or 4, which is in fact 5 (0101). But how is this single line doing > > that? > > > The explanation was cryptic (to me). > > > > > > > > > > > > -- > > > PHP General Mailing List (http://www.php.net/) > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: deciperhing oop
Haven't evaluated the below thouroughly, but in your setDBase() function be sure to use $this->db instead of $db (which is undefined). -philip On Mon, 3 Mar 2003, Larry Brown wrote: > Can someone who is used to using php oop help me figure out why this fails? > I know there are probably a thousand classes already designed to do this and > probably 100 times more efficient, but this is how I learn. From what I've > read this should work but there is obviously something I'm missing. > > Quick problem description: > Trying to set up class to connect to mysql db. Already used a procedural > test successfully connecting to db. Error is displayed as... > > Warning: mysql_select_db(): supplied argument is not a valid MySQL - Link > resource in /var/www/html/oop.php on line 67 > Database Selection to main failed. > > Code: > > Class dbConnect > { > var $machine; > var $port; > var $user; > var $password; > var $query; > var $result; > var $dbase; > var $db; > var $sel; > > function dbConnect($machine,$port,$user,$password) > { > $this->machine = $machine; > $this->port = $port; > $this->user = $user; > $this->password = $password; > > $db = mysql_pconnect ("$machine","$user","$password") > if (!$db) > { > die ("Initial connection to DB failed.") > } > $this->db = $db; > } > function setDbase($dbase) > { > $this->dbase = $dbase; > > $sel = mysql_select_db("$dbase",$db); > if(!$db) > { > die ("Database Selection to $dbase failed."); > } > } > } > > $dbn = new dbConnect("localhost","3306","bob","hjhyt4kl5"); > > $dbn->setDbase("main"); > > > > > > > So why can't I use $db? Isn't the statement $this->db=$db making it > available to the setDbase function? > > Larry S. Brown > Dimension Networks, Inc. > (727) 723-8388 > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP & NNTP w/o IMAP?
http://php.resourceindex.com/ search for NNTP. On Tue, 4 Mar 2003, Mike Walsh wrote: > I am looking for some PHP code that implements an NNTP interface that > doesn't require IMAP. > > I do not need a full featured NNTP implementation and it only needs to > support read access. If anyone knows of such a thing I would greatly > appreciate a pointer. My Google searches have not turned up anything to > date. I am trying to retrieve the newest 10 articles a newsgroup and > display it as part of a web page. > > Thanks, > > Mike - mike_walsh at mindspring dot com > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Date Question.
Strip off the H:i:s part using explode() and use date() to get an equivalent string for right now and if they match, today's the day. On Wed, 5 Mar 2003, Sebastian wrote: > I have a date field in mysql in this format: Y-m-d H:i:s > > I would like to echo "Today" if the date is today, can someone offer some > help? Thanks. > > warm regards, > Sebastian - [BBR] Gaming Clan > http://www.broadbandreports.com > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: google, php-created pages and link farm exclusion
If you're using apache you could look into the PATH_INFO aspects... basically converting URLS like: domain.com/path/to/page.php?id=3 to domain.com/path/to/page.php/id=3 then using PATH_INFO and substr() and parse_str() to get to $id = 3.. and you can always add more stuff so it looks like plain html by doing: domain.com/path/to/page.php/id=3-foo.html It does mean changing your code and checking relative links (or using ), but it does work. -philip On Wed, 12 Mar 2003, Chris Hayes (SENSE) wrote: > dear list, > > 1) Currently Google cannot find all pages on my site because most pages are > linked through database-generated selection boxes. Most pages have URL's > with different query strings after index.php. > > 2) I have made shortcut links possible such as mydomain.org/page/37 and > mydomain.org/person/jones. > > 3) I considered making a database-created page, maybe called links.php, > with a list of all currently active pages, straight html links. > > But will that work? I heard that Google has a policy to block so-called > 'link farms'; pages cramped with links, aimed to increase page ranking. > Would that exclusion also be used when the links are only for my own site? > > My most important goal is that if someone looks for [Jones soil research], > they do see a link to the page of Jones. Ranking is not that important. > > If possible please support your opinion with examples/facts/links. > thanks, > > Chris > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: How to break out of nested loops
http://www.php.net/manual/en/control-structures.break.php -philip On Mon, 17 Mar 2003, Bix wrote: > I have a for loop within a for loop, and need to break out of both > together... > > for ( blah ) { > for ( blah ) { > if ( true ) { break; } // only breaks out of this loop, how can I break it > out of both loops. > } > } > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Which is quicker, if-else statements
> Is it just as quick to do: > > if($r == 0) { > } else if($r != 0) { > } > > than to do: > > if($r == 0) { > } else { > } > > The reason I like the former method is because, in a large IF-ELSE > block, it's clear what belongs to what IF and what's going on. But does > this make it lag? And, if so, is it really all that noticeable? I don't know which is actually quicker, but I would guess that the first case would take longer since it PHP has to evaluate "$r != 0" instead of just doing whatever is in the "else { ... }" clause. If you want clarity, why not: if($r == 0) { ... } else { // $r != 0 } that gets you the clarity, but keeps PHP from having to evaluate it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: date problem
Try: $ts = time(); $i = 0; while( $i < 2 ) { $day = date("dS", $ts + $i * 86400); print("$day"); $i++; } On Wed, 19 Mar 2003, shaun wrote: > hi, > > using date(dS); how can i can increase the days so that it shows > > 19th 20th 21st > > I have tried > > while ($i < 2){ > $day++; > echo' '.$day.''; > $i++; > } > > but i get: > > 19th 19ti 19tj > > thanks for your help > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Formatting code.
here's one. http://utvikler.start.no/code/php_coding_standard.html google will probably find a lot more... maybe not all PHP specific, but still relevant. On Wed, 26 Mar 2003, Philip J. Newman wrote: > Is there any documents on how code should be layed out? > > > -- > Philip J. Newman. > Head Developer > [EMAIL PROTECTED] > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] RE: Mac IE File download problem - any solutions?
You might try... header("Content-Disposition: attachment; filename=$filename"); maybe? On Tue, 25 Mar 2003, Daniel Leighton wrote: > Actually, I think you may have misunderstood. On Mozilla (Mac), Netscape (Mac) and > Safari the script works exactly as I have intended: sending the "Content-Type: > application/octet-stream" header causes the file to download; sending the > "Content-Type: video/quicktime" causes the file to be played within the browser. On > IE (Mac OS X), some files with the .mov extension download when the "Content-Type: > application/octet-stream" header is sent, while others play in-browser, while all > play in-browser, as they should. > > From what I understand, "Content-Type: application/octet-stream" header should > ALWAYS cause a download. This is not an issue of post-processing (the settings in > the browser which tell it to open a file in a certain application AFTER the file has > been downloaded - that is not a problem). BTW, even if I change my preferences in > IE to save .mov files to disk, they still play in-browser. > > After re-compiling PHP with mime-magic enabled, the mime_content_type() function is > returning "video/quicktime" for the file which does not download and "text/plain" > for the one which does (even though the "text/plain" file plays fine both in-browser > and once it is downloaded). In any case, that will be my next area of investigation. > > At 12:03 PM -0800 on 3/25/03, Jennifer Goodie wrote: > > > >This is not a MAC IE problem, it is the way browsers work. If the MIME type > >is mapped to an application, the browser will launch the application. IE > >does it inline, while Netscape tends to launch it separately. > > > >You can send false headers with a made up type and a missing file extension, > >but then the browser will not know what type of file it is and the save as > >is harder for the user as they have to put the right extension on. It is a > >work around, but a really poor one. > > > >header("Content-disposition: filename=$filenamewithoutextension"); > >header("Content-type:reallyreallyreallybigcsv"); > > > > > > > > > >-Original Message- > >From: Step Schwarz [mailto:[EMAIL PROTECTED] > >Sent: Tuesday, March 25, 2003 11:49 AM > >To: Daniel Leighton; [EMAIL PROTECTED] > >Subject: Re: Mac IE File download problem - any solutions? > > > > > >[...] > >> The problem: When downloading certain files on a Mac using IE 5.x, files > >are > >> displayed within a browser window instead of downloading. This seems to > >occur > >> mostly with quicktime files (.mov, .mp3). Some quicktime files work, > >while > >> others with the same extension do not. > >[...] > > > >Hi Daniel, > > > >I believe this is a browser setting, is it not? Using the default setup of > >Explorer 5.2 for Mac, a clicked .mov file will play in IE. > > > >To change this behavior, go to Explorer > Preferences... > File Helpers, > >select QuickTime Movie and click Change... then switch Handling from "View > >with Browser" to "Save to File". > > > >I would be surprised if a file header could override this.. but if you find > >a way, please let us know! > > > >-Step > > > > > > > >-- > >PHP General Mailing List (http://www.php.net/) > >To unsubscribe, visit: http://www.php.net/unsub.php > > > -- > > Daniel Leighton > Chief Technology Officer > Webolution > http://www.webolution.com > > This email may contain material that is confidential and privileged for the > sole use of the intended recipient. Any review, reliance or distribution > by others or forwarding without express permission is strictly prohibited. > If you are not the intended recipient, please contact the sender and delete > all copies. > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: directory size?
If you are on unix take a look at the "du" command. On Thu, 3 Apr 2003, Mantas Kriauciunas wrote: > Hey > I looked up in the manual but found only > Disk_total_space > Disk_free_space > > Is there anything like total_space for directory? > Or I will have to think of something else? > Like counting every file size and adding it to total. > But if there is like 1000 files with directories in the main directory. > It will take time to count files from all the directories and output > total size of the main directory. > > I hope I didn't make it sound too confusing:) > Thanks for any help! > Mantas Kriauciunas > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP Rounding Time
I haven't quite thought this through, but I think something like this: $remainder = $ts % 60; if( $remainder < 15 ) { $ts = $ts - $remainder; }else if( $remainder > 15 && $remainder < 30 ) { $ts = $ts + (30 - $remainder); }else if( $remainder > 30 && $remainder < 45 ) { $ts = $ts - ($remainder - 30); }else if( $remainder >= 45 ) { $ts = $ts + (60 - $remainder); } something close to that I think... On Fri, 4 Apr 2003, Jay Fitzgerald wrote: > I apologize in advance for my constant nub questions.. > > How can I round the current time up or down to the nearest 1/2 hour? > > eg: > timeranges: > > 0900 through 0915 == 0900 > 0916 through 0930 == 0930 > 0931 through 0945 == 0930 > 0946 through 1000 == 1000 > > > Jay Fitzgerald, Design Director > Bayou Internet - http://www.bayou.com > Toll Free: 888.30.BAYOU (22968) > Vox: 318.338.2034 / Fax: 318.338.2506 > E-Mail: [EMAIL PROTECTED] > ICQ: 38823829 / AIM: bayoujf / MSN: bayoujf / Yahoo: bayoujf > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Found a bug in 4.2.3 re: and echo vs.
It's a coding error... at least I think so. change alarmLightMySQL just return the results not "echo" them... echoing them doesn't make much sense inside another echo statement... On Fri, 4 Apr 2003, Daevid Vincent wrote: > Here, try this bullshit... > > I can't upgrade to a more recent version as I'm not in control of the > server, but I've tried it with both 4.1.2 and 4.2.3 on linux with a RH > install. Can anyone confirm or dispute this bug exists in later versions? > > How does a parsing error like this go un-noticed for so long? > > Obviously I took out all the interesting stuff in the page and so that can't > be blamed. This is about as bare skeleton test case as you can get. > > *sigh* > > snip > >function alarmLightYMD() > { > return ""; > } > > function alarmLightMySQL() > { > echo alarmLightYMD(); > } > ?> > > > FUCKED UP PHP Bug #1234170238741023 > > > > PHP Version 4.1.2 > PHP Version 4.2.3 > > Why the FUCK doesn't this work > > > for ($i = 0; $i < 10; $i++ ) { >echo ""; > echo "".alarmLightMySQL().""; > echo "this fails!"; >echo ""; > } > ?> > > > > > YET THIS DOES! > > > > > > this works > > > > > > > snip > > > > "Ezekiel 25:17. The path of the righteous man is beset on all sides by the > inequities of the selfish and the tyranny of evil men. Blessed is he who in > the name of charity and goodwill shepherds the weak through the valley of > darkness, for he is TRULY his brother's keeper and the finder of lost > children. And I will strike down upon thee with GREAT vengeance and > FU-U-U-URIOUS anger, those who attempt to poison, and destroy my brothers! > And you will KNOW my name is the Lord, when I lay my vengeance upon thee!" > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: ORDER BY from 2 tables
See if your database supports the UNION clause... On Mon, 29 Jul 2002, Georgie Casey wrote: > i assume this is a simple question... > > how can I SELECT * FROM 2 different tables in the same query, ORDER BYing > the 'hits' column, which both tables have. > > eg, 2 tables i have are similiar and i want to merge them and then select > everything ordering by hits > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: attachements in mail()
You can't (in the sense that there's an $attachment argument), but I've seen several classes that will let you do it. Check zend.com and php.resourceindex.com for the classes. On Thu, 1 Aug 2002, Danny wall wrote: > I've looked, and can not find out how you send attachments using the mail() > function. I find it difficult to believe that this was left out, so > obviously I'm missing something right in front of my face. > > So my question is, how do you send attachments using the mail() fucntion? > > -Danny > "You are stupid." > Dexter of Dexter's labratory > > Yes, I watch Dexter ... you got a problem with that! :-) > > > _ > Chat with friends online, try MSN Messenger: http://messenger.msn.com > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: randomize etc?
split should work fine... Just do something like: $teamMembersArray = split(" ,;", $textarea); That will give you an array of the team members. Of course I'm assuming that their names don't include spaces and that you'll separate them with either a space, comma, or semi-colon. And you'll want to get rid of any newlines in $textarea as well. -philip On Thu, 1 Aug 2002, Hawk wrote: > I'm trying to make a small script that I can use for randomizing teams and > stuff, I have one field where I enter how many teams, one for how many in > each team, and a to write down all the players in. This is where > my brain stopped working, first I was thinking about using split, but I > don't know how when there isn't a predefined number of variables to split it > into, how do I do this? > > and when I have separated them into variables, how do I put them into > arrays? > or maybe that's not a good way to do it? I don't know, and the heat in my > room is killing me, can't think clearly :) > > Håkan > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: problems with random again
No... that wouldn't really be random then would it? :) But you could always keep track of the previous random numbers and if you've seen it ask for another one. On Thu, 1 Aug 2002, Hawk wrote: > Is there some easy way to make rand() only use each number once in a loop, > to avoid getting the same values more than once? > > Håkan > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: sucking news out of the usenet
I'm not on expert on usenet, but I'd recommend reading the RFC that defines the message headers. In particular you're going to need to look at the Message-ID, References, Xref, In-Reply-To, Subject, and Date headers and do what you can to try and sort them out... good luck! -philip On Thu, 8 Aug 2002, andy wrote: > Hi guys, > > I am trying to build a usenet gateway which is collecting usenet posts and > puts them into a phpbb forum. Same other way around. So I did read an > excelent article on that published by Armel Fauveau at: > http://www.phpbuilder.com/columns/armel20010427.php3?page=1 (this is where > the code underneath is from. So getting the articles works. > > My problem is how to glue all the articles together which are relies. I am > sure there is a way to find out which reply belongs to a post. I would like > to feed the phpbb database with it. > > This is an example of an article including the header: > > Newsgroups: php.general Path: news.php.net Xref: news.php.net > php.general:111709 Return-Path: Mailing-List: contact > [EMAIL PROTECTED]; run by ezmlm Delivered-To: mailing list > [EMAIL PROTECTED] Received: (qmail 81897 invoked by uid 1007); 8 Aug > 2002 18:28:33 - Message-ID: <[EMAIL PROTECTED]> > To: [EMAIL PROTECTED] Reply-To: "sebastian" Date: Thu, 8 Aug 2002 > 20:27:21 +0200 Lines: 11 X-Priority: 3 X-MSMail-Priority: Normal > X-Newsreader: Microsoft Outlook Express 6.00.2600. X-MimeOLE: Produced > By Microsoft MimeOLE V6.00.2600. X-Posted-By: 141.44.162.176 Subject: > streaming mp3-audio??? From: [EMAIL PROTECTED] (Sebastian) hi @ all! > i´m looking for an algorithm or class to stream mp3-audiofiles, such as easy > as it can be. i found nothing on php.net and downloaded some phpscripts from > hotscripts and sourceforge but they were all very cryptical and bad > documentated. please help me, many thanks sebastian . > > > Lots of text.. puhh! I hope this is somehow possible. Maybe one of you guys > has a good idea on that. You can just cut and past the code underneath and > try it out by yourself. > > Thanx for any help on that. > > Andy > > - > http://www.OZforum.info > Australia Information Forum > > > > > # http://www.phpbuilder.com/columns/armel20010427.php3?page=3 > > $cfgServer= "news.php.net"; > $cfgPort= 119; > $cfgTimeOut= 10; > > // open a socket > if(!$cfgTimeOut) > // without timeout > $usenet_handle = fsockopen($cfgServer, $cfgPort); > else > // with timeout > $usenet_handle = fsockopen($cfgServer, $cfgPort, $errno, $errstr, > $cfgTimeOut); > > if(!$usenet_handle) { > echo "Connexion failed\n"; > exit(); > } > else { > echo "Connected\n"; > $tmp = fgets($usenet_handle, 1024); > } > > ### > # page 2 > > //$cfgUser= "xx"; > //$cfgPasswd= "yy"; > $cfgNewsGroup= "php.general"; > > // identification required on private server > if($cfgUser) { > fputs($usenet_handle, "AUTHINFO USER ".$cfgUser."\n"); > $tmp = fgets($usenet_handle, 1024); > > fputs($usenet_handle, "AUTHINFO PASS ".$cfgPasswd."\n"); > $tmp = fgets($usenet_handle, 1024); > > // check error > > if($tmp != "281 Ok\r\n") { > echo "502 Authentication error\n"; > exit(); > } > } > > // select newsgroup > > fputs($usenet_handle, "GROUP ".$cfgNewsGroup."\n"); > $tmp = fgets($usenet_handle, 1024); > > if($tmp == "480 Authentication required for command\r\n") { > echo "$tmp\n"; > exit(); > } > > $info = split(" ", $tmp); > $first = $info[2]; > $last = $info[3]; > > print "First : $first\n"; > print "Last : $last\n"; > > ### > # page 3 > > $cfgLimit= 10; > > // upload last articles > > $boucle=$last-$cfgLimit; > > while ($boucle <= $last) { > > set_time_limit(0); > > fputs($usenet_handle, "ARTICLE $boucle\n"); > #fputs($usenet_handle, "BODY $boucle\n"); > > $article=""; > $tmp = fgets($usenet_handle, 4096); > > if(substr($tmp,0,3) != "220" AND substr($tmp,0,3) != "222") { > echo "+--+\n"; > echo "Error on article $boucle\n"; > echo "+--+\n"; > } > else { > while($tmp!=".\r\n") { > $tmp = fgets($usenet_handle, 4096); > >$article = $article.$tmp; > } > > echo "+--+\n"; > echo "Article $boucle\n"; > echo "+--+\n"; > echo "$article\n"; > } > > $boucle++; > > > } > > // close connexion > > fclose($usenet_handle); > > ?> > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] RE: Open 10 http connections in parallel
What about the PCNTL functions? http://www.php.net/manual/en/ref.pcntl.php I haven't used them, but there's a fork function in there... On Fri, 9 Aug 2002, Martin Towell wrote: > use C and fork() > php (AFAIK) can't do parallel programming > > -Original Message- > From: NoWhErEMan [mailto:[EMAIL PROTECTED]] > Sent: Friday, August 09, 2002 12:58 PM > To: [EMAIL PROTECTED] > Subject: Open 10 http connections in parallel > > > Hello, > > I had to write a script to open 10 http connections for different links and > get the response from the host. > I do it by fopen each url one by one and save the response to a separated > file. But it slow! > I wonder if i can open 10 connnect (or more) in parallel? > > Thanks in advance. > NoWhErEMaN > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Newbie question about SQL result formatting
see nl2br(). You might also want to convert spaces to 's On Fri, 9 Aug 2002, Kristoffer Strom wrote: > Ok, this is totally newbie but I just started messing around with PHP after > programming IBM's NetData for a while. > > My first big problem I haven't been able to solve myself is how to format > the result of an SQL query into HTML code. > In the (MySQL) database, I have one field for very long texts. One test > entry looks like this: > -- > test > >test > > test > -- > But when printing the result, even with HTMLENTITIES and HTMLSPECIALCHARS, > just looks like: > - > test test test > - > > How do I convert the result to HTML code, I especially want the linebreaks!! > > The answer is probably very simple > > /Kris > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: ADVANCED PHP (SOCKETS)
Take a look at the pcntl functions. In particular the pcntl_fork() function. On Wed, 14 Aug 2002, 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 General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: ereg_replace()
I'd do something like this: $str = " User : [EMAIL PROTECTED] Dir : /home/eXtremail/mbox/i-redlands.net/3/1/liam Forward : Copy : Account mapping : User Disk Quota : 0 Disk Space Used : 0 Max In Mail Size : 0 Max Out Mail Size : 0 Autoreply : No Mailbox Access : POP,IMAP Created : Sat Jul 6 09:21:23 2002 Status : Enabled "; $ary = explode("\n", $str); foreach( $ary as $line ) { list($k, $v) = split(" : ", $line); $data[$k] = $v; } print($data["User Disk Quota"] . "\n"); print($data["Dir"] . "\n"); On Thu, 15 Aug 2002, Liam MacKenzie wrote: > Hi guys, > > I'm looking to get a specific bit of data out of a slightly complex amount > of data. > Ok, I have this in a variable: > > User : [EMAIL PROTECTED] > Dir : /home/eXtremail/mbox/i-redlands.net/3/1/liam > Forward : > Copy : > Account mapping : > User Disk Quota : 0 > Disk Space Used : 0 > Max In Mail Size : 0 > Max Out Mail Size : 0 > Autoreply : No > Mailbox Access : POP,IMAP > Created : Sat Jul 6 09:21:23 2002 > Status : Enabled > > > This is different for every user as you can see. For instance, the Dir is > different for everyone, such is the Created date. > I need to extract the User Disk Quota and the Disk Space Used variables out > of this. How would I go about doing that? > > Is there an easier function to use than ereg_replace? > > Thanks in advance! > Liam > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: progress bar for uploading files
You're best bet would be to make an animated gif that looks like a progres bar (or twirling icon or whatever). Then when the users hits submit, "turn it on"... in the same way you do image rollovers, etc... Then it will spin until the form is submitted... On Fri, 16 Aug 2002, electroteque wrote: > hi guys i was wondering if there was anyway to have a progress bar for > uploading images ? > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: progress bar for uploading files
This wouldn't work for uploading files however since the long part of the process is the act of uploading the file and until that completes your "save.php" (or whatever) isn't called. So in regards to file uploading it has to be done with Javascript. What you do below is great for scripts that just take a long time though. -philip On Fri, 16 Aug 2002, Peter J. Schoenster wrote: > On 16 Aug 2002 at 23:40, electroteque wrote: > > > hi guys i was wondering if there was anyway to have a progress bar for > > uploading images ? > > TMTOWDI, but here is a way I did something similar. I was spidering remote sites and >to get user's data and store in a database and the user could not continue until > the spider spun it's web. > > I accpeted the data I needed and then returned a page with the HTTP-REFRESH tag in >it with something like this > > http://yoursite.com/verify_upload?process_id=X&action=check_upload"&timer=X> > > So it refreshes every 10 seconds and checks to see if process X has finished, if so >then redirect to the next step, if not then just return but upgrade the timer so you > can increase your counter (perhaps a percentage in a table cell). > > > Peter > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Image library
Lots of good ideas. One other thing to consider when designing this is the possibility of multiple web server accessing a single database server. If you use the file system method which assumes that the web/db are on the same server as soon as you want to have multiple web servers you'll run into problems. Of course you also probably don't want to have multiple web servers ask a single db server over and over for the same image. Especially if mysql's blobs are inefficient (I don't know if they are or not). You might consider storing the images in the database, and then setting it up so that it first checks the filesystem and if it isn't there, gets it from the database and caches it to the filesystem so the next access it fast. This would allow you to run multiple web servers since they could both cache them locally. For what it's worth, for our application we use a two level directory heirarchy of [0-9]/[0-9]/primary_id.jpg. Works well for us. -philip On Wed, 21 Aug 2002, Scott Houseman wrote: > Hi there. > > Which way would be the most efficient/fastest to access images from an image > library. > A) Store image files in a hash directory structure AND storing each file's > information in a mysql table > OR > B) Storing image information in mysql table AND storing the image in a BLOB > field in that table. > > The way I see it, considerations to be taken into acount: > - Is it quicker/better to retrieve image from table & then stream out to > browser OR simply direct the browser to the file? > i.e OR SRC="/imagelib/5/f/10"> > - Will a database OR filesystem be more scalable i.e. which wil perform > better when there are 1 images in the libary? > > Thanks in advance > > Regards > > -Scott > > -- > Scott Houseman > Jam Warehouse http://www.jamwarehouse.com/ > Smart Business Innovation > +27 21 4477440 / +27 82 4918021 > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] RE: Image library
> [snip] > > Having a large number of files in a single directory does affect > performance, > > the degree of which depends on the filesystem. > > This is generally accepted wisdom for dealing with large numbers of files - > but what number is considered "large"? > Any rules of thumb, for different OpSys/file systems? > [/snip] > > I guess the situation I have had (various OS's) and numbers of items in the > file(s) (upwards of 40k items) I have never encountered a degredation in > performance that could be deemed noticeable. I could perform some file > retrieval analysis to see time lags, and I am sure that there would be some > dependent upon the file system (and OS), not to mention hardware factors, > the most significant which comes to mind is hard-drive seek times. But as > yet, none noticed... You could probably find info on this if you dug around in the linux/freebsd source code... I think more important than how many files can you fit in one directory before things start to suck is the issue of that directory getting big enough (kilobyte wise) that it fills up the partition. If you put them in separate directories to start out with you can always add a new disk (fileserver, etc.) and put half of the directories on the new disk, mounted in the same place. This way your code doesn't need to change at all. -philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: SeparatingWords
This works. $word = "SoftwareVersionThingy"; $word = ereg_replace("([A-Z])", " \\1", $word); $word = ltrim($word); -philip On Thu, 22 Aug 2002, Hessu wrote: > Hi, > > I have strings like FileName, SoftwareVersion etc. > How can I add space between words? Somehow with preg_replace perhaps? > First letter of each word is capitalized. > > -Hessu- > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: SeparatingWords
Yes, it would and yes you can, but I'll leave that up to you :) On Wed, 21 Aug 2002, DL Neil wrote: > Philip, > What about "SoftwareVersion Thingy"? > Won't that end up as "Software Version Thingy" - with two spaces before the > "T"? > Can the RegEx be 'turned off' if the u/case letter is already preceded by a > space? > (sorry, may not be Hessu's requirement = my curiosity) > Regards, > =dn > > > > This works. > > > > $word = "SoftwareVersionThingy"; > > $word = ereg_replace("([A-Z])", " \\1", $word); > > $word = ltrim($word); > > > > -philip > > > > On Thu, 22 Aug 2002, Hessu wrote: > > > > > Hi, > > > > > > I have strings like FileName, SoftwareVersion etc. > > > How can I add space between words? Somehow with preg_replace perhaps? > > > First letter of each word is capitalized. > > > > > > -Hessu- > > > > > > -- > > > PHP General Mailing List (http://www.php.net/) > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: filter files in a directory
Try adding && !ereg("*.config", $files) -philip On Mon, 26 Aug 2002 [EMAIL PROTECTED] wrote: > I am showing a directory of files and I don't what all the files to > show on the screen. I was able to get the . and the .. not to show > with what I have below but there are some other files in there that look > like this mylist.confg. I don't want them to show in the directory > list. I tried && $files != "*.config" but this did not work . > Anybody have an suggestions on how to do this . I have look through > the manual and the mailing list but can't figure out how to make the > pattern to keep this from showing > > if ($handle = opendir('/path/to/list/directory')) { > while (false !== ($files = readdir($handle))) { > if ($files != "." && $files != "..") { > echo $files; > } > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: file reading
You want "r" instead of "w+". I'd suggest reading the Filesystem Functions section of the manual again... good luck! -philip On Tue, 27 Aug 2002, phper wrote: > how do I read the contents of a file. > > $FileStream = fopen("webmaster/forum".$Forum."/forumtopics.txt", "w+"); > $line = fgetss ($FileStream, 255); > print ("number is: ".$line." "); > > fclose($FileStream); > > always returns nothing > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: wish list for my host's new compile
On Thu, 29 Aug 2002, Justin French wrote: > Hi all, > > My host is putting together a new linux box at the moment for hosting, and I > want to make sure that they include a few things that I've needed, but > weren't available on the current server. I've got about 15 domains with > them, so it's not particularly easy to change hosts. > > A few things I've wanted so far: > - enable_trans_sid > - mcrypt (encypting credit cards, etc) > - GD library w/JPEG & PNG > - PDFlib > - XML I'd try and get GD 2 instead of 1.8.x, freetype2 could be useful, ftp, imap (for webmail), database support (mysql, postgres)... -philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Getting local domain name in CLI
What about... $hostname = `/bin/hostname`; or something along those lines... On Thu, 29 Aug 2002, Geranium wrote: > I need to get the domain name of the local machine. > I'm running a CLI script in PHP 4.3-cvs (on OpenBSD) so I have no HTTP > or other global vars to look at. The posix_uname command doesn't > include the domain on non-GNU OSs. I can get the hostname, but not the > domain. Can I get it through some other PHP command? I'd really prefer > not to resort to rummaging in /etc and parsing files or doing something > silly like a DNS lookup... > > Any ideas? > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Output php code
http://www.php.net/manual/en/function.show-source.php On Thu, 29 Aug 2002, apollo wrote: > Is there any function in php to show source code like this: > http://www.php.net/source.php?url=/index.php > > How do they do this ? I mean all these colors. > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Server Setup Walkthrough?
Check the manual at www.php.net. There are installation instructions in it... On Sat, 31 Aug 2002, Kris wrote: > Hi All, > > Relatively new to PHP and Apache. I've had some trouble setting up my own > web server for learning on - I basically have no idea where to start in > order to get them both working together. Does anyone have a link to a > website (or the time to help me) that I could take a look at? I'd much > appreciate it. > > Regs, > Kris > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Regular expression question
$str = "jeD1GLal"; $str = ereg_replace("[1LIO0lio]", "", $str); something like that... On Fri, 30 Aug 2002, Jeff Lewis wrote: > Is there a regular expression that will remove 1, L, I, O, 0 and the > lowercase equivilants from a varialbe? > > I am not horribly well versed in regular expressions...so I'm basically > asking someone to help :) > > Say I have a string like this "jeD1GLal" > > I want to remove any of the chracters that be confusing ... > > Jeff > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Simple one... Please look.
http://www.php.net/manual/en/function.file.php On Fri, 30 Aug 2002, Shane wrote: > Greetings. Can someone please enlighten me on the best way to get information from a >comma delimited file, to a variable? > > Example. A client updates a comma delimited list of names to a directory on a >server, my script would need to read in the entire list and turn it into a variable. > > Once it is in a variable, I can use explode() to parse it into an array. > > But how would I read that document? fopen() > > Thanks in advance friends. > -NorthBayShane > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP OOP
Not tested, but what if you change $b[0] = new one(); $b[1] = new one(); to: $this->b[0] = new one(); $this->b[1] = new one(); On Tue, 3 Sep 2002, Rodrigo Dominguez wrote: > I have a problem, I can't create an array of classes into a class, for > example: > > class one { > var $a; > > function foo() { > echo "foo"; > } > } > > class two { > var $b; > > function initialize() { > $b[0] = new one(); > $b[1] = new one(); > } > } > > $test = new two(); > $test->initialize(); > > $test->b[0]->foo(); //It doesn't work > $test->b[1]->foo(); //It doesn't work > > Any suggestion? > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Please help with fresh fish.
Read everything at the following sites :-) www.php.net www.zend.com www.phpbuilder.com In particular read the manuals, tips, tricks, examples, and links to other sites sections. Lots of good info there and will point to more sites. On Tue, 3 Sep 2002, Anh wrote: > Hello everyone, > > I would like to study PHP but do not have any experience about PHP or > programming. Could you please give me some advice to begin such as books, > news, forum... > > Many thanks in advance, > Anh > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: simple problem
add the following: if( $i % 3 == 0 ) { print("something else"); } You might need to vary the zero in that equation to get it to print at the "right time" by which I mean, the above will print "something else" on the first iteration of the below loop. -philip On Wed, 4 Sep 2002, Cirkit Braker wrote: > what would be the best, most efficient way to print something every three > times a loop runs > > for ($i=0; $i<$num_products; $i++) > { > echo "something"; >} > > this happens every time it runs and has to stay that way but every three > times i want to print additional info. > > Any help appreciated. > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: whitespace...
I'm not sure I fully understand your question, but given the following PHP file: all the browse will see is this (minus the dashed lines). -- hello -- On Wed, 4 Sep 2002, Matt Zur wrote: > How do I remove the whitespace from a document? I consulted the manual > and it said to use the trim function. But in a large PHP document, with > lots of fuctions etc in PHP... is there a simple way to compress the > whitespace of the entire document? Rather than going through each var > and using the trim? Like add a header at the top: compresswhitespace() ?> > > > If you have a 300k php document, won't the source code reveal (after the > browser displays the page) a bunch of whitespace. Doesn't this add to > dl time and if so, how do I get rid of it. > > TIA, > > -Matt > > > > > -- > Matt Zur > [EMAIL PROTECTED] > http://www.zurnet.com > > Need a Web Site??? - Visit... www.zurnet.com > > 1997 - 2002 - 5th Anniversary!!! > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: syntax question - eregi()
If memory serves, $match will contain an array whose 0th element is the entire string and whose 1st element contains whatever is matched in the first (), 2nd element matches the second () and so on. Check the manpage for more... and when testing things like this out try adding the following for debugging reasons: print(""); print_r($match); print(""); that will let you see what $match looks like in its entirety. good luck On Thu, 19 Sep 2002, Anthony Ritter wrote: > I'm having difficulty understanding what the array does or refers to in the > eregi() function using php. > > Listing below are returned strings with > [0] > [1] > [2] > .. > > $fp =fopen("C:\\TextFiles\\Test.htm","r"); > $content = fread($fp,10); > eregi("(.*) $FinalLine=$match[2]; > echo "$FinalLine"; > ?> > ... > > quick brown fox jumped over the lazy dog // output with $match[1] > . > > quick brown fox jumped over the lazy dog. > .. > > file://output is nothing with $match[2] > ... > > Description: > int eregi ( string pattern, string string [, array regs]) > > > Thank you. > Tony Ritter > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: All Queries TRUE even when they should be FALSE
Could be wrong, but the fact that $result isn't empty doesn't mean there are rows... it would be better to say: if ( !empty($result) ) { echo "VALID QUERY"; } else { echo "INVALID QUERY"; } Although you should probably check $result against TRUE and FALSE instead. If you want to know how many rows have been returned use mysql_num_rows() (or something very close to that). good luck! On Fri, 20 Sep 2002, Monty wrote: > Even though I have no record in my MySQL DB with that has "005" in the ID > field, the following statement always reverts to Record Found, or True, no > matter what ID I use. What's wrong? I'm using PHP 4.2.2. Has something > changed that makes this work differently? Thanks. > > > > $query = "SELECT id FROM member WHERE id = 005"; > $connect = mysql_pconnect("localhost", "dbname", "password"); > $result = mysql_query( $query, $connect ); // Query DB. > > if ( !empty($result) ) { > echo "RECORD FOUND"; > } else { > echo "RECORD NOT FOUND"; > } > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Sockets
Yes. See the online manual notes in the Socket Functions section for links to examples. On Mon, 23 Sep 2002, Martin W Jørgensen wrote: > Is it possible to read and write to multiple sockets at once with php? > > Can anyone please answer that question? > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Cronjob
You could setup cron to run lynx or some other command line web browser... something like: 0 * * * * /path/to/lynx -dump http://server/path/to/script.php >/dev/null 2>&1 Then as the first thing in that script you will probably want to set the time limit to 0 so it doesn't time out... On Wed, 25 Sep 2002, Daren Cotter wrote: > I have PHP installed on a Cobalt RaQ550. I know there > are two ways of installing PHP, one as a binary, and > one as an Apache module. I am pretty sure PHP gets > installed as an Apache module for the Cobalt > installation. > > My problem, is that I absolutely NEED to run a PHP > script using crontab. The script needs to send > numerous queries to a database every hour. Is there > any way I can accomplish this, directly or indirectly? > > __ > Do you Yahoo!? > New DSL Internet Access from SBC & Yahoo! > http://sbc.yahoo.com > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Cronjob
-dump is an option to lynx to tell it to output the page and quits. the rest of it says send all output (and errors) to /dev/null On Wed, 25 Sep 2002, Daren Cotter wrote: > What does the "-dump" and ">/dev/null 2>&1" stuff do? > > --- Philip Hallstrom <[EMAIL PROTECTED]> wrote: > > You could setup cron to run lynx or some other > > command line web browser... > > something like: > > > > 0 * * * * /path/to/lynx -dump > > http://server/path/to/script.php >/dev/null 2>&1 > > > > Then as the first thing in that script you will > > probably want to set the > > time limit to 0 so it doesn't time out... > > > > > > > > On Wed, 25 Sep 2002, Daren Cotter wrote: > > > > > I have PHP installed on a Cobalt RaQ550. I know > > there > > > are two ways of installing PHP, one as a binary, > > and > > > one as an Apache module. I am pretty sure PHP gets > > > installed as an Apache module for the Cobalt > > > installation. > > > > > > My problem, is that I absolutely NEED to run a PHP > > > script using crontab. The script needs to send > > > numerous queries to a database every hour. Is > > there > > > any way I can accomplish this, directly or > > indirectly? > > > > > > __ > > > Do you Yahoo!? > > > New DSL Internet Access from SBC & Yahoo! > > > http://sbc.yahoo.com > > > > > > -- > > > PHP General Mailing List (http://www.php.net/) > > > To unsubscribe, visit: > > http://www.php.net/unsub.php > > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > __ > Do you Yahoo!? > New DSL Internet Access from SBC & Yahoo! > http://sbc.yahoo.com > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Re: Cronjob
Then try a script with: in it and run it as: % php script.php arg1 arg2 arg3 and then search the output for arg1 and find out where it is. It's got to be there somewhere. -philip On Wed, 25 Sep 2002, Daren Cotter wrote: > Don, > > It was not there anywhere. > > --- Don Read <[EMAIL PROTECTED]> wrote: > > > > On 25-Sep-2002 Daren Cotter wrote: > > > This just prints out a bunch of info (seems to be > > > unimportant)...what am I looking for in this? > > > > > > > You're looking for your argument string "blah" > > > > -- > > Don Read > > [EMAIL PROTECTED] > > -- "Beer is proof that God loves us and wants us to > > be happy." > > > __ > Do you Yahoo!? > New DSL Internet Access from SBC & Yahoo! > http://sbc.yahoo.com > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Explorer-like "drill down" interface
On Wed, 25 Sep 2002, Mike Dunlop wrote: > >I have two questions: > > > >2. I have allowed packets through my firewall destined for port > >3306, the mysql server. So I can connect to the server from a remote > >machine. Are there any known security vulnerabilities in the mySQL > >server? > I would recommend using javascript for the expanding/contracting list > stuff and I don't know of any vulnerablilities in MySQL Server... Other than the usual caveats of making sure you're not sending your password via clear text that is... :) -philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Can I pass the ftp transfer mode in a string?
Why not do... $filetype = FTP_ASCII; $upload = ftp_fput($conid, $dfile, $sfile, $filetype); On Mon, 30 Sep 2002, John Kelly wrote: > Can I pass the ftp transfer mode in a string like ... > > $filetype = "FTP_ASCII"; > $upload = ftp_fput($conid, $dfile, $sfile, $filetype); > > I ask as when I do I get the following error message ... > > Warning: ftp_fput() expects parameter 4 to be long, string given > > If I replace $filetype with the text FTP_ASCII or FTP_BINARY it works fine. > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Math problem (222)
Well, since it's for school I'll only point out a couple of issues... - your for loop will never test the number 987 even though it should. - add the following line rightr after you compute $numtotal: print("$numtotal = $num1 + $num2 + $num3 + $num4 + $num5 + $num6\n"); and you'll see that you'll get output like: 28.6 = 2.6.5 + 2.5.6 + 6.2.5 + 6.5.2 + 5.2.6 + 5.6.2 which should help you understand why it's not doing what you think it's doing. good luck. On Wed, 2 Oct 2002 [EMAIL PROTECTED] wrote: > For a coursework assignment I have to investigate this thing where you do > the following for example: > > 264- Choose 3 digits that are not the same > 12 - Find the sum of them. > > 264 > 246 > 624 > 642 > 426 > 462- List all the possible combinations of those digits > _ > 2664 - Add the combinations > > 2664 / 12 = 222- Divide the answer by the sum of the three digits > and you allways get 222! > To speed up the process of finding any exceptions if any, I thought id use > php to do this, however i get a problem, the script runs without any coding > errors, but it doesnt do what i want it to do - instead of returning any > three digit combo that doesnt return 222, it just prints EVERY combo whice > passes my conditional statement to weed out numbers that have digits where 2 > or more are the same. > > Here is my code: > > > for ($i = 012; $i < 987; $i ++) { > > $comma = chunk_split($i, 1, ","); > $split = explode(",", $comma); > > if ($split[0] == $split[1] || $split[0] == $split[2] || $split[1] == > $split[2]) { > } else{ > > $digitstotal = $split[0] + $split[1] + $split[2]; > > $num1 = "$split[0].$split[1].$split[2]"; > $num2 = "$split[0].$split[2].$split[1]"; > $num3 = "$split[1].$split[0].$split[2]"; > $num4 = "$split[1].$split[2].$split[0]"; > $num5 = "$split[2].$split[0].$split[1]"; > $num6 = "$split[2].$split[1].$split[0]"; > > $numtotal = $num1 + $num2 + $num3 + $num4 + $num5 + $num6; > > $answer = $numtotal / $digitstotal; > > if ($answer != 222) { > echo("$i does not return 222!"); > } > } > } > ?> > > What is wrong with it? Any help at all is greatly apreciated. > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Include
To my knowledge you can include as many files as you want. If by commenting out the clean() function, I'd say you have a syntax error in that function and you're just not seeing the error message. Turn on full error reporting and see what happens. -philip On Thu, 3 Oct 2002, Matias Silva wrote: > This might sound like a dumb question but I just need verification so that > I can convince myself that I'm going insane! > > I have this error in which I include 3 files (common_html.inc, > common_db.inc, common_functions.inc) > well I have a clean() function in the common_functions.inc file. But it > seems that it is not getting called > and then my script crashes. If I comment out the clean() function then it > works. The clean() function > is just for added security. > > Is there a maximum number of times you can include different files? > > -Matias > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Code management
I'd separate out your shared PHP files and put them all in a directory named say "my_php_lib". Organize it like PEAR if you want... Then for each of your sites set up the directory structure something like this: /path/to/site/htdocs /path/to/site/my_php_lib where you've cvs-co'd my_php_lib. Then add the following to your web server config for the above site: php_value include_path .:/path/to/site/my_php_lib:/usr/local/lib/php Now phpgrid can just include("ldap_rol") without worrying where it is. On 15 Oct 2002, [ISO-8859-1] José León Serna wrote: > Hello, I would like to hear your experience about this matter: > > I have a lot of separate scripts and most of them need another script, > for example: > > phpgrid >uses adodb >uses ldap_rol > > phplogin >uses ldap_rol > > And so on, I have a CVS server to store/develop single scripts, but I > want to store them as full solutions, I mean, when I make a checkout I > want to get the full working package, so I have duplicate files. What is > the best way to manage this kind of development? > > Regards. > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Odd finding while researching $_FILES
I think that's because there are five keys for _$FILES['picname']. According to the manual: -- The contents of $_FILES from our example script is as follows. Note that this assumes the use of the file upload name userfile, as used in the example script above. $_FILES['userfile']['name'] The original name of the file on the client machine. $_FILES['userfile']['type'] The mime type of the file, if the browser provided this information. An example would be "image/gif". $_FILES['userfile']['size'] The size, in bytes, of the uploaded file. $_FILES['userfile']['tmp_name'] The temporary filename of the file in which the uploaded file was stored on the server. $_FILES['userfile']['error'] The error code associated with this file upload. ['error'] was added in PHP 4.2.0 -- Try changing your script to... each($_FILES) and see what happens. good luck. -philip On Wed, 16 Oct 2002, Jason Young wrote: > Without going into the process of how I came to do this, I just wanted > to throw out there that even if you only have 1 file input, it still > seems to loop 5 times... > > Is this something with my code... > > -- > $current = 0; > > while (list($key) = each($_FILES['picname'])) { >echo $current; >$current++; > } > -- > > ...or is there something freaky going on with the $_FILES array? > > -J > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Here's a quick script to generate IE bookmarks of the functionreference.
Hi all - I find I spend a lot of time looking up functions in the manual and even with my local copy it takes awhile (click click, page down, click). So I wrote a script to run through the PHP documentation and generate a heiarchial directory of IE bookmarks for all of the functions. I just put that on my toolbar and can now quickly cruise to the function I want or think I want (usually I just need a name reminder). It's a little long if you leave all the sections in there, but the ones I never use I just deleted and it works great. Here's the script: http://www.adhesivemedia.com/~philip/makephplinks.phps Enjoy... do whatever you want with it, but don't blame me if it doesn't work for you :) -philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Quick way to test series of integers
Just add zero to the variables in your processing script... ie... $var_1 += 0; $var_2 += 0; That way if they are set to one, no difference. if they are set to "" then they become zero. It's worked for me in the past. On Thu, 24 Oct 2002, Paul Kaiser wrote: > Hey there, > > I have around 50 checkboxes on an HTML form. Their "value" is "1". So, > when a user check the box, then no problem -- the value returned by the > form is "1" and I can enter that into my SQL database. > > HOWEVER... > > If the user does not check the box, I'm in trouble, because the "value" > does not default to "0", but rather I'm guessing... > > mysql query doesn't like my trying to pass NOTHING. > > I COULD go through each of the 50 returned variables and, if they are not > "1", assign "0" to them. > > But I'm wondering if there is a better way to go about this?? > > Thanks, > Paul > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Cleaning pasted Word text
You might look at the htmlentities() function... On Tue, 29 Oct 2002, a.h.s. boy wrote: > I'm working on a PHP-based CMS that allows users to post lengthy > article texts by submitting through a form. The short version of my > quandary is this: How can I create a conversion routine that reliably > substitutes HTML-acceptable output for high-ASCII characters pasted > into the form (from a variety of operating systems)? > > The longer version is this: > In order to prevent scripting vulnerabilities and a variety of other > undesirable content, I run the body of the text through a cleantext() > function. This function first strips out illegal HTML tags and > JavaScript. So far so good. > > Then it attempts to perform some character conversions to clean up > 8-bit ASCII characters in the text, so smart quotes, en- and em-dashes, > ellipses, etc. are converted to suitable alternative, or to HTML > entities. I'm using: > > // Reference: > // chr(133) = ellipsis > // chr(145) = left curly single quote > // chr(146) = right curly single quote (apostrophe) > // chr(147) = left curly double quote > // chr(148) = right curly double quote > // chr(149) = bullet > // chr(150) = en dash > // chr(151) = em dash > // chr(153) = trademark > // chr(160) = non-breaking space > // chr(161) = inverted exclamation mark > // chr(169) = copyright symbol > // chr(171) = left guillemet > // chr(173) = soft hyphen > // chr(174) = registered trademark > // chr(187) = right guillemet > // chr(188) = 1/4 fraction > // chr(189) = 1/2 fraction > // chr(190) = 3/4 fraction > // chr(191) = inverted question mark > $changearr = array(" "=>" ", > "\r"=>"\n", > "\r\n"=>"\n", > "\n\n\n" => "\n\n", > chr(133)=>"...", > chr(145)=>"'", > chr(146)=>"'", > chr(147)=>"\"", > chr(148)=>"\"", > chr(149)=>"*", > chr(150)=>"-", > chr(151)=>"--", > chr(153)=>"(TM)", > chr(160)=>" ", > chr(161)=>"¡", > chr(169)=>"©", > chr(171)=>"«", > chr(173)=>"-", > chr(174)=>"(R)", > chr(187)=>"»", > chr(188)=>"1/4", > chr(189)=>"1/2", > chr(190)=>"3/4", > chr(191)=>"¿"); > $returnstr = strtr($returnstr,$changearr); > > The server's on a Linux box (RedHat 7.2, standard US installation); > users can obviously post from any sort of operating system. > > This routine seems to work well on Word text pasted in from my Mac (OS > X 10.2.1), but I see a number of articles appearing on the site with > text like: > > Wouldnâ(TM)t you say? > > (That's "Wouldn[a circumflex][Euro symbol](TM)t" instead of "Wouldn't". > > ...which was almost definitely pasted in from a Windows-based Microsoft > Word, and the conversion routines are failing. (And inserting even > weirder characters...why would the single quote be replace by _3_ > character substitutions?) > > I understand that Windows may well use a different character set for > high-ASCII, but I frankly don't understand how to work that knowledge > into this situation. And the combination of original text, Linux , > chr(), and ord() stuff just doesn't make sense to me. For example, if I > post text (from my Mac) containing only: > > > (that's > [open-double-quote][close-double-quote][open-single-quote][close- > single-quote][ellipsis]) > > and have PHP run this: > > for ($x = 0; $x < strlen($str); $x++) { > $mailstr .= $str[$x].' is '.ord($str[$x])."\n"; > } > mail('me','Characters',$mailstr); > > I get mail that says (in parentheses is a description of the character): > > ì is 147 (accent-grave-i) > î is 148 (circumflex-i) > ë is 145 (umlaut-e) > í is 146 (accent-acute-i) > Ö is 133 (umlaut capital o) > > ...which means that "recognizes" the correct ASCII value (147) of a > double-quote, though my Linux box seems to think that the character is > a lowercase "i" with a grave accent on it. With this kind of strange > sub-conversion going on, I'm not all that surprised that things are > getting mucked up. > > Is there some way of getting pasted Word text from Windows "clean" in > this manner, as well as accommodating the already-working-right Mac > Word text? > > Cheers, > spud. > > - > a.h.s. boy > [EMAIL PROTECTED] > dadaIMC support > http://www.dadaimc.org/ > - > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Yahoo Moving to PHP (seen on slashdot)
Figured this was important enough to share... Yahoo Moving to PHP http://developers.slashdot.org/article.pl?sid=02/10/29/2052239&mode=thread&tid=169 Erek Dyskant writes "Yahoo has decided to switch from a proprietary system written in C/C++ to PHP for their backend scripting. Here's the notes from a presentation by a Yahoo engineer at PHP Con 2002." http://public.yahoo.com/~radwin/talks/yahoo-phpcon2002.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Dazed and Confused
Yes... for the most part... think about it this way... (and please correct me if I'm wrong :) An associative array isn't ordered. It's key based. Think of it like a dictionary, but one whose first and last several pages have been removed. You wouldn't have any way of telling me the definition for the 100th word since you don't know. But you can tell me the definition of "foo" is by looking it up directly. And you're not guaranteed anything about their order since, well, they don't have any order :) I know that in PHP you can do: $ary["y"] = "two"; $ary["x"] = "one"; print_r($ary); and you'll get back: Array ( [y] => two [x] => one ) but you're not *guaranteed* to get it back in the same order you supplied it. It just happens that you do in PHP. Back when I used Perl you wouldn't necessarily get the same order repeatedly. hope this helps. On Wed, 30 Oct 2002, PHP List wrote: > So are you saying there really is no array pointer? > Lets say I have an array with several different values like: > $myarray["a"] = "s"; > $myarray[3] = "d"; > $myarray["sdf"] = "y"; > There is no way of saying give me the value in the array at position 2? > Since the size of the array is returned as 3, should there not be a way of > doing this? > > Like I said, I seem to be blanking on arrays. > > > Because you haven't put anything in array index 0. The only array index > > that has anything is "test". There is no difference between numeric and > > string indices. You seem to be assuming that somehow the first element in > > an array can always be accessed as index 0 which is not the case and never > > has been. > > > > -Rasmus > > > > On Wed, 30 Oct 2002, PHP List wrote: > > > > > For some reason my brain is not operating within normal parameters this > week. > > > > > > $myarray["test"] = "sd"; > > > echo $myarray[0]; > > > > > > Why will nothing echo? Do I somehow have to initialize indexing on the > array $myarray? > > > php says that $myarray is an array, but I can't access it with numeric > indexes. > > > > > > I know if I do this: > > > $myarray = array("test"=>"sd"); > > > that I can now echo $myarray[0] and get the value of sd returned. > > > > > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Convince teh boss
You should also take a look at some of the case studies on zend.com as well. I seem to remember articles on the Navy and the Indy500. Also, search the archives for "Yahoo Moves to PHP" for some articles and slides on Yahoo's decision to start using PHP for new stuff. -philip On Wed, 6 Nov 2002, Evan Nemerson wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > Okay, it took me a long (expletive deleted) time, so I figured I should share. > Here is a list of popular web sites running Apache, PHP, MySQL, and Linux. If > there are any errors, I apologize. This is not meant to be a definitive work. > In fact, I wasn't even planning on posting it... until i looked at the clock > ;) > > This list is designed to convice teh boss (no type-o). If your boss is a > bandwagon kind of guy, afraid to take risks, this is for you- er- him. And > you. Him in that he can read it, you in that if he accepts LAMP, you're life > will be a much more joyous existance ;) > > > > - > Apache: > > By far the most popular web server, with 60.54% market share. Its > closest competitor, Microsoft's IIS, has 28.89%. If all variants of > each server are counted, Apache's install base increases to 62.17%, > while IIS manages 29.42%). Statistics are from > http://www.netcraft.net/survey > > Apache users: > Yahoo! > Amazon.com > AltaVista > BBC > mp3.com > SlashDot > HP > W3C > IBM > Verizon > FEMA > Infoseek > > > PHP: > > In April 2002, PHP overtook ASP as the #1 server-side scripting > language on the internet. In April, PHP was used by 24% of the > sites on the Internet. Over the past two years PHP has averaged > a 6.5% monthly growth rate. Source: zend.com/news/zendpr.php?id=49 > > PHP users: > Cisco > CMG > Vodafone > Motorola > Siemens > Ericsson > CBS > Unilever > Philips > BMC > NTT > Air Canada > Lufthansa > OnVista > Lycos Europe > Deutsche Bank > NASA > W3C > > > MySQL: > > It isn't as easy to determine which database a site uses, but here > is a list of sites that do use MySQL, according to MySQL.com: > > Yahoo! Finance > Texas Instruments > U.S. Census Bureau > NASA > Omaha Steaks > Slashdot > Cross Media Marketing Corp > Powell's Books > Department of Academic Information Systems > Avacom Net Services > Blue World Communications > CoreSense > Ericsson > handy.de > mobile.de > Nemo-Q > Silicon Storage Technology, Inc. > Virage > > > Linux: > > I can't find a list for this... I figured these out by trying big > sites that came to mind. I didn't encounter a single Microsoft site, > but I did get a few *BSD sites, and several Solaris sites. > > FBI > Google > Amazon > AltaVista > Slashdot > Verizon > FEMA > CNN > > > Security: > > Here's a list of security companies/groups that run any LAMP component: > Security Focus(LA) > Symantec (L) > CERT (LA) > Packet Storm (A) > FBI (L) > OSVDB (LA) > At Stake (LA) > Netcraft (LA) > TESO (L) > Phenoelit (LA) > Doxpara (LAP) > NGS Software (LAMP) > PivX (LAP) > Grey Magic(LAMP) > Phrack(AP) > *** > It should be noted that just because a component doesn't appear in the list > doesn't mean it's not running. The only way I could figure out MySQL was > sending > a SYN to TCP/3306. If I got a SYN|ACK, I put an M. MySQL could be (should be) > firewalled off, and infosec people know this. Also, infosec people tend to > play > with banners (hehe look @ TESO's - teso.scene.at), so it's entirely possible > they're hiding something... > > Out of all the infosec sites I tried, I managed to find two Microsofts: NAI > and > Verisign. I didn't bother with ntbugtraq, windowssecurity, etc- then again, I > didn't bother with linuxsecurity, root prompt, etc. Only went with groups who > pay > attention to all OS's... Phrack and OSVDB are a little biased, but they are > still > cross-platform. > -BEGIN PGP SIGNATURE- > Version: GnuPG v1.0.7 (GNU/Linux) > > iD8DBQE9ygtO/rncFku1MdIRAmQpAJ9d+KkYSLhMriuZtI9jsjp3CAmZrACfaWJK > Tf0R0hEMSICjAi6v9nz67GU= > =Jj3Q > -END PGP SIGNATURE- > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] RE: Why $ on variable names?
It could have, but what does "array" consist of below? variable = "foo"; array[variable] = variable; Is it "variable" => "variable", or "foo" => "foo" or "variable" => "foo" or ? By using $ you keep things simpler... at least to me :) -philip On Tue, 12 Nov 2002, brucedickey wrote: > Thanks for all the replies. > > I just seemed to me that to add $ everywhere was more work (and not as > aesthetic as a plain word) than using some other syntax for print. But, in > fact, it could have been designed so you could still use > > print "I'm a $variable"; > > without the use of $ in other uses of the variable (like in assignments and > references to it), right? Rhetorical question. > > (Just an initial impression of PHP)... > > Bruce > > > -Original Message- > From: Jason Wong [mailto:php-general@;gremlins.com.hk] > Sent: Tuesday, November 12, 2002 11:40 AM > To: [EMAIL PROTECTED] > Subject: Re: Why $ on variable names? > > > On Wednesday 13 November 2002 02:35, Leif K-Brooks wrote: > > I'm just guessing here. For one thing, to seperate variables from > > constants. Also, it makes it possible to use variables within quotes. > > Yup. So you can have: > > print "I'm a $variable"; > > instead of the messy javascript way: > > alert("I'm a " . $variable); > > -- > Jason Wong -> Gremlins Associates -> www.gremlins.com.hk > Open Source Software Systems Integrators > * Web Design & Hosting * Internet & Intranet Applications Development * > > /* > Aleph-null bottles of beer on the wall, > Aleph-null bottles of beer, > You take one down, and pass it around, > Aleph-null bottles of beer on the wall. > */ > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php