|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
php-general Digest 19 Apr 2006 10:03:16 -0000 Issue 4080
php-general-digest-help
lists.php.net
Date: Wed Apr 19 2006 - 05:03:16 CDT
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
php-general Digest 19 Apr 2006 10:03:16 -0000 Issue 4080
Topics (messages 234215 through 234260):
Re: Pushing PHP Into The Web 2.0 Generation
234215 by: Jay Blanchard
234223 by: Jochem Maas
234230 by: Jochem Maas
234242 by: Robert Cummings
pause until page is loaded
234216 by: Benjamin Adams
234218 by: Jay Blanchard
234219 by: Benjamin Adams
234224 by: Satyam
234235 by: Richard Lynch
Re: Pushing Vars into $_SESSION
234217 by: Richard Lynch
Re: Last one for today! Pager problem
234220 by: Richard Lynch
234222 by: Richard Lynch
PHP6 just became my worst nightmare.
234221 by: Jochem Maas
234241 by: Robert Cummings
234255 by: Jochem Maas
Re: Forking a search - pcntl
234225 by: Richard Lynch
234256 by: James Nunnerley
234258 by: Jochem Maas
Re: HTTP_REFERER with javascript: document.location
234226 by: Yudie
234237 by: Richard Lynch
Date time Comparison
234227 by: Murtaza Chang
234234 by: Richard Lynch
Re: creating a SELECT AND query
234228 by: Richard Lynch
Re: what functionality does CGI miss in relation to apache module SAPI?
234229 by: Richard Lynch
234232 by: Jochem Maas
234238 by: Richard Lynch
Re: Spell Checker
234231 by: Richard Lynch
234233 by: Richard Lynch
234254 by: Stut
New image already cached.
234236 by: tedd
234239 by: Paul Novitski
234240 by: Richard Lynch
234243 by: Paul Novitski
234245 by: Richard Lynch
234249 by: Paul Novitski
Re: return a formatted difference between two dates
234244 by: Richard Lynch
Sessions
234246 by: Gissel y Fridel
234247 by: Richard Lynch
Session_destroy
234248 by: Shannon Doyle
234250 by: Shannon Doyle
234251 by: Peter Hoskin
234252 by: Martin Alterisio \"El Hombre Gris\"
234253 by: Shannon Doyle
a funny variable composition out of my daily programmer life
234257 by: Barry
Re: Bar codes
234259 by: Tom Chubb
Re: php 3 to 5 upgrade: foreach loop no longer working
234260 by: Paul Waring
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscribe
lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscribe
lists.php.net
To post to the list, e-mail:
php-general
lists.php.net
----------------------------------------------------------------------
attached mail follows:
[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 address....anyone interested? He is a
college student in Atlanta Georgia, don't know if James Crane is one of
his alias' though.
attached mail follows:
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 address....anyone 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.
>
attached mail follows:
Matt Todd wrote:
> Oh, and for the record, my email address is mtodd
clayton.edu, 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.
attached mail follows:
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 address....anyone 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. |
`------------------------------------------------------------'
attached mail follows:
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
attached mail follows:
[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().
attached mail follows:
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().
>
attached mail follows:
Run it on the onLoad event of the Body entity.
----- Original Message -----
From: "Benjamin Adams" <badams
ambrosiasw.com>
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
>
>
>
attached mail follows:
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
attached mail follows:
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
attached mail follows:
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
attached mail follows:
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, ross
aztechost.com 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" <tedd
sperling.com>
> To: "Jay Blanchard" <jblanchard
pocket.com>; "Ross"
> <ross
aztechost.com>;
> <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
attached mail follows:
<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>
attached mail follows:
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
sooooooo 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. |
`------------------------------------------------------------'
attached mail follows:
Robert Cummings wrote:
> On Tue, 2006-04-18 at 17:29, Jochem Maas wrote:
>
...
>
> *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
> sooooooo KEWL. Now you have an inkling why some of us weren't so keen ;)
my argument for _using_ php5 was a little more subtle, I argued that developing
*new* applications on php4 when php5 was already long out of the door was counter
productive to adoption of php5 (which eventually has a kickback to it's general
usage and therefore our employability - if php never moves beyond php4 how long
will it remain such a force?)
besides I run a number of php4 servers which will never make the move to php5
because the code is too big/nasty/complex to make the refactoring a viable
option.
oh well back to the drawingboard - I guess I still have few months to refactor
100,000 lines of code :-P
rgds,
Jochem
>
> Cheers,
> Rob.
attached mail follows:
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
attached mail follows:
Thanks for everyone's replies - but I'm a little uncertain as to what the
reasons for not running the pcntl functions under the web browser are - is
it down to security?
cheers
-----Original Message-----
From: Richard Lynch [mailto:ceo
l-i-e.com]
Sent: 18 April 2006 22:52
To: James Nunnerley
Cc: php-general
lists.php.net
Subject: 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
attached mail follows:
James Nunnerley wrote:
> Thanks for everyone's replies - but I'm a little uncertain as to what the
> reasons for not running the pcntl functions under the web browser are - is
> it down to security?
http://php.net/pcntl
<quote>
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.
</quote>
in short you don't want to be forking your apache processes from within
php. you don't need to understand why so much as trust that there is a
good reason for not doing it - the more you delve in the underbelly of
process control/forking/etc the more you'll understand why the above advice
is sound :-)
>
> cheers
>
> -----Original Message-----
> From: Richard Lynch [mailto:ceo
l-i-e.com]
> Sent: 18 April 2006 22:52
> To: James Nunnerley
> Cc: php-general
lists.php.net
> Subject: 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.
>
attached mail follows:
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" <ceo
l-i-e.com>
To: "Yudie" <yudie
pricecomparison.com>
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
>
>
attached mail follows:
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" <ceo
l-i-e.com>
> To: "Yudie" <yudie
pricecomparison.com>
> 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
attached mail follows:
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
attached mail follows:
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
attached mail follows:
On Tue, April 18, 2006 6:03 am, Ross wrote:
> select name="area" class="text" id="area">
> <option value="a">All 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
attached mail follows:
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 soooo 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
attached mail follows:
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 #$
#&^#%
*#%#*%(
now I'm having a really bad day. HTTP Auth is one of the things I need.
>
> IIRC, the other functions were soooo 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!
attached mail follows:
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
attached mail follows:
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
attached mail follows:
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 jaw
riacs) -------------------------
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 jaw
riacs)
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
attached mail follows:
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 jaw
riacs) -------------------------
>
> 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
attached mail follows:
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
attached mail follows:
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
attached mail follows:
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=5&y=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
attached mail follows:
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
attached mail follows:
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
attached mail follows:
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
attached mail follows:
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
attached mail follows:
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
attached mail follows:
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
attached mail follows:
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
attached mail follows:
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
attached mail follows:
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
>
>
attached mail follows:
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
>>
>>
>
>
attached mail follows:
That’s 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:malterisio777
gmail.com]
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
attached mail follows:
He really didn't knew what he hase done when he came to this varname.
$_POST["f-art-nlid"];
burn baby :D *boom* xD
--
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)
attached mail follows:
Under the GD Image Functions within the PHP Help file (on php.net) there is
an example for barcodes.
It also refers to barcodeisland.com which may be of use to you.
HTH
On 13/04/06, Emil Edeholt <emil
vanster.nu> wrote:
> Hi,
>
> I've never used bar codes before. And now I need to print out bar codes,
> and I've been told it should be in the format K39 Normal (I could have
> misunderstood since I can't find that on google. Maybe Code 39 Normal?).
> Any idea how to find that bar code font or what it's called? And what
> shall I use to print it out? Is it just as a regulat font, or do I need
> some special bar code lib?
>
> Thanks for your time
>
> Best regards Emil
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
Tom Chubb
tom
ps-promo.co.uk
07915 053312
attached mail follows:
On 18/04/06, Vernon Webb <vernon
comp-wiz.com> 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).
There is actually an option in php.ini to switch on the $HTTP_*_VAR
variables, although it's off by default in PHP 5. It's still better in
my opinion to use the $_* superglobals ($_POST, $_GET etc), but if
you've got hundreds of scripts and no time to convert them (or you're
running phpBB, which relies on the deprecated behaviour), then enabled
register_long_arrays in php.ini.
Paul
--
Data Circle
http://datacircle.org
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]