Re: [PHP] ODBC_EXECUTE has a DANGEROUS 'feature'!!!
OK, I checked into this further, and I must apologize: you are correct. I suspect that most of us didn't remember that this feature even existed... You don't have to apologize. And indeed... I don't get the idea that many people know about this. Besides you and maybe one or two others I haven't heard from anyone else who knows this. And, well... before last week I didn't know it either ;) Anyway, I have now documented this, along with several of its existing restrictions. It should show up in the online manual within the next few days. Thx! And I've fixed my scripts. So everyone happy I guess. FWIW, this feature currently (in all versions up to 4.1.1) suffers from the following problems: o File reading is not subject to open_basedir. o File reading is not subject to safe_mode. o The last character of the filename parameter is replaced with \0 after the call to odbc_execute(). o This kinda makes it impossible to use a string which begins and ends with single quotes as a parameter replacement. These are also in the documentation which I added to odbc_execute(). I've submitted patches for the first three problems to the dev team; I guess we'll see whether someone gets around to committing them in time for 4.2.0. I personally would like to see a cleaner way to do this though. Seems like a good idea... your patches, I mean. I hadn't looked into it that much, so I didn't know 'bout those prob's. Except ofcourse that I could indeed simply access any directory on the server (as long as it's readable for the webserver ofcourse). -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ereg-digits only...
if ((int($string)==($string)) ($string0)) {then positive integer} not sure exactly, but try Why not use the RE's? I usually use preg_* so I'll give the example using these... if (preg_match (/^\d+$/, $string)) { print (Yep... Only digits.); } else { prnt (Noop! There are non-digit characters...); } -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ODBC_EXECUTE has a DANGEROUS 'feature'!!!
*Always* validate your data. If you validate your data and never trust anything which comes from the client side of the connection, your problem goes away. I mean, you wouldn't pass user data to exec() or fopen() without some serious checking, would you? ;) Sure, PHP could try to prevent every possible problem from cropping up, but that would make the language pretty useless. It's up to the coder to not program security flaws. -- Torben Wilson [EMAIL PROTECTED] http://www.thebuttlesschaps.com http://www.hybrid17.com http://www.inflatableeye.com +1.604.709.0506 I understand you try to 'protect' your own product, but you have to stay a bit realistic about some things. Ofcourse I check the input. But you know... there's absolutely nothing wrong with allowing quotes to be stored in the database. It's just that awful 'feature' that makes it rather dangerous to do. If that feature/bug was documented _anywhere_ it would still not be good, but at least someone would know that PHP does this. But no... it's not documented, not anywhere! You can't check user input on stuff you don't know it can harm anything. Like I said... quotes are very normal to be allowed in the database. It would be a good thing if you guys do something of: 1. Good rid of the bug(/feature) right a way or 2. Document it clearly. Eg. in the documentation of odbc_execute(). -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] ODBC_EXECUTE has a DANGEROUS 'feature'!!!
Hi folks, I don't know if everyone ever knew this, but I haven't been able to find anything about this, anywhere... odbc_execute has a very dangerous 'feature'. I would like to call it a bug, because someone has implemented it on purpose I should call it a feature... odbc_execute takes two arguments; the odbc result-ID, and an array containing the parameters for this statement. So far so good. Works perfectly. In the parameters you can put any data. Any data! So you can enter characters like eg. , *, %... you name it. You can also enter single quotes ('). Nice. Noop... not nice. If you put a single quote at the start of the parameter and at the end PHP does something very scary... it reads the _file_(!) and stores it in the database. So if you would have a parameter: 'myname' you would get an error telling you that the file myname couldn't be opened. But... if you use this parameter: '/etc/passwd' No problem! The contents of your password file is stored in the database. Any file readable for your webserver can be 'used' this way. Any file! So, imagine you have some site containing a textarea input in the form, some user can easily type: '/etc/passwd' and then submit the form. When you also have the possibility on this site for the user to take a look at the data he entered (and this is a very common feature), he gets to see the contents of your password file. And he can do this with any file(). As long as it's readable for the webserver, users can very easily get the contents of the file! And... is it documented? NO Nowhere. Not the mailinglists, not the documentation, not the bugreport, not even in the sources itself. It's just there! Some security huh?! -- * RzE: -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ODBC_EXECUTE has a DANGEROUS 'feature'!!!
Usually I would agree with you. Like I wrote in my message, I would like to call it a bug, but it was written on purpose. That would make it a feature!?! It's an if-block of app. 20 lines that makes sure this happens. Looks like someone _really_ wanted PHP to do this... This is what we call a BUG Report it on http://bugs.php.net thx -- * RzE: -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What is the best way to do this...
Original message From: DeloX [EMAIL PROTECTED] Date: Fri, Oct 26, 2001 at 03:18:33AM -0400 Message-ID: [EMAIL PROTECTED] Subject: [PHP] What is the best way to do this... Let s say i have 5 pages on my site. I want some content to appear on each page so that when i want to change that content on all the pages i have only one place to modify. I used to write that content in a .txt file and having it read each time any of the 5 pages was loaded. So i had to modify the code only in the .txt file. It was working good but the code in the .txt file could not be PHP because it would not be processed when loaded by the other pages. There s probably a better way of doing it. Like a page can probably include another page that itself include another one. Any help would be great Thx /Original message Reply You can use a FRAMESET, depending on the layout of your page. Or you can use some templating stuff (check the archives, these have been discussed several times). But you can also take a look in reversing what you're doing. I mean; instead of trying to get the changing part out, you can also get the 'static' part out of you page. Then you can use that by calling require[_once] (header.php) or something like that. Or you could use the auto_prepend and auto_append. /Reply -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] String breaking up
Original message From: Dan McCullough [EMAIL PROTECTED] Date: Fri, Oct 26, 2001 at 06:03:00AM -0700 Message-ID: [EMAIL PROTECTED] Subject: [PHP] String breaking up I was looking to take a string like Dan and return it like D A N is it the str function that does that = Dan McCullough --- Theres no such thing as a problem unless the servers are on fire! h: 603.444.9808 w: McCullough Family w: At Work __ Do You Yahoo!? Make a great connection at Yahoo! Personals. http://personals.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] /Original message Reply Hi Dan, This is what you're looking for: $string = preg_replace (/(.)/e, strtoupper('\\1').\br\, $string); See the example below: ---[ PHP Example ]--- ?php $string = Dan is great; $string = preg_replace (/(.)/e, strtoupper('\\1').\br\, $string); print ($string); ? ---[ End of PHP Example ]--- Or is you don't want the upper case characters after all: $string = preg_replace (/(.)/, \\1br, $string); Again, see the example below: ---[ PHP Example ]--- ?php $string = Dan is great; $string = preg_replace (/(.)/, \\1br, $string); print ($string); ? ---[ End of PHP Example ]--- Good luck! /Reply -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: Date-TimeStamp
Original message From: Daniel Harik [EMAIL PROTECTED] Date: Sat, Oct 20, 2001 at 09:10:05AM -0800 Message-ID: [EMAIL PROTECTED] Subject: [PHP] Re:Date-TimeStamp I've tried this code: $timea = explode( ,$timepostsed); $timea1 = explode(-,$timea[0]); $timea2 = explode(:,$timea[1]); $timestamp = mktime($timea2[0],$timea2[1],$timea2[2],$timea1[1],$timea1[2],$timea1[0]); But it return -1 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] /Original message Reply Maybe a bit late, but I wasn't at work during the weekend ;) strtotime() works fine for this! /Reply -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Window open.
Original message From: Johan Vikerskog (EMP) [EMAIL PROTECTED] Date: Fri, Oct 05, 2001 at 01:57:13PM +0200 Message-ID: [EMAIL PROTECTED] Subject: [PHP] Window open. I have yet another PHP question! =) How do i open a window in PHP and how do i insert information in it? I have a tables with a a href.. that i want to open up a new window with that displays information to the user if i clicks the link. I want everything to be in the same function. I can solve it with another function but that is not how i want to do it. Do anyone of you know how to do this? //Johan /Original message Reply JavaScript... not PHP... JavaScript=clientside... PHP=serverside JS: window.open(); /Reply -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] handling errors
Original message From: Joseph Bannon [EMAIL PROTECTED] Date: Wed, Sep 26, 2001 at 11:09:39AM -0500 Message-ID: [EMAIL PROTECTED] Subject: [PHP] handling errors How do I turn off the error messages that appear at the top of the page? I have this function below that if an image is not there for $url, it give a warning. $size = GetImageSize($url); Example error message below... Warning: getimagesize: Unable to open 'http://www.yahoo.com' for reading. line 28 Joseph /Original message Reply Ofcourse it might just be a strange idea stuck in my head for some reason, but you know what helps? Writing code that doesn't produce any errors or warnings. Supressing warnings by just not showing them doesn't really make your code very reliable does it?! /Reply -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] handling errors
Original message From: Jason G. [EMAIL PROTECTED] Date: Thu, Sep 27, 2001 at 03:25:16AM -0400 Message-ID: [EMAIL PROTECTED] Subject: Re: [PHP] handling errors Placing an @ symbol before the function name will suppress any errors. @GetImageSize() /Original message Reply Yep, I know it does. Yet, it's still no good way of handling your errors/warnings. Unless you made some real intensive errorchecking yourself, you should not use that @-construction or lower the errorreportinglevel. Reporting should be as high as possible (E_ALL). And yes, indeed, it might then just be that you get a lot of warnings (and/or errors). Then you have to fix your code, not start using @ in order to supress them. Errors and warnings are not reported without a reason you know. Even if your code works, when there are warnings it can still happen that in some situation the code will crash. /Reply -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Variable declaration
What do you mean force declaration? That's what you are doing with this line: $Test = 3; Nop! This is just starting to use a variable. Something like: integer $Test; is declaring a variable. But FAFAIK it's not possible in PHP :( -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Variable declaration
That is the nature of a loosely typed scripting language. I know. If you prefer a strongly typed compiled language, there are plenty of those available. I know to. But those are not as powerful for building websites as PHP. I mean... don't get me wrong here, I think PHP is great (or even better). It's terrific actually. I just wish sometimes that the compiler wouldn't allow so many things. It might just be a bit more strict. Or at least a seperate option for being more strict. Eg something like E_EXPLICIT_DECLARE ;) -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] handling errors
Right in principle. But there are cases (common ones), like the one shown above, where errors are unavoidable and normal. For these cases the @ operator is the right thing. Generally you're right though - error reporting should be set to E_ALL and reasons of avoidable errors/warnings should be eliminated. Correct me if I'm wrong, but I saw some posts coming along on this list yesterday (I think) telling that getImageSize can't handle URL's. So... in that case... Don't use @, but check the syntax of the variable you want to pass as parameter for getImageSize. But you're right about the *very* few cases in which it is unavoidable. Though, this isn't one of 'm. -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] handling errors
According to my docs (08 Sep 2001) it can. And http://php.net/getimagesize says the same.. Okay! I never use the function. Yesterday that was a conversation on this list in which they/he/she said it couldn't. But indeed if it can there would be a reason to use @. ... I've now made some test-page, and indeed it works like a charm; getimagesize(URL). So now I don't understand what they were talking about. Anyway... So a @ is indeed in place _for_this_one_. -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Variable declaration
Original message From: sagar N Chand [EMAIL PROTECTED] Date: Thu, Sep 27, 2001 at 06:01:26PM +0530 Message-ID: 005101c14750$c3189b10$0101a8c0@inferno Subject: Re: [PHP] Variable declaration its really a big headache with compilers like c bugging all the way just for declarations. its cl to have the freedom of using any variable at any place wherever v want in bet ween the code. chao of PHP. /sagar /Original message Reply I think it's just a matter of preference. I like this, you like that. No harm to that. That's why I proposed the E_EXPLICIT_DECLARATION. That way I can choose to use it, and you can leave it for what it is. Kinda like what Perl does with use strict;. If you don't like being forced to declare every variable before you use it, you just don't type use strict; at the start of your script. People like me, who do like to do that, _do_ use that option. Everyone gets it his/her way and it bothers noone. But anyway... I don't think they'll ever implement this, so (...) NOTE: PHP Rulz and this is just a small thing that doesn't change anything to the superb power of PHP webbuilding! :) /Reply -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] buffers...
Original message From: Nic Skitt [EMAIL PROTECTED] Date: Thu, Sep 27, 2001 at 02:13:52PM +0100 Message-ID: [EMAIL PROTECTED] Subject: [PHP] buffers... Hi all, how do you flush the buffer in PHP? IE, running through code but wanting to output to the browser at specific points, in a while loop for instance. Cheers Nic /Original message Reply It's in the manual: void flush (void) see: http://www.php.net/manual/en/function.flush.php /Reply -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Problem: ereg doesn't work ok (?).
I noticed something I haven't before: I'm generating a RPM for php-4.0.6 which is what I'm installing, but using the .spec file from the 4.0.4 which comes with RedHat. Well, in the configure it had --with-regex=system. I removed this option, recompiled, and the regex'es seem to be working fine now. The --with-regex=system comes by default in the RedHat RPM for PHP. Ah. Glad the problem is solved. Otherwise it would be a *strange* problem! Thank you. Rodolfo. P.S. $yesternews = date(Y-m-d, mktime(0,0,0,$regs[2],$regs[3]-1,$regs[1])); Indeed. Cool, thanks :) UR welcome. -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] one pattern, one string, multiple results
Original message From: Richard Baskett [EMAIL PROTECTED] Date: Wed, Sep 26, 2001 at 12:01:11AM -0700 Message-ID: [EMAIL PROTECTED] Subject: [PHP] one pattern, one string, multiple results I just can not seem to figure this out. If i have a pattern 'arc' and I want to search the string: an arc is an archer, but what about marc and darcy? How can I find out how many occurances of arc is within that string? I know I can do an explode and then compare it, but when you have huge amounts of text... is this the best way? Or is there something better? Any help would be great I have been struggling with this for awhile, since I really do not want to explode, pun intended :) Rick /Original message Reply This you do the job exactly as you want: http://www.php.net/manual/en/function.substr-count.php int substr_count (string haystrack, string needle) /Reply -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] header() confusion
Original message From: pierre-yves [EMAIL PROTECTED] Date: Wed, Sep 26, 2001 at 08:41:24AM -0400 Message-ID: 007301c14688$8d9b0d10$0100a8c0@py Subject: [PHP] header() confusion Hello, several months ago I discovered that under some IE 4.0 and upgrades of 4.0 the header() function would simply not redirect if you don't put exit() right after the header() call. Now I'm discovering that header() does not work under netscape 6 if you put exit() right after! How come this function is so dependant of the client? How can I avoid all this mess? Has anyone experience this? py /Original message Reply It's not dependent on the client. The script just simply doesn't stop after header(). It's just a bit strange that it worked with some other browsers. Everything after header() will just be executed until: - an error occurs - the script reaches the end - exit; So... when redirecting the user to a different page, you should always put exit after the header() call. /Reply -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] header() confusion
Yes that's what I do but it freeze on netscape 6 ? FAFAIK the client's browser can't influence the header() call in your script. Are you sure there aren't any errors somewhere else. Eg before the header() call or at the start of the page where you redirect the user to? -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] header() confusion
Yes that's what I do but it freeze on netscape 6 ? FAFAIK the client's browser can't influence the header() call in your script. Are you sure there aren't any errors somewhere else. Eg before the header() call or at the start of the page where you redirect the user to? Indeed. A good way to tell if this might be the case is to view the source of the page you get stuck at. Yep! Or set the error-reporting-level to eg 2047 and check the logfile(s). -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] html encode
Original message From: Mark B [EMAIL PROTECTED] Date: Tue, Sep 25, 2001 at 10:07:36AM +0100 Message-ID: [EMAIL PROTECTED] Subject: [PHP] html encode Is there a function available that will convert any none standard chars ($,@,,%,etc) into their quot; equivalents? Thanks all Mark /Original message Reply Check the manual first in the future: http://www.php.net/manual/en/function.htmlentities.php Good luck! /Reply -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Need help with auto_prepend_file
Original message From: Michael Champagne [EMAIL PROTECTED] Date: Mon, Sep 24, 2001 at 09:28:01AM -0500 Message-ID: [EMAIL PROTECTED] Subject: [PHP] Need help with auto_prepend_file Our website relies heavily on include files. We have a single include file that is 'auto prepended' to every php file on the site using the auto_prepend_file directive in php.ini. This include file does an include_once on other include files. Also, most parts of our code include other page components such as our menu bar from other .inc files. Should we be using auto_prepend_file? It seems like this does not do an include_once and when we turn error_reporting = E_ALL we are seeing a lot of errors on variables that have already been defined and such. Thanks in advance for any replies. Mike /Original message Reply What you can do is check on some constant that you define the first time the file is included. The auto prepended file will then look something like: --- Pseudo code --- - if constant A is not defined -- define constant A -- your code --- End of Pseudo code --- This will make sure function, variables and/or constants will only be defined once. /Reply -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] For the RegExps gurus!
Halo! Good to see you back:) Thanks :) Same here! ...oh... wait; _I_ was the one a was away... Well... anyway: good to be back! I've been away on vacation, so it's a bit late, but anyway... Indeed late.. Had a good one? Yep! Sun in France io rain in Holland. But :( I'm back in the rain again. And believe me: IT'S A LOT OF RAIN HERE! Hmm, Why R U not employing smilers, why you after 'humor':) Of course, I meant, that the WAY your code is made is not better, not that you _litteraly_ improved my code (The later case would be a breakage of ownership, so you wouldn't admit it, unless you R a Skliarov' type:) Skliarov... I'm still free out of prison; so guess not :) Guess wat? I use RegExp abbr. Thats why. Silly me. Now I know that this is not a developer's kit:) TnX a lot. 'Silly me'; don't think so. The number of abbr's is pretty huge on these kinds of mailinglists. So the change of someone (_anyone_) missing one is pretty large. Nothing to call yourself 'silly' over. And, BTW, I agree with your thoughts about clarity and simplicity (causing performance 'optimality') of expressions. Me too :) Not though - that it should be done at the expense of functionality. In the discussed case, your approach is just an approach to solution, sorry, whereus mine include practicaly allowed by standard symbols. May be I am missing something too, but at least do not include, what is not allowed, i hope. Correct me if I am wrong. And this is where the misunderstanding came up. I thought you were talking about the construction I was using, while you were - and correct me if I'm wrong - talking about the characters I allowed. And concerning those, it might very well be that I don't only allow characters allowed by specifications and even maybe I don't allow characters allowed by specifications. I didn't spend much time on that point. What I did was just creating the RE to parse the URL's. The allowed characters weren't really of my concern then. Let me know... -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Problem: ereg doesn't work ok (?).
Original message From: Lic. Rodolfo Gonzalez Gonzalez [EMAIL PROTECTED] Date: Tue, Sep 18, 2001 at 08:15:50PM -0500 Message-ID: [EMAIL PROTECTED] Subject: Re: [PHP] Problem: ereg doesn't wo On Tue, 18 Sep 2001, * RzE: wrote: and get DD-MM-, but with well formed -MM-DD it doesn't match!. Is this a bug?. It would help if you send the code you're using, 'cause we can't see what you're doing now. FAFAIK it should just be possible. See the Sure: --- start --- $datenews = urldecode($datenews); // just in case, but it's the same // without this line and the one below. $datenews = trim($datenews); if (!ereg(([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}), $datenews, $regs)) { echo Duh! that is not a date, u kiddie: $datenews.; exit; } else echo Cool! it is a date. Continue the proggie.; --- end --- where $datenews is passed as a get variable, which is obtained with this: --- start --- // the $regs array comes from the ereg expression above (the one which // doesn't work as expected). $timestamp = mktime(0,0,0,$regs[2],$regs[3],$regs[1]); $yesterday = $timestamp - 86400; // one day before... that's yesterday :) $yesternews = date(Y-m-d,$yesterday); // here I pass the new datenews to myself: print a href=\$PHP_SELF?datenews=.urlencode($yesternews).\Older news/a\n; --- end --- This sometimes work, but sometimes it doesn't randomly, even with the same date both times, and the worst thing is that the failure notice prints the right date in the right format. Now I went back to php-4.0.6 (apache-1.3.20, rh-7.1) and it's the same. Any help is appreciated. Thank you. Regards. R. /Original message Reply Ehhh... works fine here! Dunno what's wrong. Don't you do anything else within your code that can f#ck up the date? I have absolutely no problems with the piece of code you've send. I went through almost a complete year using the link it produces. No prob at all. Btw; you can just use: $yesternews = date(Y-m-d, mktime(0,0,0,$regs[2],$regs[3]-1,$regs[1])); PHP will make sure it produces a correct date. Then you don't have to works with timestamps and seconds and stuff. Just let PHP do all the work. That's what it's designed for :) /Reply -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Print current page with no printer dialog box - How ?
I guess people can always use the browser's print button, but this has some limitation on pages that use frames etc. I figure you already know this one: window.print(); (JavaScript) :) You still get the print-dialog, but the user doesn't have to push the print button of the browser and you don't have any problems when using frames, 'cause you just make this call from the frame you want to be printed. -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] how to use the function strtotime
Original message From: mydata [EMAIL PROTECTED] Date: Thu, Sep 20, 2001 at 11:41:09AM +0800 Message-ID: [EMAIL PROTECTED] Subject: [PHP] how to use the function strtotime Hi, I'm php developer beginner in China,but I am confused with function strtotime. yes ,I know the usage of function strtotime in php manual. But description of php manual about it is too little.I want to know more about it. /Original message Reply It's not all that difficult, really. It's exactly how it's described in the manual. Here is some code that runs some samples: (I must say, though, that most examples can be done a lot easier without strtotime(), but 'cause these are examples of strtotime()... well... you know :) --- PHP Example Code --- PRE ?php /* Show a given date (+time) */ print (Date: \n\t); print (date (r, strtotime (January 31 2000 19:20:15)).\n\n); /* Show the current date (+time) */ print (Now: \n\t); print (date (r, strtotime (now)).\n\n); /* Show the date (+time) of tomorrow */ print (Tomorrow: \n\t); print (date (r, strtotime (tomorrow)).\n\n); /* Show the date (+time) of yesterday */ print (Yesterday: \n\t); print (date (r, strtotime (yesterday)).\n\n); /* Show the date (+time) of yesterday, where now is tomorrow. So the the output will be today :) */ print (Yesterday, where 'now' is tomorrow: \n\t); print (date (r, strtotime (yesterday, strtotime(tomorrow))).\n\n); /* Show the date (+time) 13 days from december 24th 1998 */ print (13 days from december 24th 1998: \n\t); print (date (r, strtotime (+13 days, strtotime(December 24 1998))).\n\n» /* Let's say you get some date from the db (or something) and you * want to add 2 years and 4 months and 23 days. */ print (Well... just see: \n\t); $date_from_db = 2001-09-20; print (date (r, strtotime (+2 years +4 months +23 days, mktime(0,0,0,substr($date_from_db, 5, 2), substr($date_from_db, 8, 2), substr($date_from_db, 0, 4.\n\n); /* Etc. */ print (And so on... :)HR noshade size=\1\); ? /PRE --- End of PHP Example Code --- /Reply -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] interesting warning!!!
Original message From: Balaji Ankem [EMAIL PROTECTED] Date: Thu, Sep 20, 2001 at 01:11:59PM +0500 Message-ID: [EMAIL PROTECTED] Subject: [PHP] interesting warning!!! Hi,friend, i registered login info while login using session_register session_register(user,pw); --- and during logout i have unregistered like following.. session_unregister(user,pw); This is the warning i got after logout.. Warning: Wrong parameter count for session_unregister() in /www/imac/logout.php on line 4 Thanks and Regards -Balaji Ankem /Original message Reply Hai Balaji! Thx for the warning!? It's actually exactly like in the manual pages: bool session_register (mixed name [, mixed ...]) ^ and bool session_unregister (string name) ^^ :) /Reply -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] simple question...
Original message From: Ker Ruben Ramos [EMAIL PROTECTED] Date: Thu, Sep 20, 2001 at 09:36:55PM -0700 Message-ID: 012b01c14257$0afb3db0$bb05aacb@weblinqproxy Subject: Re: [PHP] simple question... One more thing... If I got '2001-09-01' Is there a fast way of incrementing the month of it? making it '2001-10-01' ? /Original message Reply You should date() do the work here. So just take the month and then +1. Date() will take care the result is a valid date. Below is some example... --- PHP Example Code --- PRE ?php $myDate = 2001-09-12; if (ereg (([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}), $myDate, $matches)) { if (checkdate ($matches[2], $matches[3], $matches[1])) { print (date (Y-m-d, mktime (0,0,0,$matches[2]+1, $matches[3], $matches[1]))); } else { print (No valid date!); } } else { print (No valid date!); } ? /PRE --- End of PHP Example Code --- /Reply -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] simple question...
You should date() do the work here. So just take the month and then +1. Date() will take care the result is a valid date. Below is some example... Well... I meant: let mktime() do the work... not date(). Date() only shows the result of mktime() in a proper format. Mktime() makes sure it's a valid time(stamp) :) -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] if statement
Original message From: Jeb Anderson Scarbrough [EMAIL PROTECTED] Date: Thu, Sep 20, 2001 at 09:46:13AM -0400 Message-ID: [EMAIL PROTECTED] Subject: [PHP] if statement This seems to be a simple questions, but it is baffling me for some reason. How do I create an if statement with multiple conditions. For example, I cannot get either of these to work correctly: if(isset($REMOTE_USER) $AUTH_TYPE='securid') { // do something } else { // do something else } OR if((isset($REMOTE_USER)) ($AUTH_TYPE='securid')) { // do something } else { // do something else } Thanks. /Original message Reply I think your problem isn't really the if-statement itself. You should use == io =. So it would be: if(isset($REMOTE_USER) $AUTH_TYPE=='securid') { ^^ ^^ /Reply -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] simple question...
Original message From: Ker Ruben Ramos [EMAIL PROTECTED] Date: Thu, Sep 20, 2001 at 10:16:01PM -0700 Message-ID: 016101c1425c$819cdcd0$bb05aacb@weblinqproxy Subject: Re: [PHP] simple question... again.. one more thing How do I know how many days date differ? let's say '2001-09-01' and '2001-09-08'. Just looking for the fastest way of code to run. /Original message Reply The sample code below does pretty much what you want. BUT!!! It's not a very nice solution... Eg it cannot calculate a difference of more than one year :( Furthermore I must point out that there is no error-checking in this example. So if you _do_ want to use this, you'll have to add the error-checking. Sorry that it's not a really good solution, but due to lack of time, I could not think of anything better right now... --- PHP Example Code --- PRE ?php $dateOne = 2001-09-01; $dateTwo = 2001-09-08; ereg (([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}), $dateOne, $match_1); ereg (([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}), $dateTwo, $match_2); $stampOne = mktime (0,0,0,$match_1[2],$match_1[3],$match_1[1]); $stampTwo = mktime (0,0,0,$match_2[2],$match_2[3],$match_2[1]); $days_differ = date(z, ($stampTwo-$stampOne)); print (Days: $days_differ); ? /PRE --- End of PHP Example Code --- /Reply -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Parsing text file and dividing column into three...PLEASE help :)
Original message From: Jeff Lewis [EMAIL PROTECTED] Date: Thu, Sep 20, 2001 at 11:59:32AM -0400 Message-ID: 013e01c141ed$3d51f340$76a1a8c0@LEWISJCIT Subject: [PHP] Parsing text file and dividing column into three...PLEASE help :) I have a very large text file that is set up like so: It contains some smaller columns but one HUGE one that contains the body of a resume. I am looking for help on processing this file. What I need to do is convert the final column into three columns. Each column can have no more than 4000 characters, is this possible? Well I know it's possible but can someone help me? I am down to my last options :( /Original message Reply Dunno what you want to do exactly, but have you ever thought about split()? Something like: $myColumns = split (|, $contents); /Reply -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] real simple regex
Original message From: Jack Dempsey [EMAIL PROTECTED] Date: Mon, Sep 17, 2001 at 09:41:07PM -0400 Message-ID: [EMAIL PROTECTED] Subject: RE: [PHP] real simple regex you actually don't need regex... if you take a few minutes you can do it all with strpos and substr, adn it'll be faster than regex. /Original message Reply Not realy the very best solution to use strpos and substr. You'll have to loop through the From-string and look for the next address each time. You can have more than one address in the From-field! And then again... what would you do with addresses that are not between and ? Eg.: Renze Munnik [EMAIL PROTECTED], [EMAIL PROTECTED] Using strpos and substr won't realy make you're live any simpler. I suggest you use something like the following RE: $emlchars = [a-z0-9.-]+; $RE = /($emlchars@$emlchars)/i; I've put the allowed characters for the email-address in a separate string in order to make it read easier. You can add all characters to that string that are also allowed, because I don't believe these are the only allowed characters in an email-address. How to use? See the following example code: --- PHP Code --- PRE ?php $from = * RzE: [EMAIL PROTECTED], [EMAIL PROTECTED], Mr Nobody [EMAIL PROTECTED]; $emlchars = [a-z0-9.-]+; $RE = /($emlchars@$emlchars)/i; if (preg_match_all ($RE, $from, $matches)) { print (H1Matched!/H1\n\n); print_r ($matches); } else { print (H1Didn't match!/H1); } ? /PRE --- End of PHP Code --- /Reply -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Problem: ereg doesn't work ok (?).
Original message From: Lic. Rodolfo Gonzalez Gonzalez [EMAIL PROTECTED] Date: Mon, Sep 17, 2001 at 05:13:04PM -0500 Message-ID: [EMAIL PROTECTED] Subject: [PHP] Problem: ereg doesn't work o Hello, I have a problem with ereg: following the example from the documentation (see the ereg page in the manual), I'm using it to parse a -MM-DD date and get DD-MM-, but with well formed -MM-DD it doesn't match!. Is this a bug?. Regards, Rodolfo. php-4.0.8-dev (maybe the problem is due to the dev, but I'd like to confirm it). /Original message Reply It would help if you send the code you're using, 'cause we can't see what you're doing now. FAFAIK it should just be possible. See the following example: --- PHP Code Example --- PRE ?php $myDate = 2001-01-31; $RE = ([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}); if (ereg ($RE, $myDate, $matches)) { print (H1Matched!/H1\n\n); printf (Year : %4d\nMonth: %02d\nDay : %02d\n, (integer)$matches[1], (integer)$matches[2], (integer)$matches[3]); } else { print (H1Didn't match!/H1); } ? /PRE --- End of PHP Code Example --- /Reply -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Print current page with no printer dialog box - How ?
Original message From: hue micheal [EMAIL PROTECTED] Date: Mon, Sep 17, 2001 at 09:51:07PM -0400 Message-ID: [EMAIL PROTECTED] Subject: [PHP] Print current page with no printer dialog box - How ? Do you know how to create a button to print current page without bringing up the printer dialog box? I just print to the default printer. And also how do I insert a page break ? Thanks. Huem /Original message Reply FAFAIK it's not possible to print a page client-side without showing the printer dialog box. And it shouldn't be either. You don't want people to just be able to do all kinds of things on your computer without being prompted for them. Page breaks are not part of HTML. Simply because HTML was never designed for that kind of puposes. /Reply -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Print current page with no printer dialog box - How ?
Original message From: Matthew Loff [EMAIL PROTECTED] Date: Tue, Sep 18, 2001 at 04:11:34AM -0400 Message-ID: 017f01c14019$887d5600$0ce60281@bang Subject: RE: [PHP] Print current page with no printer dialog box - How ? FYI-- Page breaks can be designated with CSS (style sheets)... Although that's not a completely cross-platform method. /Original message Reply Yep... that's what I said; You can't use pagebreaks. First... they're not part of HTML. Second; like you said yourself... it's not cross-platform... and like everyone knows; creating sites/pages that only some part of the users can see/use is not realy every very great solution. You build sites in order make as many people visit/use/see them as possible. Not just that one part of the world that uses the browser that you like. /Reply -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Print current page with no printer dialog box - How ?
Original message From: Chris Lambert [EMAIL PROTECTED] Date: Tue, Sep 18, 2001 at 08:52:46AM - Message-ID: [EMAIL PROTECTED] Subject: Re: [PHP] Print current page with no printer dialog box - How ? However, using CSS to insert page breaks causes no problem at all in older browsers. HTML (and related technologies) have been designed so that newer features do not cause problems on older clients. Of course not everyone will use the newer features in such a way but that does not mean that they cannot be used correctly. In theory a document written in XHTML should display (to some extent) on a text only browser which only supports HTML 1. /Original message Reply FYI; pagebreaks are added CSS2. Not available in CSS1, so not compatible with older versions of browsers (opposite to what you say). Btw; another example of non-compatibility: background-color Try using that in eg older versions of IE. It's just ignored. Eg. IE3 uses bgcolor io background-color. The browsers have been made backwards-compatible (mostly anyway), and not forwards-compatible (like you say). Pages made for the older browsers still work (usualy... not always) on the newer browsers. But pages made for newer browsers hardly ever work fine on older browsers. /Reply -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Print current page with no printer dialog box - How ?
I know that. I did not say it would work - I said it would not cause any problems. The HTML specification says that clients/browsers should ignore any tags they don't understand. Therefore any old browser coming across a STYLE=... will ignore it. Pages made solely for newer browsers will probably look awful in older browsers. However, web pages can be written that use the newer features of newer browsers (such as CSS, Javascript, DHTML, Tables!, etc.) and are still accessible to older browsers. Ahhh... well, I'm sorry... I misunderstood. I thought (/think) that stuff that doesn't work _is_ a problem, but that just a matter of oppinion obviously. If I write some code and a browser doesn't show/use it, I believe I've got a real problem, but obviously not everyone thinks that way (...) I think it's pretty irritating when a browser ignores my tags, but that will just be me, then. Btw; JavaScript written for newer browsers will not always just be ignored by older browsers. They can really choke in it. But that just aside. And for the HTML specification part... Yes... specifications can say things like that indeed. The problem, though, is that browsers not always stick to the specification. IE is a good example for that. Yet it's used by over 90% of all users, so just sticking to the specifications (like I used to do) isn't much of an option anymore. Ofcourse you should at any point it's possible, but writing pages only based on the specifications will not show up in many browsers they way you intended it. It's a damn shame, but true. -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] SMS with php
could U list the URL http://www.radio.net/rfc1861.txt?number=1861 This URL doesn't exist. Please check it... -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] SMS with php
http://www.ietf.org/rfc/rfc1861.txt?number=1861 There. How is that. A lot better :) -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] For the RegExps gurus!
Ehhh... hai! I've been away on vacation, so it's a bit late, but anyway... You didn't. Actually please expose - tell i tell i:). I am all ears:) I meant I improved my own versions, not you're version. That's why you can't find the improvement on you're code. If that's what you meant... ? RE ? Sorry, I am not a club insider:) Not realy any kind of club... just lazy typing; RE stands for Regular Expression. -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] For the RegExps gurus!
Original message From: ~~~i LeoNid ~~ [EMAIL PROTECTED] Date: Thu, Sep 06, 2001 at 05:30:44PM + Message-ID: 3b97b222.78196206@localhost Subject: Re: [PHP] For the RegExps gurus! You can keep improving:) or you can use piece of my working (except for $Harlem, to which i am not going:) code (I give it for free this time:) No /me, no ereg, no nothing - gentleMen:)-just /i (did you miss it, btw?:) /Original message Reply If you look at the stuff you sent you'll understand why I improved it. Btw... why the h*ll do you explode() the string you're matching, while there's the /m modifier? You're making it to difficult for yourself (and others). No need for the messy solution you created... Just use RE's that are as simple as possible. It has the best performance and it reads a lot easier. /Reply -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] code troble
I just gave a very quick look... so maybe there are some things that I've overlooked. But I hope this solves your problem... html head titleExample 2.01/title meta http-equiv=Content-Type content=text/html; charset=iso-8859-1 /head body ?php if (emty(provera)) {pokazi();} I'd use $ here :) if (empty ($provera)) ... ^ ^ else {obrada();} ? ?php function pokazi() { global $PHP_SELF; ? form target = ?php echo $PHP_SELF ?; METHOD = get input type = text name = ime input type = text name = vrednost If I were you I'd close the input-tag :) input type = text name = vrednost ^ ^ input type =hidden name = provera value = rezultati and again... input type =hidden name = provera value = rezultati ^ ^ /form ?php } ? ?php function obrada() { global $ime; global $vrednost; Did you check whether or not $ime and $vrednost are defined/set at all? (isset ($ime) or !empty ($ime)) if ($ime == Nikola $vrednost == 100){ echo Zdravo $ime br; echo Iznos na Vasem racunu je $vrednost dolara; } ? /body /html -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] code troble
Well... I've already found something I overlooked. You call emty() io empty(); see below... html head titleExample 2.01/title meta http-equiv=Content-Type content=text/html; charset=iso-8859-1 /head body ?php if (emty(provera)) {pokazi();} ^^ ^^ Here you forgot the 'p' in emPty() I'd use $ here :) if (empty ($provera)) ... ^ ^ else {obrada();} ? ?php function pokazi() { global $PHP_SELF; ? form target = ?php echo $PHP_SELF ?; METHOD = get input type = text name = ime input type = text name = vrednost If I were you I'd close the input-tag :) input type = text name = vrednost ^ ^ input type =hidden name = provera value = rezultati and again... input type =hidden name = provera value = rezultati ^ ^ /form ?php } ? ?php function obrada() { global $ime; global $vrednost; Did you check whether or not $ime and $vrednost are defined/set at all? (isset ($ime) or !empty ($ime)) if ($ime == Nikola $vrednost == 100){ echo Zdravo $ime br; echo Iznos na Vasem racunu je $vrednost dolara; } ? /body /html -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] session - why does this not work?
Original message From: Christian Haines [EMAIL PROTECTED] Date: Thu, Sep 06, 2001 at 03:15:05AM +1030 Message-ID: [EMAIL PROTECTED] Subject: [PHP] session - why does this not work? hi all, any ideas why this does not work? its just a simple script to test multi-dimensional arrays. the count value should increment...should it not? many thanks in advance! ? session_start(); session_register(count[0]); $count[0]++; echo $count[0].brnbsp;br; reset ($HTTP_SESSION_VARS); while (list($key, $value) = each ($HTTP_SESSION_VARS)) { echo Key: $key; Value: $valuebr\n; } ? html body form name=test method=post action=session_test.php input name=submit type=submit /form /body /html /Original message Reply Try this instead: session_start(); session_register(count); $count = array(); $count[0]++; Btw. faik a variable you session_register() will not be available in the $HTTP_SESSION_VARS before you've left the page. But I'm not sure, so you should check that out. You should check $count for existence btw, before you register it as a session variable. Ca. it's already registered as a session variable. Then you don't want to register it again. And besides that, what would you think of initializing variables? I mean... you increase $count[0], but from which value? I'd say something like this: --- PHP code --- session_start(); if (!isset ($count)) { $count = array(); $count[0] = 0; if (!session_is_registered) { session_register (count); } } $count[0]++; --- End of PHP code --- /Reply -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] str_replace and arrays
Original message From: Gerard Samuel [EMAIL PROTECTED] Date: Thu, Sep 06, 2001 at 01:10:15AM -0400 Message-ID: [EMAIL PROTECTED] Subject: [PHP] str_replace and arrays Hey all. Im trying to reduce some lines of code that has muliple lines of str_replace. I figure lets try using arrays but its not working. E.g. I have about 15-20 lines like this. $message = str_replace(:D, IMG SRC=\images/forum/icons/icon_biggrin.gif\, $message); Im trying $path = images/forum/icons/; $one = array(:D,:)); $two = array($path.icon_biggrin.gif, $path.icon_smile.gif); message = str_replace($one, $two, $message); do you see anything wrong /Original message Reply Well... you forgot the $ sign for message at the last line, it should be $message= io message= Because the rest of the construction should just work. Check out my simple example below. You haven't said what goes wrong exactly, btw. --- PHP example --- ?php $txt = And now :D some :-) smiley =( kind of ;) thing.; $match = array (:D, :-), =(, ;)); $replace = array (1, 2, 3, 4); print str_replace($match, $replace, $txt); ? --- End of PHP example --- /Reply -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] For the RegExps gurus!
Sort of yes I thought it can be done with the /e modifier! Well... the /e modifier is used. But you have a different problem, you're matching over multiple lines. That's what the /m modifier is for. Can't it be done with pure RegExps? Ehh... no. How would you implement an if-statement then? You could use the very simple pure regexps if you don't also want to match/replace the www.some.thing. If you only want to replace the URL's that start with the protocol, then you can use the pure regexps. If not... to bad, you'll need /e. -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] For the RegExps gurus!
Original message From: _lallous [EMAIL PROTECTED] Date: Thu, Sep 06, 2001 at 11:34:45AM +0200 Message-ID: [EMAIL PROTECTED] Subject: Re: [PHP] For the RegExps gurus! Ehh... no. How would you implement an if-statement then? I thought I could have build a regexp that allow you to specify a default value of a subset if it was not matched... and it seems there is no way then! Thanks Renze. /Original message Reply Okay... I found a different way. I don't actually think this is better, but the regexp is some what more pure: --- PHP code --- PRE ?php $mem = Hello world! http://www.helloworld.com\n Hello world! ftp://ftp.server.com\n Hello world www.helloworld.com; /* -- ! Here's the old regexp ! -- */ // $mem = preg_replace (/\s+([http:|ftp:]{0,1}\S+\.\S+)/me, ' A // href=\'. // (ereg('^[http:|ftp:]','\\1') // ? '\\1\\\1/A' // : 'http://\\1\;http://\\1/A'), $mem); /* -- ! Here's the new regexp ! -- */ // Need an associative array... $repl = array ( = http://;, http://; = http://;, ftp://; = ftp://;); // The regexp itself: $mem = preg_replace (/\s+([http:|ftp:]*(\/\/)*)(\S+\.\S+)/me, ' A href=\'.\$repl['\\1'].'\\3\'.\$repl['\\1'].'\\3/A', $mem); print ($mem); ? /PRE --- End of PHP code --- I'll let you know when I find a better way... I think there must be one... /Reply -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] For the RegExps gurus!
And another option... --- PHP code --- PRE ?php $mem = Hello world! http://www.helloworld.com\n Hello world! ftp://ftp.server.com\n Hello world www.helloworld.com; /* -- ! First regexp ! -- */ // $mem = preg_replace (/\s+([http:|ftp:]{0,1}\S+\.\S+)/me, ' A // href=\'. // (ereg('^[http:|ftp:]','\\1') // ? '\\1\\\1/A' // : 'http://\\1\;http://\\1/A'), $mem); /* -- ! Second regexp ! -- */ // $repl = array ( = http://;, // http://; = http://;, // ftp://; = ftp://;); // $mem = preg_replace (/\s+([http:|ftp:]*(\/\/)*)(\S+\.\S+)/me, // ' A // href=\'.\$repl['\\1'].'\\3\'.\$repl['\\1'].'\\3/A', // $mem); /* -- ! Third regexp ! -- */ $mem = preg_replace (/\s+([http:|ftp:]*(\/\/)*)(\S+\.\S+)/me, ' A href=\'.('\\1' ? '\\1' : \http://\;).'\\3\'. ('\\1' ? '\\1' : \http://\;).'\\3/A', $mem); print ($mem); ? /PRE --- End of PHP code --- ...and ...keep on trying... -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] For the RegExps gurus!
Original message From: _lallous [EMAIL PROTECTED] Date: Thu, Sep 06, 2001 at 02:28:03PM +0200 Message-ID: [EMAIL PROTECTED] Subject: Re: [PHP] For the RegExps gurus! Thanks alot man! They are all still using /e switch... ;) /Original message Reply Yep... still using /e switch. I'm not sure if there's a way to do this without using it. But I'm still pretty sure there's a better way then the three I've mentioned so far. But you know... fact is that I do have to work, so I don't have time to keep on trying nonstop. In between things I'm trying to figure out what's the best way to do this. I believe there's a better way, and I'm (also) trying to figure out a way to do it without /e. Btw... It's your job to try to proof the regexp's aren't correct. Try to find some weird construction in $mem that should be a valid URL but isn't matched/replaced by the regexp's. It's a necessary evil to (try to) proof what you have is wrong. Seems strange, but one should realy try hard to find a way to make one's own program's fail. Only then you can fix realy everything a make the most optimal program. So... if you find something where the regexp's fail: plz let me know. I don't have time to test the regexp's thoroughly. (sorry?!) /Reply -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Session destruction
Original message From: Kristofer Thorssell [EMAIL PROTECTED] Date: Thu, Sep 06, 2001 at 04:56:17PM +0200 Message-ID: [EMAIL PROTECTED] Subject: [PHP] Session destruction ? session_start(); if(session_destroy()) echo You are now logged out; ? is there something wrong with this? because i've seen many comments where people say that you can't have start and destroy in the same script. /Kristofer /Original message Reply I don't know who the h*ll told you that, but session_start() _has_to_be_ in the same script as session_destroy(). Otherwise that d#mn thing doesn't know what to destroy. /Reply -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] For the RegExps gurus!
Got another solution. So far the first solution not using the /e modifier. It's not realy the best solution, but I'm still trying to improve it. Getting closer every time... --- PHP code --- PRE ?php $mem = Hello world! http://www.helloworld.com\n Hello world! ftp://ftp.server.com\n Hello world www.helloworld.com; /* -- ! Fourth regexp ! -- */ $mem = preg_replace (/\s+([http:|ftp:]*(\/\/)*)(\S+\.\S+)/m, A href=\http://\\1\\3\;http://\\1\\3/A, $mem); $mem = preg_replace (/http:\/\/([http:\/\/|ftp:\/\/]+)/m, \\1, $mem); print ($mem); ? /PRE --- End of PHP code --- -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] For the RegExps gurus!
Okay... this time an even better solution, without the /e modifier. Think this comes pretty close to some final solution. --- PHP code --- PRE ?php $mem = Hello world! http://www.helloworld.com\n Hello world! ftp://ftp.server.com\n Hello world www.helloworld.com; /* -- ! Fifth regexp ! -- */ $pattern = array (~\s+((?:http://|ftp://){0}(?:\w+\.)+(?:\w+))~m, ~\s+((?:http://|ftp://)+(?:\w+\.)+(?:\w+))~m); $replace = array ( A href=\http://$1\;http://$1/A, A href=\$1\$1/A); $mem = preg_replace ($pattern, $replace, $mem); print ($mem); ? /PRE --- End of PHP code --- This still needs some optimization imo (...) -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] For the RegExps gurus!
And here is version 5.2! I optimized the search patterns. I found out that there was only a very limited scope of URL's that was matched... So I pretty much fixed that now (see the example). Repeating elements from the patterns have been extracted and put in an array, so that you can easily see the diff between the two patterns. Also it's a bit easier to read this way. Also note the adjusted test-string $mem. There are some more realistic URL's in it than before. Just to see that they can realy be matched. --- PHP code --- PRE ?php $mem = Hello world! http://www.helloworld.com/index.html\n Hello world! ftp://ftp-system.server.com?name=Renze%20Munnik\n Hello world! www.helloworld.com this-is/not=a%link.\n Hello world! www.helloworld.com/dynamic-html/main.php?and=some%20Extra; /* --- RE version 5.2 --- */ /* Sub patterns: */ $sub = array ((ht|f)tp://,/* protocols */ (\w+|-)+\., /* first (required) part of URL */ \w+[/?=\.%\-]*);/* rest of the URL */ /* Search-patterns: */ $pattern = array (~\s+(($sub[0])+($sub[1])($sub[2])+)~m, ~\s+(($sub[0]){0}($sub[1])($sub[2])+)~m); $replace = array ( A href=\$1\$1/A, A href=\http://$1\;http://$1/A); $mem = preg_replace ($pattern, $replace, $mem); print ($mem); ? /PRE --- End of PHP code --- -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] The future of PHP - PHP Pattern Repository
Original message From: Miles Thompson [EMAIL PROTECTED] Date: Thu, Sep 06, 2001 at 01:44:16PM -0300 Message-ID: [EMAIL PROTECTED] Subject: Re: [PHP] The future of PHP - PHP Pattern Repository Geoff, I'm getting a 404 not found on that URL. Please check it. Miles /Original message Reply You should replace the slash by a dot: http://www/geocities.com/SiliconValley/Lab/6888/prpats.htm ^ | v http://www.geocities.com/SiliconValley/Lab/6888/prpats.htm /Reply -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] urgent. need posix-style regexp expert
Original message From: [EMAIL PROTECTED] [EMAIL PROTECTED] Date: Tue, Sep 04, 2001 at 07:48:27PM +0200 Message-ID: [EMAIL PROTECTED] Subject: [PHP] urgent. need posix-style regexp expert what is the correct POSIX-regexp to match a range of characters between two parantheses, while ensuring that it is the largest match possible? need fast reply. thanks. Running against (foo (bar (baaz) quux( fred woody) wang)) it should return foo (bar (baaz) quux( fred woody) wang) D. Alvarez Arribas [EMAIL PROTECTED] /Original message Reply Here's your regex: --- PHP Code --- PRE ? $myStr = foo (bar (baaz) quux( fred woody) wang); if (ereg (^[^(]*\((.+)\)[^)]*$, $myStr, $regs)) { print (Matched!HR); print_r ($regs); } else { print (No match... sorry!); } ? /PRE --- End of PHP Code --- So the expr to use: ^[^(]*\((.+)\)[^)]*$ /Reply -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] For the RegExps gurus!
Original message From: _lallous [EMAIL PROTECTED] Date: Wed, Sep 05, 2001 at 12:17:21PM +0200 Message-ID: [EMAIL PROTECTED] Subject: [PHP] For the RegExps gurus! I want to write a RegExp that converts something like this: $mem = Hello world! http://www.helloworld.com\n Hello world! ftp://ftp.server.com\n Hello world www.helloworld.com how can I write a single regexp that converts $mem to this: $mem = Hello world! a href=http://www.helloworld.com;http://www.helloworld.com/a\n Hello world! a href=ftp://ftp.server.com;ftp://ftp.server.com/a\n Hello world a href=http://www.helloworld.com;http://www.helloworld.com/a As you noticed that the second line didn't have the protocol specifier and it took by default http://; and the ones that had a protocol specifier were kept as is. /Original message Reply This should do the job: --- PHP code --- PRE ?php $mem = Hello world! http://www.helloworld.com\n Hello world! ftp://ftp.server.com\n Hello world www.helloworld.com; /* -- ! Here's your regexp ! -- */ $mem = preg_replace (/\s+([http:|ftp:]{0,1}\S+\.\S+)/me, ' A href=\'. (ereg('^[http:|ftp:]','\\1') ? '\\1\\\1/A' : 'http://\\1\;http://\\1/A'), $mem); print ($mem); ? /PRE --- End of PHP code --- Let me know if this was what you were looking for... /Reply -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Links
Original message From: Kunal Jhunjhunwala [EMAIL PROTECTED] Date: Wed, Sep 05, 2001 at 03:49:49PM +0530 Message-ID: 056a01c135f4$4e7b99a0$0301a8c0@CONFUSED Subject: [PHP] Links Hey, This is the second time I am asking about this. I havent been able to solve the problem. I am trying to get all the information between the a /a tags. How can i do this? I couldnt figure the regex out :( Regards, Kunal Jhunjhunwala /Original message Reply Here you are! This regex gets you everything between all A and /A tags. Case insensitive, including embedded HTML-tags etc. Try it and let me know if this is what you need. --- PHP code --- preg_match_all (/a[^]*(.+)\/a/imU, $StringToSearch, $matches); print_r ($matches); --- End of PHP code --- /Reply -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: what will be the output for this pgm?
Original message From: Balaji Ankem [EMAIL PROTECTED] Date: Wed, Sep 05, 2001 at 02:05:50AM +0530 Message-ID: 03f301c13581$2fccf8a0$[EMAIL PROTECTED] Subject: what will be the output for this pgm? Hi friend, what will be the output for the following program? ?php $foo=$HTTP_SERVER_VARS[HTTP_REFERER]; echo $foo; ? For me it is printing the blank value. Thanks in advance Regards -Balaji /Original message Reply Hi there, Well... it depends on several things. First of all the browser of the user (your browser in this case) should support sending the referer. If it doesn't you tough out of luck. But I believe most browsers _do_ send it. But then... This is the tricky thing about testing these kinds of variables. You musn't call the page directly. Say you have your example in a page called test.php and you just type domain/test.php in your location bar you won't get to see anything. Very simply because there is no referer if you go to the page directly. So you should go there by using some link on a different page. You probably have warning message in your logfile saying that the index HTTP_REFERER is undefined. Working with these kinds of variables takes some more acurate coding. You should always first check whether or not the variable is defined: if (isset ($HTTP_SERVER_VARS[HTTP_REFERER])) { $foo = $HTTP_SERVER_VARS[HTTP_REFERER]; echo $foo; } Another tricky thing with using the referer is when users use bookmarks. If they bookmark the page and use that bookmark the next time they want to see the page, you won't get a referer from them. So... you should always check very thoroughly whether or not the referer is defined. And you should never base your authentication on it. Conclusion: Accept for the missing error-checking your code is correct. You should make a diffent page with a link to the page where this code is on and test it by clicking that link. It should work then... Hope this helped you out... /Reply -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Text area's width in NS
Original message From: Niklas Lampén [EMAIL PROTECTED] Date: Tue, Sep 04, 2001 at 02:39:03PM +0300 Message-ID: [EMAIL PROTECTED] Subject: [PHP] Text area's width in NS This helped me out (at least made my site look nicer :), but is there a way set text area's width like this? Doesn't seem to work with same code. IE however works great. Why the hell there can not be just ONE standard?!? Niklas /Original message Reply Sorry. Can't do. Netscape doesn't seem to support this feature. It does work in IE, though. Just add a style= to it. There you can set the width and height. Eg: TEXTAREA style=width: 400px; height: 200px;/TEXTAREA And for Netscape... well... you'll have to live with only using cols= and rows=. /Reply -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: Fwd: [PHP] Text area's width in NS
There is at: www.w3c.org but everyone (read big enterprises) is not following the recommendations |:-( /Original message Reply Yep... so actually your answer is: No you can't. The fact that there is a standard telling that something could be done really doesn't mean very much when, what you call 'big enterprises', don't stick to that standard. And yes... indeed... they don't stick to it. /Reply -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Another script doesnt work!
Original message From: Kyle Smith [EMAIL PROTECTED] Date: Tue, Sep 04, 2001 at 01:18:42PM -0700 Message-ID: [EMAIL PROTECTED] Subject: [PHP] Another script doesnt work! And this time its not because of a dot, someone please help! Parse error: parse error in /web/sites/197/lk6/www.stupeedstudios.f2s.com/dannys/sendform.php on line 22 line 22 is $message = blah!! ?php $addresses = [EMAIL PROTECTED]; $subject = Cam Application; $line = \r\n $message = $name. $line. $email. $line. $bestbritish. $line. $bestcharacterinbrit. $line. $bestyank. $line. $bestcharacterinyank. $line. $bestsketch. $line. $bestanimation. $line. $bestcomedyfilm. $line. $bestfilmchar. $line. $bestquiz. $line. $worstsitcom. $line. $comments; ? /Original message Reply Look at line 21, then. You forgot the semicolon: $line = \r\n; ^ /Reply -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] potential preg_replace bug; unsure however
Original message From: [EMAIL PROTECTED] [EMAIL PROTECTED] Date: Sat, Sep 01, 2001 at 08:55:15PM +0200 Message-ID: [EMAIL PROTECTED] Subject: [PHP] potential preg_replace bug; unsure however I built a Perl-style regex to match function calls in C-like languages where $name is the functions name. The functions are assumed to accept a single string as parameter. Here it is. /$name\s*\(\s*\(.*)\\s*\)\s*;/s The expression is successfully preg_match'ed on a stream of code, but when preg_replace is passed the same expression it does not return. The piece of code I tested this with was fairly small so that an increased demand of computation time is unlikely be the reason for this behaviour. Substituting the subexpression (.*) by ([^\]*) remedies this. The version of the PHP install is 4.05. Any ideas? D. Alvarez Arribas [EMAIL PROTECTED] /Original message Reply Well... Don't think this is a bug. Regexps usualy are greedy. They try to take as much code/text as they can get. And well... '.*' can take up about everything it encounters. Actually (IMO) you should try to avoid using '.*'. What you mentioned Substituting the subexpression (.*) by ([^\]*) remedies this. is a much better solution. It's what you're looking for in the first place. I mean... you're looking for some text that goes 'till the . Why would you want to use '.*' then? /Reply -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Problem with PHP_SELF
Original message From: David Otton [EMAIL PROTECTED] Date: Mon, Sep 03, 2001 at 03:21:00PM -0700 Message-ID: [EMAIL PROTECTED] Subject: Re: [PHP] Problem with PHP_SELF On Mon, 03 Sep 2001 15:11:04 -0700, you wrote: Following up my own post (in case someone finds this in the archives): Is there any situation where such variables would be available to phpinfo(), but not the rest of the script? You can't see $PHP_SELF within a function until you declare it global. This language really frustrates me sometimes... /Original message Reply It's not so frustrating if you configure it correct. If you set register_globals, you can just use 'm everywhere. It's not something you should do, though. You can better use $HTTP_SERVER_VARS[]. It's (some) safer. For those you don't need to turn on the register_globals. Just turning on track_vars will do then. And from PHP 4.0.3 you don't even need to do that. Quote from PHP manual PHP variables These variables are created by PHP itself. The $HTTP_*_VARS variables are available only if the track_vars configuration is turned on. When enabled, the variables are always set, even if they are empty arrays. This prevents a malicious user from spoofing these variables. Note: As of PHP 4.0.3, track_vars is always turned on, regardless of the configuration file setting. If the register_globals directive is set, then these variables will also be made available in the global scope of the script; i.e., separate from the $HTTP_*_VARS arrays. This feature should be used with care, and turned off if possible; while the $HTTP_*_VARS variables are safe, the bare global equivalents can be overwritten by user input, with possibly malicious intent. If you cannot turn off register_globals, you must take whatever steps are necessary to ensure that the data you are using is safe. /Quote from PHP manual See: http://www.php.net/manual/en/language.variables.predefined.php /Reply -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] header() + link..
Original message From: Ashwin Kutty [EMAIL PROTECTED] Date: Thu, Aug 30, 2001 at 10:51:20PM -0300 Message-ID: [EMAIL PROTECTED] Subject: [PHP] header() + link.. Hi, Is there a simple way to hide the redirect url when using the header function? I would like for the script url or even the form url to remain, but not the redirected url.. Besides printing the page in the script itself, would there be any other way? Any help is appreciated.. thanks.. /Original message Reply There's actually no good way to achieve it in a different way. You could include/require the new page, but that's actually what you don't want (quoteBesides printing the page in the script itself/quote). But there is a different way to do it. It concerns the frame-layout, though. 'Cause if you use frames, the URL of one of the frames will not be shown in the location bar. But then you'll have to use frames, which I don't know if you want. One thing I can tell you though... of a page that's being shown, you cannot hide the URL. Never. /Reply -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Delete files older than X seconds.
Original message From: Julio Nobrega Trabalhando [EMAIL PROTECTED] Date: Thu, Aug 30, 2001 at 12:56:38PM -0300 Message-ID: [EMAIL PROTECTED] Subject: [PHP] Delete files older than X seconds. Hi All, Another doubt. How can I delete files older than X seconds from a given folder? At the on-line manual I could only find a contributed note about 'discover time of last modification' from a file under a folder. Any help is appreciated. -- Julio Nobrega A hora está chegando: http://toca.sourceforge.net /Original message Reply I don't exactly see any problem here. If you want files older than X seconds, and you have a modification time... Then you can unlink() them can't you?! I think you pretty much found the solution yourself. But just in case... Take a look at the following manual pages and create a construction with them. I think these are all you need. http://www.php.net/manual/en/function.opendir.php http://www.php.net/manual/en/function.readdir.php http://www.php.net/manual/en/function.closedir.php (in order to scan your directory) http://www.php.net/manual/en/function.stat.php (in order to get the modification time) Hope this helps... And if this wasn't the problem... Tell me/us! /Reply -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Is there anything in here that could be considered a parse error?
Original message From: John Meyer [EMAIL PROTECTED] Date: Thu, Aug 30, 2001 at 03:49:57PM -0700 Message-ID: [EMAIL PROTECTED] Subject: [PHP] Is there anything in here that could be considered a parse error? 1 if (empty($DidSurvey[$p_surveyid])) { 2 if (is_array($p_answers)){ 3 foreach($p_answers as $value) { 4 $sql = INSERT INTO RESULTS(SURVEY_ID, ANSWER_ID) VALUES( . $p_surveyid . , . $value . );; 5 mysql_query($sql); 6 } 7 else { /Original message Reply Take a look yourself... Pretty obvious isn't it?! There's some code missing! At least... well... It's not right. You either don't close your foreach() loop which starts at line 3, or you don't close the if() loop which starts at line 2, and you definitely don't close the if() loop which starts at line 1. You probably mean something like: 1 if (empty($DidSurvey[$p_surveyid])) { 2 if (is_array($p_answers)){ 3 foreach($p_answers as $value) { 4 $sql = INSERT INTO RESULTS(SURVEY_ID, ANSWER_ID) VALUES( . $p_surveyid . , . $value . );; 5 mysql_query($sql); 6 } 7 } 8 } else { etc. /Reply -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] just 10 characters from a string
Original message From: Marcos Lloret [EMAIL PROTECTED] Date: Fri, Aug 31, 2001 at 09:53:01AM +0200 Message-ID: 019701c131f1$f57bdfa0$371c94c1@mlloret Subject: [PHP] just 10 characters from a string hi to all, i have a long string (about 255 characters) and i would like to show only 10. how can i do it? thanks in advance, marcos /Original message Reply When it's about _showing_ 10 characters, and not to change the string itself: $yourString = abcdefghijklmnopqrstuvwxyz; printf (%.10s, $yourString); /Reply -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] number to word converter
Original message From: Carry Ian [EMAIL PROTECTED] Date: Fri, Aug 31, 2001 at 12:36:20PM +0200 Message-ID: [EMAIL PROTECTED] Subject: [PHP] number to word converter Hello, can anybody suggest me where could i get a script to convert a integer value to a phrase. for eg. 135 to One Hundred And Thirty Five thanks in advance. carry /Original message Reply In some spare time I just created this function. It's prob. far from optimal, so maybe you'll have to give a look in order to optimize it. But at least it works. --- PHP code --- ? function inttoword ($x) { settype ($x, string); $returnString = ; $digit = array (One, Two, Three, Four, Five, Six, Seven, Eight, Nine, Ten, Eleven, Twelve, Thirteen, Fourteen, Fifteen, Sixteen, Seventeen, Eighteen, Nineteen); $tens = array (Twenty, Thirty, Fourty, Fifty, Sixty, Seventy, Eighty, Ninety); $hundred = false; for ($pos = 0; $pos strlen ($x); $pos++) { $togo = strlen($x)-$pos; $returnString .= ; if ($togo 2) { if ($togo 3) { $returnString .= inttoword (substr($x, 0, $togo-3)); $returnString .= Thousand; $pos += ($togo-4); } else { if ((integer)substr($x, $pos, 1) 0) { $returnString .= $digit[((integer)substr($x, $pos, 1))-1]; $returnString .= Hundred; $hundred = true; } } } elseif ($togo == 2) { if ((integer)substr($x, $pos, 1) == 1) { if ($hundred) $returnString .= and ; $returnString .= $digit[((integer)substr($x, $pos, 2))-1]; break; } else { if ((integer)substr($x, $pos, 1) 0) { if ($hundred) $returnString .= and ; $hundred = false; $returnString .= $tens[((integer)substr($x, $pos, 1))-2]; } $pos++; $returnString .= ; if ((integer)substr($x, $pos, 1)) { if ($hundred) $returnString .= and ; $returnString .= $digit[((integer)substr($x, $pos, 1))-1]; } break; } } else { if ($hundred) $returnString .= and ; $returnString .= $digit[((integer)substr($x, $pos, 1))-1]; } } return (preg_replace (/\s+/, , preg_replace (/^\s+/, , $returnString))); } ? PRE ? print inttoword(11).\n; print inttoword(21).\n; print inttoword(101).\n; print inttoword(152).\n; print inttoword(1000).\n; print inttoword(101032).\n; print inttoword(11).\n; ? /PRE --- End of PHP code --- Let me know if this is what you're looking for and/or if you have optimized it. Good luck! /Reply -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] number to word converter
Original message From: * RzE: [EMAIL PROTECTED] Date: Fri, Aug 31, 2001 at 02:03:06PM +0200 Message-ID: [EMAIL PROTECTED] Subject: Re: [PHP] number to word converter Oh... btw... It works uptil 99. So you can convert everything between 1 and 99. Zero (0) cannot be converted (stupid but true, and easy to patch in) and everything = a million will result in very weird results. But like I said... it's just a quickly written function and the most used numbers you can convert. -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] form data used on the same page?
Original message From: webmaster [EMAIL PROTECTED] Date: Fri, Aug 31, 2001 at 07:46:41AM -0500 Message-ID: 003001c1321a$fb84afc0$[EMAIL PROTECTED] Subject: [PHP] form data used on the same page? Greetungs. Is it possible to use data collected in a form ON THE SAME PAGE without using the form's submit button? In other words, if a text field is filled in, can I capture (via PHP or other means) the info typed there and display it elsewhere on the same page? I realize the answer may very well be NO, but if it is possible, it would certainly make my life easier this morning. Thanks in advance. Kenn /Original message Reply JavaScript is your solution! /Reply -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] header() + link..
Original message From: Ashwin Kutty [EMAIL PROTECTED] Date: Fri, Aug 31, 2001 at 10:44:04AM -0300 Message-ID: [EMAIL PROTECTED] Subject: Re: [PHP] header() + link.. Hi, I thought as much.. And no, dont want to use frames.. Id rather just have the URL shown in the Location Field.. I do realise, there is no real way to ever hide the URL, however, I just dint want to make it too obvious for the users to bookmark or pass around to people who are not authorized to view the page.. However, thanks for the reply.. /Original message Reply Ehmmm... You say that people who aren't authorized aren't allowed to see the page (which makes sense ;). I don't know ofcourse how you take care of things, but for me it's no problem if unauthorized people get URL's where they shouldn't look. I mean... the server just denies access. Problem solved! /Reply -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Variable Syntax Question
Original message From: Ninety-Nine Ways To Die [EMAIL PROTECTED] Date: Fri, Aug 31, 2001 at 10:28:56AM -0400 Message-ID: [EMAIL PROTECTED] Subject: [PHP] Variable Syntax Question I have a form that reads in a couple variables via: input type=textbox name=bob1 input type=textbox name=bob2 input type=textbox name=bob3 input type=textbox name=bob4 Now... I want to read in those variables in something like the following: for($i=1;$i4;$i++) { echo $bob$i; } BUT that obviously doesn't work, it simple prints 1, so how to I make it echo the value of the variable bob1? -Hass /Original message Reply for ($i = 1; $i 4; $i++) { $myVar = bob$i; print ($$myVar); } /Reply -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Variable Syntax Question
Original message From: * RzE: [EMAIL PROTECTED] Date: Fri, Aug 31, 2001 at 04:36:36PM +0200 Message-ID: [EMAIL PROTECTED] Subject: Re: [PHP] Variable Syntax Question Btw... Why not just use an array? input type=text name=bob[] input type=text name=bob[] input type=text name=bob[] input type=text name=bob[] and then: foreach ($bob as $myValue) { print ($myValue); } That's a much nicer solution... -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] strings in a function return
Original message From: Gerard Samuel [EMAIL PROTECTED] Date: Wed, Aug 29, 2001 at 09:58:12PM -0400 Message-ID: [EMAIL PROTECTED] Subject: Re: [PHP] strings in a function return I found an error, but it didn't do me any good. I tried this, any tips... Thanks function assign() { global $adminurl, $string; top(); if ($string) { $data = explode (|, $string); foreach ($data as $foo) { echo $foo[0]; } } form $array = array($new_cat,$assigned_to,$job,$assigned_by); $string = implode(|,$array); return $string; } The variables that form $array are from the form /Original message Reply Why use array($new_cat,...,$assigned_by); Loose the quotes: array ($new_cat,...,$assigned_by); You don't need to use implode(). Just return the array. In the calling function you can then get the results in two ways: $results = assign(); /* $results is an array */ or list ($new_cat,...,$assigned_by) = assign(); If you want a better answer on what is going wrong, you'll need to send some more code. Eg the code that you've now replaced by form. It might just be that the error is in that part. /Reply -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Referrer
Original message From: Nic Skitt [EMAIL PROTECTED] Date: Thu, Aug 30, 2001 at 12:25:44PM +0100 Message-ID: [EMAIL PROTECTED] Subject: [PHP] Referrer Hi all, What is the server variable for referrer? Cheers Nic /Original message Reply $HTTP_SERVER_VARS[HTTP_REFERER] Check phpinfo() next time... ;) /Reply -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] If statement within a variable?
Original message From: Brandon Orther [EMAIL PROTECTED] Date: Thu, Aug 30, 2001 at 08:59:44AM -0700 Message-ID: 006301c1316c$c9395010$0a00a8c0@webintel Subject: [PHP] If statement within a variable? Hello, Is there a way to put an if statement in a variable? For example: $var = Hello.IF($var2 = 1) { .Mr. Bean. } else { .New Comer. }. To The Coffee House.; Thank you, Brandon Orther /Original message Reply This is it: $var = Hello.($var2 = 1 ? Mr. Bean : New Comer).To The Coffee House.; /Reply -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] If statement within a variable?
Original message From: * RzE: [EMAIL PROTECTED] Date: Thu, Aug 30, 2001 at 06:05:57PM +0200 Message-ID: [EMAIL PROTECTED] Subject: Re: [PHP] If statement within a variable? This is it: $var = Hello.($var2 = 1 ? Mr. Bean : New Comer).To The Coffee House.; /Original message Reply Oops... copying your code I also copied an error. It should be $var2 == 1 io $var2 = 1. So your check will be: $var = Hello.($var2 == 1 ? Mr. Bean : New Comer).To The Coffee House.; /Reply -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Header() function and redirect
Original message From: Zhu George-CZZ010 [EMAIL PROTECTED] Date: Thu, Aug 30, 2001 at 11:10:19AM -0500 Message-ID: [EMAIL PROTECTED] Subject: [PHP] Header() function and redirect I am using Apache and PHP. I encountered a redirect problem in PHP, and traced it down, so, I generated a very short PHP page as following: ?php sleep(30); $goto = http://tt.mot.com/to_pdf/pdf_tmp/test.pdf;; Header(Location: $goto); exit; ? If the sleep(30); statement is commented out, this page works fine in both IE4.0/IE5.0 and netscape, but if sleep(30) statement is in this page, it will only work in Netscape, but not in IE. Is there another way to do the redirect in PHP? or how to fix this problem (I can't remove the sleep statement because in the real program, it is a System call and will take more than 30 seconds)? Thank you very much in advance. Regards, George -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] /Original message Reply You can (possibly) just redirect before the rest of your script. Ofcourse you can't do that when the rest of the script produces output, but it seems to me like it doesn't. Try the next code: --- PHP code --- ?php header (Location: http://somewhere.com;); error_log (And still my script is running!, 0); ? --- End of PHP code --- You'll see that the original script will write the line to the logfile although the user is already redirected to the next page. Btw... 30 seconds is a rather long time. No user will ever want to wait that long. Just my opinion... /Reply -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Date formatting in PHP 3.0
Original message From: Paul McGee [EMAIL PROTECTED] Date: Thu, Aug 30, 2001 at 12:13:21PM -0400 Message-ID: [EMAIL PROTECTED] Subject: [PHP] Date formatting in PHP 3.0 I'm looping through a MSQL db pulling out the dates where I would like to display the date and then the day of the week. The problem is that every date returns the same day of the week, Wed. I checked the documentation and it doesn't say anything about the expression only being executed once during inside the WHILE loop. I've tried: $m = substr($row[0],0,4); $d = substr($row[0],5,2); $y = substr($row[0],8,2); $dy = date (D, mktime(0,0,0,$m,$d,$y)); and just using the date field $dy = date (D, $row[0]); Any help would be greatly appreciated! /Original message Reply Did you give a look at your own code? A month consisting of 4 digits? And a year consisting of 2 digits? I'd say: --- PHP code --- $y = substr($row[0],0,4); $m = substr($row[0],5,2); $d = substr($row[0],8,2); $dy = date (D, mktime(0,0,0,$m,$d,$y)); and just using the date field $dy = date (D, $row[0]); --- End of PHP code --- /Reply -- * RzE: /Reply -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Header() function and redirect
Original message From: Zhu George-CZZ010 [EMAIL PROTECTED] Date: Thu, Aug 30, 2001 at 11:27:41AM -0500 Message-ID: [EMAIL PROTECTED] Subject: RE: [PHP] Header() function and redirect But I have to wait for the application to finish. The idea is: the application will take the file, and convert it into PDF file (it takes more than 30 seconds generally), then display the generated PDF file. I am just wondering if I can use Header() to redirect to a general php page, then in that page, redirect to the PDF file. Thanks, George /Original message Reply Ah... well... Don't know what you exactly mean, but you either have to wait 'till the processing has been done (which, like I said, takes too long to wait for), or you can use one of the following options: - You can have an email send to the user telling him/her that the PDF is ready. You can either send it as an attachment, or just send a URL of the page where the PDF can be downloaded. - You can have the user redirected to a page with a download link on it. Then you still have to problem, though, that the PDF isn't ready yet at the moment the user gets that link. But you get back to what you're wondering (if I can use Header() to redirect to a general php page); Yes, ofcourse... you can do it before or after the processing. But! You can't do anything about client-timeouts. And let's be honest... It's not that weird that a browser gives up if it doesn't get any answer for more than 30 seconds. It's a pretty long timeout already. /Reply -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Date formatting in PHP 3.0
Original message From: Paul McGee [EMAIL PROTECTED] Date: Thu, Aug 30, 2001 at 12:45:49PM -0400 Message-ID: [EMAIL PROTECTED] Subject: Re: [PHP] Date formatting in PHP 3.0 Thanks, I knew it was something stupid! However, the $dy = date (D, $row[0]) doesn't work. /Original message Reply You're welcome... and eh... for the However, the $dy = date (D, $row[0]) doesn't work.: It shouldn't. date() requires a timestamp as a second argument, not a string. Unless you retrieve an actual timestamp from your db (which you don't) you could directly feed it to date(). So as long as you get strings from your db you'll have to parse 'm first and then put them through mktime() (like you do in your example). Then you have a real timestamp and you can put that through date(). /Reply -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] file upload size, before upload complete
Original message From: christopher johnson [EMAIL PROTECTED] Date: Thu, Aug 30, 2001 at 12:47:00PM -0500 Message-ID: [EMAIL PROTECTED] Subject: [PHP] file upload size, before upload complete Can anyone think of a way to determine the file size of what the user is uploading before it has been fully uploaded? I know because of security restrictions javascript can't do this, but is it possible in php? I'm trying to make an upload progress bar, it doesn't have to be exact, but a close approximation would be nice. Thanks, Chris /Original message Reply Not possible. You first have to submit the form before the PHP starts. And then it's too late, 'cause at the moment you submit the form, the files are already being uploaded. You should really have a client-side solution for this (if there is any). /Reply -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] I beleive I have found a bug.....
Original message From: Brian White [EMAIL PROTECTED] Date: Wed, Aug 29, 2001 at 04:01:06PM +1000 Message-ID: [EMAIL PROTECTED] Subject: [PHP] I beleive I have found a bug. ... I just thought I would see if anyone else can reproduce it! Ok. The problem is in the following snippet of code. ( Note : this exmaple is extremely contrived, and is the essence of a much more complicated situation involving a function call from a class method... ) ?php $data = array( A = AA , B = BB, C= CC, D= DD, E = EE ); print pre\n; foreach ( $data as $key1=$val1 ) { //foreach ( $data as $key2=$val2 ) foreach ( array_keys($data) as $key2 ) // = PROBLEM IS HERE { if ( $key1 == $key2 ) print b$key2/b; else print $key2; print ; } print \n; } print /pre; ? I beleive it should generate pre bA/b B C D E A bB/b C D E A B bC/b D E A B C bD/b E A B C D bE/b /pre Instead it generates pre bA/b B C D E /pre If I replace the problem line foreach ( array_keys($data) as $key2 ) with the alternate foreach ( $data as $key2=$val2 ) then it works fine. I am using PHP 4.0.4pl1. Regs Brian White - Brian White Step Two Designs Pty Ltd - SGML, XML HTML Consultancy Phone: +612-93197901 Web: http://www.steptwo.com.au/ Email: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] /Original message Reply Hai Brain, I don't _think_ this is a bug (note: think). I haven't taken a very good look at your code, but as I understand you believe that: foreach ($data as $key) delivers the same $key as in: foreach ($data as $key=$value) Well... it doesn't. Check the manual on it. If you use the foreach ($x as $y) construction, $y is the value... not the key. Take a look at: http://www.php.net/manual/en/control-structures.foreach.php Quote from PHP manual foreach(array_expression as $value) foreach(array_expression as $key = $value) /Quote from PHP manual I think this solves your problem... /Reply -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] I beleive I have found a bug.....
Original message From: Brian White [EMAIL PROTECTED] Date: Wed, Aug 29, 2001 at 06:16:49PM +1000 Message-ID: [EMAIL PROTECTED] Subject: Re: [PHP] I beleive I have found a bug. You didn't read my code closely enough: I said: If I replace the problem line foreach ( array_keys($data) as $key2 ) ^^ with the alternate foreach ( $data as $key2=$val2 ) /Original message Reply Oops... Sorry! That's what I said... I didn't take a very good look. But now I have... You need to reset the $data-array before the inner foreach-loop. Then there's no problem. --- PHP code --- ?php print pre\n; foreach ( $data as $key1=$val1 ) { reset ($data); // - R E S E T !!! foreach ( array_keys($data) as $key2 ) { if ( $key1 == $key2 ) print b$key2/b; else print $key2; print ; } print \n; } print /pre; ? --- End of PHP code --- /Reply -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Update form objects before submit
Original message From: Stephane Pinel [EMAIL PROTECTED] Date: Wed, Aug 29, 2001 at 11:08:45AM +0200 Message-ID: [EMAIL PROTECTED] Subject: [PHP] Update form objects before submit I have a html page including php scripts that perform different stuff. The page contains a form (a Select 'products-price' and a field 'qty'). Depending the choice made by the user, I need to know what item in the SELECT object was choose and the number entered in the 'Qty' field to initialized a 'subtotal' zone BEFORE the user submit the form. This functionality is common to all e-business sites when you have to clic on the 'update' button before submit the form. Any idea ? thanks -- Stéphane Pinel 39, Rue du Docteur Heulin 75017 Paris (FRANCE) 33 1 53 11 05 77 33 6 08 94 63 16 [EMAIL PROTECTED] -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] /Original message Reply You'll need to use JS... Eg: --- HTML example --- HTML BODY FORM name=frm SELECT name=mySel OPTION value=25Blah 1/OPTION OPTION value=5Blah 2/OPTION OPTION value=83Blah 3/OPTION OPTION value=2Blah 4/OPTION /SELECT INPUT type=button value=Update onclick=void(someUpdateFunc()); /FORM /BODY SCRIPT type=text/javascript function someUpdateFunc () { var selValue = document.frm.mySel.options[document.frm.mySel.selectedIndex].value; alert (You selected: +selValue); } /SCRIPT /HTML --- End of HTML example --- This will show you what you need (I hope)... /Reply -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Multiple JavaScript Windows
Original message From: Carlos Fernando Scheidecker Antunes [EMAIL PROTECTED] Date: Mon, Aug 27, 2001 at 07:48:06PM -0500 Message-ID: 001201c12f5b$19d05e60$0a505ad1@Nando4 Subject: [PHP] Multiple JavaScript Windows Hello All, I need to have multiple JavaScripts windows with my database PHP script. The idea is to have a main Page and links to pop-up JavaScript Windows to enter information on the database. Once these windows are closed the main PHP page need to be automaticaly updated. The Database is a Report system that depends on 4 tables. One main table and 3 other tables that contain information for that report such as part number, procedures taken and repairs made. Each report can have none to several parts, none to several procedures and one to several repairs. Once the user starts a new report a lot od stuff is add to the main table such as CustomerNo, ReportNo, ReportDate, etc. Then, the other three tables lists parts, procedures and repairs for a Report using the ReportNo as common field. The help and advice I need consist of beeing able to call pop up windows with JavaScript from the main page to add Parts, Repairs and Procedures. Once the user finish adding stuff on a Pop Up window he would close it by clicking a link and the main Page of the Report would be reloaded to reflect the changes he did. Can anyone help me with this task? Thank you very much, Carlos Fernando [EMAIL PROTECTED] /Original message Reply Think you're looking for things like: window.open ('page-to-open', 'WindowName', 'attribs'); (in order to open a (popup)window). and then, when they've entered all information you submit the form (still in the same popup) to the PHP that stores it in the db. That page normally doesn't need to produce any output to the user. So what you put at the end of that page is: SCRIPT type=text/javascript window.opener.reload(true); /* reloads the main page */ window.close(); /* closes the popup */ /SCRIPT Hope this is what you were looking for... /Reply -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Refresh Main frame
Original message From: Rosen [EMAIL PROTECTED] Date: Tue, Aug 28, 2001 at 04:29:05PM +0300 Message-ID: [EMAIL PROTECTED] Subject: [PHP] Refresh Main frame Hi, how can I tell to refresh the main frame ( index.php ) from some subframe I use frames ) ? Thanks, Rosen /Original message Reply SCRIPT type=text/javascript window.parent.name-of-mainframe.reload(true); /SCRIPT That should be what you're looking for... /Reply -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Refresh Main frame
Original message From: Rosen [EMAIL PROTECTED] Date: Tue, Aug 28, 2001 at 05:03:50PM +0300 Message-ID: [EMAIL PROTECTED] Subject: Re: [PHP] Refresh Main frame Can I send params to main frame ? Thanks, Rosen /Original message Reply Well... yes, you can. You'll have to use a different kind of construction though: SCRIPT type=text/javascript window.parent.name-of-mainframe.location.href = URL-of-mainpage?params-as-you-know; /SCRIPT Depending on the construction as you use it in your PHP, you can do it in a better way. If you want to refresh the mainframe after eg submitting a form in a subframe you can just use the reload-thing as I sent earlier and then use sessions. Then you don't need to send params over the URL. But like I say... that totaly depends on the construction as you use it. /Reply -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Print..
Original message From: Daniel Antonio de Lima [EMAIL PROTECTED] Date: Tue, Aug 27, 2019 at 07:55:33AM -0300 Message-ID: 001d01d55cc5$f38cc7a0$[EMAIL PROTECTED] Subject: [PHP] Print.. Good Morning I am working with PHP 4.0.6, and I do not obtain to send given of the page for the printer. I use function PRINTER_OPEN() , I make the manual in accordance with, exactly thus it gives an error to me of indefinite function. What it can be? Fatal error: Call you undefined function:printer_open() $print = printer_open(); $print = printer_open(LPT1 ); printer_write($print, Test of printer ); printer_write($print, Test of printer ); printer_write($print, Test of printer ); $print = printer_close(); e this error it even gives to me with function PRINTER_WRITE() , could give tips of that he can be happening. Yours truly. Daniel /Original message Reply Don't know which OS you're using, but the printer-functions only work with Windows: http://www.php.net/manual/en/ref.printer.php /Reply -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Print..
Original message From: MBK [EMAIL PROTECTED] Date: Mon, Aug 27, 2001 at 01:59:10PM +0200 Message-ID: 008e01c12eef$ae7be0a0$3d1c8418@mbkomp Subject: Re: [PHP] Print.. the function printer_open() or printer_write() doesn't exist in php. I don't know where you saw those functions. /Original message Reply Hello! Did you ever take the time to look at the manual? Or some previous posts? http://www.php.net/manual/en/ref.printer.php /Reply -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Print..
Original message From: Daniel Antonio de Lima [EMAIL PROTECTED] Date: Tue, Aug 27, 2019 at 10:03:31AM -0300 Message-ID: 00c001d55cd7$d37e6e20$[EMAIL PROTECTED] Subject: Re: [PHP] Print.. as I make to print of the page for the printer without using the button of the navigator, ito is, to print through a command php, could say which to me the command or function that I must use . Daniel /Original message Reply Where do you want to print, client-side or server-side? 'Cause if you want to print client-side it's real easy; using PHP you can't print client-side, you'll have to use JavaScript. /Reply -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] konquerer and php
Original message From: Scott [EMAIL PROTECTED] Date: Thu, Aug 23, 2001 at 08:29:07PM -0400 Message-ID: [EMAIL PROTECTED] Subject: [PHP] konquerer and php I have a database browser that I made with php and mysql. When I use it in Netscape it behaves normally. However when I view it using Konquerer, all kinds of php code shows up on the screen when I execute a php page. I thought that Konquerer might not be recognizing the ? and ? start and end tags so I tried script language=php and /script. However if I use these nothing at all shows up on the screen. Can someone tell me what the problem is? Thanks, SW -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] /Original message Reply For the script execution it doesn't matter at all which browser you use. PHP is processed server-side, so the browser just gets 'plain' HTML. I guess something else is wrong than using a different browser. /Reply -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] begginer how to make integer ?
On Tue, Aug 21, 2001 at 02:08:06AM -0700, Andras Kende wrote: Hello, I have a query but it not creating integer result: $saleprice=$amyrow[saleprice]+$saleprice; $squarefeet=$amyrow[squarefeet]+$squarefeet; $dom=$amyrow[dom]+$dom; result: Total listings: 18 -- Average Price: $339166.6667 Average Square Foot: 1596.61 Average DOM: 52.5556 Average Price Per Square Feet: 212.42910330909 But I need Integer numbers like 339166 , 1596 Thanks :) Andras Try: round() http://www.php.net/round Eg.: $myInt = (integer)round($nonInteger); -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] List of files?
On Tue, Aug 21, 2001 at 01:26:27PM +0100, Seb Frost wrote: OK so I'vebeen reading about reading and writing to/from files, but what I want to do is (I think) simpler than this. Basically I want to look at a directory and be able to get a list of all subdirectories and then a list of the files in each directory. Can someone give me a hint? cheers - seb This should give you all info you need: http://www.php.net/manual/en/ref.dir.php -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Detecting empty query result?
On Tue, Aug 21, 2001 at 02:54:33PM +0100, Seb Frost wrote: Basically I want to check to see if $fileDir is already in my database. I do this as: $result = mysql_query(SELECT fileDir FROM shoots WHERE (fileDir='$fileDir')); How do I check the result? I normally use mysql_result($result, $row, $field) to read my result, but if I try that I get an error: if(mysql_result($result, $row, $field)) gives me: Warning: Unable to jump to row 0 on MySQL result index 3 cheers, - seb You're looking for: msql_num_rows() Try: http://www.php.net/manual/en/function.msql-num-rows.php -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]