[PHP] mktime() vs date()
hi, is mktime() actually faster than date() or any other date functions? tnx. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Spell Checker
Hi We need to check the spelling of a word which is actually a Domain name. For example we have to check the word onlinetradeing. When checked with the spell checkers we are getting the words which are unrelated such as on, obliterating, incinerating, intruding etc. But exactly what we want was online trading. So we would like to have the word to be split into phrases and check the spelling too. The normal spell checkers are just checking the words in the dictionary but not splitting the word into phrases. Regards BH.VN.Viswanath
Re: [PHP] Spell Checker
BH.VN.Viswanath wrote: Hi We need to check the spelling of a word which is actually a Domain name. For example we have to check the word onlinetradeing. When checked with the spell checkers we are getting the words which are unrelated such as on, obliterating, incinerating, intruding etc. But exactly what we want was online trading. So we would like to have the word to be split into phrases and check the spelling too. The normal spell checkers are just checking the words in the dictionary but not splitting the word into phrases. by all means ask a question. oh btw, I doubt there are many tools out there capable fo smelling that you want a space between the 'e' and the 't' of onlinetradeing. Regards BH.VN.Viswanath -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] can i do this in one step
I am retrieving the vlaue from an associative arrray but do I need to do it in with two lines of code? The numerical value is stroed in the DB. $region_array = array('a' ='All of Scotland', 1 ='Aberdeen City Council', 2 ='Aberdeenshire Council', 3 ='AngusCouncil', 5 ='Argyll and Bute Council', 6 = 'Clackmannanshire Council', 9 ='Dumfries and Gallowalloway', 10 = 'Dundee City Council', 11 = 'East Ayrshire Council', 13 = 'East Dunbartonshire', 14 = 'East Lothian Council', 15 = 'East Renfrewshire Council', 16 ='Edinburgh City Council', 17 ='Falkirk Council', 18 ='Fife Council', 20 ='Highland Council', 21 ='Inverclyde Council', 22 ='Midlothian Council', 23 = 'Moray Council', 24 ='North Ayrshire Council', 25 ='North Lanarkshire Council', 26 ='Orkney Islands Council', 27 ='Perth Kinross Council', 28 = 'Renfrewshire Council',29 ='Scottish Borders Council', 30 = 'Shetland Isles Council', 31 ='South Ayrshire Council', 32 = 'South Lanarkshire Council', 33 = 'Stirling Council', 34 ='West Dunbartonshire', 35 = 'West Lothian Council', 8 = 'Comhairle nan Eilean'); $convert=$row['area']; $area= $region_array['$convert']; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Spell Checker
Possibly the Porter Stemming Algorithm could help you? Just an idea . . . Basically I'm thinking that in each string, you would break it down into a combination of root words and Prefixes and suffixes. Definitely some serious data crunching going on. Hope this helps. http://www.chuggnutt.com/stemmer.php (this just just one implementation of it) See this for the background theory and more info: http://en.wikipedia.org/wiki/Stemming_algorithm Dan -Original Message- From: Jochem Maas [mailto:[EMAIL PROTECTED] Sent: Tuesday, April 18, 2006 1:31 AM To: BH.VN.Viswanath Cc: php-general@lists.php.net Subject: Re: [PHP] Spell Checker BH.VN.Viswanath wrote: Hi We need to check the spelling of a word which is actually a Domain name. For example we have to check the word onlinetradeing. When checked with the spell checkers we are getting the words which are unrelated such as on, obliterating, incinerating, intruding etc. But exactly what we want was online trading. So we would like to have the word to be split into phrases and check the spelling too. The normal spell checkers are just checking the words in the dictionary but not splitting the word into phrases. by all means ask a question. oh btw, I doubt there are many tools out there capable fo smelling that you want a space between the 'e' and the 't' of onlinetradeing. Regards BH.VN.Viswanath -- 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] SQL result
I think you need mysql_fetch_assoc() or mysql_fetch_array(). You also can have a look into php's manual and simple find your functions... http://www.php.net/download-docs.php Andy Mohsen Pahlevanzadeh wrote: Dear all, I remember that i use a func that it return an array what it consist of result of my sql query. Please name me that. Yours,Mohsen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] can i do this in one step
Ross wrote: I am retrieving the vlaue from an associative arrray but do I need to do it in with two lines of code? The numerical value is stroed in the DB. $region_array = array('a' ='All of Scotland', 1 ='Aberdeen City Council', 2 ='Aberdeenshire Council', 3 ='AngusCouncil', 5 ='Argyll and Bute Council', 6 = 'Clackmannanshire Council', 9 ='Dumfries and Gallowalloway', 10 = 'Dundee City Council', 11 = 'East Ayrshire Council', 13 = 'East Dunbartonshire', 14 = 'East Lothian Council', 15 = 'East Renfrewshire Council', 16 ='Edinburgh City Council', 17 ='Falkirk Council', 18 ='Fife Council', 20 ='Highland Council', 21 ='Inverclyde Council', 22 ='Midlothian Council', 23 = 'Moray Council', 24 ='North Ayrshire Council', 25 ='North Lanarkshire Council', 26 ='Orkney Islands Council', 27 ='Perth Kinross Council', 28 = 'Renfrewshire Council',29 ='Scottish Borders Council', 30 = 'Shetland Isles Council', 31 ='South Ayrshire Council', 32 = 'South Lanarkshire Council', 33 = 'Stirling Council', 34 ='West Dunbartonshire', 35 = 'West Lothian Council', 8 = 'Comhairle nan Eilean'); $convert=$row['area']; $area= $region_array['$convert']; $area = $region_array[ $row['area'] ]; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] what functionality does CGI miss in relation to apache module SAPI?
hi Guys/Girls, does anyone have a concise list of the functionality missing from the CGI SAPI in comparison to the the Apache module (including any functional differences)? as far as I can tell CGI doesn't give me anything extra in terms of functionality but the precise differences elude me (STFW didn't turn up any difinitive info - that might a be monday morning issue, combined with a lack of coffee) (I'm not interested in any security pro/cons atm) thanks regards, Jochem -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Spell Checker
Hi, Can you please mention those tools ? I am unaware of any tool of that kind Regards BH.VN.Viswanath -Original Message- From: Jochem Maas [mailto:[EMAIL PROTECTED] Sent: Tuesday, April 18, 2006 1:01 PM To: BH.VN.Viswanath Cc: php-general@lists.php.net Subject: Re: [PHP] Spell Checker BH.VN.Viswanath wrote: Hi We need to check the spelling of a word which is actually a Domain name. For example we have to check the word onlinetradeing. When checked with the spell checkers we are getting the words which are unrelated such as on, obliterating, incinerating, intruding etc. But exactly what we want was online trading. So we would like to have the word to be split into phrases and check the spelling too. The normal spell checkers are just checking the words in the dictionary but not splitting the word into phrases. by all means ask a question. oh btw, I doubt there are many tools out there capable fo smelling that you want a space between the 'e' and the 't' of onlinetradeing. Regards BH.VN.Viswanath -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Spell Checker
BH.VN.Viswanath wrote: Hi, Can you please mention those tools ? I am unaware of any tool of that kind I said 'I doubt there are many tools ...' which strongly suggests that I don't know off the top of my head any tools/software that will allow someone with absolutely no knowledge of dictionary/spelling algorithm 'magic'/etc to go about implementing a routine that will automatically split a string of characters into two or more strings at exactly the point you it to be split unless that routine involves _you_ doing it manually at a keyboard. software doesn't generally do well at either mind-reading or smelling. maybe google will launch GoogleSmell[tm] soon - in the mean time try their search engines (anyones search engine for that matter - Yahoo! is another good one to get you going) ... or do you expect me to do the searching for you? (like some of your country-men have seemed to in the past) Regards BH.VN.Viswanath -Original Message- From: Jochem Maas [mailto:[EMAIL PROTECTED] Sent: Tuesday, April 18, 2006 1:01 PM To: BH.VN.Viswanath Cc: php-general@lists.php.net Subject: Re: [PHP] Spell Checker BH.VN.Viswanath wrote: Hi We need to check the spelling of a word which is actually a Domain name. For example we have to check the word onlinetradeing. When checked with the spell checkers we are getting the words which are unrelated such as on, obliterating, incinerating, intruding etc. But exactly what we want was online trading. So we would like to have the word to be split into phrases and check the spelling too. The normal spell checkers are just checking the words in the dictionary but not splitting the word into phrases. by all means ask a question. oh btw, I doubt there are many tools out there capable fo smelling that you want a space between the 'e' and the 't' of onlinetradeing. Regards BH.VN.Viswanath -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Spell Checker
BH.VN.Viswanath wrote: Hi I just asked you because I m unaware of those things. All wont be the same.. better stop blaming and criticizing and work on the things. And My country the critique is justified because you _just_ asked - you didn't (seemlingly) make any effort to even do a 5 second search for anything related to what you want to achieve. and there was no blame placed anywhere, btw. people don't criticize like U. I serously doubt that of the 800million+ people currently living in in the Indian subcontinent none of them have ever critizised anything. as an example: the guy that owned this blog, http://mediaah.blogspot.com/, obviously critizised something or somebody (given that he was server a take down notice). UR country people do such things. which country might that be then? :-P Thanks for your help -Original Message- From: Jochem Maas [mailto:[EMAIL PROTECTED] Sent: Tuesday, April 18, 2006 2:43 PM To: BH.VN.Viswanath Cc: php-general@lists.php.net Subject: Re: [PHP] Spell Checker BH.VN.Viswanath wrote: Hi, Can you please mention those tools ? I am unaware of any tool of that kind I said 'I doubt there are many tools ...' which strongly suggests that I don't know off the top of my head any tools/software that will allow someone with absolutely no knowledge of dictionary/spelling algorithm 'magic'/etc to go about implementing a routine that will automatically split a string of characters into two or more strings at exactly the point you it to be split unless that routine involves _you_ doing it manually at a keyboard. software doesn't generally do well at either mind-reading or smelling. maybe google will launch GoogleSmell[tm] soon - in the mean time try their search engines (anyones search engine for that matter - Yahoo! is another good one to get you going) ... or do you expect me to do the searching for you? (like some of your country-men have seemed to in the past) Regards BH.VN.Viswanath -Original Message- From: Jochem Maas [mailto:[EMAIL PROTECTED] Sent: Tuesday, April 18, 2006 1:01 PM To: BH.VN.Viswanath Cc: php-general@lists.php.net Subject: Re: [PHP] Spell Checker BH.VN.Viswanath wrote: Hi We need to check the spelling of a word which is actually a Domain name. For example we have to check the word onlinetradeing. When checked with the spell checkers we are getting the words which are unrelated such as on, obliterating, incinerating, intruding etc. But exactly what we want was online trading. So we would like to have the word to be split into phrases and check the spelling too. The normal spell checkers are just checking the words in the dictionary but not splitting the word into phrases. by all means ask a question. oh btw, I doubt there are many tools out there capable fo smelling that you want a space between the 'e' and the 't' of onlinetradeing. Regards BH.VN.Viswanath -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Forking a search - pcntl
I'm creating a search function as part of our webmail frontend, however I'm having big problems with timeout etc. What we'd like to do is run the actual search query in the background (i.e. fork) while the viewable page shows a nice scrollie banner etc! Due to various problems with the server we are using (Zeus) we can't just run an exec(). I've had a look around, and it would seem that pcntl maybe the way forward. Does anyone have an example working script, or indeed a decent tutorial on how to use the functionality? The php manual has limited information on using the functions, and I just can't get my head around how it's meant to work?!!! Cheers Nunners
Re: [PHP] Forking a search - pcntl
James Nunnerley wrote: I'm creating a search function as part of our webmail frontend, however I'm having big problems with timeout etc. What we'd like to do is run the actual search query in the background (i.e. fork) while the viewable page shows a nice scrollie banner etc! Due to various problems with the server we are using (Zeus) we can't just run an exec(). I've had a look around, and it would seem that pcntl maybe the way forward. Does anyone have an example working script, or indeed a decent tutorial on how to use the functionality? The php manual has limited information on using the functions, and I just can't get my head around how it's meant to work?!!! IMHO forking in response to a web request is a very very very bad idea(tm). I had a similar problem a while back. I solved it by having a CLI process that watches a search queue table in the DB. When it sees an entry it kicks off another script to do the actual search. Meanwhile the frontend is using AJAX to display a progress bar using a percentage written to the search queue record by the searching process. Works very well for that site, although it has to be said it is not a particularly busy site so scalability has never been tested. Using this method it's possible to restrict each session to a single search if needed since you can set a cancel flag in the search queue record which gets checked by the searching process. This particular site ties each search to the php session id. HTH. -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] creating a SELECT AND query
I have a textboxt which searches for the surname of a client. A SELECTBOX searches for the area. I am trying to generate a query that searches all of scotland (when area=a) and by area (say I live in area 16= edinburgh) and combine this with the name search select name=area class=text id=area option value=aAll of Scotland/option option value='1'Aberdeen City Counci.../option option value='16'Edinburgh City Counc.../option option value='17'Falkirk Council/option option value='18'Fife Council/option option value='19'Glasgow City Council/option option value='20'Highland Council/option option value='21'Inverclyde Council/option option value='22'Midlothian Council/option option value='23'Moray Council/option /select This is what I thought would work.. $query1= select * from $table_name WHERE sname LIKE '$search_string%' ; if ($area=a) { $query1 .= AND area='a'; } else { $query1 .=AND area='$area'; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] mktime() vs date()
[snip] hi, is mktime() actually faster than date() or any other date functions? [/snip] This sounds like the perfect opportunity for you to write a test and return the results. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] creating a SELECT AND query
On 18/04/06, Ross [EMAIL PROTECTED] wrote: $query1= select * from $table_name WHERE sname LIKE '$search_string%' ; if ($area=a) { $query1 .= AND area='a'; } else { $query1 .=AND area='$area'; } Firstly, you're assigning a to area rather than testing whether $area is a. You need a == operator, not a =. Secondly, even if you were testing $area properly, you're doing the same thing in both halves of the if-statement. Which isn't very useful. Really, you only need the AND area='?' part if $area is not equal to a: if ($area != a) { $query1 .= AND area='$area'; } -robin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Spell Checker
At 12:42 PM +0530 4/18/06, BH.VN.Viswanath wrote: Hi We need to check the spelling of a word which is actually a Domain name. For example we have to check the word onlinetradeing. When checked with the spell checkers we are getting the words which are unrelated such as on, obliterating, incinerating, intruding etc. But exactly what we want was online trading. So we would like to have the word to be split into phrases and check the spelling too. The normal spell checkers are just checking the words in the dictionary but not splitting the word into phrases. When your post was checked, I found words that were absent, such as: Google, Google search, and any attempt at finding a solution besides posting this nonsense to a php list. Your question is as shallow as the solution you seek is complex -- try thinking about it for a while. tedd -- http://sperling.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Table formation...
that said how often do you _really_ need a 1 or a 0, Surprisingly enough, I need it quite often. Enough so that I keep an example nearby. I'm assuming that the 1 or 0 are used to detemine an on/off state. is my assumption correct? Mostly even/odd, this/that, right/left, on/off, up/down, se/nw sort of things. :-) if so then take another good look at the way php autocasts variables, for instance tyr running this: $zero = 0; $one = 1; var_dump( (false == $zero), (true == $one), ((bool)$zero), ($zero 1), ((bool)($zero 1)), ((bool)$one), ($one 1), ((bool)($one 1)) ); That's very interesting, but being dyslexic, it's beyond me -- it looks like Halloween (lot's of boo's). That's one of the reasons why I don't use IF ELSE/IF -- I simply can't follow it. But I can always find a way around it's use. Thanks for the code. tedd -- http://sperling.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Forking a search - pcntl
On 4/18/06, Stut [EMAIL PROTECTED] wrote: James Nunnerley wrote: I'm creating a search function as part of our webmail frontend, however I'm having big problems with timeout etc. What we'd like to do is run the actual search query in the background (i.e. fork) while the viewable page shows a nice scrollie banner etc! Due to various problems with the server we are using (Zeus) we can't just run an exec(). I've had a look around, and it would seem that pcntl maybe the way forward. Does anyone have an example working script, or indeed a decent tutorial on how to use the functionality? The php manual has limited information on using the functions, and I just can't get my head around how it's meant to work?!!! IMHO forking in response to a web request is a very very very bad idea(tm). On top of that advice, see the big notice on the php manual page: http://www.php.net/pcntl Process Control should not be enabled within a webserver environment and unexpected results may happen if any Process Control functions are used within a webserver environment. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Last one for today! Pager problem
[snip] My pager does everything but when I hit any of the links for the pages it doesn't show any results. It can be seen here (alothough the page doesn't seen to submit on the remote host. Any ideas why?? [/snip] I think it might be coder error, but that's just me. Anyone else? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Spell Checker
BH.VN.Viswanath wrote: We need to check the spelling of a word which is actually a Domain name. For example we have to check the word onlinetradeing. When checked with the spell checkers we are getting the words which are unrelated such as on, obliterating, incinerating, intruding etc. But exactly what we want was online trading. So we would like to have the word to be split into phrases and check the spelling too. The normal spell checkers are just checking the words in the dictionary but not splitting the word into phrases. Ok, this is gonna show how bored I've been today, maybe I need to find a more interesting job!! http://dev.stut.net/words/ There's a link there to the source of the guts. Hope it helps you. -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Last one for today! Pager problem
The page works fine on my localhost the only problem is the first page of the pager is the only one I can see before it resets. On the remote host the area should automatically be set to a with the line. if(!isset($_POST['area'])){ $_POST['area']='a'; $area = $_POST['area'];} but it does not work. This may shed some light on it! regards, Ross - Original Message - From: Jay Blanchard [EMAIL PROTECTED] To: Ross [EMAIL PROTECTED]; php-general@lists.php.net Sent: Tuesday, April 18, 2006 3:53 PM Subject: RE: [PHP] Last one for today! Pager problem [snip] My pager does everything but when I hit any of the links for the pages it doesn't show any results. It can be seen here (alothough the page doesn't seen to submit on the remote host. Any ideas why?? [/snip] I think it might be coder error, but that's just me. Anyone else? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Spell Checker
Stut wrote: BH.VN.Viswanath wrote: We need to check the spelling of a word which is actually a Domain name. For example we have to check the word onlinetradeing. When checked with the spell checkers we are getting the words which are unrelated such as on, obliterating, incinerating, intruding etc. But exactly what we want was online trading. So we would like to have the word to be split into phrases and check the spelling too. The normal spell checkers are just checking the words in the dictionary but not splitting the word into phrases. Ok, this is gonna show how bored I've been today, maybe I need to find a more interesting job!! http://dev.stut.net/words/ There's a link there to the source of the guts. Hope it helps you. -Stut lol. Awesome =) -- Smileys rule (cX.x)C --o(^_^o) Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Pushing Vars into $_SESSION
Afternoon Was wondering if there is an easier way to get returned variables into the $_SESSION rather than going through each one?? eg $link_id = mysql_connect($dbhost, $dbuser, $dbpass) or die(Connection to $dbhost failed on verification section); mysql_select_db($logindb, $link_id) or die(Selection of database failed on verification section); $query = SELECT * FROM blah where blah = 'blah'; $result = mysql_query($query) or die (Query failed: . mysql_error()); while ($line = mysql_fetch_object($result, MYSQL_ASSOC)) { $id = $line-id; $firstname = $line-firstname; $surname = $line-surname; $email = $line-email; } mysql_close($link_id); $_SESSION[id] = $id; $_SESSION[firstname] = $firstname; $_SESSION[surname] = $surname; $_SESSION[email] = $email; Any help here is appreciated Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Last one for today! Pager problem
At 9:53 AM -0500 4/18/06, Jay Blanchard wrote: [snip] My pager does everything but when I hit any of the links for the pages it doesn't show any results. It can be seen here (alothough the page doesn't seen to submit on the remote host. Any ideas why?? [/snip] I think it might be coder error, but that's just me. Anyone else? Hmmm considering that his pager does everything, maybe he should have it wrote the code. Anyone else? tedd -- http://sperling.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Last one for today! Pager problem
what does this mean? when I said 'everything else' I meant it calcualted the number of results/pages and displays the first page but then wipes the results when I click on any of the other links (page2 | page3 etc.) Ross - Original Message - From: tedd [EMAIL PROTECTED] To: Jay Blanchard [EMAIL PROTECTED]; Ross [EMAIL PROTECTED]; php-general@lists.php.net Sent: Tuesday, April 18, 2006 4:10 PM Subject: RE: [PHP] Last one for today! Pager problem At 9:53 AM -0500 4/18/06, Jay Blanchard wrote: [snip] My pager does everything but when I hit any of the links for the pages it doesn't show any results. It can be seen here (alothough the page doesn't seen to submit on the remote host. Any ideas why?? [/snip] I think it might be coder error, but that's just me. Anyone else? Hmmm considering that his pager does everything, maybe he should have it wrote the code. Anyone else? tedd -- http://sperling.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Last one for today! Pager problem
tedd wrote: At 9:53 AM -0500 4/18/06, Jay Blanchard wrote: [snip] My pager does everything but when I hit any of the links for the pages it doesn't show any results. It can be seen here (alothough the page doesn't seen to submit on the remote host. Any ideas why?? [/snip] I think it might be coder error, but that's just me. Anyone else? Hmmm considering that his pager does everything, maybe he should have it wrote the code. Anyone else? tedd OWZIE WOWZIE! TOO MUCHY CODY! EYEZ HURTY! OWZIE WOWZIE! -- Smileys rule (cX.x)C --o(^_^o) Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] sprintf() oddity
What's going on here: $number = 50.1234567890; echo sprintf( '%.05f', $number ); result: 50.12346 $number = 5.1234567890; echo sprintf( '%.05f', $number ); result: 5.12305 $number = 5000.1234567890; echo sprintf( '%.05f', $number ); result: 5000.0 Why isn't it formatting the decimals properly? And apparently losing some? Running PHP 4.3.11 on Windows Server 2003 box. thnx, Chris
[PHP] Re: sprintf() oddity
Chris Boget wrote: What's going on here: $number = 50.1234567890; echo sprintf( '%.05f', $number ); result: 50.12346 $number = 5.1234567890; echo sprintf( '%.05f', $number ); result: 5.12305 $number = 5000.1234567890; echo sprintf( '%.05f', $number ); result: 5000.0 Why isn't it formatting the decimals properly? And apparently losing some? Running PHP 4.3.11 on Windows Server 2003 box. thnx, Chris Because you can either work with large Numbers before point or after. both doesn't work. And on top of that, PHP works intern with double typed vars. That's causing the problem here. probably round() and number_format() will have better outcomes. Test that :) -- Smileys rule (cX.x)C --o(^_^o) Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Pushing Vars into $_SESSION
On 18/04/06, Chris Grigor [EMAIL PROTECTED] wrote: Was wondering if there is an easier way to get returned variables into the $_SESSION rather than going through each one?? First of all, why are you using mysql_fetch_object and then passing in MYSQL_ASSOC? You should be using $line = mysql_fetch_array($result) instead. If you get the row data as an associative array, you can then simply do: foreach ( $line as $key = $value ) { $_SESSION[$key] = $value; } That way, whatever columns you select from the database will automatically be loaded into session variables, so if you change the SQL, you'll also change the sessions. I think this is what you're asking for, apologies if I'm misinterpreted the question. Paul -- Data Circle http://datacircle.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Pushing PHP Into The Web 2.0 Generation
I've written a short paper on the future of PHP and I'd appreciate it if you folks would take a look at it and exchange your thoughts with me. http://www.maraby.com/papers/pushing_php_into_the_web_20_generation Don't be too skeptical. ;) Cheers! M.T. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Pushing PHP Into The Web 2.0 Generation
[snip] I've written a short paper on the future of PHP and I'd appreciate it if you folks would take a look at it and exchange your thoughts with me. http://www.maraby.com/papers/pushing_php_into_the_web_20_generation Don't be too skeptical. ;) [/snip] Web 2.0 Hype alert. There is no such thing, just as there are no standards for web development. I'll read it when I have more time. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] sprintf() oddity
You are going beyond the number of significant digits PHP can handle so it is truncating beyond that. In the second case it look sstrange, the 12305 ending, but it is probably a 'round' number if you put it in binary, but it turns funny when converted to decimal. In the last example, the precision does not even reach the decimal part. - Original Message - From: Chris Boget [EMAIL PROTECTED] To: php-general@lists.php.net Sent: Tuesday, April 18, 2006 5:19 PM Subject: [PHP] sprintf() oddity What's going on here: $number = 50.1234567890; echo sprintf( '%.05f', $number ); result: 50.12346 $number = 5.1234567890; echo sprintf( '%.05f', $number ); result: 5.12305 $number = 5000.1234567890; echo sprintf( '%.05f', $number ); result: 5000.0 Why isn't it formatting the decimals properly? And apparently losing some? Running PHP 4.3.11 on Windows Server 2003 box. thnx, Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Pushing PHP Into The Web 2.0 Generation
[snip] I've written a short paper on the future of PHP and I'd appreciate it if you folks would take a look at it and exchange your thoughts with me. http://www.maraby.com/papers/pushing_php_into_the_web_20_generation Don't be too skeptical. ;) [/snip] I have now taken the time to read it and I am sorry that I did. It was five minutes of drivel not remotely related to PHP other than to say that PHP may not be Web 2.0 (which is OK because Web 2.0 is a hype term) because the language constructs aren't friendly enough. I suggest that the author spend some time programming C++ and then rewrite his paper. It is nothing personal, just a review of a poorly written article. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Pushing PHP Into The Web 2.0 Generation
Jay Blanchard wrote: [snip] I've written a short paper on the future of PHP and I'd appreciate it if you folks would take a look at it and exchange your thoughts with me. http://www.maraby.com/papers/pushing_php_into_the_web_20_generation Don't be too skeptical. ;) [/snip] Web 2.0 Hype alert. There is no such thing, just as there are no standards for web development. I'll read it when I have more time. save yourself the time Jay. it's alot of hot air topped off with some madness about everything must be an object, he already posted to php-internals - it got shot down there too. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Spell Checker
Stut wrote: BH.VN.Viswanath wrote: We need to check the spelling of a word which is actually a Domain name. For example we have to check the word onlinetradeing. When checked with the spell checkers we are getting the words which are unrelated such as on, obliterating, incinerating, intruding etc. But exactly what we want was online trading. So we would like to have the word to be split into phrases and check the spelling too. The normal spell checkers are just checking the words in the dictionary but not splitting the word into phrases. Ok, this is gonna show how bored I've been today, maybe I need to find a more interesting job!! http://dev.stut.net/words/ There's a link there to the source of the guts. Hope it helps you. nice :-) -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Pushing PHP Into The Web 2.0 Generation
Jay Blanchard wrote: [snip] I've written a short paper on the future of PHP and I'd appreciate it if you folks would take a look at it and exchange your thoughts with me. http://www.maraby.com/papers/pushing_php_into_the_web_20_generation Don't be too skeptical. ;) [/snip] I have now taken the time to read it and I am sorry that I did. It was five minutes of drivel not remotely related to PHP other than to say that PHP may not be Web 2.0 (which is OK because Web 2.0 is a hype term) because the language constructs aren't friendly enough. I suggest that the author spend some time programming C++ and then rewrite his paper. I did tell you not to bother ;-) It is nothing personal, just a review of a poorly written article. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Spell Checker
Stut wrote: Ok, this is gonna show how bored I've been today, maybe I need to find a more interesting job!! http://dev.stut.net/words/ There's a link there to the source of the guts. Hope it helps you. Still bored!! It can now order the results by average word length which pushes the less likely results to the end. *Twiddles thumbs* -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Pushing PHP Into The Web 2.0 Generation
That paper does not have any substance in the same way that Web 2.0 does not have any substance. Web 2.0 is just a marketing ploy, a buzzword for the gullible. As far as I can see there is very little material difference between Web 1.0 and Web 2.0, certainly not as much difference a desktop application and a web application, or the difference between a flat file system and a relational database. If you cannot point out something which is materially different with this mythical Web 2.0 then you are wasting your time. -- Tony Marston http://www.tonymarston.net http://www.radicore.org James Crane [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I've written a short paper on the future of PHP and I'd appreciate it if you folks would take a look at it and exchange your thoughts with me. http://www.maraby.com/papers/pushing_php_into_the_web_20_generation Don't be too skeptical. ;) Cheers! M.T. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Pushing PHP Into The Web 2.0 Generation
[snip] .. [/snip] And his mailing list name is James Crane, he signs of as M.T. which stands for Matt Todd. I call shenanigans. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Pushing PHP Into The Web 2.0 Generation
On Tuesday 18 April 2006 10:50 am, Jay Blanchard wrote: [snip] .. [/snip] And his mailing list name is James Crane, he signs of as M.T. which stands for Matt Todd. I call shenanigans. My nominee for best analogy from the article: Much like the artists and writers of the early twentieth century when they realized that the weapons and machines were dehumanizing war, making it far too easy to kill, web designers and developers realized that there was a need for a social, human revolution within the sterile, synthetic arena of the web. Hence, the Web 2.0 Movement was born. Web development and war in the same sentence. Killer! -- Joe Henry www.celebrityaccess.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Pushing PHP Into The Web 2.0 Generation
Just what I needed today, another guy trying to find solutions when he doesn't even comprehend what the real problem is. A complete waste of my time. James Crane wrote: I've written a short paper on the future of PHP and I'd appreciate it if you folks would take a look at it and exchange your thoughts with me. http://www.maraby.com/papers/pushing_php_into_the_web_20_generation Don't be too skeptical. ;) Cheers! M.T. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php 3 to 5 upgrade: foreach loop no longer working
I've recently upgraded a server from Fedora Core 3 to Core 5 in the process php had been upgraded from either 3 or 4 to php 5. In doing so I had to do a major overhaul of a web site as many things stopped working (.i.e $HTTP_POST_VAR, etc). Haven't gotten through most of that I know have a problem with a page that is being submitted to another page which contains different values for checkboxes. I would pull the values from each checkbox using a foreach loop as such: foreach ($checkbox as $value) { echo Value: $valuebr /\n; } however the value is no longer being echoed to the page. What am I missing here? This is the code that is being submitted, $num being an incremented value: input name=checkbox[?php echo $num; ?] type=checkbox id=checkbox[?php echo $num; ?] value=?php echo $row_rsADS['customers_id']; ? / Thanks in advance -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php 3 to 5 upgrade: foreach loop no longer working
Vernon Webb wrote: I've recently upgraded a server from Fedora Core 3 to Core 5 in the process php had been upgraded from either 3 or 4 to php 5. In doing so I had to do a major overhaul of a web site as many things stopped working (.i.e $HTTP_POST_VAR, etc). Haven't gotten through most of that I know have a problem with a page that is being submitted to another page which contains different values for checkboxes. I would pull the values from each checkbox using a foreach loop as such: foreach ($checkbox as $value) { echo Value: $valuebr /\n; } however the value is no longer being echoed to the page. What am I missing here? This is the code that is being submitted, $num being an incremented value: input name=checkbox[?php echo $num; ?] type=checkbox id=checkbox[?php echo $num; ?] value=?php echo $row_rsADS['customers_id']; ? / Thanks in advance Register Globals? -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] php 3 to 5 upgrade: foreach loop no longer working
[snip] foreach ($checkbox as $value) { echo Value: $valuebr /\n; } however the value is no longer being echoed to the page. What am I missing here? This is the code that is being submitted, $num being an incremented value: input name=checkbox[?php echo $num; ?] type=checkbox id=checkbox[?php echo $num; ?] value=?php echo $row_rsADS['customers_id']; ? / [/snip] Is the checkbox 'checked'? If not it returns no value. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php 3 to 5 upgrade: foreach loop no longer working
Register Globals? You got it. Is there any advantage to having this turned off? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php 3 to 5 upgrade: foreach loop no longer working
Vernon Webb wrote: Register Globals? You got it. Is there any advantage to having this turned off? One or two http://us2.php.net/register_globals -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php 3 to 5 upgrade: foreach loop no longer working
Vernon Webb wrote: Register Globals? You got it. Is there any advantage to having this turned off? It's a major security hole if left on ;) And convincing people to plug that hole was not happening, so something more major was needed. As I understand it - PHP6 will not even have the option to enable it at all :) -- Lester Caine - G8HFL - L.S.Caine Electronic Services Treasurer - Firebird Foundation Inc. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] php 3 to 5 upgrade: foreach loop no longer working
It's a major security hole if left on ;) And convincing people to plug that hole was not happening, so something more major was needed. Only if the programmer uses it. As I understand it, register_globals being on doesn't present a security risk in and of itself as long as the programmer is not relying on its functionality. JM -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Pushing PHP Into The Web 2.0 Generation
This one time, at band camp, James Crane [EMAIL PROTECTED] wrote: http://www.maraby.com/papers/pushing_php_into_the_web_20_generation random rantings, lacks depth. 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
[PHP] uml tool for php
is there a suggested tool that can create uml diagrams for php 5 objects (ie import in a file and create a diagram)? -jonathan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] uml tool for php
[snip] is there a suggested tool that can create uml diagrams for php 5 objects (ie import in a file and create a diagram)? [/snip] http://uml.sourceforge.net/index.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php 3 to 5 upgrade: foreach loop no longer working
Lester Caine wrote: Vernon Webb wrote: Register Globals? You got it. Is there any advantage to having this turned off? It's a major security hole if left on ;) it's a major _potential_ security hole. proper initialized of all [global] variables (and santization of incoming data) means an application running under register_globals can be as safe as one running without. the reality of course is that there are millions of security issues out there due to the problem of global variables not being initialized ... :-P And convincing people to plug that hole was not happening, so something more major was needed. As I understand it - PHP6 will not even have the option to enable it at all :) correct - setting register_globals in php6 will cause an error. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Pushing PHP Into The Web 2.0 Generation
Jay Blanchard wrote: [snip] .. [/snip] And his mailing list name is James Crane, he signs of as M.T. which stands for Matt Todd. I call shenanigans. the article is also under the name of Matt Todd, didn't catch that first time round - very odd - if this was some kind of prank then first mailing internals (also under the name James Crane) has a really high ***hole factor. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] HTTP_REFERER with javascript: document.location
Does anyone know how to resolve my problem I tried to get the referer url with $_SERVER['HTTP_REFERER'] but returns blank when I use javascript: document.location='...' from the previous page. Thank you. Yudie -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] sprintf() oddity
On Tue, April 18, 2006 10:19 am, Chris Boget wrote: What's going on here: $number = 50.1234567890; echo sprintf( '%.05f', $number ); result: 50.12346 $number = 5.1234567890; echo sprintf( '%.05f', $number ); result: 5.12305 $number = 5000.1234567890; echo sprintf( '%.05f', $number ); result: 5000.0 Why isn't it formatting the decimals properly? And apparently losing some? Running PHP 4.3.11 on Windows Server 2003 box. PHP stores float/decimal numbers internally in 4-byte (32-bit) values using standard C float libraries. Rounding things off is guaranteed to produce results like this. Though the one that ends in .12305 is a bit odd... Still, if you NEED any sort of verifiable accuracy or especially large scale, you'll have to use a custom library that deals with decimal numbers as strings and allows you to choose arbitrary precision. You'll sacrifice speed, of course. And RAM. How much you sacrifice depends on how much accuracy you need, to some degree, but it's also just inherently slower and more resource-intensive to do all the calculations as strings. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Pushing PHP Into The Web 2.0 Generation
On Tue, April 18, 2006 10:37 am, James Crane wrote: I've written a short paper on the future of PHP and I'd appreciate it if you folks would take a look at it and exchange your thoughts with me. http://www.maraby.com/papers/pushing_php_into_the_web_20_generation That's 5 minutes I'll never get back... My thoughts are: There was no redeeming value to me whatsoever in this paper. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTTP_REFERER with javascript: document.location
On Tue, April 18, 2006 12:49 pm, Yudie wrote: Does anyone know how to resolve my problem I tried to get the referer url with $_SERVER['HTTP_REFERER'] but returns blank when I use javascript: document.location='...' from the previous page. Don't do that. :-) More specifically, no browser is required to provide HTTP_REFERER, so that value is completely un-reliable. If, for some reason, your application NEEDS the preceding page, you'll need to track it in the URL, or in their session, or through some mechanism that YOU control. Rule #1: Never, ever, ever, trust the browser. Or the guy/gal/bot using it, for that matter. Hope that helps, even if it's *so* not what you wanted to hear. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Pushing PHP Into The Web 2.0 Generation
[snip] the article is also under the name of Matt Todd, didn't catch that first time round - very odd - if this was some kind of prank then first mailing internals (also under the name James Crane) has a really high ***hole factor. [/snip] I found the kid's actual e-mail addressanyone interested? He is a college student in Atlanta Georgia, don't know if James Crane is one of his alias' though. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] pause until page is loaded
I created a script to redirect to a download auto. but it redirects before the Whole page is loaded. How do I pause until page is loaded? Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Pushing Vars into $_SESSION
On Tue, April 18, 2006 10:05 am, Chris Grigor wrote: Was wondering if there is an easier way to get returned variables into the $_SESSION rather than going through each one?? eg $link_id = mysql_connect($dbhost, $dbuser, $dbpass) or die(Connection to $dbhost failed on verification section); mysql_select_db($logindb, $link_id) or die(Selection of database failed on verification section); $query = SELECT * FROM blah where blah = 'blah'; $result = mysql_query($query) or die (Query failed: . mysql_error()); while ($line = mysql_fetch_object($result, MYSQL_ASSOC)) { $id = $line-id; $firstname = $line-firstname; $surname = $line-surname; $email = $line-email; } mysql_close($link_id); $_SESSION[id] = $id; $_SESSION[firstname] = $firstname; $_SESSION[surname] = $surname; $_SESSION[email] = $email; foreach($line as $key = $value) $_SESSION[$key] = $value; But this will do EVERY thing in $line, which may not be what you really want. And it brings up some big questions: How much do you TRUST your data in the database? Cuz if you are just going to blindly cram it into $_SESSION, it should really be data you TRUST. Why do this? Is it really going to help you to have the data stored in TWO places? What happens when the database changes from another source, and the $_SESSION copy is out-dated? What about the other way around, when another part of your application use $_SESSION['email'] for something else, or, worse, you hit this code again and get some other $id / record in there, but your application has a bug where it thinks you still have the previous $id / record in the $_SESSION I predict that if you really think about what you are doing, you won't want to do this. There are simply too many pitfalls for this to be a Good Idea 99.9% of the time. Maybe you've got that 0.01% situation on your hands, though... -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] pause until page is loaded
[snip] I created a script to redirect to a download auto. but it redirects before the Whole page is loaded. How do I pause until page is loaded? [/snip] Page loading is client-side, but you can delay the redirect using sleep(). -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] pause until page is loaded
I tried it but it still stops half way through the page and then continues. On Apr 18, 2006, at 5:24 PM, Jay Blanchard wrote: [snip] I created a script to redirect to a download auto. but it redirects before the Whole page is loaded. How do I pause until page is loaded? [/snip] Page loading is client-side, but you can delay the redirect using sleep(). -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Last one for today! Pager problem
On Tue, April 18, 2006 9:46 am, Ross wrote: http://scottishsocialnetworks.org/editor.phps My pager does everything but when I hit any of the links for the pages it doesn't show any results. It can be seen here (alothough the page doesn't seen to submit on the remote host. Any ideas why?? This is bad: if(!isset($_GET['page'])){ $_GET['page']=1; $page = $_GET['page'];} //$page = $_GET['page']; You need something like this: if (!isset($_GET['page'])) $page = 1; else $page = $_GET['page']; As it stands now, you only set $page if $_GET['page'] is not set. So you either have: No $_GET['page'] = $page = 1 $_GET['page'] = ANYTHING = $page is not set, so it's just 0. You do that same mistake at the top with all the $_POST stuff. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP6 just became my worst nightmare.
RANT type=long, lingering, desperate apparently calling a dynamic function using static syntax will cause an E_FATAL. well f***ing great. so the foundation of the Object-Database mapping code I have been writing/developing since php5 was in beta [you won't believe how many segfaults I worked through - together with Ard B. (author of the ibase extension and fixer/finder of numerous killer bugs in php5)] in now dead-man-walking because both the DB class and the base class that drives the Object--Database mapping rely on the ability to call certain methods statically and dynamically - the code is carefully crafted to avoid any problems this might entail. refactoring is possible but the speed of the code will suffer _greatly_ because of the requirement that I must now create _hordes_ of objects just to call these certain methods (only to be able to throw away the object straight afterwards). oh and the late static binding I have been wishing for (for use in the same codebase) since Nov2003 will be part of php6 - but I won't be able to upgrade. :-( I feel rather shafted given the hoops I have had to jump through to keep my code working with every little version update of php5... I'll just go into a corner a cry for a while now - many thanks to whoever is inposing these fantastic restrictions. no doubt King Wez would say quit bitching and file a bug report - this time I might just do that. /RANT -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Last one for today! Pager problem
They're complaining that your pager code actually has a whole bunch of stuff in it that has nothing to do with paging, really, and that you need to educate yourself as a better programmer... That's kind of WAY beyond the scope of this list, but perhaps you could take some kind of General Programming course somewhere, or take some Programming 101 tutorials on the 'net, or something along those lines. On Tue, April 18, 2006 10:17 am, [EMAIL PROTECTED] wrote: what does this mean? when I said 'everything else' I meant it calcualted the number of results/pages and displays the first page but then wipes the results when I click on any of the other links (page2 | page3 etc.) Ross - Original Message - From: tedd [EMAIL PROTECTED] To: Jay Blanchard [EMAIL PROTECTED]; Ross [EMAIL PROTECTED]; php-general@lists.php.net Sent: Tuesday, April 18, 2006 4:10 PM Subject: RE: [PHP] Last one for today! Pager problem At 9:53 AM -0500 4/18/06, Jay Blanchard wrote: [snip] My pager does everything but when I hit any of the links for the pages it doesn't show any results. It can be seen here (alothough the page doesn't seen to submit on the remote host. Any ideas why?? [/snip] I think it might be coder error, but that's just me. Anyone else? Hmmm considering that his pager does everything, maybe he should have it wrote the code. Anyone else? tedd -- http://sperling.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Pushing PHP Into The Web 2.0 Generation
Jay Blanchard wrote: [snip] the article is also under the name of Matt Todd, didn't catch that first time round - very odd - if this was some kind of prank then first mailing internals (also under the name James Crane) has a really high ***hole factor. [/snip] I found the kid's actual e-mail addressanyone interested? He is a college student in Atlanta Georgia, don't know if James Crane is one of his alias' though. five minutes ago I was all for asking him what he's smoking - then the bottom fell out of my php world... now the WebIdiot2.0 seems rather irrelevant. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] pause until page is loaded
Run it on the onLoad event of the Body entity. - Original Message - From: Benjamin Adams [EMAIL PROTECTED] To: php Nichel php-general@lists.php.net Sent: Tuesday, April 18, 2006 11:19 PM Subject: [PHP] pause until page is loaded I created a script to redirect to a download auto. but it redirects before the Whole page is loaded. How do I pause until page is loaded? Ben -- 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] Forking a search - pcntl
On Tue, April 18, 2006 5:21 am, James Nunnerley wrote: What we'd like to do is run the actual search query in the background (i.e. fork) while the viewable page shows a nice scrollie banner etc! fork is not the only solution for this, thank [insert deity here] Due to various problems with the server we are using (Zeus) we can't just run an exec(). I've had a look around, and it would seem that pcntl maybe the way forward. NO WAY! pcntl should NOT be run in a web-hosted environment, according to the docs. I don't think Zeus' threading model is going to make it okay to use. Does anyone have an example working script, or indeed a decent tutorial on how to use the functionality? The php manual has limited information on using the functions, and I just can't get my head around how it's meant to work?!!! pctnl should only be used from CLI/CGI The examples should be sufficient for that, but you don't really care, as it's not useful for what you want. Here is what *I* would recommend: Create a new table of searches: create table search( search_id int(11) auto_increment unique not null primary key, status enum{0, 1, 2} default 0, search_pid int(11) default null, inputs text, results text ); 0 = new search 1 = in progress 2 = complete Now, when somebody wants you to do a search, just insert a record: $query = insert into search(inputs) values('$CLEAN[inputs]'); where $CLEAN is your sanitized validated $_REQUEST input, of course. $id = mysql_insert_id(); Your scrolling banner can than have a META Refresh of a few seconds/minutes/whatever, and embed the $id into the URL for that. See: http://php.net/mysql_insert_id Then, of course, you need something to actually PERFORM the searches, which is where a nice cron job comes in. That cron job can start a new search task which will do this: [in psuedo-code] $pid = getmypid(); // or something like that: UPDATE search set status = 1, search_pid = $pid where status = 0 LIMIT 1 SELECT id, inputs from search where search_pid = $pid $id = $row['id']; update search set status = 1 where id = $id //do the search //when done: update search set status = 2, results = '$search_results' where id = $id Doing it this way means you could even run several processes at once, each working on a different search. Note that the UPDATE marks the record as in progress and ties it to the process running, so that there is NO race condition. If MySQL does not support LIMIT 1 in an UPDATE, which I'm pretty sure it does, but not 100% certain, then you'd have to just update all the inputs available, and have the thread handle each search that it took in the UPDATE. You could still have an army of search processes, though, as new search inputs are coming in all the time, and each search process would handle however many were on the To Do (status 0) stack when they started. This is very scalable, and you could even buy more computers and throw them at it, with just one database, provided you tagged the process_id with a machine_id of some kind as well, to avoid duplciate process IDs on 2 computers. I'll leave that part as an exercise. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTTP_REFERER with javascript: document.location
Thank you for your advise. I guess it's impossible to get reliable value referrer from another site? How about the website statistic engine out there be able to get the referrals address' - Original Message - From: Richard Lynch [EMAIL PROTECTED] To: Yudie [EMAIL PROTECTED] Cc: php-general@lists.php.net Sent: Tuesday, April 18, 2006 4:16 PM Subject: Re: [PHP] HTTP_REFERER with javascript: document.location On Tue, April 18, 2006 12:49 pm, Yudie wrote: Does anyone know how to resolve my problem I tried to get the referer url with $_SERVER['HTTP_REFERER'] but returns blank when I use javascript: document.location='...' from the previous page. Don't do that. :-) More specifically, no browser is required to provide HTTP_REFERER, so that value is completely un-reliable. If, for some reason, your application NEEDS the preceding page, you'll need to track it in the URL, or in their session, or through some mechanism that YOU control. Rule #1: Never, ever, ever, trust the browser. Or the guy/gal/bot using it, for that matter. Hope that helps, even if it's *so* not what you wanted to hear. -- Like Music? http://l-i-e.com/artists.htm -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.1.385 / Virus Database: 268.4.3/317 - Release Date: 4/18/2006 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Date time Comparison
Hi everyone, this is the function I have written for comparing a date time please tell me if my logic is correct ? and if there's a better alternative please let me know of that as well. // This function will return 1 if supplied date is expired function is_expire($expiry_date){ $current_date=date('YmdHis'); $year=substr($expiry_date,0,4); $month=substr($expiry_date,5,2); $day=substr($expiry_date,8,2); $hour=substr($expiry_date,11,2); $min=substr($expiry_date,14,2); $sec=substr($expiry_date,17,2); $formated_expiry_date=$year.$month.$day.$hour.$min.$sec; if ($current_date=$formated_expiry_date) return 1; else return 0; } -- Murtaza Chang
Re: [PHP] creating a SELECT AND query
On Tue, April 18, 2006 6:03 am, Ross wrote: select name=area class=text id=area option value=aAll of Scotland/option option value='1'Aberdeen City Counci.../option /select This is what I thought would work.. $query1= select * from $table_name WHERE sname LIKE '$search_string%' ; if ($area=a) { $query1 .= AND area='a'; If $area is 'a', they want ALL of Scotland. Since your table probably has ONLY Scotland in it, you don't want to restrict anything there. For sure, the area isn't going to be 'a' in your table, is it? Cuz the next line or two seem to indicate that area is a number like '1' for Aberdeen City Council and so on. If you're thinking of adding, say, Wales, next month/year, then you need to have a different field from 'area' and put in the restriction here for getting just Scotland. If you just plain don't care about adding anything more ever, you can just take out the line above. } else { $query1 .=AND area='$area'; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] what functionality does CGI miss in relation to apache module SAPI?
On Tue, April 18, 2006 3:54 am, Jochem Maas wrote: does anyone have a concise list of the functionality missing from the CGI SAPI in comparison to the the Apache module (including any functional differences)? as far as I can tell CGI doesn't give me anything extra in terms of functionality but the precise differences elude me (STFW didn't turn up any difinitive info - that might a be monday morning issue, combined with a lack of coffee) I know I once tracked down all four (4) things in PHP 3 that wouldn't work with CGI and posted to the PHP list. There was only one list back then... I think one was the HTTP Authentication, because the username/password would have to be passed on the command line to the CGI. Or *something* that would have required passing a password on the command line, so it was disabled for that reason, and HTTP Authentication is the obvious candidate. IIRC, the other functions were s esoteric, there wasn't any real reason to prefer CGI/Module in terms of feature set other than HTTP Auth, but that was long ago, so there may be more functionality now that matters. If you have a really GOOD reason to use CGI, you probably will not notice any features missing. If you do, almost for sure a quick read of the docs on php.net will tell you WHY that feature is missing from CGI, even if you can't find a single-page collection of those features. Performance under CGI can suck, or not, depending, as I understand it: *IF* all your Apache children and enough PHP CGI processes can fit in RAM without page-faulting, then it's fine. Once your PHP CGI starts getting dumped to disk for page-faults, performance goes bad fast. This is just a parrot of what has been posted here in the past. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Pushing PHP Into The Web 2.0 Generation
Matt Todd wrote: Oh, and for the record, my email address is [EMAIL PROTECTED], amongst many others. And what does me posting this up have anything to do with me being an *sshole? Salman Rushie might have good reason to use a psuedonym - and probably a few human-rights activists living china. not you though. with regard to your 'article': this is php-land, php is probably the simplest, most straight forward programming language on the planet - we want to stay that way, it's for pragmatistics not OO fundamentalists. we certainly don't like hype and everything Web2.0 is exactly that. rather than telling us (and more importantly the php devs) how they should supposedly be making php more 'human friendly' I suggest actually writing a serious application. or start using .NET it has plenty of OTT OO cruft for you to feel friendly about. you hit a nerve - the community obviously want to clearly demonstrate that it has no desire to sink into the nightmare you think we should all be living. heh smile() * 5-times() it's not the end of the world. M.T. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Spell Checker
On Tue, April 18, 2006 2:12 am, BH.VN.Viswanath wrote: We need to check the spelling of a word which is actually a Domain name. For example we have to check the word onlinetradeing. When checked with the spell checkers we are getting the words which are unrelated such as on, obliterating, incinerating, intruding etc. But exactly what we want was online trading. So we would like to have the word to be split into phrases and check the spelling too. The normal spell checkers are just checking the words in the dictionary but not splitting the word into phrases. Okay. Who's going to split it into words for you?... There are only so many choices, here: #1. Brute force. spellcheck('o nlinetrading'); spellcheck('on linetrading'); spellcheck('onl inetrading'); . . . Plus, you have to consider that it might be THREE words in the domainname... This means you have WAY too many things to check. #2. Some human reads the domainname and types in the words. #3. If these are existing valid domains with content, read the HTML and see if you can find the domain name in the content, but with spaces. I don't think you can do this with a single regex or anything, but it's at least in the realm of possible. #4. Solve the AI problem. :-) You'd have to get the computer to know what words are in the domainname, somehow, by being intelligent. Also note that things like nite are not correctly spelled, but humans have absolutely no problem with something like goodnitesite and knowing that it's probably about sleeping or something of that nature. So your spelling check is probably useless in the first place, when you get right down to it... -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] what functionality does CGI miss in relation to apache module SAPI?
Richard, thanks for the feedback. Richard Lynch wrote: On Tue, April 18, 2006 3:54 am, Jochem Maas wrote: does anyone have a concise list of the functionality missing from the CGI SAPI in comparison to the the Apache module (including any functional differences)? as far as I can tell CGI doesn't give me anything extra in terms of functionality but the precise differences elude me (STFW didn't turn up any difinitive info - that might a be monday morning issue, combined with a lack of coffee) I know I once tracked down all four (4) things in PHP 3 that wouldn't work with CGI and posted to the PHP list. There was only one list back then... I think one was the HTTP Authentication, because the username/password would have to be passed on the command line to the CGI. Or *something* that would have required passing a password on the command line, so it was disabled for that reason, and HTTP Authentication is the obvious candidate. O*#@(%)(#285 [EMAIL PROTECTED]^#%@ *#%#*%(@ now I'm having a really bad day. HTTP Auth is one of the things I need. IIRC, the other functions were s esoteric, there wasn't any real reason to prefer CGI/Module in terms of feature set other than HTTP Auth, but that was long ago, so there may be more functionality now that matters. If you have a really GOOD reason to use CGI, you probably will not notice any features missing. If you do, almost for sure a quick read of the docs on php.net will tell you WHY that feature is missing from CGI, even if you can't find a single-page collection of those features. CGI is the only way to run php5 on an apache setup already running the php4 module (the guy the admins the server in question will only install php5 in that way because it's managable -- that is to say Gentoo now support this configuration via their emerge system) .. and I need php4 for the main site that already runs their - it doesnt work with php5 ... and the code is too large and shitty to consider upgrading it. Performance under CGI can suck, or not, depending, as I understand it: *IF* all your Apache children and enough PHP CGI processes can fit in RAM without page-faulting, then it's fine. Once your PHP CGI starts getting dumped to disk for page-faults, performance goes bad fast. here Im lucky - the php5 stuff I want to run is meant for CMS/Intranet stuff that is onyl run by the client - so minimal hits to the server (just a couple of employees will be logging in and doing stuff) This is just a parrot of what has been posted here in the past. your parrots are better than most peoples insights my friend! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Spell Checker
On Tue, April 18, 2006 9:53 am, Stut wrote: BH.VN.Viswanath wrote: We need to check the spelling of a word which is actually a Domain name. For example we have to check the word onlinetradeing. When checked with the spell checkers we are getting the words which are unrelated such as on, obliterating, incinerating, intruding etc. But exactly what we want was online trading. So we would like to have the word to be split into phrases and check the spelling too. The normal spell checkers are just checking the words in the dictionary but not splitting the word into phrases. Ok, this is gonna show how bored I've been today, maybe I need to find a more interesting job!! http://dev.stut.net/words/ There's a link there to the source of the guts. Hope it helps you. You may find a longer (possibly better, or not) list of words in: /usr/share/dict/web2 Or similar location. Here is the README from that directory: # @(#)README 8.1 (Berkeley) 6/5/93 # $FreeBSD: src/share/dict/README,v 1.7.2.2 2002/08/20 21:42:32 alfred Exp $ WEB (introduction provided by [EMAIL PROTECTED]) - Welcome to web2 (Webster's Second International) all 234,936 words worth. The 1934 copyright has elapsed, according to the supplier. The supplemental 'web2a' list contains hyphenated terms as well as assorted noun and adverbial phrases. The wordlist makes a dandy 'grep' victim. -- James A. Woods{ihnp4,hplabs}!ames!jaw(or [EMAIL PROTECTED]) Dictionaries for other languages, e.g. Afrikaans, American, Aussie, Chinese, Croatian, Czech, Danish, Dutch, Esperanto, Finnish, French, German, Hindi, Hungarian, Italian, Japanese, Latin, Norwegian, Polish, Russian, Spanish, Swahili, Swedish, Yiddish, are available at ftp://ftp.ox.ac.uk/pub/wordlists. Country names are stored in the file /usr/share/misc/iso3166. FreeBSD Maintenance Notes - Note that FreeBSD is not maintaining a historical document, we're maintaining a list of current [American] English spellings. A few words have been removed because their spellings have depreciated. This list of words includes: corelation (and its derivatives) -- correlation is the preferred spelling -- A list of technical terms has been added in the file 'freebsd'. This word list contains FreeBSD/Unix lexicon that is used by the system documentation. It makes a great ispell(1) personal dictionary to supplement the standard English language dictionary. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Date time Comparison
http://php.net/mktime may be more suitable, depending on the date range of the input. That said, as far as I can tell, your $formated_expiry_date is the SAME as your $expiry_date, except possibly for some separation characters. If the separation characters are ALWAYS the same, you could just do: $current_date = date('Y/m/d H:i:s'); //match formatting of expiry date. return $current_date $expiry_date; On Tue, April 18, 2006 5:02 pm, Murtaza Chang wrote: Hi everyone, this is the function I have written for comparing a date time please tell me if my logic is correct ? and if there's a better alternative please let me know of that as well. // This function will return 1 if supplied date is expired function is_expire($expiry_date){ $current_date=date('YmdHis'); $year=substr($expiry_date,0,4); $month=substr($expiry_date,5,2); $day=substr($expiry_date,8,2); $hour=substr($expiry_date,11,2); $min=substr($expiry_date,14,2); $sec=substr($expiry_date,17,2); $formated_expiry_date=$year.$month.$day.$hour.$min.$sec; if ($current_date=$formated_expiry_date) return 1; else return 0; } -- Murtaza Chang -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] pause until page is loaded
On Tue, April 18, 2006 4:19 pm, Benjamin Adams wrote: I created a script to redirect to a download auto. but it redirects before the Whole page is loaded. How do I pause until page is loaded? If you want to wait until the BROWSER loads the whole page, then the BROWSER has to tell you when it has finished. Since the communication between the BROWSER and PHP is limited to: BROWSER: Gimme this URL PHP: Here, here's your data. Bye. I'm gone. Note that the browser could spend an HOUR (in principle) rendering the data sent by PHP, if that rendering was particularly difficult. So, clearly, PHP is *NOT* going to be able to do what you want. You are therefore urged to consult a Javascript list. Or an AJAX list. Or, really, any kind of mailing list about running code on a BROWSER, but not PHP, which runs on the SERVER. :-) -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] New image already cached.
Hi gang: I wrote a program that presents a bunch of thumbnails to the users. When the user wants to view a larger version of one of the thumbnails, s/he simply clicks the thumbnail and another page is displayed with the larger image -- nothing new there. However, considering that the larger image is copyrighted, the client wanted a copyright printed across the image, but not on the thumbnail (too small to worry about and it distracted from the small image). So, my code takes two images, merges them (i.e., the large version with a copyright) and then presents the new image to the browser via a link. It sounded good and works in Safari and FireFox. Unfortunately, not all browsers treat an image link in the same manner. For example, Safari and FireFox treats the link /images/merged.png as a new image every time. Unfortunately, Opera and some other browsers cache the first image and every time after that, the same large image is shown regardless of the thumbnail. In other words, they treat the link /images/merged.png as it has the same image each time, when it doesn't. So, I have several options to solve this, but I was wondering if there was a way to force a browser not to cache images? I tried using this: // expires on any past date header (Expires: Mon, 26 Jul 1997 05:00: GMT); // last modified at current date and time header (Last-Modified: . gmdate(D, d M Y H:i:s) . GMT); // for HTTP 1.1: header (Cache-Control: no-store, no-cache, must-revalidate); header (Cache-Control: post-check=0, pre-check=0, false); // for HTTP 1.0 header (Pragma: no-cache); However, it works only IF the user refreshes their browser. Any ideas before I jump back into this? Thanks. tedd -- http://sperling.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTTP_REFERER with javascript: document.location
Probably uses the same thing you're trying to use, which is NOT reliable. Works for most browsers in most situations, but not reliably. Walking through your web access logs can also sometimes use heuristics regarding time and IP address to guess which users are unique or not, but they are not really accurate. Just guesses. Websites that claim # unique visitors are either: A) Guessing B) Requiring a login If it's A, and you want to compare 2 sites, and both sites aren't using the same methodology to determine unique visitor your statistics have to be taken with a huge grain of salt... There is no magical solution out there that any log analysis website statistic engine is using -- It's all assuming the browsers aren't lying (and some of them are) and guesswork. Again I say: If you NEED to know the REFERER for sure, then YOU have to track it. Nobody will do it for you. If you don't really care and just want a guess then you can use REFERER. On Tue, April 18, 2006 5:01 pm, Yudie wrote: Thank you for your advise. I guess it's impossible to get reliable value referrer from another site? How about the website statistic engine out there be able to get the referrals address' - Original Message - From: Richard Lynch [EMAIL PROTECTED] To: Yudie [EMAIL PROTECTED] Cc: php-general@lists.php.net Sent: Tuesday, April 18, 2006 4:16 PM Subject: Re: [PHP] HTTP_REFERER with javascript: document.location On Tue, April 18, 2006 12:49 pm, Yudie wrote: Does anyone know how to resolve my problem I tried to get the referer url with $_SERVER['HTTP_REFERER'] but returns blank when I use javascript: document.location='...' from the previous page. Don't do that. :-) More specifically, no browser is required to provide HTTP_REFERER, so that value is completely un-reliable. If, for some reason, your application NEEDS the preceding page, you'll need to track it in the URL, or in their session, or through some mechanism that YOU control. Rule #1: Never, ever, ever, trust the browser. Or the guy/gal/bot using it, for that matter. Hope that helps, even if it's *so* not what you wanted to hear. -- Like Music? http://l-i-e.com/artists.htm -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.1.385 / Virus Database: 268.4.3/317 - Release Date: 4/18/2006 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] what functionality does CGI miss in relation to apache module SAPI?
On Tue, April 18, 2006 5:26 pm, Jochem Maas wrote: CGI is the only way to run php5 on an apache setup already running the php4 module (the guy the admins the server in question will only install php5 in that way because it's managable -- that is to say Gentoo now support this configuration via their emerge system) Well... Maybe you could get them to implement what RASMUS said was the right way to do this... :-) You'll have to search the archives for it, from about 6 months (?) ago... It was pretty slick, and wouldn't hurt their 4.x userbase at all. At least, it SEEMED pretty slick, but I didn't really fully understand it... :-^ -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] New image already cached.
At 03:47 PM 4/18/2006, tedd wrote: Unfortunately, not all browsers treat an image link in the same manner. For example, Safari and FireFox treats the link /images/merged.png as a new image every time. Unfortunately, Opera and some other browsers cache the first image and every time after that, the same large image is shown regardless of the thumbnail. In other words, they treat the link /images/merged.png as it has the same image each time, when it doesn't. So, I have several options to solve this, but I was wondering if there was a way to force a browser not to cache images? Why merge the images each time they're requested? I suggest you merge an image with the copyright notice only the first time it's requested, then save that merged image on the server and allow it to be cached normally. (This means deriving a unique name for each merged image, which could be as simple as using the original image filename in a new folder. You could keep the image originals in a folder below root to protect them from public access.) In the unlikely event that you ever needed to refresh the photo+copyright merges, you could simply delete the merged images from the server and let your program regenerate them as needed. Paul -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] New image already cached.
Browsers are not at all reliable about caching (or not) anything other than HTML text in terms of HTTP Headers. Don't waste your time looking for a set of HTTP Headers that will work. I can guarantee *SOME* user out there will have a browser that will do the Wrong Thing for any set of headers you can find. And, Murphy's Law, your boss/client will use *THAT* browser, and love it. The easiest answer is to add /copyright/ into the URL for the one that needs the copyright notice merged in. If however, you want to be sure the browser doesn't cache the image, because it is dynamic, just add some randomness to the URL. Technically, that means the browser WILL cache it, but you'll never use the same URL twice, so you won't really care. You're also better off embedding the parameters in the URL so that it looks like a directory to the browser: http://example.com/actual_script/57823642346963/copyright/whatever.png The PHP scritp is actual_script. You can use .htaccess and ForceType to make Apache run it. $_SERVER['PATH_INFO'] will have all the parameters you need. I think all the browsers get it right with ?x=5y=7 for Images, but some ersions of IE will screw up when you try to apply the same techniques to PDFs and FDFs. The embedded parameters pretty much give the browser NO opportunity to screw up. Remember Rule #1. Never trust the browser. Or the user of the browser. On Tue, April 18, 2006 5:47 pm, tedd wrote: Hi gang: I wrote a program that presents a bunch of thumbnails to the users. When the user wants to view a larger version of one of the thumbnails, s/he simply clicks the thumbnail and another page is displayed with the larger image -- nothing new there. However, considering that the larger image is copyrighted, the client wanted a copyright printed across the image, but not on the thumbnail (too small to worry about and it distracted from the small image). So, my code takes two images, merges them (i.e., the large version with a copyright) and then presents the new image to the browser via a link. It sounded good and works in Safari and FireFox. Unfortunately, not all browsers treat an image link in the same manner. For example, Safari and FireFox treats the link /images/merged.png as a new image every time. Unfortunately, Opera and some other browsers cache the first image and every time after that, the same large image is shown regardless of the thumbnail. In other words, they treat the link /images/merged.png as it has the same image each time, when it doesn't. So, I have several options to solve this, but I was wondering if there was a way to force a browser not to cache images? I tried using this: // expires on any past date header (Expires: Mon, 26 Jul 1997 05:00: GMT); // last modified at current date and time header (Last-Modified: . gmdate(D, d M Y H:i:s) . GMT); // for HTTP 1.1: header (Cache-Control: no-store, no-cache, must-revalidate); header (Cache-Control: post-check=0, pre-check=0, false); // for HTTP 1.0 header (Pragma: no-cache); However, it works only IF the user refreshes their browser. Any ideas before I jump back into this? Thanks. tedd -- http://sperling.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP6 just became my worst nightmare.
On Tue, 2006-04-18 at 17:29, Jochem Maas wrote: RANT type=long, lingering, desperate apparently calling a dynamic function using static syntax will cause an E_FATAL. well f***ing great. so the foundation of the Object-Database mapping code I have been writing/developing since php5 was in beta [you won't believe how many segfaults I worked through - together with Ard B. (author of the ibase extension and fixer/finder of numerous killer bugs in php5)] in now dead-man-walking because both the DB class and the base class that drives the Object--Database mapping rely on the ability to call certain methods statically and dynamically - the code is carefully crafted to avoid any problems this might entail. refactoring is possible but the speed of the code will suffer _greatly_ because of the requirement that I must now create _hordes_ of objects just to call these certain methods (only to be able to throw away the object straight afterwards). oh and the late static binding I have been wishing for (for use in the same codebase) since Nov2003 will be part of php6 - but I won't be able to upgrade. :-( I feel rather shafted given the hoops I have had to jump through to keep my code working with every little version update of php5... I'll just go into a corner a cry for a while now - many thanks to whoever is inposing these fantastic restrictions. no doubt King Wez would say quit bitching and file a bug report - this time I might just do that. /RANT *lol* While I feel for you, I'm pretty sure you were on that bandwagon telling all us PHP4 clinger-ons to suck it up and upgrade cuz PHP5 is sooo KEWL. Now you have an inkling why some of us weren't so keen ;) 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] Pushing PHP Into The Web 2.0 Generation
On Tue, 2006-04-18 at 17:20, Jay Blanchard wrote: [snip] the article is also under the name of Matt Todd, didn't catch that first time round - very odd - if this was some kind of prank then first mailing internals (also under the name James Crane) has a really high ***hole factor. [/snip] I found the kid's actual e-mail addressanyone interested? He is a college student in Atlanta Georgia, don't know if James Crane is one of his alias' though. While I agree with everyone that the article was pretty bunk, the identity issue seems to be much ado about nada. The guy clearly wrote in his original post that HE wrote it, and then he signed off as M.T. This obviously correlates with the author name in the article. Why he wrote in from another email address is unimportant to the identity issue being raised. He never pretended to be anyone but the writer. 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] New image already cached.
At 04:12 PM 4/18/2006, Richard Lynch wrote: If however, you want to be sure the browser doesn't cache the image, because it is dynamic, just add some randomness to the URL. Technically, that means the browser WILL cache it, but you'll never use the same URL twice, so you won't really care. But the user might care. This will artificially inflate the user's computer's internet cache -- an insignificant load if they visit this one site just a little, but potentially significant if they visit it a lot or if doing this became common practice on the net. Or the programmer might care. It feels very inelegant to me to keep generating trash with no automatic trash collection in place. I'd be somewhat mollified if some of those cache-suppression techniques were used to keep things cleaner at the user's end, but still... Why create an engine that produces an unlimited stream of garbage when it's so easy to make it all finite? Paul -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] return a formatted difference between two dates
On Mon, April 17, 2006 8:55 pm, tedd wrote: As I understand it, it won't make any difference if you use strtotime() See: http://www.weberdev.com/strtotime Errr, yeah. Only problem is, he needs non-existent function that might be named timetostr which takes an elapsed time and turns it into a string like 1 week and 3 days -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] New image already cached.
On Tue, April 18, 2006 6:39 pm, Paul Novitski wrote: At 04:12 PM 4/18/2006, Richard Lynch wrote: If however, you want to be sure the browser doesn't cache the image, because it is dynamic, just add some randomness to the URL. Technically, that means the browser WILL cache it, but you'll never use the same URL twice, so you won't really care. But the user might care. This will artificially inflate the user's computer's internet cache -- an insignificant load if they visit this one site just a little, but potentially significant if they visit it a lot or if doing this became common practice on the net. When the browsers in question (mostly Microsoft Internet Explorer) want to solve this problem by actually following standards [*] consistently, I'll be happy to fix my code. Or the programmer might care. It feels very inelegant to me to keep generating trash with no automatic trash collection in place. I'd be somewhat mollified if some of those cache-suppression techniques were used to keep things cleaner at the user's end, but still... Why create an engine that produces an unlimited stream of garbage when it's so easy to make it all finite? Because the browsers do *NOT* behave correctly! If you think it's so easy to make it all finite, then you clearly aren't understanding the problem. And, actually, the browsers will expire and garbage-collect the images. Presumably through some kind of sensible least-used-expire rule, though you never know. If you don't care that some users are not going to see what they need to see on your site, then you just go right ahead and try it with your caching headers. Run regression tests on a LOT of older browsers and see how it works. My position is: The browser is screwed up, and I cannot fix it. I can only work around it. If that causes a problem for the people who wrote the browser, and people who use that browser, then maybe they'll actually fix, or cause to be fixed, the original bug. I doubt it, though, as they're too busy adding some new lame-ass feature with lots of buzzwords like Web 2.0 or something. :-) * When MS decides to not follow a standard, and then publishes a conflicting standard instead, with no technological reason/improvement driving their new standard, that doesn't count as following a standard. That just makes their browser geometrically worse. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP]Sessions
Hi: I'm a beginner using PHP and I don't speak english very well but I like your site because I believe that you are the best. Mi problem is with sessions, how can I do to delete a files of a server when the user closes the page. Cheers Fridel
Re: [PHP]Sessions
On Tue, April 18, 2006 1:09 pm, Gissel y Fridel wrote: I'm a beginner using PHP and I don't speak english very well but I like your site because I believe that you are the best. Mi problem is with sessions, how can I do to delete a files of a server when the user closes the page. They expire after some time goes by. You'll never know when the user closes the browser or not. You can change the time in php.ini or with: http://www.php.net/manual/en/function.session-cache-expire.php -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Session_destroy
Hi People, Trying to get a session to destroy correctly, however the darn thing just refuses to destroy. I call the following in a separate webpage in a effort to destroy the session, only to find that the session still persists. ?php session_start(); session_unset(); session_destroy(); Header(Location: index.php); ? Any help would be appreciated. Cheers, Shannon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] New image already cached.
At 05:02 PM 4/18/2006, Richard Lynch wrote: If you don't care that some users are not going to see what they need to see on your site, then you just go right ahead and try it with your caching headers. Richard, I'm not suggesting the use of flakey cache control, but rather the use of a different tack altogether: At 04:06 PM 4/18/2006, Paul Novitski wrote: I suggest you merge an image with the copyright notice only the first time it's requested, then save that merged image on the server and allow it to be cached normally. Paul -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] session_destroy
Hi People, Trying to get a session to destroy correctly, however the darn thing just refuses to destroy. I call the following in a separate webpage in a effort to destroy the session, only to find that the session still persists. ?php session_start(); session_unset(); session_destroy(); Header(Location: index.php); ? Any help would be appreciated. Cheers, Shannon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] session_destroy
I've also had this issue from time to time. Used the following to destroy it under all circumstances. if (isset($_COOKIE[session_name()])) { setcookie(session_name(), '', time()-42000, '/'); } session_destroy(); Shannon Doyle wrote: Hi People, Trying to get a session to destroy correctly, however the darn thing just refuses to destroy. I call the following in a separate webpage in a effort to destroy the session, only to find that the session still persists. ?php session_start(); session_unset(); session_destroy(); Header(Location: index.php); ? Any help would be appreciated. Cheers, Shannon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] session_destroy
That's exactly what the manual says. session_destroy() doesñ't clean the session cookie (if one is used), that's probably why your session persists. Peter Hoskin wrote: I've also had this issue from time to time. Used the following to destroy it under all circumstances. if (isset($_COOKIE[session_name()])) { setcookie(session_name(), '', time()-42000, '/'); } session_destroy(); Shannon Doyle wrote: Hi People, Trying to get a session to destroy correctly, however the darn thing just refuses to destroy. I call the following in a separate webpage in a effort to destroy the session, only to find that the session still persists. ?php session_start(); session_unset(); session_destroy(); Header(Location: index.php); ? Any help would be appreciated. Cheers, Shannon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] session_destroy
Thats just it, I am not setting a session cookie. Just starting a session with the following :- session_name(XPCSESS); session_start(); $sessID = session_id(); -Original Message- From: Martin Alterisio El Hombre Gris [mailto:[EMAIL PROTECTED] Sent: Wednesday, 19 April 2006 12:36 PM To: Peter Hoskin Cc: Shannon Doyle; php-general@lists.php.net Subject: Re: [PHP] session_destroy That's exactly what the manual says. session_destroy() doesñ't clean the session cookie (if one is used), that's probably why your session persists. Peter Hoskin wrote: I've also had this issue from time to time. Used the following to destroy it under all circumstances. if (isset($_COOKIE[session_name()])) { setcookie(session_name(), '', time()-42000, '/'); } session_destroy(); Shannon Doyle wrote: Hi People, Trying to get a session to destroy correctly, however the darn thing just refuses to destroy. I call the following in a separate webpage in a effort to destroy the session, only to find that the session still persists. ?php session_start(); session_unset(); session_destroy(); Header(Location: index.php); ? Any help would be appreciated. Cheers, Shannon -- 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] Spell Checker
Richard Lynch wrote: You may find a longer (possibly better, or not) list of words in: /usr/share/dict/web2 Or similar location. Here is the README from that directory: # @(#)README 8.1 (Berkeley) 6/5/93 # $FreeBSD: src/share/dict/README,v 1.7.2.2 2002/08/20 21:42:32 alfred Exp $ WEB (introduction provided by [EMAIL PROTECTED]) - Welcome to web2 (Webster's Second International) all 234,936 words worth. I did find a wordlist named web2 that contained roughly that number of words, unfortunately it contained far too much noise to be useful for this utility. For example it had a-z as single letters instead of just 'a' and 'i' which really messed it up. Of course if I was going to use it in a production system it would evolve over time, and I might take the time to clean a wordlist such as this to remove noise like that. Thanks for the suggestion tho. Dictionaries for other languages, e.g. Afrikaans, American, Aussie, Chinese, Croatian, Czech, Danish, Dutch, Esperanto, Finnish, French, German, Hindi, Hungarian, Italian, Japanese, Latin, Norwegian, Polish, Russian, Spanish, Swahili, Swedish, Yiddish, are available at ftp://ftp.ox.ac.uk/pub/wordlists. The table has a field for the language. My original intention was to import wordlists in several languages and to add a language selection field to the form, but it started to seem more like work than play so I didn't bother. It would be trivial to add tho. -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php