[PHP] Concatenation vs. Interpolation
Hi, FASTER CODE! This question involves Coding Style, Readability, Write-ability and Performance. Some people use the . operator to concat an string to a variable, some people use interpolation (embeding variable into string). = 1st Method (Concatenation) $str = 'My name is ' . $name; 2nd Method (Interpolation) $str = "My name is $name"; = I know that the 1st Method is much faster, according to some benchmarks, which one of them is available in the book "Advanced PHP Programming, page 470". Could we consider the 1st Method as a "Best Practice", which offers better Performance? I know that the performance here is not very much, but is it considerable in a high-traffic website? Thank you in advanced for sharing your opinions, Behzad
[PHP] reading a word document
Hello, Would anyone know or could point me to a link which might have a way for php to read a word document? The code will run on linux, so unfortunately cannot use COM. I've done research on a third application tool which converts docs to html, but have yet to find one which keeps proper formatting and doesn't need root to install it. Would appreicate any help. Thanks!! Tom
[PHP] problem in
hello friends, i need your ehlp,actually i have a tablbe in my php page,the format is something like this: monu23 monu23 What i want,when i click a row like row "t1" the values of this particuler row,i means to say the value in s((monu,23) of this row is send to some other page similarly,when i click the row2 "t2" same function perform.pls help me its urgent -- View this message in context: http://www.nabble.com/problem-in-%3Ctr%3E-tf4253021.html#a12104148 Sent from the PHP - General mailing list archive at Nabble.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php.ini of PHP 5.2.3
Hi, I have a stupid problem. At work i installed the PHP 5.2.1 and it works fine. i uncomment extension = php_opensll and i see that extension is activated because phpinfo show me information about such extension. However, at homw i've just installed PHP 5.2.3 and i did the same as at work but i'm not able to get any table information about openssl via phpinfo(); function. could you help me please ? thanks a lot. -- Alain Windows XP SP2 PostgreSQL 8.2.3 Apache 2.2.4 PHP 5.2.3
Re: [PHP] php.ini of PHP 5.2.3
Alain Roger wrote: I have a stupid problem. At work i installed the PHP 5.2.1 and it works fine. i uncomment extension = php_opensll and i see that extension is activated because phpinfo show me information about such extension. However, at homw i've just installed PHP 5.2.3 and i did the same as at work but i'm not able to get any table information about openssl via phpinfo(); function. could you help me please ? OpenSSL requires a DLL file to be in the path on Windows. From the manual page (http://php.net/openssl)... "Note to Win32 Users: In order for this extension to work, there are DLL files that must be available to the Windows system PATH. See the FAQ titled "How do I add my PHP directory to the PATH on Windows" for information on how to do this. Although copying DLL files from the PHP folder into the Windows system directory also works (because the system directory is by default in the systems PATH), it is not recommended. This extension requires the following files to be in the PATH: libeay32.dll" -Stut -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Switch To VoIPTelco And Save!
Hi, I want to introduce you to a new phone service that I'm using. It's called VoIPTelCo and it transforms your high speed Internet connection into a regular phone line. It works just like your current telephone service except it's 40% - 60% cheaper. You get features like Call Waiting, Caller ID Display, Voicemail, 3-Way calling, Call Forwarding and many more for a fraction of what you're paying now. You can even keep your existing number if you decide to switch to their service. With VoIPTelCo, I also save money on long distance calling. Unlike a regular phone line, VoIPTelCo is "portable", which means I can get phone service anywhere in the world. All I need is high speed Internet access. For example, I use my VoIPTelCo service when I travel and there are no long distance fees because these calls are considered "local". I save so much money just on this alone. Right now, VoIPTelCo is offering a ONE MONTH FREE trial period to friends and families of their customers. There is no obligation and it is completely free. If you'd like to try them out, just click on the link below and you will receive a 30 days trial period, free of charge: http://www.voiptelco.net Hope you'll find this useful.
Re: [PHP] php.ini of PHP 5.2.3
I've discovered that when i type "php -m", openssl is already loaded as module. It seems that PHP 5.2.3 was compiled with "--with-openssl" command. So, why modules with which ones PHP has been compiled do not appear in the phpinfo() report ? thanks a lot, Al. On 8/11/07, Stut <[EMAIL PROTECTED]> wrote: > > Alain Roger wrote: > > I have a stupid problem. > > At work i installed the PHP 5.2.1 and it works fine. > > i uncomment extension = php_opensll and i see that extension is > activated > > because phpinfo show me information about such extension. > > > > However, at homw i've just installed PHP 5.2.3 and i did the same as at > work > > but i'm not able to get any table information about openssl via > phpinfo(); > > function. > > > > could you help me please ? > > OpenSSL requires a DLL file to be in the path on Windows. From the > manual page (http://php.net/openssl)... > > "Note to Win32 Users: In order for this extension to work, there are > DLL files that must be available to the Windows system PATH. See the FAQ > titled "How do I add my PHP directory to the PATH on Windows" for > information on how to do this. Although copying DLL files from the PHP > folder into the Windows system directory also works (because the system > directory is by default in the systems PATH), it is not recommended. > This extension requires the following files to be in the PATH: > libeay32.dll" > > -Stut > > -- > http://stut.net/ > -- Alain Windows XP SP2 PostgreSQL 8.2.3 Apache 2.2.4 PHP 5.2.3
Re: [PHP] magic quotes
I added the code to my script and I still ended up escaped quotes. if(ini_get('magic_quotes_gpc')) $_POST['data'] = stripslashes($_POST['data']); Didn't work at all. I think I read something about it not working on runtime data. Like gpc if this is correct do you have another solution? I put this line in the .htaccess file it didn't work either: php_flag magic_quotes_gpc off... Is there anyway possible? I don't need it now but it'd be nice to know for the future dev. http://www.phpguru.org/article.php?ne_id=58 -- Richard Heyes +44 (0)844 801 1072 http://www.websupportsolutions.co.uk Knowledge Base and HelpDesk software that can cut the cost of online support -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Concatenation vs. Interpolation
On 8/11/07, AmirBehzad Eslami <[EMAIL PROTECTED]> wrote: > Hi, > > FASTER CODE! > > This question involves Coding Style, Readability, Write-ability and > Performance. > Some people use the . operator to concat an string to a variable, some > people use interpolation (embeding variable into string). > > = > 1st Method (Concatenation) > $str = 'My name is ' . $name; > > 2nd Method (Interpolation) > $str = "My name is $name"; > = > > I know that the 1st Method is much faster, according to > some benchmarks, which one of them is available > in the book "Advanced PHP Programming, page 470". > > Could we consider the 1st Method as a "Best Practice", which offers > better Performance? > > I know that the performance here is not very much, but is it > considerable in a high-traffic website? > > Thank you in advanced for sharing your opinions, > Behzad > Code readability is quite important when working with a team on a project, and if you got for method 1 on things like this: $str = ''; It gets quite inreadable, having a double qoute next to a single quote. while this looks much better: $str = ""; I just did some benchmarks myself, and you can see that concatenation is definitly a little bit fast, but it's only 2 seconds on 10 million loops: For 10,000,000 loops: Concatenation single quote:5.62786102295 Concatenation double quote:5.6335657 Interpolation:7.32201290131 Test code used: '; } $time[2] = microtime(TRUE); $x = 0; $str = ''; $add = '?'; $time[3] = microtime(TRUE); for($x = 0; $x < 1000; $x++) { $str = ""; } $time[4] = microtime(TRUE); $x = 0; $str = ''; $add = 'def'; $time[5] = microtime(TRUE); for($x = 0; $x < 1000; $x++) { $str = ""; } $time[6] = microtime(TRUE); echo 'For 10,000,000 loops:'; echo 'Concatenation single quote:'.($time[2]-$time[1]); echo 'Concatenation double quote:'.($time[4]-$time[3]); echo 'Interpolation:'.($time[6]-$time[5]); ?> Tijnema -- Vote for PHP Color Coding in Gmail! -> http://gpcc.tijnema.info -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] I know this is not easy and I'm not stupid but...
On 8/10/07, Zoltán Németh <[EMAIL PROTECTED]> wrote: > 2007. 08. 10, péntek keltezéssel 02.31-kor Jan Reiter ezt írta: > > Hi! > > Thank you for your response! > > > > The only intention of my code was to investigate the (back then) unexpected > > behavior of the if statement. > > > > > > With $var['test'] set to "blah" this expression should be false > > ($var['test'] == 0) for what I know ... > > > > $var['test'] = "blah"; > > var_dump($var['test'] == 0); > > > > //returns bool(true) > > > > Now I know why this happens! According to Table 6.5 of the Operators page in > > the PHP Manual in this comparison all of the values are converted to > > integer. And atoi("blah") for sure will fail!;-) So you have to use === to > > keep the types of the values! > > I found something interesting: > > [EMAIL PROTECTED]:~ php -r '$var = 'bla'; var_dump('0' == $var);' > bool(true) > [EMAIL PROTECTED]:~ php -r '$var = 'bla'; var_dump("0" == $var);' > bool(false) > > version is 5.2.1 > > is this expected behaviour to be a difference between the two types of > quotes in this case? > > greets > Zoltán Németh I think you're little bit confused by the quotes :P and since you don't have error reporting including E_NOTICE, you don't see that there's some problem with your code :P If I execute your code with the -n option, I get same results. When I put them in a PHP file like this: I get : bool(false) bool(false) and you probably also ;) Tijnema > > > > > Jan > > > > > > > > -Original Message- > > From: Jim Lucas [mailto:[EMAIL PROTECTED] > > Sent: Friday, August 10, 2007 1:47 AM > > To: Jan Reiter > > Cc: [EMAIL PROTECTED]; php-general@lists.php.net > > Subject: Re: [PHP] I know this is not easy and I'm not stupid but... > > > > Jan Reiter wrote: > > > Hi! > > > > > > Phil: > > > Still I am curious what var_dump($userValues['afterDark']); at line 102.5 > > > would return. > > > I managed to recreate that fault with > > > > > > $var['test'] = "blah"; > > > > > > echo ($var['test']); > > > > > > if( $var['test'] == 0) > > > { > > > echo "ok"; > > > } > > > > > > //this returns blahok -- not expected. > > > > > > In my case Var_dump() returns string(4) "blah" as expected. > > > > > > Using > > > > > > if( $var['test'] === 0) > > > > > > behaves as expected!! > > > > Are you wanting to only test for a empty/non-empty string? > > > > if so, use this. > > > > if ( empty($var['test']) ) { > > echo "var['test'] is empty"; > > } > > > > > > > > > > > Jim: > > > TypeCasting would only be effective if you used the type sensitive > > > comparison operator === , because with "==" 0 equals NULL equals false > > > equals "" and so on ... or do I miss something here?? > > > > > > > > > Hope that solves it for you! I'm still investigating why my first examples > > > fails. I've got the strong feeling that I'm missing something there. I > > don't > > > believe in a php bug or a memory leak in this case! Must be something > > pretty > > > obvious! Anyone a clue?? > > > > > > Thanks, > > > Jan > > > > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Vote for PHP Color Coding in Gmail! -> http://gpcc.tijnema.info -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Forwarding $_POST[]...
At 7:10 PM +0100 8/9/07, Stut wrote: Rethink things. There's almost certainly a better way but without knowing why you think you need to do this it's not possible to help any further. -Stut I think I understand what the OP is asking. How about this example: 1. User selects items he wants to purchase and is sent to a "buy" page (with $_POST data). 2. However, the user has not logged in and thus is sent to a log-in page. 3. After the user logs in, the user is returned back to the "buy" page. Now, in this exchange what's the easiest way to maintain the $_POST data? For me, I place the data in a $_SESSION array and pull it out if/when the user returns. As you know, there are all sorts of ways to do this and I think that was the question of the poster. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Friday morning brain farts....
At 11:00 AM -0400 8/10/07, Robert Cummings wrote: On Fri, 2007-08-10 at 10:43 -0400, Jason Pruim wrote: Hi All :) Hope you're not getting sick of my questions as of late, but I keep getting closer and closer and thank you all who have helped me in the past! "The only reason I can see this far is I am standing on the shoulders of giants" don't know who said that but I like it :) http://en.wikipedia.org/wiki/Stand_on_the_shoulders_of_giants Cheers, Rob. Yeah, but when I do that I always fall off. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Concatenation vs. Interpolation
You're right. There is a low benefit in performance. But I think it's valuable in high-traffic websites. Of course, we should consider a lot of thing to have a better performance, but Concatenation, IMO, is the best practice. Let me explain: َActually, the programmers' preference on readability and write-ability varies. I think that concatenation provides a more readable syntax, since it allows us to distinguish variables from plain strings very easily. Consider the following code: $str = 'My name is ' . $name . ' and I live in ' . $city; VS. $str = "My name is $name and I live in $city"; (You may view the above code in an Editor with syntax-highlighting capability for a better result). However, it is possible to offer opposite examples. In addition to the Performance on Speed, Concatenation uses less memory than Interpolation, as explained in PHP Manual. Take a look at the following URL: http://us2.php.net/manual/en/language.types.string.php Quote: Note: Parsing variables within strings uses more memory than string concatenation. When writing a PHP script in which memory usage is a concern, consider using the concatenation operator (.) rather than variable parsing Thus, I think that it is better to use Concatenation instead of Interpolation. Since it provides Performance, both on Speed and Memory Usage. There is a benchmark available here: http://us2.php.net/manual/en/function.print.php#66392 On 8/11/07, Tijnema <[EMAIL PROTECTED]> wrote: > > On 8/11/07, AmirBehzad Eslami <[EMAIL PROTECTED]> wrote: > > Hi, > > > > FASTER CODE! > > > > This question involves Coding Style, Readability, Write-ability and > > Performance. > > Some people use the . operator to concat an string to a variable, some > > people use interpolation (embeding variable into string). > > > > = > > 1st Method (Concatenation) > > $str = 'My name is ' . $name; > > > > 2nd Method (Interpolation) > > $str = "My name is $name"; > > = > > > > I know that the 1st Method is much faster, according to > > some benchmarks, which one of them is available > > in the book "Advanced PHP Programming, page 470". > > > > Could we consider the 1st Method as a "Best Practice", which offers > > better Performance? > > > > I know that the performance here is not very much, but is it > > considerable in a high-traffic website? > > > > Thank you in advanced for sharing your opinions, > > Behzad > > > > Code readability is quite important when working with a team on a > project, and if you got for method 1 on things like this: > $str = ''; > It gets quite inreadable, having a double qoute next to a single quote. > while this looks much better: > $str = ""; > > I just did some benchmarks myself, and you can see that concatenation > is definitly a little bit fast, but it's only 2 seconds on 10 million > loops: > For 10,000,000 loops: > Concatenation single quote:5.62786102295 > Concatenation double quote:5.6335657 > Interpolation:7.32201290131 > > Test code used: > > $x = 0; > $str = ''; > $add = '?'; > > $time[1] = microtime(TRUE); > for($x = 0; $x < 1000; $x++) { > $str = ''; > } > $time[2] = microtime(TRUE); > > $x = 0; > $str = ''; > $add = '?'; > > $time[3] = microtime(TRUE); > for($x = 0; $x < 1000; $x++) { > $str = ""; > } > $time[4] = microtime(TRUE); > > $x = 0; > $str = ''; > $add = 'def'; > > $time[5] = microtime(TRUE); > for($x = 0; $x < 1000; $x++) { > $str = ""; > } > $time[6] = microtime(TRUE); > > echo 'For 10,000,000 loops:'; > echo 'Concatenation single quote:'.($time[2]-$time[1]); > echo 'Concatenation double quote:'.($time[4]-$time[3]); > echo 'Interpolation:'.($time[6]-$time[5]); > > ?> > > Tijnema > > -- > Vote for PHP Color Coding in Gmail! -> http://gpcc.tijnema.info >
Re: [PHP] Friday morning brain farts....
At 7:21 PM +0200 8/10/07, Tijnema wrote: On 8/10/07, Robert Cummings <[EMAIL PROTECTED]> wrote: > if( !isset( $argv[1] ) || !isset( $argv[2] ) || !isset( $argv[3] ) ) if(!isset($argv[1],$argv[2],$argv[3])) // Bit shorter ;) But a bit harder to recognize IMO. :-) Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Friday morning brain farts....
On 8/11/07, tedd <[EMAIL PROTECTED]> wrote: > At 7:21 PM +0200 8/10/07, Tijnema wrote: > >On 8/10/07, Robert Cummings <[EMAIL PROTECTED]> wrote: > > > > > if( !isset( $argv[1] ) || !isset( $argv[2] ) || !isset( $argv[3] ) ) > > > >if(!isset($argv[1],$argv[2],$argv[3])) // Bit shorter ;) > > But a bit harder to recognize IMO. :-) > > Cheers, > > tedd > -- But less confusing :) When I started PHP, I stumbled over this pice of code: if(!isset($get['a']) && !isset($get['b']) && !isset($get['c'])) if I had used this: if(!isset($get['a'],$get['b'],$get['c'])) it would have been correct :) After looking at it for about an hour (LOL), I figured out I needed to change it to: if(!isset($get['a']) || !isset($get['b']) || !isset($get['c'])) Tijnema -- Vote for PHP Color Coding in Gmail! -> http://gpcc.tijnema.info -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] simplexml_load_file()
switch to an underscore comment_id instead bastien > Date: Fri, 10 Aug 2007 23:03:19 +0100 > From: [EMAIL PROTECTED] > To: php-general@lists.php.net > Subject: [PHP] simplexml_load_file() > > Hello, > > I'm doing an script which it'll "read" the xml values, but I have one > problem doing that. > > On the xml there is a tag that has an hífen in the middle, so when I do > "echo $xml->comment-id" it gives me an error. > > How can I make this work? > > Thanks in advantage. _ Connect to the next generation of MSN Messenger http://imagine-msn.com/messenger/launch80/default.aspx?locale=en-us&source=wlmailtagline -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] multiple data to insert to database
Richard Lynch wrote: On Fri, August 10, 2007 8:36 am, Alain Roger wrote: I would like to know what is the best way and fastest to insert into PostgreSQL around 25.000 records (extracted from CSV file). Should i use the standard pg_exec($dbconn, "insert into..."); for each record ? 25.000 records is not THAT large, so try it and see if it's acceptable performance. If not, ask the PostgreSQL list/forum how to bulk load a CSV file, as it's not a PHP question, it's a PostgreSQL question. This question just came up in the pgsql-general list last week, actually. You'll want to use the COPY command: COPY your_table FROM STDIN; http://www.postgresql.org/docs/techdocs.15 But, as you're using PHP, you should look into the pg_copy_from() function: http://www.php.net/manual/en/function.pg-copy-from.php In a nutshell, pass it an array holding each line from your CSV file. That is, each value in the array is a single line from your CSV file. Note that you can specify the field delimiter, which defaults to a tab. Take special note of how NULLs are represented. If there's any chance that your CSV file has empty fields you might want to replace them with '\N' (which is the default that the function is expecting). brian -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] javascript in or in ?
At 9:29 PM +0200 8/7/07, Tijnema wrote: On 8/7/07, Robert Cummings <[EMAIL PROTECTED]> wrote: > Yeah!! This list is for public apologies and Copyright discussion. Cheers, Rob. -- Oh yeah, Tedd is only the first of thousands of people that need to apologize... :P Tijnema Ah crap, have I got something else to apologize for? At this rate, by the time I reach the end of my life, I'll know only two sentences, namely "I'm sorry" and "Yes, Dear". Oh, to bring this off-topic question back to on-topic (?) Always (fishing for another apology opportunity) place javascript in external files and call them in via the header. Keep the code unobtrusive. There are ways to use javascript without having to mix it into your html -- look up DOM scripting. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] reading a word document
Tom Cruickshank wrote: Hello, Would anyone know or could point me to a link which might have a way for php to read a word document? The code will run on linux, so unfortunately cannot use COM. I've done research on a third application tool which converts docs to html, but have yet to find one which keeps proper formatting and doesn't need root to install it. In what sense do you require the formatting to be preserved? If it's the *structure* that you need to keep for some reason (and they're complex docs) you'll likely have an uphill battle. Word isn't the best tool for that sort of thing, so you'll be starting from a handicapped position to begin with. Will you only be displaying the contents? If so, you'll want to convert it to HTML, so either figure out a way to make whatever tool you've already looked into work or find another. Perhaps you could convert to HTML, then use the DOM functions with the output if you want to get at certain elements of the result. You didn't say what you've already tried so i'll just list these: wv Converts to plaintext, HTML, PDF, etc. http://freshmeat.net/projects/wv/ catdoc Convert MSWord files to plaintext http://freshmeat.net/projects/catdoc/ word2x Convert to plaintext, HTML, and LaTeX. http://word2x.sourceforge.net/ brian -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] manual vs. meta refresh
At 2:10 AM +0200 8/11/07, Tijnema wrote: On 8/11/07, Richard Lynch <[EMAIL PROTECTED]> wrote: On Fri, August 10, 2007 1:26 pm, Kevin Murphy wrote: > I doubt this, but is there any way to determine via PHP if a browser > was refreshed automatically via a META tag vs the person clicking the > refresh button? You could embed something in the META tag's URL such as: http://example.com?from_meta_tag=1"; > You would then need to re-direct back to the URL *without* the GET parameter from_meta_tag=1 so that their refresh button would not be going to that URL with from_meta_tag in it. Kind of kludgy, but should work > Do you guys read other replies first before making a reply yourself? You're the third one making the same reply... Tijnema No, this is a test and we shouldn't look off other's test sheets -- that would be cheating. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] javascript in or in ?
On Sat, 2007-08-11 at 12:15 -0400, tedd wrote: > At 9:29 PM +0200 8/7/07, Tijnema wrote: > >On 8/7/07, Robert Cummings <[EMAIL PROTECTED]> wrote: > > > Yeah!! This list is for public apologies and Copyright discussion. > >> > >> Cheers, > >> Rob. > >> -- > > > >Oh yeah, Tedd is only the first of thousands of people that need to > >apologize... :P > > > >Tijnema > > > Ah crap, have I got something else to apologize for? > > At this rate, by the time I reach the end of my life, I'll know only > two sentences, namely "I'm sorry" and "Yes, Dear". > > Oh, to bring this off-topic question back to on-topic (?) > > Always (fishing for another apology opportunity) place javascript in > external files and call them in via the header. Keep the code > unobtrusive. There are ways to use javascript without having to mix > it into your html -- look up DOM scripting. I absolutely agree with unobtrusive JavaScript, but I do disagree with you slightly on using external files. Generally speaking i keep large bits of code (Especially libs) in external files, but a few lines of script for a form that appears on one page I'll often be put in the head section. This way the JavaScript is in the same file as the template for which it is associated. My template engine will relocate the JavaScript to the section at compile time. Cheers, Rob. -- ... SwarmBuy.com - http://www.swarmbuy.com Leveraging the buying power of the masses! ... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] simplexml_load_file()
But How? I tried an str_replace, and preg_replace and didn't work at all.. can you help me? Thanks in advantage. On 11/08/07, Bastien Koert < [EMAIL PROTECTED]> wrote: > > > switch to an underscore comment_id instead > > bastien > > > > > > > Date: Fri, 10 Aug 2007 23:03:19 +0100 > > From: [EMAIL PROTECTED] > > To: php-general@lists.php.net > > Subject: [PHP] simplexml_load_file() > > > > Hello, > > > > I'm doing an script which it'll "read" the xml values, but I have one > > problem doing that. > > > > On the xml there is a tag that has an hífen in the middle, so when I do > > "echo $xml->comment-id" it gives me an error. > > > > How can I make this work? > > > > Thanks in advantage. > > _ > Connect to the next generation of MSN Messenger > > http://imagine-msn.com/messenger/launch80/default.aspx?locale=en-us&source=wlmailtagline > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >
Re: [PHP] preg_match_all to match tags
At 11:45 PM + 8/9/07, Ólafur Waage wrote: I know this isn't exactly a php related question but due to the quality of answers ive seen lately ill give this a shot. (yes yes im smoothing up the crowd before the question) I have a weblog system that i am creating, the trouble is that if a user links to an external image larger than 500pixels in width, it messes with the whole layout. I had found some regex code im using atm but its not good at matching the entire image tag. It seems to ignore properties after the src declaration and not match tags that have properties before the src declaration . preg_match_all("/\< *[img][^\>]*[src] *= *[\"\']{0,1}([^\"\'\ >]*)/i", $data, $matches); print_r($matches); This currently makes two arrays for me, the source location from all img tags and a large part of the tag itself. But not the entire tag. What i do is i match the img tag, find the src, get the image properties, and if the width is more than 500, i shrink it down and add width="X" and height="Y" properties to the image tag. How can i match an image tag correctly so it does not cause any issues with how the user adds the image. You could set a class attribute for the image in html and scale it in css. An img {width: 100%;} would hold the size to the maximum of the parent. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] preg_match_all to match tags
How can i match an image tag correctly so it does not cause any issues with how the user adds the image. preg_match_all('/]*>/Ui'); Off the top of my head. This wouldn't allow for using the right angle bracket in the img tag, but that's almost never going to happen in reailty. -- Richard Heyes +44 (0)844 801 1072 http://www.websupportsolutions.co.uk Knowledge Base and HelpDesk software that can cut the cost of online support -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] preg_match_all to match tags
Richard Heyes wrote: How can i match an image tag correctly so it does not cause any issues with how the user adds the image. preg_match_all('/]*>/Ui'); Off the top of my head. This wouldn't allow for using the right angle bracket in the img tag, but that's almost never going to happen in reailty. Oops that should be: preg_match_all('/]*>/Ui', $input, $matches); -- Richard Heyes +44 (0)844 801 1072 http://www.websupportsolutions.co.uk Knowledge Base and HelpDesk software that can cut the cost of online support -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] preg_match_all to match tags
On 8/11/07, Richard Heyes <[EMAIL PROTECTED]> wrote: > Richard Heyes wrote: > >> How can i match an image tag correctly so it does not cause any issues > >> with how the user adds the image. > > > > preg_match_all('/]*>/Ui'); > > > > Off the top of my head. This wouldn't allow for using the right angle > > bracket in the img tag, but that's almost never going to happen in reailty. > > Oops that should be: > > preg_match_all('/]*>/Ui', $input, $matches); > > -- > Richard Heyes < img src="image.jpg"> Your script doesn't catch above ;) Tijnema -- Vote for PHP Color Coding in Gmail! -> http://gpcc.tijnema.info -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] preg_match_all to match tags
> < img src="image.jpg"> Your script doesn't catch above ;) So don't write HTML like that. -- Richard Heyes +44 (0)844 801 1072 http://www.websupportsolutions.co.uk Knowledge Base and HelpDesk software that can cut the cost of online support -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] preg_match_all to match tags
On 8/11/07, Richard Heyes <[EMAIL PROTECTED]> wrote: > > < img src="image.jpg"> > > > > Your script doesn't catch above ;) > > So don't write HTML like that. > Depends where the HTML is coming from, it might be user input Tijnema -- Vote for PHP Color Coding in Gmail! -> http://gpcc.tijnema.info -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] preg_match_all to match tags
> < img src="image.jpg"> Your script doesn't catch above ;) So don't write HTML like that. Depends where the HTML is coming from, it might be user input Ok, add \s* after the initial angle bracket. -- Richard Heyes +44 (0)844 801 1072 http://www.websupportsolutions.co.uk Knowledge Base and HelpDesk software that can cut the cost of online support -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] preg_match_all to match tags
Tijnema wrote: On 8/11/07, Richard Heyes <[EMAIL PROTECTED]> wrote: Richard Heyes wrote: How can i match an image tag correctly so it does not cause any issues with how the user adds the image. preg_match_all('/]*>/Ui'); Off the top of my head. This wouldn't allow for using the right angle bracket in the img tag, but that's almost never going to happen in reailty. Oops that should be: preg_match_all('/]*>/Ui', $input, $matches); -- Richard Heyes < img src="image.jpg"> Your script doesn't catch above ;) That's not valid HTML and won't get displayed correctly in most browsers. -Stut -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] reading a word document
Tom Cruickshank wrote: Hello, What I would like to preserve in the sense of formatting is bold, italics, spacing, pictures (if any). That kind of thing. I'm aware that Word isn't the best type of document to read from, unfortunately some folks will be using that file format to upload files. Ideally, yes I do want to convert the doc file to an html file. I've tried wvWare and I really like it. Unfortunately, the hosting provider refuses to install it since you do need root access for the installation. catdoc, doesn't appear to preserve text format, so that would defeat the purpose of uploading word documents. word2x has also potential, however, I don't have root access on this system. Appreicate the feedback. With these restrictions in mind, is there any other solutions that you can think of? Not really. If you're doing this for a client, i'd tell them to find a new host or drop the idea of converting user-supplied MSWord files. Do the files really need to be converted? Aside from the fact that it's lame, you could just serve up DOC files to the browser. No, i hate that idea. Forget it. How big are these files, anyway? Could you, instead, have the users supply the information through a WYSIWYG widget (widgEdit, FCKEditor, etc.) that would do the mark-up itself? Do you have shell access to the server? If so, can you see if any of these tools are already available. Do the conversions need to be immediate? If not, you could write a handler to send them to you as they come in so you could convert them on your own machine. Not at all ideal, but ... Any possibility to not accept Word files in the first place? brian -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] preg_match_all to match tags
On 8/11/07, Stut <[EMAIL PROTECTED]> wrote: > Tijnema wrote: > > On 8/11/07, Richard Heyes <[EMAIL PROTECTED]> wrote: > >> Richard Heyes wrote: > How can i match an image tag correctly so it does not cause any issues > with how the user adds the image. > >>> preg_match_all('/]*>/Ui'); > >>> > >>> Off the top of my head. This wouldn't allow for using the right angle > >>> bracket in the img tag, but that's almost never going to happen in > >>> reailty. > >> Oops that should be: > >> > >> preg_match_all('/]*>/Ui', $input, $matches); > >> > >> -- > >> Richard Heyes > > > > < img src="image.jpg"> > > > > Your script doesn't catch above ;) > > That's not valid HTML and won't get displayed correctly in most browsers. > > -Stut hmm.. damn.. you're right :P I always assumed it was just correct... Tijnema -- Vote for PHP Color Coding in Gmail! -> http://gpcc.tijnema.info -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] question about note on php.net
Hello, I have a question--is the note from equazcion here correct? It is left unchallenged on the page but I can't see how it is correct since I am under the impression that the environment is refreshed each page load and the function or method definitions (including those for session_set_save_handler) would need to be re-established each page, not each session. I am having tremendous difficulty debugging some code I wrote and eliminating my uncertainty regarding this point would be greatly helpful. Any advice would be appreciated. Thanks!
Re: [PHP] question about note on php.net
Michael Cooper wrote: Hello, I have a question--is the note from equazcion here correct? It is left unchallenged on the page but I can't see how it is correct since I am under the impression that the environment is refreshed each page load and the function or method definitions (including those for session_set_save_handler) would need to be re-established each page, not each session. I am having tremendous difficulty debugging some code I wrote and eliminating my uncertainty regarding this point would be greatly helpful. Any advice would be appreciated. Thanks! Erm, what note where on php.net? -Stut -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] convert (windows-1250) to (utf-8)
Hi, I import a csv file (which includes characters from "windows-1250" charset) to postgreSQL database which is in UTF-8. How can i convert windows-1250 to utf-8 charset ? thanks a lot, -- Alain Windows XP SP2 PostgreSQL 8.2.3 Apache 2.2.4 PHP 5.2.3
Re: [PHP] preg_match_all to match tags
Ive already finished the code and pasted it to this mailing list :) Just an fyi. Ólafur Waage > 2007/8/11, Tijnema <[EMAIL PROTECTED]>: > > On 8/11/07, Stut <[EMAIL PROTECTED]> wrote: > > > Tijnema wrote: > > > > On 8/11/07, Richard Heyes <[EMAIL PROTECTED]> wrote: > > > >> Richard Heyes wrote: > > > How can i match an image tag correctly so it does not cause any > > > issues > > > with how the user adds the image. > > > >>> preg_match_all('/]*>/Ui'); > > > >>> > > > >>> Off the top of my head. This wouldn't allow for using the right angle > > > >>> bracket in the img tag, but that's almost never going to happen in > > > >>> reailty. > > > >> Oops that should be: > > > >> > > > >> preg_match_all('/]*>/Ui', $input, $matches); > > > >> > > > >> -- > > > >> Richard Heyes > > > > > > > > < img src="image.jpg"> > > > > > > > > Your script doesn't catch above ;) > > > > > > That's not valid HTML and won't get displayed correctly in most browsers. > > > > > > -Stut > > > > hmm.. damn.. you're right :P I always assumed it was just correct... > > > > Tijnema > > -- > > Vote for PHP Color Coding in Gmail! -> http://gpcc.tijnema.info > > > > -- > > 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] results to html table
I wish to get a result set into a html table. normally this is not a problem. But I wish to use one of the results as a heading. Here is the data... ASCII art warning ++--+-+---+ | forum_group_id | forum_group_name | forum_type_name | forum_type_id | ++--+-+---+ | 1 | Administration | Photography | 1 | | 1 | Administration | Site Issues | 3 | | 1 | Administration | Test| 4 | | 2 | General | Modelling | 2 | | 2 | General | foo |10 | | 2 | General | bar |11 | ++--+-+---+ The goal is to produce HTML tables like this.. ++ | Adninistration | ++ | Photography| ++ | Site Issues| ++ |Test| ++ ++ | General | ++ | Modelling | ++ | foo| ++ | Bar| ++ Kind regards kevin -- "Democracy is two wolves and a lamb voting on what to have for lunch. Liberty is a well-armed lamb contesting the vote." -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] results to html table
On Sun, 2007-08-12 at 08:07 +1000, Kevin Waterson wrote: > I wish to get a result set into a html table. > normally this is not a problem. > But I wish to use one of the results as a heading. > > Here is the data... ASCII art warning > ++--+-+---+ > | forum_group_id | forum_group_name | forum_type_name | forum_type_id | > ++--+-+---+ > | 1 | Administration | Photography | 1 | > | 1 | Administration | Site Issues | 3 | > | 1 | Administration | Test| 4 | > | 2 | General | Modelling | 2 | > | 2 | General | foo |10 | > | 2 | General | bar |11 | > ++--+-+---+ > The goal is to produce HTML tables like this.. > ++ > | Adninistration | > ++ > | Photography| > ++ > | Site Issues| > ++ > |Test| > ++ > ++ > | General | > ++ > | Modelling | > ++ > | foo| > ++ > | Bar| > ++ $types ) { echo '' .'' .'' .$forumName .'' .''; foreach( $types as $type ) { echo '' .'' .'' .$type['forum_type_name'] .'' .''; } echo ''; } ?> Cheers, Rob. -- ... SwarmBuy.com - http://www.swarmbuy.com Leveraging the buying power of the masses! ... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] convert (windows-1250) to (utf-8)
On 8/11/07, Alain Roger <[EMAIL PROTECTED]> wrote: > Hi, > > I import a csv file (which includes characters from "windows-1250" charset) > to postgreSQL database which is in UTF-8. > How can i convert windows-1250 to utf-8 charset ? > > thanks a lot, > > -- I personally never worked with different charsets, but this might help you: http://www.php.net/manual/en/function.mb-convert-encoding.php Tijnema -- Vote for PHP Color Coding in Gmail! -> http://gpcc.tijnema.info -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] manual vs. meta refresh
On Fri, August 10, 2007 6:51 pm, Geoff Nicol wrote: > That was my first thought as well but you will still have to use a > session > variable or cookie for the page following redirect to know it was a > meta-refresh. No. For the page following, you can use some other GET parameter, such as "was_meta_refresh_before" So long as you are not using the same GET parameter, you can bounce back and forth all day. -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] question about note on php.net
Michael Cooper wrote: Hello, I have a question--is the note from equazcion here correct? It is left unchallenged on the page but I can't see how it is correct since I am under the impression that the environment is refreshed each page load and the function or method definitions (including those for session_set_save_handler) would need to be re-established each page, not each session. I am having tremendous difficulty debugging some code I wrote and eliminating my uncertainty regarding this point would be greatly helpful. Any advice would be appreciated. Thanks! Because i'm already procrastinating ... google "site:php.net equazcion" http://www.php.net/session_set_save_handler wherein: equazcion 10-Mar-2007 02:44 I know this might be obvious, but session_set_save_handler() should only be called once per session, or else your saved data will keep getting reset. If your script doesn't have a predictable start page that will only be called only once per session, place the session_set_save_handler statement in an include file, and call it via require_once(). I doubt that this is correct. The save handler that is being set is not, in itself, a part of the session, but a function that is to be used to act upon the session. That is, there isn't anything inherent to the session in the function. Thus, it wouldn't be saved as *a part of* the session. It's just a handler. It's not as if the function, itself, were a container for the session vars. My $.02 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] convert (windows-1250) to (utf-8)
Alain Roger wrote: Hi, I import a csv file (which includes characters from "windows-1250" charset) to postgreSQL database which is in UTF-8. How can i convert windows-1250 to utf-8 charset ? Try the iconv functions: http://www.php.net/manual/en/function.iconv.php $out = iconv('ISO-8859-2', 'UTF-8', $in); This page may be of use, as well: http://en.wikipedia.org/wiki/Windows-1250 "Windows-1250 is *similar* to ISO-8859-2 ..." brian -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Running a server process
Thanks for the info guys. Sockets sound interesting. Will check the out more. I have played with sockets and flash before, but I will read up more. >From what you are saying I gather that 500 people with an open socket to the program is a lot different to 500 people spawning their own process. Thanks again, Nathan -Original Message- From: Richard Lynch [mailto:[EMAIL PROTECTED] Sent: Saturday, August 11, 2007 10:10 AM To: Nathan Wallis Cc: php-general@lists.php.net Subject: Re: [PHP] Running a server process On Fri, August 10, 2007 6:26 am, Nathan Wallis wrote: > I have a windows application the performs a certain task that I need > it to > perform. I am in the process of developing my site and am really > interested > in the functionality of the site at the moment and haven't set about > putting > the details in place, so I am using the php function > > exec ("start ... "); > > To run the process. > > It works. > > That is it works with just me using the site. I am wondering how this > would > effect performance if say 500 people were executing this php function > around > the same time and the processing overlapped. Don't wonder. Run ab (Apache Benchmark) and find out. Or use valgrind/callgrind to find out. Or use wget to find out. Or use that whack-a-mole benchmark or SuperSmack or whatever it is. > Is there anyway to make > an > executable run as a service, I am guessing at the terminology that I > should > use here, but I feel there would be a much more efficient way of > performing > this task. Any program can be run as a "service" (Un*x: daemon) Writing that program to do something useful and, more so, efficient, is a bit challenging. Here's a sample "talkback service" that just spits out whatever you put in: http://php.net/sockets -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- 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] manual vs. meta refresh
And if they do a manual refresh on the page you re-directed to, the "was_meta_refresh_before" flag will be set. How will you tell it from a meta-refresh redirect? You need to use a cookie or session id. Regardless, by reading the whole thread and 'cheating off the other students' this has been pretty beat to death. On 8/11/07, Richard Lynch <[EMAIL PROTECTED]> wrote: > > On Fri, August 10, 2007 6:51 pm, Geoff Nicol wrote: > > That was my first thought as well but you will still have to use a > > session > > variable or cookie for the page following redirect to know it was a > > meta-refresh. > > No. > > For the page following, you can use some other GET parameter, such as > "was_meta_refresh_before" > > So long as you are not using the same GET parameter, you can bounce > back and forth all day. > > -- > Some people have a "gift" link here. > Know what I want? > I want you to buy a CD from some indie artist. > http://cdbaby.com/browse/from/lynch > Yeah, I get a buck. So? > >
Re: [PHP] manual vs. meta refresh
On Sat, 2007-08-11 at 18:26 -0700, Geoff Nicol wrote: > And if they do a manual refresh on the page you re-directed to, the > "was_meta_refresh_before" flag will be set. > How will you tell it from a meta-refresh redirect? I already explained this in previous email. Go read the history of this thread. Cheers, Rob. -- ... SwarmBuy.com - http://www.swarmbuy.com Leveraging the buying power of the masses! ... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] manual vs. meta refresh
Rob, What you suggested, which matches the theory of what I and others suggested, would certainly work as an ID that changes is involved. If you read the specific posting by Richard Lynch, which is what I was replying to, you will note he suggest refreshing to a static 'was_meta_refresh_before' link which of course won't work as refreshing manually at that point will be indistinguishable from a true meta-refresh after the redirect has occurred. Anyways; this thread seems done, there are several solid suggestions on how to do it properly. I just didn't want it to close on an incomplete solution, as people apparently don't read the thread history ;) -Geoff On 8/11/07, Robert Cummings <[EMAIL PROTECTED]> wrote: > > On Sat, 2007-08-11 at 18:26 -0700, Geoff Nicol wrote: > > And if they do a manual refresh on the page you re-directed to, the > > "was_meta_refresh_before" flag will be set. > > How will you tell it from a meta-refresh redirect? > > I already explained this in previous email. Go read the history of this > thread. > > Cheers, > Rob. > -- > ... > SwarmBuy.com - http://www.swarmbuy.com > > Leveraging the buying power of the masses! > ... >
Re: [PHP] manual vs. meta refresh
On Sat, 2007-08-11 at 19:36 -0700, Geoff Nicol wrote: > Rob, > > What you suggested, which matches the theory of what I and others > suggested, would certainly work as an ID that changes is involved. > > If you read the specific posting by Richard Lynch, which is what I was > replying to, you will note he suggest refreshing to a static > 'was_meta_refresh_before' link which of course won't work as > refreshing manually at that point will be indistinguishable from a > true meta-refresh after the redirect has occurred. > > Anyways; this thread seems done, there are several solid suggestions > on how to do it properly. > > I just didn't want it to close on an incomplete solution, as people > apparently don't read the thread history ;) Ah ok, I see what you're saying. Yeah, Richard must have missed that you can't just redirect to a URL and all is well. Cheers, Rob. -- ... SwarmBuy.com - http://www.swarmbuy.com Leveraging the buying power of the masses! ... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] manual vs. meta refresh
You don't do it there. You do whatever it is you have to do in the URL before you re-direct. Though I guess if you want different output on that page, you would need to set something somewhere, be it session, database, or a cookie. On Sat, August 11, 2007 8:25 pm, Geoff Nicol wrote: > And if they do a manual refresh on the page you re-directed to, the > "was_meta_refresh_before" flag will be set. > How will you tell it from a meta-refresh redirect? > > You need to use a cookie or session id. Regardless, by reading the > whole > thread and 'cheating off the other students' this has been pretty beat > to > death. > > On 8/11/07, Richard Lynch <[EMAIL PROTECTED]> wrote: >> >> On Fri, August 10, 2007 6:51 pm, Geoff Nicol wrote: >> > That was my first thought as well but you will still have to use a >> > session >> > variable or cookie for the page following redirect to know it was >> a >> > meta-refresh. >> >> No. >> >> For the page following, you can use some other GET parameter, such >> as >> "was_meta_refresh_before" >> >> So long as you are not using the same GET parameter, you can bounce >> back and forth all day. >> >> -- >> Some people have a "gift" link here. >> Know what I want? >> I want you to buy a CD from some indie artist. >> http://cdbaby.com/browse/from/lynch >> Yeah, I get a buck. So? >> >> > -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] manual vs. meta refresh
On Sat, 2007-08-11 at 22:11 -0500, Richard Lynch wrote: > You don't do it there. > > You do whatever it is you have to do in the URL before you re-direct. > > Though I guess if you want different output on that page, you would > need to set something somewhere, be it session, database, or a cookie. I think you're missing the point Richard. Yes you can detect the meta redirect or manual refresh using your method. But only the first can be detected because when the page is served up to the browser again either the special meta redirect URL is active, non special normal URL is active, or a super special I'm redirecting but don't count me URL is active. Now what happens when the user does a manual refresh again? It's not about output, it's about detecting subsequent refreshes and determining again the source of the refresh. You must have some kind of session tracking system in place, be it a regular session or a database query that can check if an ID was already detected that indicates to discount the page load from any statistics. Cheers, Rob. -- ... SwarmBuy.com - http://www.swarmbuy.com Leveraging the buying power of the masses! ... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php