Re: [PHP] Redirects in PHP
I miss the response.redirect in Python and DTML which can be placed anywhere as well. Michael On Friday 13 June 2003 10:28 am, Johnny Martinez wrote: > try a delayed javascript redirect. location header must be in the header > whichprevents your visitor from seeing html...thats irritating. i miss the > ASP "response.redirect" which can be placed anywhere > > J > > -Original Message- > From: Carl Furst [mailto:[EMAIL PROTECTED] > Sent: Friday, June 13, 2003 9:23 AM > To: > Subject: [PHP] Redirects in PHP > > > I want to do one of those redirect pages where a php script prints HTML > saying "sorry we're not here, we're redirecting you to the right location" > and then after about 2-3 seconds a new location header gets printed and you > are transported to the new location. I see this everywhere but don't know > how it's done. > > I tried this by printing the "Location" header first and then the text and > it just > relocated me without seeing the text. I tried printing the text first and > then the "Location" header and php complains that my header was already > sent and I > can't modify it to relocate. > > How do you do this?? Is there something in the header I have to specify to > wait before it relocates? Do I have to do it manually by printing the > text.. tell the script to wait and then clear the header somehow and send a > new one (can that be done?) I looked at HTTP1.1 docs and I didn't really > get anywhere. > > Any ideas? > > > Carl. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Redirects in PHP
Search engines frown on using meta refresh because of abuse problems. Some engines won't index the page period and all of them penalize you at the very least. While it will work as you described, you're sacrificing search engine positioning to use it. You need to weigh the trade-offs Michael On Friday 13 June 2003 11:00 am, Zak Johnson wrote: > content="3;URL=http://example.com/new-page.html"; /> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Redirects in PHP
You're absolutely right. Thus, the need for a server-side redirect. You can use meta refresh as long as the time is set to around 10 seconds without being penalized. I guess you could include a message that you are going to be transferred in 10 seconds, then provide a link for the impatient types, like myself, to get there quicker. michael On Friday 13 June 2003 11:30 am, Zak Johnson wrote: > On 2003-06-13 10:34-0600, Michael wrote: > > Search engines frown on using meta refresh because of > > abuse problems. Some engines won't index the page > > period and all of them penalize you at the very least. > > While it will work as you described, you're sacrificing > > search engine positioning to use it. > > How many search engines do you know of that will parse and follow the > JavaScript location.href redirection suggested earlier? > > -Zak -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Redirecting to index.php from index.html
I'm a relative newbie to PHP coming from the Zope/Python/DTML world. Does anyone know of a good way, short of a javascript, to redirect from index.html to index.php. Also, can I use PHP to test for browsers, then redirect them to the appropriate page. In DTML/Python it would be : = 0> This can be called from anywhere in the page. I know that PHP does not work this way and that this would need to be done before , but I'm even having problems with that. I guess I'm just having a hard time THINKING like php. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Redirecting to index.php from index.html
If I use this on index.html, it does nothing. If I use it on index.php I get: Parse error: parse error, unexpected '=' in /path/to/file_named/main.php on line 3 What am I doing wrong On Tuesday 17 June 2003 02:11 pm, Ralph wrote: > > if(strstr = ($HTTP_USER_AGENT, "Mozilla/4")){ >header("Location: http://www.mydomain.com/moz4_page.php";) > } > > elseif(strstr = ($HTTP_USER_AGENT, "MSIE")){ >header("Location: http://www.mydomain.com/ie_page.php";) > } > > etc... > > ?> > > > > My Page > > > etc.. > > > -Original Message- > From: Michael [mailto:[EMAIL PROTECTED] > Sent: Tuesday, June 17, 2003 11:42 AM > To: [EMAIL PROTECTED] > Subject: [PHP] Redirecting to index.php from index.html > > I'm a relative newbie to PHP coming from the Zope/Python/DTML world. > Does > anyone know of a good way, short of a javascript, to redirect from > index.html > to index.php. Also, can I use PHP to test for browsers, then redirect > them > to the appropriate page. In DTML/Python it would be : > > = 0> > > > > This can be called from anywhere in the page. I know that PHP does not > work > this way and that this would need to be done before , but I'm even > > having problems with that. I guess I'm just having a hard time THINKING > like > php. -- Exasource Inc. Web: http://www.exasource.com Email: [EMAIL PROTECTED] Phone: 970-206-4556 "The Israelite army looked at Goliath and said, he's so big we can't possibly win. David looked at Goliath and said, wait a minute, he's so big I can't possibly miss" -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Redirecting to index.php from index.html
With that I get: Parse error: parse error, unexpected T_STRING in /path/to/file_named/main.php on line 4 Michael On Tuesday 17 June 2003 02:50 pm, Jay Blanchard wrote: > [snip] > If I use this on index.html, it does nothing. If I use it on index.php > I get: > > Parse error: parse error, unexpected '=' in > /path/to/file_named/main.php on line 3 > > What am I doing wrong > > On Tuesday 17 June 2003 02:11 pm, Ralph wrote: > > > > > if(strstr = ($HTTP_USER_AGENT, "Mozilla/4")){ > >header("Location: http://www.mydomain.com/moz4_page.php";) > > } > > > > elseif(strstr = ($HTTP_USER_AGENT, "MSIE")){ > >header("Location: http://www.mydomain.com/ie_page.php";) > > } > > [/snip] > > > Shouldn't it be > > > if(strstr($HTTP_USER_AGENT, "Mozilla/4")){ > >header("Location: http://www.mydomain.com/moz4_page.php";) > > } > > > > elseif(strstr($HTTP_USER_AGENT, "MSIE")){ > >header("Location: http://www.mydomain.com/ie_page.php";) > > } > > HTH -- Exasource Inc. Web: http://www.exasource.com Email: [EMAIL PROTECTED] Phone: 970-206-4556 "The Israelite army looked at Goliath and said, he's so big we can't possibly win. David looked at Goliath and said, wait a minute, he's so big I can't possibly miss" -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Redirecting to index.php from index.html
Parse error: parse error, unexpected T_STRING in /path/to/file_named/main.php on line 4 Here is my actual code so you can look at it and see what I am doing something wrong. I know I must be, since I don't see how php could become so popular for site development when it appears to be so difficult to do a simple test and redirect. It works fine in forms such as: " maxlength="50"> But I have yet to be able to do a redirect after a test. index.html is a dhtml splash screen to allow time for image preloading. It does not work on Opera or Konqueror. http://www.servantsmc.com/main.php";); } elseif(strstr($HTTP_USER_AGENT, "Konqueror")){ header("Location: http://www.servantsmc.com/main.php";); } ?> Motorcycle Clubs. Servants For Christ - Northern Colorado On Tuesday 17 June 2003 03:26 pm, Ralph wrote: >Oops. Typos. Try this: > if(strstr($HTTP_USER_AGENT, "Mozilla/4")){ > header("Location: http://www.mydomain.com/moz4_page.php";); > } > > elseif(strstr($HTTP_USER_AGENT, "MSIE")){ > header("Location: http://www.mydomain.com/ie_page.php";); > } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] calling user-defined php functions from tag
Hi, everyone. There MUST be some creative way to call a user-defined PHP function from an tag. Does anyone have any suggestions? For example: == Click here to start "function joe()". == So, if the user clicks on the link, he'll see: "The result of this function is: 20" Any ideas? Any help would be VERY much appreciated. Thanks! -- Michael -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] calling user-defined php functions from tag
Hi, Justin. Thanks very much for the reponse. Yeah, this is a SUPER simplified form of my question, so please don't expect it to make sense. Heh. Basically, I have a php file with dozens of functions in it. I want ONE of them to get called when a link is clicked. Currently, I achieve this with the use of HTML forms. My form generates a list of options. And the user has to select an option, then click the SUBMIT button. But I want to make it a one-step process, whereby the user only needs to click on the option. Of course, you can't achieve this in a form with JavaScript, but the JavaScript code won't let me execute a server-side php function (obviously). And I don't want to just shoot the link off to another page (even though that's what it was designed to do). I want to call a very specific function. Tricky, I know. :( -- Michael On Sat, 27 Jul 2002, Justin French wrote: > Date: Sat, 27 Jul 2002 11:35:23 +1000 > From: Justin French <[EMAIL PROTECTED]> > To: Michael <[EMAIL PROTECTED]>, [EMAIL PROTECTED] > Subject: Re: [PHP] calling user-defined php functions from tag > > on 27/07/02 12:09 PM, Michael ([EMAIL PROTECTED]) wrote: > > > > function joe() { > > $temp1=10; > > $temp2=20; > > $result=$temp1+$temp2; > > echo "The result of this function is: " . $result; > > } > > ?> > > wouldn't that be > > return "The result of this function is: " . $result; > > rather than echo? > > > Anyhoo, you haven't specified HOW you want to communicate the result of the > function to the browser. > > A HREF is supposed to take you off to another page (amongst other things), > which might be what you're after. > > JavaScript (*shudder*) is designed to provide client-side actions, so maybe > a javascript alert is what you want, or a pop-up window, or who knows what. > > You need to decide what happens, in a story board fashion. > > > Remember, everything in PHP code takes place on the server, BEFORE the > browser gets it. > > > Example of using JS alert: > > > function joe() { > $temp1=10; > $temp2=20; > $result=$temp1+$temp2; > return "The result of this function is: " . $result; > } > ?> > calculate foo > > > but really, I can't understand why you wouldn't just do: > > > $result=$temp1+$temp2; > echo "Total: {$result}"; > ?> > > > Why do they have to click? > > > You'll have to check all the javascript stuff and maybe massage it, because > I haven't tested this, and haven't written much JS in the past coupla years. > > > Beware of the limitations of relying on javascript for anything though :) > > > Justin French > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] calling user-defined php functions from tag
Hmm. Hey, Mathieu. Many thanks for the reply. However, I currently AM using a form. What I'm trying to get away from, is the two step process: 1. pick your option 2. click submit I'm trying to get a one-step process, where the user can click on a link, and that calls the function. JavaScript won't work, because it's client side, and can't be used to call a server-side php function (unless you tell me some neat trick I don't know about yet). See my struggle now? On Fri, 26 Jul 2002, Mathieu Dumoulin wrote: > Date: Fri, 26 Jul 2002 21:46:00 -0400 > From: Mathieu Dumoulin <[EMAIL PROTECTED]> > To: [EMAIL PROTECTED] > Subject: Re: [PHP] calling user-defined php functions from tag > > Easy > > Your form when pressed the button submit will send the data from the form > via post (Which is the best method) to the functions.php with all the > functions. What you need to modify now is that all the > need to be modified to "FuncToExec" name. > > When you receive the input of the form, you just verify what $FuncToExec is > and execute the correct function. > > > if($FuncToExec == "joe"){ > joe(); > }elseif(...){ > } > > ... (All functions in your file goes there)... > > ?> > > Now what you also want to add is that if your JOE function is to return > something, the IF ELSE calling that thing should intercept the value > returned and this part of the script should either do something with that > value or just redirect the value to another script by GET mode: > > header("location: myresultpage.php?result=$result"); > > There, sorted that out right? > > have fun > insanecoder! > > "Michael" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > > > > Hi, Justin. > > > > Thanks very much for the reponse. > > Yeah, this is a SUPER simplified form of my question, so please don't > > expect it to make sense. Heh. > > > > Basically, I have a php file with dozens of functions in it. I want ONE of > > them to get called when a link is clicked. > > > > Currently, I achieve this with the use of HTML forms. My form generates a > > list of options. And the user has to select an option, then click the > > SUBMIT button. > > > > But I want to make it a one-step process, whereby the user only needs to > > click on the option. > > > > Of course, you can't achieve this in a form with JavaScript, but the > > JavaScript code won't let me execute a server-side php function > > (obviously). > > > > And I don't want to just shoot the link off to another page (even though > > that's what it was designed to do). I want to call a very specific > > function. > > > > Tricky, I know. :( > > > > -- Michael > > > > On Sat, 27 Jul 2002, Justin French wrote: > > > > > Date: Sat, 27 Jul 2002 11:35:23 +1000 > > > From: Justin French <[EMAIL PROTECTED]> > > > To: Michael <[EMAIL PROTECTED]>, [EMAIL PROTECTED] > > > Subject: Re: [PHP] calling user-defined php functions from tag > > > > > > on 27/07/02 12:09 PM, Michael ([EMAIL PROTECTED]) wrote: > > > > > > > > > > function joe() { > > > > $temp1=10; > > > > $temp2=20; > > > > $result=$temp1+$temp2; > > > > echo "The result of this function is: " . $result; > > > > } > > > > ?> > > > > > > wouldn't that be > > > > > > return "The result of this function is: " . $result; > > > > > > rather than echo? > > > > > > > > > Anyhoo, you haven't specified HOW you want to communicate the result of > the > > > function to the browser. > > > > > > A HREF is supposed to take you off to another page (amongst other > things), > > > which might be what you're after. > > > > > > JavaScript (*shudder*) is designed to provide client-side actions, so > maybe > > > a javascript alert is what you want, or a pop-up window, or who knows > what. > > > > > > You need to decide what happens, in a story board fashion. > > > > > > > > > Remember, everything in PHP code takes place on the server, BEFORE the > > > browser gets it. > > > > > > > > > Example of using JS alert: > > > > > > > > > > > function joe() { > > > $temp1=10; > > > $temp2=20; > > &
[PHP] Hiding the remote server
Is it possible to write a script that: 1) gathers information 2) upon clicking a "submit" button, "posts" this information to a remote server for processing. 3) the remote server, by default, will generate results and display on it's own web page generated dynamically. 4) can we "intercept" this response back to the browser, parse through the information and generate our own presentation of the page on our site? Example: http://www.siteA.com/change_password_script (I don't know what kind of scripting this is, but it is dynamic) Site A has this interface that takes in the username, old password, and new password. If we change the password at Site A, we would be brought back that same page with a result displayed. What I need is: http://www.mysite.com/my_change_password_script.php?action=change-password Present my own look and feel. Collect the same information (username, old password, new password), and send to: http://www.siteA.com/change_password_script The challenge is that we don't want the url of Site A appearing at any one moment. So we need to get responses from the remote server, parse through for results, and display this information: http://www.mysite.com/my_change_password_script.php?result=success Is this possible at all with just PHP scripting? I am just guessing can the header() function be used to send information like a form-POST? and receive responses that is parsable prior to printing to the browser?
[PHP] Passing a PHP variable to javascript
Hello everyone, This may seem a newbie question... I have a PHP variable containing the text of the alert I want to display ($text) and I want to have it displayed in a javascript alert box (something like alert($text) ). I couldn't find out how to sort this out... Regards, Michael __ Pour mieux recevoir vos emails, utilisez un PC plus performant ! Découvrez la nouvelle gamme DELL en exclusivité sur i (france) http://www.ifrance.com/_reloc/signhdell -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] how to generate ms-word files
hello I'm trying to generate ms-word files with php. Until now, I can create a document and even insert page-breaks. Is there any tutorials going further (boxes, mergedocuments etc...)? this is my code so far: Text before PagBreak Text after PagBreak Thank you for any help. michael -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] MSSQL/PHP Query Help
Hey guys... I'm currently using PHP, FreeTDS, and Sybase libraries to access a database on an MS SQL 2000 server. Things are going fine, except for my more complex queries. Here is an example: SELECT Servers.Name, Nics.MAC FROM Servers INNER JOIN Nics ON Servers.ServerId = Nics.Server WHERE (((Nics.MAC)="0002B34DA81F")) OR (((Nics.MAC)="0002B34DA76F")) OR (((Nics.MAC)="0002B34DA32D")) OR (((Nics.MAC)="0002B34DA31D")); This query isn't even as bad as it's going to get, but I get the error: "Sybase error: Invalid column name '0002B34DA81F'." I get this for each Nics.MAC entry that I make. If I don't include the "WHERE/OR" statement, the query runs fine. The query runs correctly on the MS SQL server itself, but I can't get it to work here. I assume that PHP just passes the query to the SQL server directly, so there must be something that I'm missing. Do I need to escape more than just the quotes? If there is anything I need to know about PHP and MS SQL before I go on, I'd love to hear it. ;-) Michael -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Standard Input?
Are there functions in PHP that will allow me to read in a variable via standard input? I just wanted to do something like this: echo "What is your name? "; $name = ; print "Your name is $name."; I looked but didn't see anything that quite matched up on the PHP website. Michael -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Wait/Timeout
Hi! I've been using PHP to write shell scripts and was wondering how to implement the following: - I have a menuing system - If a user does not give an input within a certain amount of time, I want it to go to a default value I checked the PHP functions page and the closest thing I found was "sleep" which isn't quite right. I'm sure this is a common thing, so does anyone have any suggestions? Again, this is a terminal program and not a web CGI. While I have your attention, I also wanted to create one of those "spinners" while users wait for longer tasks to complete. I tried using the ncurses stuff to print and erase characters, but it didn't seem to work. What is a good way to create a "spinner" so that users know that the program is working. For those who don't know what I mean, I'm thinking of something like... - (backspace) \ (backspace) | (backspace) / (backspace) etc. etc. Thanks in advance! Michael -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Wait/Timeout
Well, the problem is this. I work for an all-Microsoft company that is currently being forced to take on a number of Linux servers. They have this framework that allows for the automated installation and configuration of servers based on a number of Windows 2000 staging servers and a SQL server. The problem? They want the same framework to build out Linux servers as well. So basically I had to find a way to get these Linux servers to talk to the existing framework. It didn't seem so bad at first, but I had a hell of a time getting the Linux box to talk to the MS SQL server. ODBC didn't seem to work nor did the variety of Perl modules that I tried. The only thing I got to work was PHP (Sybase) and FreeTDS. I really wanted to do this in Perl, but alas, I'm forced to do it in PHP. That's the story. ;-) Michael - Original Message - From: "Taylor York" <[EMAIL PROTECTED]> To: "Michael" <[EMAIL PROTECTED]> Sent: Tuesday, July 09, 2002 9:47 AM Subject: Re: Wait/Timeout > Hum. Im kindof curious about the shell... > I really know next to nothing about them, but anyway..just wondering why you > are making one? > and just little details or something...sounds like an interesting project. > > - Original Message - > From: "Michael" <[EMAIL PROTECTED]> > Newsgroups: php.general > To: "PHP General" <[EMAIL PROTECTED]> > Sent: Tuesday, July 09, 2002 11:14 AM > Subject: Wait/Timeout > > > > Hi! > > > > I've been using PHP to write shell scripts and was wondering how to > > implement the following: > > > > - I have a menuing system > > - If a user does not give an input within a certain amount of time, I > want > > it to go to a default value > > > > I checked the PHP functions page and the closest thing I found was "sleep" > > which isn't quite right. I'm sure this is a common thing, so does anyone > > have any suggestions? Again, this is a terminal program and not a web > CGI. > > > > While I have your attention, I also wanted to create one of those > "spinners" > > while users wait for longer tasks to complete. I tried using the ncurses > > stuff to print and erase characters, but it didn't seem to work. What is > a > > good way to create a "spinner" so that users know that the program is > > working. > > > > For those who don't know what I mean, I'm thinking of something like... > > > > - (backspace) \ (backspace) | (backspace) / (backspace) etc. etc. > > > > Thanks in advance! > > > > > > Michael > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Include an encoder into PHP distribution?
Zend will never include a free encoder/accelerator into php by default. What I am waiting for is Turck MMCache to offer a download of a file like php-4.3.4.tar.gz with Turck included. So when I need to upgrade php, I would go download a new version of php from Turck instead of php.net. What I want to know is ... Turck MMCache is open source and php is open source so how hard is it to create that? -Original Message- From: David T-G [mailto:[EMAIL PROTECTED] Sent: November 16, 2003 7:23 PM To: PHP General list Cc: John Smith Subject: Re: [PHP] Include an encoder into PHP distribution? John, et al -- ...and then John Smith said... % % > I was not saying or implying that Zend controls PHP alone. In practice % > they have the "knife and the cheese" in their hands, meaning currently % > PHP programs depend on Zend Engine to run. Maybe when somebody develops % > real PHP compilers things will be different. % % I know that you were not implying it, I just wanted to make my point. Fair enough. % % In practice it seems that Zend has the final say on PHP, and I think it's % bad for the language. Not at all. If enough decide to include some other encoding engine in PHP then Zend can happily withdraw all of their support from PHP, perhaps making a new product called zPHP or such, and the PHP camp is not controlled in any way. It seems a bit extreme and probably not worth it, but no materially different from supporting (insert your favorite and my least favorite cause here) and watching us part ways. % % JS I think that supporting this discussion any further might cause some others to part ways with this list, so let's be done here :-) HTH & HAND :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, "Science and Health" http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Include an encoder into PHP distribution?
I've tried installing it but I need MS Visual Studio C++ so they have to make it even easier. Windows Installation Notes == To build Turck MMCache on Windows platform you will need MS Visual Studio C++ 6.0. Step 1. Compiling Turck MMCache - Unpack php sources. - Put mmcache sources under "ext/mmcache". - Put "php4ts.lib" into "ext/mmcache". - Copy "main/config.w32.h.in" into "main/config.w32.h". - Open project file "ext/mmcache/mmcache.dsp". - Select release configuration and build "mmcache.dll". Step 2. Installing Turck MMCache Copy "mmcache.dll" into your PHP extension folder. Step 3. Configuring Turck MMCache Add the following lines into your "php.ini" file (usually "c:\winnt\php.ini") -Original Message- From: Manuel Lemos [mailto:[EMAIL PROTECTED] Sent: November 17, 2003 2:31 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] Include an encoder into PHP distribution? Hello, On 11/17/2003 05:17 AM, Michael wrote: > Zend will never include a free encoder/accelerator into php by default. > > What I am waiting for is Turck MMCache to offer a download of a file like > php-4.3.4.tar.gz with Turck included. So when I need to upgrade php, I > would go download a new version of php from Turck instead of php.net. > > What I want to know is ... Turck MMCache is open source and php is open > source so how hard is it to create that? No. It is very simple. Turck MMCache is a shared library extension. You just need to drop the shared library (.so or .DLL) file in your PHP extensions directory and enable it in php.ini . -- Regards, Manuel Lemos Free ready to use OOP components written in PHP http://www.phpclasses.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Include an encoder into PHP distribution?
David T-G says > I hate to sound like a curmudgeon, but if you want this then you should > build it, just like John anyone else who wants it should. No, I haven't > looked at either (I don't even know what an encoder does; I *think* that > it could be a precompiler or an obfuscator but don't really care), but > neither can be impossible to build and so you can have it without worry > of politics -- or you could write your own in something other than VS C++ > or get a different one or... 1. An obsfuscator scrambles all the variable, function and class names 2. An encoder stores your source in compiled form whatever that looks like 3. An accelerator speeds up the php scripts by 1 to 10 times Option 1 and 2 are debateable whether it should be included in php. Option 3 is a no brainer that it should be included. Why don't I make my own? I don't know how. Should I learn and do it? No because there's already an open source encoder and accelerator. Why do redundant work? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Include an encoder into PHP distribution?
Oh my god thanks Curt! I don't know when they added that in for windows but now my scripts are flying. My scripts are pretty bloated since I'm using both smarty and adodb and my times were hovering around 1.5 seconds but I installed mmcache and I'm at 0.14 seconds now. Sweet! mmcache should really take out needing visual c and put this in its place 1. Copy mmcache.dll to C:\PHP\extensions\mmcache.dll 2. Copy and paste the mmcache settings into C:\WINDOWS\php.ini Ignore what I said earlier cuz I don't think you can make it any easier. -Original Message- From: Curt Zirzow [mailto:[EMAIL PROTECTED] Sent: November 17, 2003 10:29 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] Include an encoder into PHP distribution? * Thus wrote Michael ([EMAIL PROTECTED]): > I've tried installing it but I need MS Visual Studio C++ so they have to > make it even easier. There is a compiled version on the website for windows. Go to the download section and you'll see that they have it available for multiple version of php there. Curt -- "My PHP key is worn out" PHP List stats since 1997: http://zirzow.dyndns.org/html/mlists/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: PHP Encoders
I like POB too but it's an obsfuscator. To fix your $email problem just do a search for $2d4g3a5sd and change them all to $email. An encoder would be Ioncube or Turck's mmcache but the server needs to be installed with their software to run the encoded scripts. POB doesn't need anything installed to run. -Original Message- From: Ryan A [mailto:[EMAIL PROTECTED] Sent: November 20, 2003 12:29 PM To: R. Rajesh Jeba Anbiah Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Re: PHP Encoders Hi, POBs is really good, but I have had some weird problems when encoding large files, especially if you take out the line breaks in the options. Another problem with POBS is that you can have your "config.php" file not encoded with the rest of the files, since it changes your variables (eg $email becomes something like $2d4g3a5sd) your $email variable is not recognised in the rest of the program/s, which is quite a pain in the ass explaining to a customer who just bought your software to enter the $email variable in $2d4g3a5sd and their $blah variable in $234sdhk23 etc etc I personally prefer CodeSecure from securecents.com at only 49$ but then, i'm biased :-) Cheers, -Ryan > Did you try http://pobs.mywalhalla.net/ ? > > Hi there ! > > > > I am curretly looking for suitbale solutions for encoding PHP scripts > > after developing a couple of comercial applications in PHP. > > > > Has anybody made any experience with several encoders like IONCUBE, > > SOURCEGUARDIAN, ZEND, etc... so far? > > Did you try http://pobs.mywalhalla.net/ ? > > --- > "One who mix sports and patriotism is a barbarian" > Email: rrjanbiah-at-Y!com > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] money data type cause problem in connection to Mssql7.0
Hi, I have got a problem that I canot connect to mssql 7.0 tables with PHP if it contains field in "money" data type. When I change the "monty" type to interger or other types, everything fine. The fact is that I have to use "money" data type. Can somebody help me please? Thanks in advance. Michael Luk This message was sent using i-Office Webmail - Powered by i-Server. For more information visit http://www.i-serverbox.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] merging arrays quickly
say I have $array1 = array("name"=>NULL,"thread"=>NULL,"id"=>NULL); $array2 = array("0"=>"fred","1"=>"3","2"=>""); I want $array1 to have the values of array2 - or $array2 to hve the keys of $array1 A foreach loop works fine to do this - but I was wondering if there is a quicker way to merge the values of one array to another array. -- 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] merging arrays quickly
Reuben D Budiardja wrote: > > Take a look at the function array_merge > http://www.php.net/array_merge > > Reuben D. B > I have - it's no use unfortuntely - The array with the values has numeric keys so they just get appended - would have been okay if they had string keys though. > On Friday 17 August 2001 08:46 am, you wrote: > > say I have > > $array1 = array("name"=>NULL,"thread"=>NULL,"id"=>NULL); > > $array2 = array("0"=>"fred","1"=>"3","2"=>""); > > > > I want $array1 to have the values of array2 - or $array2 to hve the keys > > of $array1 > > A foreach loop works fine to do this - but I was wondering if there is a > > quicker way to merge the values of one array to another array. -- 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] mysql , postgres
Chris Lambert wrote: > > MySQL is easier to use and faster to develop with for 90% of web > applications. Sure, PostgreSQL has some huge advantages, but not everyone > needs the same thing. easier to use ? I'm not sure why anyone would say that faster to develop ? nope - I find postgresql quicker to develop with, I can use triggers to cut out a whole heap of extra php code. MYsql lacks subselects which forces you to do extra code, it lacks true foreign keys which means you need to add extra code to check data integrity. People use MYSql because it's so widely available, just like people use Windows. > > /* Chris Lambert, CTO - [EMAIL PROTECTED] > WhiteCrown Networks - More Than White Hats > Web Application Security - www.whitecrown.net > */ > > | > | -- 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] mysql , postgres
Tom Carter wrote: > > What would you say the advantages were? > Well just my opinion but I think that Postgresql development is advancing quicker. With Red Hat joining in development and no infighting bewteen Postgresql developers things are looking good for the future. > other than just the fact the the postgres implementation of sql is more > powerful (sub-selects etc). Foreign keys, triggers both make life a lot easier. Also once your used to Postgresql, moving onto Sybase, Interbase etc isn't near as hard as making the jump from MYsql. > > I'ld be very interested to see some performance comparisions if anyone has > any Dig around greatbridge.org and you might find some. > - Original Message - > From: "Chris Lambert" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Sunday, August 19, 2001 10:21 AM > Subject: Re: [PHP] mysql , postgres > > > MySQL is easier to use and faster to develop with for 90% of web > > applications. Sure, PostgreSQL has some huge advantages, but not everyone > > needs the same thing. > > > > /* Chris Lambert, CTO - [EMAIL PROTECTED] > > WhiteCrown Networks - More Than White Hats > > Web Application Security - www.whitecrown.net > > */ > > > > - Original Message - > > From: nafiseh saberi <[EMAIL PROTECTED]> > > To: <[EMAIL PROTECTED]> > > Sent: Sunday, August 19, 2001 4:24 AM > > Subject: [PHP] mysql , postgres > > > > > > | > > | hi. > > | why most of you , use mysql and not > > | postgres? > > | nafiseh. > > | > > | -- > > | PHP General Mailing List (http://www.php.net/) > > | To unsubscribe, e-mail: [EMAIL PROTECTED] > > | For additional commands, e-mail: [EMAIL PROTECTED] > > | To contact the list administrators, e-mail: [EMAIL PROTECTED] > > | > > | > > | > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > -- PHP 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] coding standards
Ive read through the PEAR coding standards but was wondering about a few things not talked about in them - - Is declaring all variables a good idea - so theres no unassigned variables hanging around ? (no warnings produced when error reporting set to E_ALL) - Naming of include files - .inc or .php ? - naming of class files .inc or .php ? I know these have no big effect on the actual scripts themselves - but was wondering what people consider "good practice" to be. -- 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] mysql , postgres
Indrek Siitan wrote: > > Hi, > > > Well just my opinion but I think that Postgresql development is > > advancing quicker. With Red Hat joining in development and no > > infighting bewteen Postgresql developers things are looking > > good for the future. > > just to clear one issue - there has never been a "fight between mysql > developers". > > the thing you're probably referring to above is the MySQL-vs-NuSphere fight. > NuSphere was to add their Gemini table handler (MySQL has an abstraction table > handler layer, so you can add many different table handlers) to MySQL. it has > not and won't affect the general development of MySQL. > > Rgds, > Indrek > fair enough - slip of the tongue there but it does highlight the differences in in development style between MYsql and Postgresql. > For technical support contracts, goto https://order.mysql.com/ >__ ___ ___ __ > / |/ /_ __/ __/ __ \/ /Indrek Siitan <[EMAIL PROTECTED]> > / /|_/ / // /\ \/ /_/ / /__ MySQL AB, The Web Guru > /_/ /_/\_, /___/\___\_\___/ Tallinn, Estonia ><___/ www.mysql.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: transaction
Nafiseh Saberi wrote: > > hi. > in large database with php,postgres > and when in each time come many request , > how do we implement transactions?? > nafiseh. If you are wanting to run several queries in the one script though the one transaction - you'll need to send a begin(as a query) and execute it - then to the same connection send all your other queries as normal, and follow it up with a commit. -- 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: Database Preference?
James wrote: > > We have several GUI applications that we are preparing to convert to > web-based applications, based primarily on PHP. The applications are based > on Informix On-Line (on a SCO Unix server) and MS SQL (on NT). Since we > will be doing a port, in any case, I am wondering your thoughts on whether > MySQL may be a better database solution. This is particularly important > from a price-performance point of view since the other two databases are > quite pricy on a per-seat basis. > > TIA, > James Postgresql - www.postgresql.org is opensource and is probably a better choice than MYsql, MYsql lacks sub slects, foreign keys and all sorts of things you would be used to. You can even look at firebird http://firebird.sourcefoge.net or SAPDB www.sapdb.org which are both open source. Database abstraction layers are fine but they can't properly replicate functionality that doesn't exist in a database. -- 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] Heredoc inside eval?
I have a html template with php variables. I then run it through eval(). All that works fine. Problem is that when I add simple html attributes or javascript calls I need to use single or double quotes. And this is where eval throws an error. So I then used htmlspecialchars to mask all the non-php code and then decode after eval. Then I remembered the heredoc syntax which allows both single and double quotes. So I wrote this line: eval("\$html=<
Re: [PHP] php applications
Paul M Foster wrote: On Mon, Jun 08, 2009 at 09:30:18AM -0700, Kyle Terry wrote: I don't mean to be the thread spirit killer, but I think another language would be better for this. Such as Python. PHP desktop apps might be fun to hack around with, but I wouldn't use it for a production application. I've coded a bit in Python, and parts of it really annoy me. I much prefer PHP, as it's more C-ish. Why wouldn't you use PHP for production applications? Paul Why wouldnt you? Besides the design of PHP generally being completely against it? PHP is not designed to be run continuously in infinite-loop (while true) scenarios... it's threading support is poor and it's memory handing and library are geared almost exclusively towards web-programming. If you want to compile it, or use it in a .NET/Java context... fine (see phc, etc.). The language itself can handle it, but the standard implementation *shouldnt*. In anycase other languages have much better support of desktop and network programming, entire libraries and communities have been developed around it. Preferably use Python/Java/etc. though C has its place. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php applications
Robert Cummings wrote: Michael wrote: Paul M Foster wrote: On Mon, Jun 08, 2009 at 09:30:18AM -0700, Kyle Terry wrote: I don't mean to be the thread spirit killer, but I think another language would be better for this. Such as Python. PHP desktop apps might be fun to hack around with, but I wouldn't use it for a production application. I've coded a bit in Python, and parts of it really annoy me. I much prefer PHP, as it's more C-ish. Why wouldn't you use PHP for production applications? Paul Why wouldnt you? Besides the design of PHP generally being completely against it? PHP is not designed to be run continuously in infinite-loop (while true) scenarios... Citation? see the history of php development and use it's threading support is poor and it's memory What does threading support have to do with running something in an infinite loop? What if I don't need threads? handing and library are geared almost exclusively towards web-programming. I dunno, I've written amultitude of shell/cron scripts in PHP that leverage the codebase already written for the web application. i wasnt arguing against cron-scripts, these are 'run-once' sort of things which php handles well. they dont run for minutes let alone hours. If you want to compile it, or use it in a .NET/Java context... fine (see phc, etc.). The language itself can handle it, but the standard implementation *shouldnt*. Why? for the reasons detailed in this post. using web-oriented php as a desktop programming language is a magnitude of dumb perhaps only eclipsed by the smarty programming language In anycase other languages have much better support of desktop and network programming, entire libraries and communities have been developed around it. Preferably use Python/Java/etc. though C has its place. As I've said before, ones place in the sun can't be identified if one never tries sitting in the sun. It's hard to grasp the proverbial brass ring if you never extend your reach. There are good reasons why php isnt "in the sun" (ie. used for desktop programming), as i've listed. If you'd care to learn a few other languages the reasons would be immediately obvious, python can be learnt in a few days - try it. Cheers, Rob. The standard PHP execution model is geared almost exclusively towards web-used (though crons etc. are reasonable)... that is, to sit in/with a server and handle requests... to operate over, at maximum, "insane" lifespans of 30 seconds. There are languages designed to be used for desktop programming, and for various tasks in general. The smart thing would be to use them. PHP may be a hammer, but every problem is not a nail. Use the tools designed for the job. Michael -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php applications
This was about half of my point, writing these applications in PHP is difficult, it is a task to be overcome. PHP requires cajoling into being useful. Your solution to "use the Java extension" is peculiarly ironic - yes: Use Java! If the only language you know is PHP i'm sure it looks very capable, and i was, several years ago, in this position (wanting to write various desktop apps in it) the wise and experienced freenode gurus then told me to learn the right tools. Despite how it may look from the myopia of primarily PHP development, PHP isnt a desktop-capable language. It would take a great deal of time and effort to do in PHP what would take a handful of lines in python, due to the extensive library support. Many PHP programmers goes thru' the phase of wanting to write 'http servers', 'irc clients', etc. in PHP. It would be irresponsible to not point them in the direction of more capable languages, when they are in fact, greatly more capable. Eddie Drapkin wrote: While the technology is pretty immature at the moment, due to its under-use no doubt, saying that PHP is never the tool for a desktop application is pretty inane. While the primary developmental lifecycle is geared towards web development (who's arguing that?), there's nothing really pervasive preventing people from using it for desktop apps. Given the recent focus towards closing memory leaks internally and the control of the (new, iirc) garbage collector, I wouldn't say it's a bad idea, resource speaking, to write in PHP (certainly no worse than Java). There's sound support, GTK support, CUPS support, Windows COM / printing support, so the support for the APIs is certainly there (and where it's not, there's ways around it, like with the java extension). Just because you have a hammer that's only been used for nailing particle board doesn't mean it's not suited for hammering into plywood! The only issue I see with PHP is the relative difficulty of making "stand-alone" applications that are bundled with a statically compiled PHP executable, but that shouldn't be too hard to overcome, with a little bit of time and creativity. On Tue, Jun 9, 2009 at 9:28 PM, Michael wrote: Robert Cummings wrote: Michael wrote: Paul M Foster wrote: On Mon, Jun 08, 2009 at 09:30:18AM -0700, Kyle Terry wrote: I don't mean to be the thread spirit killer, but I think another language would be better for this. Such as Python. PHP desktop apps might be fun to hack around with, but I wouldn't use it for a production application. I've coded a bit in Python, and parts of it really annoy me. I much prefer PHP, as it's more C-ish. Why wouldn't you use PHP for production applications? Paul Why wouldnt you? Besides the design of PHP generally being completely against it? PHP is not designed to be run continuously in infinite-loop (while true) scenarios... Citation? see the history of php development and use it's threading support is poor and it's memory What does threading support have to do with running something in an infinite loop? What if I don't need threads? handing and library are geared almost exclusively towards web-programming. I dunno, I've written amultitude of shell/cron scripts in PHP that leverage the codebase already written for the web application. i wasnt arguing against cron-scripts, these are 'run-once' sort of things which php handles well. they dont run for minutes let alone hours. If you want to compile it, or use it in a .NET/Java context... fine (see phc, etc.). The language itself can handle it, but the standard implementation *shouldnt*. Why? for the reasons detailed in this post. using web-oriented php as a desktop programming language is a magnitude of dumb perhaps only eclipsed by the smarty programming language In anycase other languages have much better support of desktop and network programming, entire libraries and communities have been developed around it. Preferably use Python/Java/etc. though C has its place. As I've said before, ones place in the sun can't be identified if one never tries sitting in the sun. It's hard to grasp the proverbial brass ring if you never extend your reach. There are good reasons why php isnt "in the sun" (ie. used for desktop programming), as i've listed. If you'd care to learn a few other languages the reasons would be immediately obvious, python can be learnt in a few days - try it. Cheers, Rob. The standard PHP execution model is geared almost exclusively towards web-used (though crons etc. are reasonable)... that is, to sit in/with a server and handle requests... to operate over, at maximum, "insane" lifespans of 30 seconds. There are languages designed to be used for desktop programming, and for various tasks
Re: [PHP] php applications
Daniel Brown wrote: > Hate to police threads here, but please don't top-post. Apologies, my client was not configured properly. Hopefully it is threading now, if not please notify me. Michael -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php applications
"Languages were designed to be programmed, what they are programmed to do is entirely up to the programmer." Perhaps there is no hope then. This is so distant from the actual case it does not require more than pointing out. If you want to write demons in php fine, i wince at the thought. The question isnt whether a PHP programmer thinks PHP is the right tool for the job, unanimously the answer will be 'yes' because of the myopia of the position. It is whether people with experience on a number of different platform, using a number of different languages think it is... i've yet to hear *anyone* in this position advocate PHP. Michael -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php applications
Robert Cummings wrote: > Michael wrote: >> "Languages were designed to be programmed, what they are programmed to >> do is entirely up to the programmer." >> >> Perhaps there is no hope then. This is so distant from the actual case >> it does not require more than pointing out. >> >> If you want to write demons in php fine, i wince at the thought. > > Demons are fantastical creatures. The word you're erroneously trying to > repeat is "daemon". You'll find both spellings refer to the same thing. > >> The question isnt whether a PHP programmer thinks PHP is the right >> tool for the job, unanimously the answer will be 'yes' because of the >> myopia of the position. It is whether people with experience on a >> number of different platform, using a number of different languages >> think it is... i've yet to hear *anyone* in this position advocate PHP. > > I don't have myopia, I've already said many times that there can > certainly be better ways to do something, there can be more established > choices, but just because there are, doesn't preclude the use of a less > worthy tool with the possible side effect that the less worthy tool > undergoes some kind of evolution such that it becomes a better choice in > the future. You're advocating using a hammer as a screwdriver to spur the invention of the screwdriver? We already have the screwdriver, it's called python. If you need a drill there's Java, etc. There was a time when C was a less worthy choice, there was > a time when Java was a less worthy choice, there was a time when you > probably had a more open mind. The fact remains that things change, and > usually change is driven by some impetus. That impetus may indeed be due > to the selected environment having been found lacking. Yes, certainly. This is why we have phc, phalanger, pint, mod_php, PHP4Mono, etc. You'll also notice youre talking about a progression of languages... not a progression within a language. People arent writing operating systems in python precisely because that would be an absurd misuse of a tool, nor are they writing RDMBs in PHP. There are good reasons for this. Michael -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Form handling
Have a look at Zend Form -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Session Info Storage: Session File or MySQL DB?
I am currently developing a few security functions for my website and have finally decided to use the session functions that I have been avoiding for years since I did not want to change from what I am used to developing. So now that I have refreshed my brain on how to use sessions I have to make a decision, Where should I store my session data, in the session file or on my mysql database, Speed is my main drive here and I believe the file might be just a few microseconds faster, but what do you suggest I use? Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: php user groups - searching for php developers for a project...
Try this Forum: http://www.phpfreaks.com/forums/index.php?showforum=8 Hope this Helps! Bruce wrote: hi... we're trying to find php developers/partners for a project, and we're wondering if there are php user groups in the cali/bay area (san fran/san jose) area that we can talk with, attend meetings, etc... searching google didn't really turn up anything... we know that there are some php job sites, but we didn't want to post there, given that this isn't a 'salaried' opportunity. this would be strictly startup/sweat equity, ie.. risky as hell!! thanks bruce [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP5 RC3 Runnay Processes
HI, I installed PHP 5 RC3 this morning and am having some mixed results. Specifically, every so often, I will refresh a page that loaded fine and fast the first (second, third, etc...) time around, and then for no obvious reason the script will eat up all my CPU cycles and time out (I have it set to time out at 30 seconds). I am wondering if anyone else has noticed similar behaviour. Also, I haven't a clue how to go about debugging such an issue, and would appreciate any pointers. Thanks, Michael BTW, I am running a Dual Xeon processor, 1 Gig ram, Red Hat 9, Apache 1.31 (I think that's right). -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] odd behavior of stripos() with === operator
HEllo all, After pulling my hair out for several hours trying to figure out why my code wasn't working I built this little test and ran it, the results are interesting in the least, and to me, surprising. It is possible that I have done something wrong, but I checked and rechecked this in the documentation. It appears there is either a problem with the === operator (or my brain...) If you don't mind, I'd like to see what you all think. I am running php 5.2.0 on a linux redhat 9 box with Apache 2.2 (the php 5.2.0 install is brand new, perhaps I set it up wrong?) anyway here is the code I wrote, and the output from it... $found = stripos("abcdefg", "abcdefg"); echo "found = stripos(\"abcdefg\", \"abcdefg\");\n" echo "The value of found is = : $found\n" // 1a) --- needle was found in haystack THIS SHOULD BE if ( $found !== FALSE ) { echo "found does not equal FALSE\n" } // 1b) --- needle was found in haystack THIS SHOULD ALSO BE if ($found === TRUE ) { echo "found is equal to TRUE\n" } //1c) --- needle was NOT found in haystack THIS SHOULD NOT BE if ( $found === FALSE ) { echo "found is equal to FALSE\n" } //1d) --- needle was NOT found in haystack THIS ALSO SHOULD NOT BE if ($found !== TRUE ) { echo "found does not equal TRUE\n" } $found = stripos("abcdefg", "tuvwxyz"); echo "\$found = stripos(\"abcdefg\", \"tuvwxyz\");\n" echo "The value of found is = : $found\n" //2a) --- needle was found in haystack THIS SHOULD NOT BE if ( $found !== FALSE ) { echo "found does not equal FALSE\n" } //2b) --- needle was found in haystack THIS ALSO SHOULD NOT BE if ($found === TRUE ) { echo "found is equal to TRUE\n" } //2c) --- needle was NOT found in haystack THIS SHOULD BE if ( $found === FALSE ) { echo "found is equal to FALSE\n" } //2d) --- needle was NOT found in haystack THIS SHOULD ALSO BE if ($found !== TRUE ) { echo "found does not equal TRUE\n" } the output: $found = stripos("abcdefg", "abcdefg"); The value of found is = : 0 found does not equal FALSE //this is from section 1a) of the code found does not equal TRUE//this is from section 1d) of the code // I expected the code from 1b) to be executed $found = stripos("abcdefg", "tuvwxyz"); The value of found is = : found is equal to FALSE //this is from section 2c) of the code found does not equal TRUE//this is from section 2d) of the code I have underlined the output I am interested in... How can the variable $found be both TRUE and FALSE at the same time? Anyone who can provide me some insight on this, please enlighten me. If my code is correct, then this behavior of the === operator is counter-intuitive, it was my understanding that the === and !== operators were supposed to be used with the output of stripos() for just this situation, but === does not appear to recognize that the returned "0" (because the string was found at index 0) ; whereas the !== does recognize this... is === buggy? or am I? heh thoughts? comments? Thanks all, Michael -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] odd behavior of stripos() with === operator
At 12:29 AM 11/17/2006 , you wrote: >> I have underlined the output I am interested in... > >You did??? Where? > Ok, my bad, I sent the mail as plain text instead of styled :P oops >> How can the variable $found be both TRUE and FALSE at the same time? > >None of your output above indicates that it is both equal to TRUE and >FALSE at the same time. It does indicate that $found does NOT equal TRUE >and does NOT equal FALSE at the same time and that is because it >returned the integer value 0 which is the location of the string in the >haystack. > Ok, picking gnits... I should have said NOT true and NOT false at the same time. As for the return of the integer 0.. The documentation indicates that the === and !== operators take this into account in fact there is a specific example in the manual. My point here is that if !== works , why does === not? thanks for responding. >Cheers, >Rob. >-- >.. >| InterJinn Application Framework - http://www.interjinn.com | >:: >| An application and templating framework for PHP. Boasting | >| a powerful, scalable system for accessing system services | >| such as forms, properties, sessions, and caches. InterJinn | >| also provides an extremely flexible architecture for | >| creating re-usable components quickly and easily. | >`' > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] odd behavior of stripos() with === operator *UPDATE*
At 12:24 AM 11/17/2006 , Michael wrote: >HEllo all, > >After pulling my hair out for several hours trying to figure out why my code >wasn't working I built this little test and ran it, the results are interesting >in the least, and to me, surprising. It is possible that I have done something >wrong, but I checked and rechecked this in the documentation. > >It appears there is either a problem with the === operator (or my brain...) >If you don't mind, I'd like to see what you all think. > >I am running php 5.2.0 on a linux redhat 9 box with Apache 2.2 (the php 5.2.0 >install is brand new, perhaps I set it up wrong?) > >anyway here is the code I wrote, and the output from it... > > $found = stripos("abcdefg", "abcdefg"); >echo "found = stripos(\"abcdefg\", \"abcdefg\");\n" >echo "The value of found is = : $found\n" > >// 1a) --- needle was found in haystack THIS SHOULD BE > if ( $found !== FALSE ) { > echo "found does not equal FALSE\n" > } >// 1b) --- needle was found in haystack THIS SHOULD ALSO BE > if ($found === TRUE ) { > echo "found is equal to TRUE\n" > } > >//1c) --- needle was NOT found in haystack THIS SHOULD NOT BE > if ( $found === FALSE ) { > echo "found is equal to FALSE\n" > } >//1d) --- needle was NOT found in haystack THIS ALSO SHOULD NOT BE > if ($found !== TRUE ) { > echo "found does not equal TRUE\n" > } > > $found = stripos("abcdefg", "tuvwxyz"); > >echo "\$found = stripos(\"abcdefg\", \"tuvwxyz\");\n" >echo "The value of found is = : $found\n" > >//2a) --- needle was found in haystack THIS SHOULD NOT BE > if ( $found !== FALSE ) { > echo "found does not equal FALSE\n" > } >//2b) --- needle was found in haystack THIS ALSO SHOULD NOT BE > if ($found === TRUE ) { > echo "found is equal to TRUE\n" > } > >//2c) --- needle was NOT found in haystack THIS SHOULD BE > if ( $found === FALSE ) { > echo "found is equal to FALSE\n" > } >//2d) --- needle was NOT found in haystack THIS SHOULD ALSO BE > if ($found !== TRUE ) { > echo "found does not equal TRUE\n" > } > >the output: > >$found = stripos("abcdefg", "abcdefg"); >The value of found is = : 0 > >found does not equal FALSE //this is from section 1a) of the code > >found does not equal TRUE//this is from section 1d) of the code > // I expected the code from 1b) to be executed > >$found = stripos("abcdefg", "tuvwxyz"); >The value of found is = : > >found is equal to FALSE //this is from section 2c) of the code > >found does not equal TRUE//this is from section 2d) of the code > >I have underlined the output I am interested in... How can the variable $found >be both TRUE and FALSE at the same time? > >Anyone who can provide me some insight on this, please enlighten me. > >If my code is correct, then this behavior of the === operator is >counter-intuitive, it was my understanding that the === and !== operators were >supposed to be used with the output of stripos() for just this situation, but >=== does not appear to recognize that the returned "0" (because the string was >found at index 0) ; whereas the !== does recognize this... > >is === buggy? or am I? heh > >thoughts? comments? > >Thanks all, >Michael > Hello again, I have tested and re-tested this to the point I am confident to update this post with my findings... given: $haystack="abcdef" and $needle="abc" any use of " stripos($haystack, $needle) === TRUE " will return a FALSE RESULT. In other words, if there is ANY chance that $needle will be found at the very beginning of $haystack (index = 0), you CANNOT USE "=== TRUE", you must use "!== FALSE". To me this behavior is counter-intuitive. If something is "!== FALSE", then "=== TRUE" should also be correct. I understand why a string found at the beginning of another string returns an integer 0 (the index at which the needle was found in the haystack) from stripos(), however, my point is that you SHOULD be able to test this for a TRUE condition as well as for a FALSE. I'm not sure why the === operator does not handle this condition, since the wonderful people at PHP foresaw the problem and fixed !== to handle it, I would like to see the === fixed to handle this as well (if it is even possible, not sure about how this is implemented??) ANywa
Re: [PHP] odd behavior of stripos() with === operator
At 02:10 AM 11/17/2006 , Stut wrote: >Michael wrote: >> Ok, picking gnits... >> I should have said NOT true and NOT false at the same time. >> As for the return of the integer 0.. >> The documentation indicates that the === and !== operators take this into >> account in fact there is a specific example in the manual. >> >> My point here is that if !== works , why does === not? >> > >I think you need to re-read the docs for ===. > >0 !== false > >0 == false > >1 == true > >1 !== true > >only... > >false === false > >and > >true === true > >The === and !== check both value and type, so 0 and false are different. > >Hope that helped. > >-Stut > >-- Thanks for your reply Stut. I understand that the integer 0 and FALSE are different and I read the manual so many times my head hurts, heh. There are a few ways to work around this, probably more than I know. (according to the documentation for strrpos() you could test the return from stripos() for is_bool before using it), or (perhaps, cast the return from stripos() to a boolean, although integer 0 probably casts to false :/, I honestly didn't test this {see >>>}), or (easiest solution...just suck up and use !== FALSE all the time :D ) My point in posting this was threefold, 1) to help others who may not know that stripos() returns an INTEGER 0 when the needle is found at the beginning of haystack, and/or don't realize the implications of that. 2) My main point is that !== works, so should ===. If !== knows the difference between integer 0 and boolean FALSE, why doesn't ===? 3) to get feedback from the community and deepen my understanding of PHP. So, I thank you very much for your reply :) Regards, Michael -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] odd behavior of stripos() with === operator
At 02:33 AM 11/17/2006 , Stut wrote: >Michael wrote: >> I understand that the integer 0 and FALSE are different and I read the >> manual so many times my head hurts, heh. >> >> There are a few ways to work around this, probably more than I know. >> (according to the documentation for strrpos() you could test the return from >> stripos() for is_bool before using it), or (perhaps, cast the return from >> stripos() to a boolean, although integer 0 probably casts to false :/, I >> honestly didn't test this {see >>>}), or (easiest solution...just suck up >> and use !== FALSE all the time :D ) >> > >I'm not understanding what you need to work around. What's wrong with >using !== false? Nothing at all wrong with using "!== FALSE" :) I am doing so NOW :) However, I DIDN'T know that (integer) 0 !== FALSE and (integer) 0 === TRUE are not the same thing, perhaps someone else will gain from my experience here. > >> My point in posting this was threefold, >> 1) to help others who may not know that stripos() returns an INTEGER 0 when >> the needle is found at the beginning of haystack, and/or don't realize the >> implications of that. >> > >The manual page for strpos and any other function that may return 0 or >false clearly make this point. > >> 2) My main point is that !== works, so should ===. If !== knows the >> difference between integer 0 and boolean FALSE, why doesn't ===? >> > >It does, but it also knows the difference between 1 and true, 2 and >true, 3 and true, etc. > >> 3) to get feedback from the community and deepen my understanding of PHP. > >I'm trying ;) I appreciate your efforts :) Thanks again! > >-Stut > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] odd behavior of stripos() with === operator *LAST POST*
This will be my last post on this thread of discussion. Thanks to all who replied, I have it figured out. I guess my only problem with the way the !== and === operators work in this situation is this: Logic dictates that if something evaluates to NOT FALSE it must be TRUE. Regardless of the type, regardless of the species, breed, flavor etc. if !== evaluates to TRUE then === should also under the same conditions (all other things being equal) if !== evaluates an integer 0 to TRUE, so should ===, it can't be true and still return a false value. The !== and === operators work differently, they should be complimentary. Sorry if all this has inconvenienced anyone. Cheers, Michael -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Need help with RegEx
At 01:02 AM 12/11/2006 , Anthony Papillion wrote: >Hello Everyone, > >I am having a bit of problems wrapping my head around regular expressions. I >thought I had a good grip on them but, for some reason, the expression I've >created below simply doesn't work! Basically, I need to retreive all of the >text between two unique and specific tags but I don't need the tag text. So >let's say that the tag is > >THIS IS A TEST > >I would need to retreive THIS IS A TEST only and nothing else. > >Now, a bit more information: I am using cURL to retreive the entire contents >of a webpage into a variable. I am then trying to perform the following >regular expression on the retreived text: > >$trans_text = preg_match("\/(.+?)<\/div>/"); Using the tags you describe here, and assuming the source html is in the variable $source_html, try this: $trans_text = preg_replace("/(.*?)()(.*?)(<\/div>)(.*?)^/s","$3",$source_html); how this breaks down is: opening quote for first parameter (your MATCH pattern). open regex match pattern= / first atom (.*?) = any or no leading text before , the ? makes it non-greedy so that it stops after finding the first match. second atom () = the opening tag you are looking for. third atom (.*?) = the text you want to strip out, all text even if nothing is there, between the 2nd and 4th atoms. fourth atom (<\/div>) = the closing tag of the div tag pair. fifth atom (.*?) = all of the rest of the source html after the closing tag up to the end of the line ^,even if there is nothing there. close regex match pattern= /s in order for this to work on html that may contain newlines, you must specify that the . can represent newline characters, this is done by adding the letter 's' after your regex closing /, so the last thing in your regex match pattern would be /s. end of string ^ (this matches the end of the string you are matching/replacing , $source_html) closing quote for first parameter. The second parameter of the preg_replace is the atom # which contains the text you want to replace the text matched by the regex match pattern in the first parameter, in this case the text we want is in the third atom so this parameter would be $3 (this is the PHP way of back-referencing, if we wanted the text before the tag we would use atom 1, or $1, if we want the tag itself we use $2, etc basically a $ followed by the atom # that holds what we want to replace the $source_html into $trans_text). The third parameter of the preg_replace is the source you wish to match and replace from, in this case your source html in $source_html. after this executes, $trans_text should contain the innerText of the tag pair from $source_html, if there is nothing between the opening and closing tags, $trans_text will == "", if there is only a newline between the tags, $trans_text will == "\n". IMPORTANT: if the text between the tags contains a newline, $trans_text will also contain that newline character because we told . to match newlines. I am no regex expert by far, but this worked for me (assuming I copied it correctly here heh) There are doubtless many other ways to do this, and I am sure others on the list here will correct me if my way is wrong or inefficient. I hope this works for you and that I haven't horribly embarassed myself here. Good luck :) > >The problem is that when I echo the value of $trans_text variable, I end up >with the entire HTML of the page. > >Can anyone clue me in to what I am doing wrong? > >Thanks, >Anthony > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php >
Re: [PHP] Need help with RegEx
I just realized I neglected to explain a couple of things here, sorry... My method will only work for the FIRST occurrence of the div tag pair in $source_html. The reason this method works is that you are telling preg_replace to replace everything that matches the match pattern, with just what is contained in the third atom of the match pattern. Since we are matching everything between the start of $source_html and the end of $source_html (the (.*?) atom at the beginning, and the (.*?)^ atom at the end) your return value ends up being $3, or the contents of the third atom of the match pattern, which represents the text between the opening tag and closing tag of your div element. hope this makes sense, I'm writing this at 5am heh Cheers, Michael At 04:58 AM 12/11/2006 , Michael wrote: >At 01:02 AM 12/11/2006 , Anthony Papillion wrote: >>Hello Everyone, >> >>I am having a bit of problems wrapping my head around regular expressions. I >>thought I had a good grip on them but, for some reason, the expression I've >>created below simply doesn't work! Basically, I need to retreive all of the >>text between two unique and specific tags but I don't need the tag text. So >>let's say that the tag is >> >>THIS IS A TEST >> >>I would need to retreive THIS IS A TEST only and nothing else. >> >>Now, a bit more information: I am using cURL to retreive the entire contents >>of a webpage into a variable. I am then trying to perform the following >>regular expression on the retreived text: >> >>$trans_text = preg_match("\/(.+?)<\/div>/"); > >Using the tags you describe here, and assuming the source html is in the >variable $source_html, try this: > >$trans_text = preg_replace("/(.*?)(dir=ltr>)(.*?)(<\/div>)(.*?)^/s","$3",$source_html); > >how this breaks down is: > >opening quote for first parameter (your MATCH pattern). > >open regex match pattern= / > >first atom (.*?) = any or no leading text before , >the ? makes it non-greedy so that it stops after finding the first match. > >second atom () = the opening tag you are looking >for. > >third atom (.*?) = the text you want to strip out, all text even if nothing is >there, between the 2nd and >4th atoms. > >fourth atom (<\/div>) = the closing tag of the div tag pair. > >fifth atom (.*?) = all of the rest of the source html after the closing tag up >to the end of the line ^,even if there is nothing there. > >close regex match pattern= /s > >in order for this to work on html that may contain newlines, you must specify >that the . can represent newline characters, this is done by adding the letter >'s' after your regex closing /, so the last thing in your regex match pattern >would be /s. > >end of string ^ (this matches the end of the string you are matching/replacing >, $source_html) > >closing quote for first parameter. > >The second parameter of the preg_replace is the atom # which contains the text >you want to replace the text matched by the regex match pattern in the first >parameter, in this case the text we want is in the third atom so this parameter >would be $3 (this is the PHP way of back-referencing, if we wanted the text >before the tag we would use atom 1, or $1, if we want the tag itself we use $2, >etc basically a $ followed by the atom # that holds what we want to replace the >$source_html into $trans_text). > >The third parameter of the preg_replace is the source you wish to match and >replace from, in this case your source html in $source_html. > >after this executes, $trans_text should contain the innerText of the id=result_box dir=ltr> tag pair from $source_html, if there is nothing >between the opening and closing tags, $trans_text will == "", if there is only >a newline between the tags, $trans_text will == "\n". IMPORTANT: if the text >between the tags contains a newline, $trans_text will also contain that newline >character because we told . to match newlines. > >I am no regex expert by far, but this worked for me (assuming I copied it >correctly here heh) >There are doubtless many other ways to do this, and I am sure others on the >list here will correct me if my way is wrong or inefficient. > >I hope this works for you and that I haven't horribly embarassed myself here. >Good luck :) > >> >>The problem is that when I echo the value of $trans_text variable, I end up >>with the entire HTML of the page. >> >>Can anyone clue me in to what I am doing wrong? >> >>Thanks, >>Anthony >> >>-- >>PHP General Mailing List (http://www.php.net/) >>To unsubscribe, visit: http://www.php.net/unsub.php >> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Need help with RegEx
At 08:29 AM 12/11/2006 , Brad Fuller wrote: > >The example provided didn't work for me. It gave me the same string without >anything modified. You are absolutely correct, this is what I get for not testing it explicitly :( My most sincere apologies to the OP and the list, there is an error in my example (see below for correction) I have cut and pasted from further down in the quoted message, for convenience >> Using the tags you describe here, and assuming the source html is in the >> variable $source_html, try this: >> >> $trans_text = preg_replace("/(.*?)(> dir=ltr>)(.*?)(<\/div>)(.*?)^/s","$3",$source_html); The End of string symbol ^ should not be included. I tested the above function without the ^ and it worked for me. below is the TESTED version: $trans_text = preg_replace("/(.*?)()(.*?)(<\/div>)(.*?)/s","$3",$source_html); * end of pasted section * > >I am also looking for this solution to strip out text from some XML response >I get from posting data to a remote server. I can do it using substring >functions but I'd like something more compact and portable. (A one-liner >that I could modify for other uses as well) > >Example 1: > > 16664 Rejected: Invalid LTV > > >Example 2: > > Unable to Post, Invalid Information > > >I want what is inside the tags. > >Does anyone have a working solution how we can get the text from inside >these tags using regex? > >Much appreciated, > >B > >> -Original Message- >> From: Michael [mailto:[EMAIL PROTECTED] >> Sent: Monday, December 11, 2006 6:59 AM >> To: Anthony Papillion >> Cc: php-general@lists.php.net >> Subject: Re: [PHP] Need help with RegEx >> >> At 01:02 AM 12/11/2006 , Anthony Papillion wrote: >> >Hello Everyone, >> > >> >I am having a bit of problems wrapping my head around regular >> expressions. I >> >thought I had a good grip on them but, for some reason, the expression >> I've >> >created below simply doesn't work! Basically, I need to retreive all of >> the >> >text between two unique and specific tags but I don't need the tag text. >> So >> >let's say that the tag is >> > >> >THIS IS A TEST >> > >> >I would need to retreive THIS IS A TEST only and nothing else. >> > >> >Now, a bit more information: I am using cURL to retreive the entire >> contents >> >of a webpage into a variable. I am then trying to perform the following >> >regular expression on the retreived text: >> > >> >$trans_text = preg_match("\/(.+?)<\/div>/"); >> >> Using the tags you describe here, and assuming the source html is in the >> variable $source_html, try this: >> >> $trans_text = preg_replace("/(.*?)(> dir=ltr>)(.*?)(<\/div>)(.*?)^/s","$3",$source_html); The End of string symbol ^ should not be included. I tested the above function without the ^ and it worked for me. below is the TESTED version: $trans_text = preg_replace("/(.*?)()(.*?)(<\/div>)(.*?)/s","$3",$source_html); >> >> how this breaks down is: >> >> opening quote for first parameter (your MATCH pattern). >> >> open regex match pattern= / >> >> first atom (.*?) = any or no leading text before > dir=ltr>, >> the ? makes it non-greedy so that it stops after finding the first match. >> >> second atom () = the opening tag you are >> looking for. >> >> third atom (.*?) = the text you want to strip out, all text even if >> nothing is >> there, between the 2nd and >> 4th atoms. >> >> fourth atom (<\/div>) = the closing tag of the div tag pair. >> >> fifth atom (.*?) = all of the rest of the source html after the closing >> tag up >> to the end of the line ^,even if there is nothing there. >> >> close regex match pattern= /s >> >> in order for this to work on html that may contain newlines, you must >> specify >> that the . can represent newline characters, this is done by adding the >> letter >> 's' after your regex closing /, so the last thing in your regex match >> pattern >> would be /s. >> >> end of string ^ (this matches the end of the string you are >> matching/replacing >> , $source_html) ignore this part of the explanation, the ^ is not needed and in fact breaks the example given >> >> closing quote for first parameter. >> >> The second parameter of the
RE: [PHP] Need help with RegEx
At 04:56 AM 12/12/2006 , Ford, Mike wrote: >On 11 December 2006 19:43, Michael wrote: > >> At 08:29 AM 12/11/2006 , Brad Fuller wrote: >> > >> > The example provided didn't work for me. It gave me the same >> > string without anything modified. >> >> You are absolutely correct, this is what I get for not >> testing it explicitly :( My most sincere apologies to the OP >> and the list, there is an error in my example (see below for >> correction) >> >> I have cut and pasted from further down in the quoted >> message, for convenience >> > > Using the tags you describe here, and assuming the source html is >> > > in the variable $source_html, try this: >> > > >> > > $trans_text = preg_replace("/(.*?)(> > > dir=ltr>)(.*?)(<\/div>)(.*?)^/s","$3",$source_html); >> >> The End of string symbol ^ should not be included. > >That's because ^ is not the end-of-string symbol -- it's the START-of-string >symbol. $ is the END-of string symbol. But the OP doesn't need either of >these symbols as he's not trying to match at the start or end of the string, >and nor does he need your suggested leading and trailing (.*?) for the same >reason. Unless anchored with ^ and/or $, preg is perfectly happy to match in >the middle of the subject string. Well, DOH, leave it to me to bugger something up like that heh, got the $ and ^ reversed. Thanks for correcting me :) > >@Anthony: your pattern is fine -- it's what you're doing with it that's wrong. > >On 11 December 2006 08:03, Anthony Papillion wrote: > >> $trans_text = preg_match("\/> dir=ltr>(.+?)<\/div>/"); >> >> The problem is that when I echo the value of $trans_text variable, I >> end up with the entire HTML of the page. > >I don't see how this is possible, since preg_match returns an integer telling >you how many times the pattern matched -- which will be 0 or 1, since >preg_match doesn't do multiple matches! You also clearly haven't given us >your actual call, since you've only included the pattern and not the subject >string. > >What you're after is the third argument to preg_match, which returns an array >of matched text; so for: > >preg_match("/ dir=ltr>(.+?)<\\/div>/", $orig, $matches); > >$matches[0] will return the entire match (everything from "" >$matches[1] will return the first parenthesized expression, which is what >you're looking for. > >Note also the doubled backslash, since you need to pass a single backslash >through to escape the / for preg_match. As an alternative, I would strongly >advise using a different delimiter, so that no escaping is needed; for >instance: > >preg_match("# dir=ltr>(.+?)#", $orig, $matches); > >Cheers! > >Mike > >- >Mike Ford, Electronic Information Services Adviser, >Learning Support Services, Learning & Information Services, >JG125, James Graham Building, Leeds Metropolitan University, >Headingley Campus, LEEDS, LS6 3QS, United Kingdom >Email: [EMAIL PROTECTED] >Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 > > >To view the terms under which this email is distributed, please go to >http://disclaimer.leedsmet.ac.uk/email.htm > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] preg_replace problem (or possibly bug)
I am currently writing a forum system, but at the moment I have a bug that no one can seem to get to the root cause of. Basically I am using preg_replace with the pattern as "'\[url=(.*?)\](.*?)\[/url\]'is". However for most links it works fine but for others it just doesn't render the bbcode to a link, we were trying to get to the root cause of it here http://michael-m.co.uk/forums/index.php?action=view_topic&id=31&page=1 but we failed. I'm not really that good with regular expresions so that might explain why. Also we had never noticed these problems until about 3 days ago, but I see no reason why it could have started. All help will be greatly appreciated, you may use the username php and the password php to log on to do your own tests but please keep the testing to the topic (and the spam forum if necessary). Many Thanks, Michael Mulqueen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] stripos kills my script but strpos is fine?
I'm trying to use stripos as a faster and less resource-intensive alternative to preg_match with the i flag, but I'm getting some strange behavior. Here's a test script that demonstrates the problem: --- $days = array("Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"); foreach ($days as $d) { echo "Checking day: $d"; if (stripos($d, 'T') === 0) { echo "Day is Tuesday or Thursday"; } else { echo "Day is MWFSS"; } } ?> --- When I run this as-is, it prints "Checking day: Mon" and stops. When I change stripos to strpos, it runs all the way through doing what it's supposed to. It's as if stripos calls 'die' somehow and strpos doesn't. AFAIK, stripos should behave exactly like strpos except case-insensitively. So in the function above, it should make absolutely no difference which one I use. Any thoughts? Thanks! PS: Ignore the fact I'm using days above, what I'm really doing has nothing to do with date handling. That was just a convenient example to demonstrate the problem. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] stripos kills my script but strpos is fine?
Richard Lynch wrote: Michael wrote: I'm trying to use stripos as a faster and less resource-intensive alternative to preg_match with the i flag, but I'm getting some strange behavior. AFAIK, stripos should behave exactly like strpos except case-insensitively. So in the function above, it should make absolutely no difference which one I use. stripos only exists in PHP 5. Aha. Must have missed that in the docs. You are probably running PHP 4. Yes, indeed I am. That would be the problem then. You also are hiding/re-directing your error messages somewhere, and have not gotten into the habit (yet) of reading the error log. On this point, however, you're mistaken (not your fault, of course... :) ). I was watching tail -f php_error_log as I was diagnosing the problem. I've written a custom error handler, however, which may not be handling PHP-generated errors correctly (although it does deal with syntax errors, for instance). So I'm not sure what the issue is there. But that's less important. Thanks very much for your help! Mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: What's wrong with this rewrite rule?
Chris W. Parker wrote: Hello, I've been messing with a certain rewrite rule for about 30 minutes now and it's driving me insane. I've got plenty of other rewrite rules working perfectly. Here is the rule in question. RewriteRule ^detail\.asp\?product_id=([\w-]+)$ product.php?id=$1 You're insisting that the path to rewrite start with d. It's not going to start with d, it's going to start with /. As in "/detail.asp"... Easy thing to miss, though... Mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Strange notation to create object
John Hinton wrote: Michael Stepanov wrote: With a return receipt attached and I'm wondering if we all return the receipt each time someone forgets about this on various mailing lists, would the 6583 subscribers actually returned the receipt, would it break the habit? All in fun... sorry Michael.. it just happened to be yours that finally convinced me to send this. I just get tired of the interruption of my delete process. Sorry for that. It's my working email and sometimes it's useful to see did somebody read your email or not. And many thanks, guys, for you explanation! Best, John Hinton -- Best regards, Michael Stepanov, www.stepanoff.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] set_time_limit behavior
Hi, I am trying to figure out why a script that is set to time out after 30 seconds will run indefinitely. For example, set_time_limit(30); echo ini_get('max_execution_time'), ""; echo date("H:i:s"), ""; for ($i = 0; $i < 100; $i++) { sleep(10); echo date("H:i:s"),""; flush(); } echo "Done!"; result: 30 13:54:09 14:10:50 Done! As you can see, this script ran for over 14 minutes. I have read that max_execution_time is bound to CPU time, and I am not sure how this translates into being able to effectively use this parameter. Comments / insight extremely appreciated. Michael -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] set_time_limit behavior
HI Jay, Thanks for the reply. No, we are not in safe mode. That was one of the first things I looked at. It's quite a confusing issue. I certainly have had PHP time out on me before, and have juggled max_execution_time to solve this. But with it just running indefinitely regardless of INI values or run time setting... well its a little disturbing! Thanks, Michael Jay Blanchard wrote: [snip] I am trying to figure out why a script that is set to time out after 30 seconds will run indefinitely. For example, As you can see, this script ran for over 14 minutes. I have read that max_execution_time is bound to CPU time, and I am not sure how this translates into being able to effectively use this parameter. Comments / insight extremely appreciated. [/snip] Are you running PHP in safe mode? If so set_time_limit() has no effect. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] set_time_limit behavior
Hi Jim, I certainly did overlook the ramifications of the sleep function. I modified my script so that sleep is not called: set_time_limit(1); echo ini_get('max_execution_time'), ""; echo date("H:i:s"), ""; while (true) { echo date("H:i:s"),""; flush(); } This did time out! But, oddly it timed out only after 10 seconds. Any ideas of why the discrepancy? Thanks, Michael Jim Moseby wrote: ] set_time_limit behavior HI Jay, Thanks for the reply. No, we are not in safe mode. That was one of the first things I looked at. It's quite a confusing issue. I certainly have had PHP time out on me before, and have juggled max_execution_time to solve this. But with it just running indefinitely regardless of INI values or run time setting... well its a little disturbing! Thanks, Michael Jay Blanchard wrote: [snip] I am trying to figure out why a script that is set to time out after 30 seconds will run indefinitely. For example, As you can see, this script ran for over 14 minutes. I have read that max_execution_time is bound to CPU time, and I am not sure how this translates into being able to effectively use this parameter. Comments / insight extremely appreciated. [/snip] Are you running PHP in safe mode? If so set_time_limit() has no effect. From the online manual: The set_time_limit() function and the configuration directive max_execution_time only affect the execution time of the script itself. Any time spent on activity that happens outside the execution of the script such as system calls using system(), the sleep() function, database queries, etc. is not included when determining the maximum time that the script has been running. JM -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP support for hexadecimal
Hi, I have a question about PHP's support for unsigned integers. I was trying out the following code fragment $val = 0x8000; $hexval_str = sprintf("%X", $val); echo $hexval_str; result= -8000 It seems here that I can not represent $val as an unsigned integer. Since settype does not have unsigned types, does anyone know how I can use sprintf to format an unsigned value? Any help would be greatly appreciated. TIA! Michael -- 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] Is this potentially a problem?
Hi everyone! I wrote a script which utilises semaphore and shared memory. It polls the shared memory for an event before breaking from the polling function. I wrote another script that the sets this event in shared memory. How I tested the script was as follows: I ran 3 ttys, two of them running the polling script. Naturally they will be waiting for the event to be set. And on the last terminal, I executed the event set script. Upon execution, both polling scripts were seen to have terminated their polling. Everything seems to be acting accordingly, except for the warning message that appears on both terminals running the polling script. Here is the warning message: Warning: Releasing SysV semaphore id 1 key 0x7b2 in request cleanup in Unknown on line 0 Is this warning message potentially a problem? Or could I just turn off this warning in the php.ini? How can I prevent this message from appearing if it is not potentially dangerous? Any help is greatly appreciated. TIA Michael -- 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] sessions and trans-sid problem/question
On Fri, 22 Nov 2002 15:08:31 +0100, you wrote: >I don't think the session handler checks session expiry - only gc does. I >haven't checked the PHP sources yet, but I found out that on my development >server (where we definetely don't have a lot of traffic ;->) session files >can persist over night, and the session is still available in the >morning... only when the gc_probability is hit (i.e. at the 100th access), >the file gets removed. At least with my PHP (4.2.2, RH 7.2). Then I suppose it's just an added feature of the session handler I am using. Maybe the OP should give it a shot, as I use it and I definitely don't have a problem with expired sessions being reactivated. That's not to say that you cannot pass a SID that was given to you the day before, but all of the data that was associated with it will be gone using this custom session handler, and it will effectively be a new session with the same name. I'm using the MySQL based session handler which is available here: http://www.phpbuilder.com/columns/ying2602.php3 FWIW... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP Syntax - mail statement
I have a html form that has just 3 fields and each are defined as name="firstname", name="lastname", and name="email" . The action is calling a sendmail.php file and the method is POST. Here is the contents of sendmail.php: http://probsd.org/rlewis/thankyou.txt";); ?> When submitting the form, mail gets sent to [EMAIL PROTECTED] with the subject defined in sendmail.php, but the contents simply displayes both of the commas from $contents = and not $firstname, $lastname, and $email. Syntax error or what? Michael -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Newbie: element index array
If I declared an element indexed array and put some values into it: $a['element1'] = array('btime' => '19D', 'etime' => '22D', 'dayname' => 4); $a['element2'] = array('btime' => '12D', 'etime' => '20D', 'dayname' => 2); $a['element3'] = array('btime' => '15D', 'etime' => '17D', 'dayname' => 3); I would like to ask that how can I completely delete the $a['element2'] in the array? That's mean I will get 'false' in 'isset($a['element2']) after the delete process is taken place. Thanks for your help. Regards, Michael Wai -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] sessions and trans-sid problem/question
On Sun, 24 Nov 2002 17:01:21 +0900, you wrote: >Michael Sims wrote: >> >> Then I suppose it's just an added feature of the session handler I am >> using. Maybe the OP should give it a shot, as I use it and I >> definitely don't have a problem with expired sessions > >I'll think about writing my own session handler as it can be quite >useful. However I need to evaluate the amount of extra disk read/writes >it would add. Using a DB vs the file system does add some overhead ... Experience has taught me that the additional overhead is negligible, especially if the database is running locally on the web server... Having a DB based session handler comes in very handy when you are troubleshooting a new session-based application. It's much easier to run queries against active sessions that to mess around with files, IMHO. Good luck... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] perplexed as to why this is happening...
Ahem ... $sec=1 means "set $sec to 1" You want $sec==1 :-) M. -Original Message- From: Peter Houchin [mailto:[EMAIL PROTECTED]] Sent: 25 November 2002 00:53 To: php_gen Subject: [PHP] perplexed as to why this is happening... Howdy, I'm doing a simple db check.. grabbing a db value, in this case $sec, based on the user name registered in the session, I've created a user called test with $sec equal to "2" but when i get to the second echo of $sec the value has changed to "1" and I can't understand why... can some one please give me some idea as to why this is happening? elseif ($_POST['cost'] >=11){ //query db $res = mysql_query("SELECT sec FROM users WHERE uname='$_SESSION[uname]'"); $num = mysql_numrows($res) ; if ($num == 1) { //get results $sec = mysql_result($res, 0, 'sec'); echo $sec; // pulls out sec as 2 ( as is sposed to ) } if (!$sec = "1"){ echo "please contact your nearest representive"; } else { echo $sec; // on this echo $sec has changed value from 2 to 1 Cheers Peter "the only dumb question is the one that wasn't asked" -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ This message has been checked for all known viruses by the MessageLabs Virus Control Centre. This message has been checked for all known viruses by the MessageLabs Virus Control Centre. * Notice: This email is confidential and may contain copyright material of Ocado Limited (the "Company"). Opinions and views expressed in this message may not necessarily reflect the opinions and views of the Company. If you are not the intended recipient, please notify us immediately and delete all copies of this message. Please note that it is your responsibility to scan this message for viruses. Company reg. no. 3875000. Swallowdale Lane, Hemel Hempstead HP2 7PY * -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: BBCode?
This will replace all versions (open and close) of bold, italicize and underline tags with brackets using preg_replace. $text = preg_replace("/\[(\/)?([biu])\]/","<\\1\\2>",$text) ; - find [ = "\[" - match IF slash exists = "(\/)?" - match one of the following = "([biu])" - find ] = "\]" - matches get put into 'memory' (\\1 \\2) even if not found (ie. slash didn't exist). - replace with "< 'first match' 'second match' >" - NOTE : in PCRE regexs, brackets and forward-slashes are special characters and must be escaped (preceded with a back-slash) when looking for them as regular characters. Even if you do not know PCRE yet, don't hamstring yourself looking for a solution that is too complicated and time-consuming. EREG does not work very well on this type of problem. Buck up, learn PCRE and use this type of solution (if you find something that works for you, use it...by no means does the code above cover every tag you 'may' want to use). Builder.com has a pretty good regular expression checker for PERL-style regexs that make PCRE pretty easy. http://builder.com -> Go To: Web Scripting (left menu) -> Cool Tools (right menu) -> Regular Expression Inspector (2/3 way down page) .mike === Michael Geier CDM Sports, Inc. Systems Administration email: [EMAIL PROTECTED] phone: 314.991.1511 x 6505 --- This email sent using CDM Sports Webmail v3.1 [ http://webmail.cdmsports.com ] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP Magick version 0.5a Released!
Just released some more functionality. The major push right now is join my efforts with those of Christian Stocker to get one single module into PEAR. Christian and I have been working that. Please see the latest changes below...they are significant. - functions added: imagick_getcanvas() imagick_blur() imagick_despeckle() imagick_edge() imagick_emboss() imagick_enhance() imagick_gaussianblur() imagick_medianfilter() imagick_motionblur() - one major change - renamed everything to imagick*; I've joined my efforts with Christian Stocker who had a previously written but smaller extension - magick_getcanvas() allows you to create a blank image to draw on - changed comment header in imagick.h to match the one in imagick.c - added Christian Stocker to credits - moved over to Christian Stocker's config.m4, removed the need for gen_configm4 - rewrote INSTALL to reflect new config.m4 - slight modifications to config.m4 to get it to work properly - added package.xml - removed ChangeLog, everything is now in package.xml - removed imagick_free_reason() and imagick_free_description() since they are no longer necessary - preceded all internal functions with _php_ - created imagick_read() for backward compatibility with old extension - created imagick_write() for backward compatibility with old extension You can download here http://magick.communityconnect.com/. -- Michael C. Montero Chief Technology Officer Community Connect Inc. Co-founder [EMAIL PROTECTED] -=-=-=-=-= Community Connect Inc. -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- The Premier Source of Interactive Online Communities149 Fifth Avenue http://www.CommunityConnectInc.com/ New York, NY 10010 http://www.AsianAvenue.com/ http://www.BlackPlanet.com/ Click into Asian AmericaThe World Is Yours http://www.MiGente.com/ http://www.DiversityJobMarket.com/ The Power of LatinosIn partnership with The New York Times - Your Message May Appear Below This Line -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Detecting email bounces sent by the mail function?
On Thu, 28 Nov 2002 17:54:46 -, you wrote: >Hello > >Is it possible to detect with PHP whether an email sent using the PHP >'mail' function has bounced back or has not been delivered? Hi, If you're using PHP on a unix/linux with sendmail you can set the envelope sender via the 5th parameter to the mail function, additional_parameters. Normally the envelope sender is the username that your web server process runs under (usually "nobody" if you're using Apache), but you can set it to either your email address or an email address you have setup specifically to catch bounces. Example: mail('[EMAIL PROTECTED]', 'Test email', 'This is a test', '', '[EMAIL PROTECTED]'); Most MTA in existence will route DSNs to the envelope sender, not the From: header. Note that sendmail will add an X-Warning header if the user your web server runs as isn't considered a sendmail "trusted user". The quickest way to fix this (on Redhat machines anyway) is to put the username in /etc/mail/trusted-users. Other systems and sendmail installations may differ, so YMMV. HTH... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Quota function
On Sat, 30 Nov 2002 23:36:20 +0800, you wrote: >There is a php code from Internet, it is enable Quota function with wu-imap >server, but I can't run it into my server ( Linux Redhat system ) like There is a mailing list that is specifically for Imp. You'd have better luck getting answers if you sent your question to that list: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] preg_match()
Why not use split() (http://www.php.net/split) or explode() instead of matching? ..michael.. On Mon, 2002-12-02 at 09:34, Sturle wrote: > Hello > > I have one coloumn with lots of e-mail adress like this: > > [EMAIL PROTECTED];[EMAIL PROTECTED];[EMAIL PROTECTED] > [EMAIL PROTECTED];[EMAIL PROTECTED];[EMAIL PROTECTED] > [EMAIL PROTECTED] > > And i want to take the first row and put the adresses into an array, then > the second row... > > I try like this, but i don't know what i can write in preg_match() to only > get the email adress. > > while(odbc_fetch_row($ret)){ > $Epost = odbc_result($ret,"Epost"); > preg_match_all( '/?/', $Epost, $result); > foreach ($result[0] as $loop_result) > > > > > sturle > -- Michael Sweeney <[EMAIL PROTECTED]> Verisity Design, Inc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] imagick v0.9.0.1 RELEASED
imagick, the PHP ImageMagick module, has been moved and can be found here: http://pear.php.net/package-info.php?pacid=76 All releases will occur at this location from now on. The site: http://magick.communityconnect.com/ Will continue to point to the above PHP URL. Christian and I released version 0.9.0.1. It contains support for image lists and almost all of the image processing functions - image effects, special effects, etc. Contact either myself or Christian ([EMAIL PROTECTED]) if you have comments, suggestions or to report bugs. Thanks. -- Michael C. Montero Chief Technology Officer Community Connect Inc. Co-founder [EMAIL PROTECTED] -=-=-=-=-= Community Connect Inc. -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- The Premier Source of Interactive Online Communities149 Fifth Avenue http://www.CommunityConnectInc.com/ New York, NY 10010 http://www.AsianAvenue.com/ http://www.BlackPlanet.com/ Click into Asian AmericaThe World Is Yours http://www.MiGente.com/ http://www.DiversityJobMarket.com/ The Power of LatinosIn partnership with The New York Times - Your Message May Appear Below This Line -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: C#
Wilmar Perez wrote: Hello guys I'm sorry if this message disturbs anyone, I know it is completely off topic. I've been thinking about open a C# mailing list for I hadn't been able to find a good one so far. All I want to know is if there is enough people out there interested in joining such list. I posted this message to this list for a couple of reason: it is the only programming list I am in and since you're php developers I thought many of you may be interested. Again please don't get mad at me for this I don't mean to upset or disturb anyone. Sr. Perez: Please visit aspfriends.com (I think that's it) or learnasp.com. There are links there to many c# and other .net-related lists and boards. Good luck. Michael Kimsal http://www.phpappserver.com 734-480-9961 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Forms
Beauford.2002 wrote: John Mary John Mary Maybe you just had a typo before? Michael Kimsal http://www.phphelpdesk.com Guaranteed PHP support when you need it! 734-480-9961 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP imagick Windows DLL
For any Windows users of PHP that want ImageMagick functionality built into PHP, you can download the ImageMagick PHP DLL from here: http://php.chregu.tv/php_imagick.dll Christian Stocker was gracious enough to spend time figuring out how to get it to work. For the official imagick PEAR site, go here: http://pear.php.net/package-info.php?package=imagick For examples of using the functions, you should download the latest version from the PEAR site and look at all the examples in the examples directory contained in the tar. -- Michael C. Montero Chief Technology Officer Community Connect Inc. Co-founder [EMAIL PROTECTED] -=-=-=-=-= Community Connect Inc. -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- The Premier Source of Interactive Online Communities149 Fifth Avenue http://www.CommunityConnectInc.com/ New York, NY 10010 http://www.AsianAvenue.com/ http://www.BlackPlanet.com/ Click into Asian AmericaThe World Is Yours http://www.MiGente.com/ http://www.DiversityJobMarket.com/ The Power of LatinosIn partnership with The New York Times - Your Message May Appear Below This Line -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] take text before '-' and after it
You can use split() or explode(). $string = "1234-5467" ; list( $before_dash, $after_dash ) = explode( "-", $string ) ; or $array = explode( "-", $string ) ; On Thu, 12 Dec 2002 [EMAIL PROTECTED] wrote: > > Wouldn't it be simpler to just remove the '-'? > > $var = str_replace("-","",$var); > > Ed > > > On Thu, 12 Dec 2002, Antti wrote: > > > How can I take some text before the mark - and after it and put them for > > example in array. The purpose of this is to read trough mp3 files which > > are in the form of artist - song.mp3 and put them into a text file so I > > can put them into mysql db. > > > > antti > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > -- Michael C. Montero Chief Technology Officer Community Connect Inc. Co-founder [EMAIL PROTECTED] -=-=-=-=-= Community Connect Inc. -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- The Premier Source of Interactive Online Communities149 Fifth Avenue http://www.CommunityConnectInc.com/ New York, NY 10010 http://www.AsianAvenue.com/ http://www.BlackPlanet.com/ Click into Asian AmericaThe World Is Yours http://www.MiGente.com/ http://www.DiversityJobMarket.com/ The Power of LatinosIn partnership with The New York Times - Your Message May Appear Below This Line -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Performance issues
Karel wrote: I'm having a lot of trouble with loading times... Let me explain in detail: I've a full & huge coded website based upon a mysql database... mysql entries: at least 2M php code: at least 1M lines (longest file about 25k, without includes) about 2 months ago we resetted the entire database and reworked a part of the code (nothing really essential). And now we are experiencing a really heavy load on the server. (no root access, but we think it's PHP). What reasons could there be for that? BTW if I was pretty unclear about what I said in here, please ask... I know my english ain't that well ;) My company can perform a detailed analysis of your site, isolating the specific weak points regarding performance, with specific recommendations about what to improve. This could be a code issue, or a database issue, or a combination, but you probably won't be able to get a solid answer by doing 'back and forth' over the newsgroups with various people, however well-intentioned. If you're serious about getting this issue resolved, please contact us - we will need access to your code, database, and server account. We have a standard NDA, or will work within NDA terms you provide. We've done this before with good results, and will be happy to work with you on your issues. -- Michael Kimsal http://www.tapinternet.com 734-480-9961 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Session: I RTFM
Instead of while(list($k,$v)=each($_POST)){ $_SESSION[$k]=$v; //echo "_name_ ".stripslashes($k)." _value_ ".stripslashes($v).""; } why not just $_SESSION = array_merge($_SESSION,$_POST); ??? Michael Kimsal http://www.phpappserver.com 734-480-9961 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Session: I RTFM
Marco Tabini wrote: Single quotes are normal strings. Double quotes are strings in which substitutions can take place. For example: Double quotes also expand escape strings (e.g."\n") whereas single quotes don't. However, in a case like this: -- What is the difference between: $familyname = getvar("familyname"); and $familyname = getvar('familyname'); -- There's no effective difference. :) Good magazine Marco - keep it up! Michael Kimsal http://www.phpappserver.com 734-480-9961 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PDF Lib
Bogomil Shopov wrote: hi folks Is there any way to include in PDF file .gif file with more than 8 colors? Error:Warning: Internal PDFlib warning: Color depth other than 8 bit not supported in GIF file regards Bogomil No, there's no *standard* way. I dare say that PDFlib itself could be hacked to accomodate things differently, but that's a PDFlib issue itself, not PHP's issue. If you have the option, PNGs might be better in this situation because they can be greater than 8 bits. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Undefined variable error message
All of the PHP scripts hosted on a Linux server I'm working with have suddenly begun producing an error message: undefined variable 'variablename' This occurs wherever a variable name is referred to. I'm concerned about this for two reasons: 1 Will I have to go through each script making substantial alterations? 2 Has the configuration of PHP been altered in some way without my knowledge? The latter would suggest fairly significant security issues. Does anybody have any ideas as to how this might have occurred and the quickest way of resolving it? Or of links to possible solutions? This is particularly irritating as last night was the office Christmas party and I'm in a rather fragile state this morning :-( Michael Egan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Undefined variable error message[Scanned]
Jon, Many thanks - the actual problem is now solved. As to how it occurred I think must be attributable to me at some stage in terms of fiddling around with the php.ini file. Perhaps I've had too many nights like last night and the brain cells are depleting past a critical point! Thanks to everybody else who responded to this query. Michael Egan -Original Message- From: Jon Haworth [mailto:[EMAIL PROTECTED]] Sent: 18 December 2002 10:39 To: Michael Egan; PHP General (E-mail) Subject: RE: [PHP] Undefined variable error message[Scanned] Hi Michael, > All of the PHP scripts hosted on a Linux server > I'm working with have suddenly begun producing > an error message: > > undefined variable 'variablename' Looks like someone's tweaked the error reporting level so it's on E_ALL, which can be a somewhat alarmist setting :-) Read all about it at http://php.net/manual/en/ref.errorfunc.php > The latter would suggest fairly significant > security issues. Does anybody have any ideas > as to how this might have occurred Are you on a shared host, or is there someone else who admins your box? If so, have a word with them and see if they've been fiddling with php.ini - that's where the error reporting level is set. Cheers Jon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] date part[Scanned]
You could use the explode function to break the string down into its different elements with '/' as the delimiter. Problem is if you're allowing users to input the date into a text box you can't be sure how they'll enter the data. The better option is probably to constrain what they can enter with drop down boxes for year, month and day. Michael Egan -Original Message- From: Diana Castillo [mailto:[EMAIL PROTECTED]] Sent: 19 December 2002 14:05 To: [EMAIL PROTECTED] Subject: [PHP] date part[Scanned] How can I get a string containing the month part of a date the user types in? e.g. if they type in "06/07/200" I want to get "06" thanks, diana -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Training Courses in PHP & MySQL
Ben C . wrote: Does anyone know where I can get a good training course in both PHP and MySQL that would make me proficient? Or does anyone know of a good tutor? I would prefer it to be in California or on the west coast. Please provide your comments. Hello Ben: We offer PHP/MySQL training courses - currently in Detroit/Chicago, but we're planning others in Texas and later California. More info can be found at http://www.tapinternet.com/php. We've recently partnered with Zend and are looking to expand our classes into various other markets. If you're serious about learning PHP, give me a call or drop me an email at [EMAIL PROTECTED] Our next class is in January in Detroit, but we may still be able to convince you to come out here anyway! :) I can be reached at 734-480-9961, or 1-866-745-3660 (toll free). I look forward to hearing from you. Michael Kimsal http://www.tapinternet.com 734-480-9961 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Training Courses in PHP & MySQL
Ben C . wrote: Does anyone know where I can get a good training course in both PHP and MySQL that would make me proficient? Or does anyone know of a good tutor? I would prefer it to be in California or on the west coast. Please provide your comments. I'd neglected to mention that with our courses, students get a free Zend Studio, and free snacks and lunch. Little things, true, but they mean a lot to some people. :0 Michael Kimsal http://www.tapinternet.com/php 734-480-9961 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Good program to indent large quantity of files?
Leif K-Brooks wrote: I haven't been indenting any of my code, but I want to start indenting to make the code more readable. It would be near-impossible for me to manually indent what's already there, though. So, I'm looking for a program to indent an entire folder of PHP files at once. Any suggestions? phpedit.com (I believe) has a 'code beautifier' program which will take existing files and make them 'pretty' (indented, etc) Not sure if it can do things in batches or not, but still faster than doing things manually. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Error installing
If you are trying to load a PHP-Nuke site, your problem is that the page can't access your mysql server. Either the server is not running, or the hostname/username/password is not correct so the program is unable to successfully connect to the mysql server. ..michael.. On Fri, 2002-12-20 at 01:08, Jason Wong wrote: > On Thursday 19 December 2002 23:48, Mako Shark wrote: > > Anybody have any bright ideas? > > > > Trying to install my own PHP on my own server. I'm > > getting the error "Redirection limit for this URL > > exceeded. Unable to load the requested page." > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] libcrypt.a and solaris 8
I've recently compiled PHP (4.2.3) with openssl support on a Solaris 8 system. openssl does not have a libcrypt.a library - it does have libcrypto.a. How did you install openssl and what is your configuration line for PHP? I've found it to be best to configure openssl so that it installs somewhere like /usr/local/ssl and to configure php to look at that directory for the openssl linking. It might also help if you told us what error message you're getting. ..michael.. On Fri, 2002-12-20 at 06:21, dweise wrote: > hello, >i'm trying to compile php with openssl and ldap. i can't i keep getting > an error. i surfed the web and found a reference that the library > libcrypt.a in openssl is not compatable with that in solaris 8. is this true? > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] LDAP support...
Peter Lavender wrote: OK this is lame, but I'm posting a reply straight after the message hits my box... I'm running debian and have apt-get php and openldap. openldap works, as does php. I'm now working with the ldap functions and here is where I'm stuck. apt-cache search php4 what turns up? php4-ldap I've installed the package, restarted apache but still not joy.. :( Pete I'd suggest posting this to a debian group as well - perhaps first next time if there's another problem. They don't like people dispelling the 'apt-get install solves it all' myth in non-debian circles. :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] exec, system , backtick
On Sat, 28 Dec 2002 02:55:44 +0530, you wrote: >I tried a simple command line script, in all cases no_file does not exist. I >do not want the command line script to show the error on the screen but to >deliver it in the variable $r. But alas, in all 3 cases i get 'rm: canoot >remove `no_file': No such file or directory' [script snipped] I think this is because your error is being sent to stderr but PHP is only capturing what is sent to stdout. I was able to acheive your desired results by redirecting stderr to stdout via the shell. Try the following, it worked for me: #! /usr/bin/php -q &1`; echo "the value in r is $r"; ?> If you need more info on the "2>&1" part, consult the Advanced Bash Scripting Guide here: http://www.digitaltoad.net/docs/guide/advshell/io-redirection.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php app frameworks?
Jason Sheets wrote: If you go to www.hotscripts.com they have several PHP application frameworks listed. I've investigated PHPLIB, and horde (http://www.horde.org) but wound up creating my own framework because I have not yet found a well documented framework that does what I need it to do. What were you looking for that you couldn't find in other products/projects? Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] exec, system , backtick
On Sat, 28 Dec 2002 13:30:49 +0530, you wrote: >Im running a linux system so i have no problem, but how would one redirect >stderr to stdout on a Win machine, if it is possible at all I believe it works the same way on NT kernels (NT, 2000, XP) but I could be wrong. A friend of mine actually has an entire book on shell scripting in NT, so apparently the NT shell has SOME functionality. :-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: php.ini ignored! Re: [PHP] PHP 4.3.0 released
In php.dev Omer K <[EMAIL PROTECTED]> wrote: > redhat, apache2.0.43 (as dso). compiles and runs without a problem > > php4.3.0release fails to utilize php.ini settings. ignores changes to the > ini file. > > ./configure --with-config-file-path=/usr/local/apache2/conf/php.ini --with-a > pxs2=/usr/local/apache2/bin/apxs --with-mysql (got no errors) Does it help if you use --with-config-file-path=/usr/local/apache2/conf instead? Regards... Michael -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] imap_set_quota function
On Sun, 29 Dec 2002 18:26:01 -0800 (PST), you wrote: >"This function requires the imap_stream to have been opened as the mail >administrator account. It will not work if opened as any other user. [...] >my question is, where do i set this admin called 'mailadmin' with password >'password'. do i set it in courier/uw for example? Yes, you need to give imap_set_quota() a username and password of an account that has administrator privileges on your IMAP server. If you were using Cyrus IMAP you'd use an account that's specified in the "admins" section of /etc/imapd.conf. I don't know how this is handled in Courier or UW, but I assume the mechanisms are similar. I suggest checking the documentation for your particular IMAP server... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP & PostgreSQL
On Mon, 30 Dec 2002 04:11:02 -0700, you wrote: >The things that bothered me the most: > >o Pg doesn't have DATE_FORMAT() to_char() accomplishes the same thing, for example: select to_char(lastlogin, 'FMMM-DD- FMHH:MI AM') as lastloginf from users; >, or the types SET and ENUM. I'm not sure what SET is, never used it, but ENUM is totally unnecessary in Postgres because it supports foreign keys. If you want a particular field to only allow ENUM('red', 'blue', 'green') then create a lookup table, insert these values into it, and then set up a foreign key. This is more standard anyway, and if you need to update the set there is no need to touch the database schema. >o Changing database structure is harder. With PG, I usually found it > easier to dump, edit, then reload the database to make changes I did > in MySQL with ALTER TABLE. True, changing schema is a major PITA with Postgres. My only real complaint about it, in fact... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] function misfunction
On Mon, 30 Dec 2002 14:48:13 +0100, you wrote: >function setCurrentDevGroup($devID) >{ >// start original routine >$query = "SELECT dev_group FROM tracking WHERE (computer = > > > > > > > > > > > > >$devID)"; >$sth = $adb->prepare($query); [...] > Call to a member function on a non-object in >/www/htdocs/dev/include/irm.inc on line 2857 Just a guess, but where did $adb inside your function come from? It doesn't appear that you've instantiated it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP & PostgreSQL
On Mon, 30 Dec 2002 07:57:04 -0600, you wrote: >> >o Pg doesn't have DATE_FORMAT() >> to_char() accomplishes the same thing, for example: >> select to_char(lastlogin, 'FMMM-DD- FMHH:MI AM') as lastloginf >> from users; > >Unless I missed something, that function doesn't work with unix timestamps. >Is there anythin internal to PG that allows you to convert to and from unix >timestamps? To convert TO a unix timestamp: select date_part('epoch', lastlogin) as lastloginf; or select extract(epoch from lastlogin) as lastloginf; To convert FROM a unix timestamp: select to_char(timestamp 'epoch' + unix_timestamp, 'FMMM-DD- FMHH:MI AM'); >That's how I did it and it was, indeed, a pain in the butt... But there was >some good that came out of it. When I created the MySQL tables, I didn't >have foreign keys (wasn't using InnoDB), constraints or anything like that >so in recreating the tables, I was able to implement those things to make >life easier down the road when reworking the code and the logic. And there is the major benefit of using Postgres...not to mention sub-selects, views, unions, etc. Once you get used to these things it's very hard to give them up. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Getting short (DOS) name of file?
On Tue, 31 Dec 2002 02:14:18 -0500, you wrote: >Thanks... thing is, it can be anything from c:\whatever.exe to >c:\program files\program name\bin\program.exe. I'll write a function >that goes to each directory in a string and does a dir /x if I have to, >but isn't there a simpler way? I don't know of anything built into PHP. There is a Win32 API call called GetShortPathName that would return the information. Maybe you can search and find a small binary that makes that API call and returns it's result. Another option is to use Perl. If you can install ActivePerl on your server you can use the following script: #!/usr/bin/perl use strict; use warnings; use Win32; use Getopt::Std; use File::Basename; our ($opt_p); getopts('p:'); my $path = $opt_p; if (!defined($path) || $path eq '') { print "Please specify a path with the -p option, for example: ". basename($0)." -p \"c:\\my long path\"\n"; exit; } my $short_path = Win32::GetShortPathName($path); print $short_path; exit 0; HTH... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Securing areas of a web site with PHP
Jean-Christian Imbeault wrote: I'll try this out and see what I get. Though I have read that not all browsers follow cache-control directives ... Exactly - and some don't follow other HTTP header directives to the letter either. You will not be able to 'secure' this stuff 100% simply because you only control 50% of the environment (the server, not the client). The cache-control stuff people have already replied is good, but realize nothing's 100%. You also can't prevent someone from taking a snapshot of the page, or control who sees a piece of paper with the information printed on it either. :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php