[PHP] Re: Fastest templating mechanism

2005-05-08 Thread Satyam
You might try using the first pass of a regular C compiler, the 
pre-compiler, which expands macro definitions.  It shouldn't have any 
problems with the structure of PHP, except for the # comments which it would 
mistake for its own pre-compiler declarations.

Otherwise, may I sugest you check in the archives my own posting with the 
subject "XML/HTML specific instructions"?

Satyam


"Evert | Rooftop Solutions" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Hi all,
>
> I'm working on a template system which works a bit like a text translation 
> block. The data looks for example like:
>
> beginblock 
> endblock 
> beginauthor 
> endauthor 
>
>
> The list is going to be very large, it will have several overlays and not 
> all pages need all items in the list. (usually just a fraction)
>
> What will be the smartest way to implement this? I need a low-memory cost 
> and fast solution
> I can do it with a php script, like:
>
> $list = array(
>  'beginblock' => '',
>
>  etc.
>
> );
>
> but this will use up too much memory. I could additionally do it with a 
> textfile, but if I need to loop through it at every lookup it will be 
> slow..
>
> What are your suggestions?
>
> regards,
> Evert 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] I'm having a blond moment with a while loop???

2005-05-08 Thread George Pitcher
Hi guys,

I'm doing something dumb but I can't see it.

The basic premise is:

sql search of orders sorted by customer
set g_customer_id to ''
loop through resultset
  if customer_id not same as last record's customer_id (g_customer_id)
get customer email details
set up message header if this is the first record for a customer
set item details
  else
set item details
set g_customer_id to customer_id
  endif
  send email
end loop

The problem is that as a sample I have two records from one demo customer
(me) and I can only get my email to handle one record - either sending
separate records for each record or one email covering the last record only

Its as if I should have another inner loop

Any tips

MTIA

George

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] browser detect and redirect

2005-05-08 Thread Ross
I want to redirect anyone not using ie 4+ as there browser.

Is this possible with php?

R. 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Fastest templating mechanism

2005-05-08 Thread Jens Kleikamp
Evert | Rooftop Solutions wrote:

> Hi all,
> 
> I'm working on a template system which works a bit like a text
> translation block. The data looks for example like:
> 
> beginblock 
> endblock 
> beginauthor 
> endauthor 
> 
> 
> The list is going to be very large, it will have several overlays and
> not all pages need all items in the list. (usually just a fraction)
> 
> What will be the smartest way to implement this? I need a low-memory
> cost and fast solution
> I can do it with a php script, like:
> 
> $list = array(
>   'beginblock' => '',
> 
>   etc.
> 
> );
> 
> but this will use up too much memory. I could additionally do it with a
> textfile, but if I need to loop through it at every lookup it will be
> slow..
> 
> What are your suggestions?
> 
> regards,
> Evert
> 
Have also a look at www.phpsavant.com. Different from smarty,  its a
lightweight object-oriented template engine. 
One neat feature is that you could add optionally your own custom markup
compilers.

Regards,
Jens

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] browser detect and redirect

2005-05-08 Thread bala chandar
Hi,

On 5/8/05, Ross <[EMAIL PROTECTED]> wrote:
> I want to redirect anyone not using ie 4+ as there browser.
> 
> Is this possible with php?

Yes!  you can use get_browser function. 
chec out http://in.php.net/manual/en/function.get-browser.php
> 
> R.
> 
> 

-- 
bala> balachandar muruganantham
blog> lynx http://chandar.blogspot.com
web> http://www.chennaishopping.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] browser detect and redirect

2005-05-08 Thread =?ISO-8859-2?Q?Heged=FBs_Bal=E1zs?=
Hi,
I should say RTFM, or just read a bit before you ask, pls.
Anyway take a look at the $_SERVER superglobal or the get_browser() 
function.

Balazs Hegedus
Ross wrote:
I want to redirect anyone not using ie 4+ as there browser.
Is this possible with php?
R. 

 

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: browser detect and redirect

2005-05-08 Thread David Dorward
Ross wrote:

> I want to redirect anyone not using ie 4+ as there browser.
> 
> Is this possible with php?

You could examine the user agent string, but that can be (and is in many
cases) spoofed.

Its generally better to just write code which doesn't depend on the use of a
specific browser. Its very rare that something really needs IE (At least I
assume that "+" means "higher" rather that "better").

-- 
David Dorward      
 Home is where the ~/.bashrc is

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Fastest templating mechanism

2005-05-08 Thread Evert | Rooftop Solutions
Joe Wollard wrote:
Evert,
Have you looked at smarty (http://smarty.php.net) ? It doesn't do 
exactly what you're talking about but it seems to be the "Fastest 
templating mechanism" that I've tested; probably one of the most 
versatile as well.

Cheers!
-Joe
www.joewollard.com
Evert | Rooftop Solutions wrote:
Hi all,
I'm working on a template system which works a bit like a text 
translation block. The data looks for example like:

beginblock 
endblock 
beginauthor 
endauthor 
The list is going to be very large, it will have several overlays and 
not all pages need all items in the list. (usually just a fraction)

What will be the smartest way to implement this? I need a low-memory 
cost and fast solution
I can do it with a php script, like:

$list = array(
 'beginblock' => '',
 etc.
);
but this will use up too much memory. I could additionally do it with 
a textfile, but if I need to loop through it at every lookup it will 
be slow..

What are your suggestions?
regards,
Evert
Hi everyone,
Thanks for your replies. I Think I haven't been very clear about what I 
really need. First of all, I don't need an existing templating system, 
because I am working on my own templating system.
And regarding Satyam's post. This looks a lot like what I'm developing 
right now, but also not my issue =)

What I really need is a fast lookup mechanism, to 'translate' statements.
For example:
setOutputType('xhtml');
echo(translate('authorstart'));
the function translate opens xhtml.data, which contains:
authorstart : 
authorend : 
so, the translate function looks 'authorstart' up and returns ''

or if you had specified 'wml' as the outputtype, the file could like like:
authorstart : 
authorend :  
and the function would return ''
This is all no problem, except that these lists can be pretty big. And I 
wouldn't like to load them all into the memory, or have to loop through 
the file every time translate is called.

So I need a very fast mechanism to overcome this problem.
Any ideas?
grt,
Evert
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Between Query (0T)

2005-05-08 Thread Ryan A
Hi,
Sorry I know this is OT but I'm hoping someone will still help...it should
be quite simple :-)
I have a field in the database called "age" which is a DATE field.

I also have a webform where the user can select between which ages he wants
the records shown...
eg: if he types 23,25 then I should get all results where
age >=23 and age <=25

Thanks,
Ryan



-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.11.6 - Release Date: 5/6/2005

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Question about acessing databases and formatting output

2005-05-08 Thread The Doctor
On Thu, May 05, 2005 at 05:49:38AM -0600, The Doctor wrote:
> On Thu, May 05, 2005 at 10:11:14AM +0530, bala chandar wrote:
> > hi,
> > 
> > On 5/5/05, The Doctor <[EMAIL PROTECTED]> wrote:
> > > This is probably easy, but how does
> > > one access a database, mysql or oracle or postgresql,
> > > and
> > > present the data in a tabular format?
> > > 
> > > --
> > > Member - Liberal International
> > > This is [EMAIL PROTECTED]   Ici [EMAIL PROTECTED]
> > > God Queen and country! Beware Anti-Christ rising!
> > > UK as 5 May 2005 approaches, vote LDem!!
> > > 
> > 
> > check out http://in2.php.net/mysql
> >
> 
> Looks good to me.
>  

So far so good except my blobs are appearing as is instead of 
as an interpret item.  What next?
> > -- 
> > bala> balachandar muruganantham
> > blog> lynx http://chandar.blogspot.com
> > web> http://www.chennaishopping.com
> > 
> > -- 
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> > 
> > 
> 
> -- 
> Member - Liberal International
> This is [EMAIL PROTECTED] Ici [EMAIL PROTECTED]
> God Queen and country! Beware Anti-Christ rising!
> UK as 5 May 2005 approaches, vote LDem!!
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

-- 
Member - Liberal International  
This is [EMAIL PROTECTED]   Ici [EMAIL PROTECTED]
God Queen and country! Beware Anti-Christ rising!
BC, Vote Liberal!!

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] I'm having a blond moment with a while loop???

2005-05-08 Thread Marek Kilimajer
George Pitcher wrote:
Hi guys,
I'm doing something dumb but I can't see it.
The basic premise is:
sql search of orders sorted by customer
set g_customer_id to ''
loop through resultset
  if customer_id not same as last record's customer_id (g_customer_id)
get customer email details
set up message header if this is the first record for a customer
set item details
  else
set item details
set g_customer_id to customer_id
  endif
  send email
end loop
Should not be line "set g_customer_id to customer_id" be in the "if" 
part? It's certainly useless in the "else" part as it's already equal to 
 customer_id ;)

The problem is that as a sample I have two records from one demo customer
(me) and I can only get my email to handle one record - either sending
separate records for each record or one email covering the last record only
Its as if I should have another inner loop
Any tips
MTIA
George
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Between Query (0T)

2005-05-08 Thread Andy Pieters
On Sunday 08 May 2005 15:20, Ryan A wrote:
> Hi,
> Sorry I know this is OT but I'm hoping someone will still help...it should
> be quite simple :-)
> I have a field in the database called "age" which is a DATE field.
>
> I also have a webform where the user can select between which ages he wants
> the records shown...
> eg: if he types 23,25 then I should get all results where
> age >=23 and age <=25
>
SELECT * FROM 
`table`
WHERE `age` BETWEEN 25 AND 26;

You might want to sanitize your input first.

Like using intval() on your input or mysql_escape_string


Regards


Andy

> Thanks,
> Ryan
>
>
>
> --
> No virus found in this outgoing message.
> Checked by AVG Anti-Virus.
> Version: 7.0.308 / Virus Database: 266.11.6 - Release Date: 5/6/2005

-- 
Registered Linux User Number 379093
-- --BEGIN GEEK CODE BLOCK-
Version: 3.1
GAT/O/>E$ d-(---)>+ s:(+)>: a--(-)>? C$(+++) UL>$ P-(+)>++
L+++>$ E---(-)@ W+++>+++$ !N@ o? !K? W--(---) !O !M- V-- PS++(+++)
PE--(-) Y+ PGP++(+++) t+(++) 5-- X++ R*(+)@ !tv b-() DI(+) D+(+++) G(+)
e>$@ h++(*) r-->++ y--()>
-- ---END GEEK CODE BLOCK--
--
Check out these few php utilities that I released
 under the GPL2 and that are meant for use with a 
 php cli binary:
 
 http://www.vlaamse-kern.com/sas/
--

--

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] I'm having a blond moment with a while loop???

2005-05-08 Thread Andy Pieters
On Sunday 08 May 2005 12:55, George Pitcher wrote:
> Hi guys,
>
> I'm doing something dumb but I can't see it.
>
Actually you are doing many dumb things ;-)

Please post your real code instead of pseudo.  Then we'll have a look.  And if 
possible append a "describe table" so we can see how your table looks like.


Andy

-- 
Registered Linux User Number 379093
-- --BEGIN GEEK CODE BLOCK-
Version: 3.1
GAT/O/>E$ d-(---)>+ s:(+)>: a--(-)>? C$(+++) UL>$ P-(+)>++
L+++>$ E---(-)@ W+++>+++$ !N@ o? !K? W--(---) !O !M- V-- PS++(+++)
PE--(-) Y+ PGP++(+++) t+(++) 5-- X++ R*(+)@ !tv b-() DI(+) D+(+++) G(+)
e>$@ h++(*) r-->++ y--()>
-- ---END GEEK CODE BLOCK--
--
Check out these few php utilities that I released
 under the GPL2 and that are meant for use with a 
 php cli binary:
 
 http://www.vlaamse-kern.com/sas/
--

--

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] I'm having a blond moment with a while loop???

2005-05-08 Thread disguised.jedi
On 5/8/05, George Pitcher <[EMAIL PROTECTED]> wrote:
> Hi guys,
> 
> I'm doing something dumb but I can't see it.
> 
> The basic premise is:
> 
> sql search of orders sorted by customer
> set g_customer_id to ''
> loop through resultset
>   if customer_id not same as last record's customer_id (g_customer_id)
> get customer email details
> set up message header if this is the first record for a customer
> set item details
>   else
> set item details
> set g_customer_id to customer_id
>   endif
>   send email
> end loop
This looks fine to me.  Although you might want to use an $i that gets
incremented instead of the customer IDs.

> The problem is that as a sample I have two records from one demo customer
> (me) and I can only get my email to handle one record - either sending
> separate records for each record or one email covering the last record only
Not sure I understand what is going on..Could you post the code? 
It's kind of hard to troubleshoot code I can't see.

However, I can offer this suggestion.  Check your syntax.  Make sure
your loops have double equal signs, and be sure that the while loop
has a way of moving on in the records. (I didn't see anything like
that in the outline)

Also, you might want to try adding some echo statements in at the
various steps that output what is going to happen on the next line of
code.  That way you can see what it's doing, and how many times it's
doing it.  Even output the data in the table with a print_r to make
sure the data PHP has is the data you want it to loop through.  Adding
output to troubleshoot your code is always a good thing to do.

Take two of these and call me in the morning.  That is, try this
stuff, and if you can fix it, great.  If not, reply WITH CODE POSTED
and I'll be happy to tell you what I can, and I'm sure others will be
too.

-- 
[EMAIL PROTECTED]

PHP rocks!
"Knowledge is Power.  Power Corrupts.  Go to school, become evil"

Disclaimer: Any disclaimer attached to this message may be ignored. 
However, I must say that the ENTIRE contents of this message are
subject to other's criticism, corrections, and speculations.

This message is Certified Virus Free

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Between Query (0T)

2005-05-08 Thread Duncan Hill
On Sunday 08 May 2005 14:20, Ryan A wrote:
> Hi,
> Sorry I know this is OT but I'm hoping someone will still help...it should
> be quite simple :-)
> I have a field in the database called "age" which is a DATE field.

http://dev.mysql.com/doc/mysql/en/comparison-operators.html

'BETWEEN'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Between Query (0T)

2005-05-08 Thread Ryan A
Hey,
Thanks for replying.

> SELECT * FROM
> `table`
> WHERE `age` BETWEEN 25 AND 26;

I knew the above, but how do i use it with my date field when i have
birthdates like this:
01-01-1969
and 03-05-1955

Thanks,
Ryan




On 5/8/2005 4:28:44 PM, Andy Pieters ([EMAIL PROTECTED]) wrote:
> On Sunday 08 May 2005 15:20, Ryan A wrote:
>
> > Hi,
>
> > Sorry I know this is OT but I'm hoping someone will still help...it
should
> > be quite simple :-)
> > I have a field in the database called "age" which is a DATE field.
> >
> > I also have a webform where the user can select between which ages he
wants
> > the records shown...
> > eg: if he types 23,25 then I should get all results where
> > age >=23 and age <=25
> >
> SELECT * FROM
> `table`
> WHERE `age` BETWEEN 25 AND 26;
>
> You might want to sanitize your input first.
>
> Like using intval() on your input or mysql_escape_string
>
>
> Regards
>
>
> Andy
>
> > Thanks,
> > Ryan
> >
> >
> >
> > --
> > No virus found in this outgoing message.
> > Checked by AVG Anti-Virus.
> > Version: 7.0.308 / Virus Database: 266.11.6 - Release Date: 5/6/2005
>
> --
> Registered Linux User Number 379093
> -- --BEGIN GEEK CODE BLOCK-
> Version: 3.1
> GAT/O/>E$ d-(---)>+ s:(+)>: a--(-)>? C$(+++) UL>



-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.11.6 - Release Date: 5/6/2005

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Reducing size of htm output

2005-05-08 Thread Andy Pieters
On Friday 06 May 2005 19:59, Kirsten wrote:
> I need to reduce the size of the HTM generated by a PHP script for faster
> transmission. I'm actually using ob_start("ob_gzhandler") but I also need
> some function to reduce the size of javascript blocks, deletion of
> unnecesary blanks, etc.


Hi Kirsten,

You know, PHP can be used to create all kinds of files "on the fly".  It is 
not limited to html files.

I would suggest you rewrite your javascript into a seperate file.



When you need to call javascript functions, include them like this: 

With this scheme, the browser can cache the different bits of the script, and 
you don't need to send all of the script on each page hit.

Kind regards


Andy

-- 
Registered Linux User Number 379093
-- --BEGIN GEEK CODE BLOCK-
Version: 3.1
GAT/O/>E$ d-(---)>+ s:(+)>: a--(-)>? C$(+++) UL>$ P-(+)>++
L+++>$ E---(-)@ W+++>+++$ !N@ o? !K? W--(---) !O !M- V-- PS++(+++)
PE--(-) Y+ PGP++(+++) t+(++) 5-- X++ R*(+)@ !tv b-() DI(+) D+(+++) G(+)
e>$@ h++(*) r-->++ y--()>
-- ---END GEEK CODE BLOCK--
--
Check out these few php utilities that I released
 under the GPL2 and that are meant for use with a 
 php cli binary:
 
 http://www.vlaamse-kern.com/sas/
--

--

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Fastest templating mechanism

2005-05-08 Thread trlists
On 8 May 2005 Evert | Rooftop Solutions wrote:

> What I really need is a fast lookup mechanism, to 'translate'
> statements. 
> 
> For example:
> 
> setOutputType('xhtml');
> echo(translate('authorstart'));
> 
> the function translate opens xhtml.data, which contains:
> 
> authorstart : 
> authorend : 
> 
> so, the translate function looks 'authorstart' up and returns ' class="author">'
> 
> or if you had specified 'wml' as the outputtype, the file could like like:
> 
> authorstart : 
> authorend :  
> 
> and the function would return ''
> 
> This is all no problem, except that these lists can be pretty big. And I 
> wouldn't like to load them all into the memory, or have to loop through 
> the file every time translate is called.
> 
> So I need a very fast mechanism to overcome this problem.

I think it's called a database.  The fields are outputtype, key, and 
text to output, with an index on outputtype + key, then you do 
something like this:

select OutputText from TranslateTable where OutputType = 'wml'
and key = 'authorstart';

I wonder how many of these you really have.  If on each script 
invocation you will be looking up many of them (dozens or hundreds) it 
might be more efficient to load all the ones for the outputtype you are 
using into a PHP array at the start, whether that's in a hard-coded 
array or loaded from the database.  If you're only looking up a couple 
then a separate database lookup for each one is probably more 
efficient.

Incidentally I would say this is not a templating problem.  It's simply 
a translation or lookup problem.

--
Tom

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Between Query (0T)

2005-05-08 Thread bala chandar
Hi,

On 5/8/05, Ryan A <[EMAIL PROTECTED]> wrote:
> Hi,
> Sorry I know this is OT but I'm hoping someone will still help...it should
> be quite simple :-)
> I have a field in the database called "age" which is a DATE field.

are u storing in terms of Date of Birth??? if so the below lines u cannot do

> 
> I also have a webform where the user can select between which ages he wants
> the records shown...
> eg: if he types 23,25 then I should get all results where
> age >=23 and age <=25

Instead store the age in a column with int data type. or else

you must provide date range using some calendar script

> 
> Thanks,
> Ryan
> 


-- 
bala> balachandar muruganantham
blog> lynx http://chandar.blogspot.com
web> http://www.chennaishopping.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Question about acessing databases and formatting output

2005-05-08 Thread bala chandar
On 5/8/05, The Doctor <[EMAIL PROTECTED]> wrote:
> On Thu, May 05, 2005 at 05:49:38AM -0600, The Doctor wrote:
> > On Thu, May 05, 2005 at 10:11:14AM +0530, bala chandar wrote:
> > > hi,
> > >
> > > On 5/5/05, The Doctor <[EMAIL PROTECTED]> wrote:
> > > > This is probably easy, but how does
> > > > one access a database, mysql or oracle or postgresql,
> > > > and
> > > > present the data in a tabular format?
> > > >
> > > > --
> > > >
> > >
> > > check out http://in2.php.net/mysql
> > >
> >
> > Looks good to me.
> >
> 
> So far so good except my blobs are appearing as is instead of
> as an interpret item.  What next?
> > > --

what are you storing in BLOB? 


-- 
bala> balachandar muruganantham
blog> lynx http://chandar.blogspot.com
web> http://www.chennaishopping.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] I'm having a blond moment with a while loop???

2005-05-08 Thread George Pitcher
Andy, and the others who have kindly responded,

I managed to get this sorted.

Ta

George

> -Original Message-
> From: Andy Pieters [mailto:[EMAIL PROTECTED]
> Sent: 8 May 2005 3:26 pm
> To: php-general@lists.php.net
> Subject: Re: [PHP] I'm having a blond moment with a while loop???
> 
> 
> On Sunday 08 May 2005 12:55, George Pitcher wrote:
> > Hi guys,
> >
> > I'm doing something dumb but I can't see it.
> >
> Actually you are doing many dumb things ;-)
> 
> Please post your real code instead of pseudo.  Then we'll have a 
> look.  And if 
> possible append a "describe table" so we can see how your table 
> looks like.
> 
> 
> Andy
> 
> -- 
> Registered Linux User Number 379093
> -- --BEGIN GEEK CODE BLOCK-
> Version: 3.1
> GAT/O/>E$ d-(---)>+ s:(+)>: a--(-)>? C$(+++) UL>$ P-(+)>++
> L+++>$ E---(-)@ W+++>+++$ !N@ o? !K? W--(---) !O !M- V-- PS++(+++)
> PE--(-) Y+ PGP++(+++) t+(++) 5-- X++ R*(+)@ !tv b-() DI(+) D+(+++) G(+)
> e>$@ h++(*) r-->++ y--()>
> -- ---END GEEK CODE BLOCK--
> --
> Check out these few php utilities that I released
>  under the GPL2 and that are meant for use with a 
>  php cli binary:
>  
>  http://www.vlaamse-kern.com/sas/
> --
> 
> --
> 
> -- 
> 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] Between Query (0T)

2005-05-08 Thread Matthew Weier O'Phinney
* Ryan A <[EMAIL PROTECTED]> :
> Thanks for replying.
>
> > SELECT * FROM
> > `table`
> > WHERE `age` BETWEEN 25 AND 26;
>
> I knew the above, but how do i use it with my date field when i have
> birthdates like this:
> 01-01-1969
> and 03-05-1955

Just like you would in the example above -- only with dates that are
compliant with your RDBMS, and using the earliest date first. The
formats you give -- 'MM-DD-' won't work in most RDBMS'; typically
you go from most general to most specific, e.g. '-MM-DD'. So, using
the dates you gave:

SELECT * FROM `table` WHERE `age` BETWEEN '1955-03-05' AND '1969-01-01';

The date fields may be subject to the UNIX epoch; if so, neither of the
dates above will be valid (epoch started 1970-01-01). Check the manual
for your RDBMS to see if this is the case.

Now, based on the OP's original question, about finding all users
between an age range, one would need to determine the start date and end
date prior to passing in the SQL. This can easily be done with
strtotime():

$ages = explode(',', $_GET['ages'], 2); // get the start/end ages
$startDate = date("Y-m-d", strtotime("-$ages[0] years"));
$endDate   = date("Y-m-d", strtotime("-$ages[1] years"));
$sql = "SELECT * FROM `table` WHERE `age` BETWEEN $startDate AND $endDate";

Hope that helps.

> On 5/8/2005 4:28:44 PM, Andy Pieters ([EMAIL PROTECTED]) wrote:
> > On Sunday 08 May 2005 15:20, Ryan A wrote:
> > > Sorry I know this is OT but I'm hoping someone will still
> > > help...it should be quite simple :-)
> > > I have a field in the database called "age" which is a DATE field.
> > >
> > > I also have a webform where the user can select between which ages
> > > he wants the records shown...
> > > eg: if he types 23,25 then I should get all results where
> > > age > =23 and age <=25
> > >
> > SELECT * FROM
> > `table`
> > WHERE `age` BETWEEN 25 AND 26;
> >
> > You might want to sanitize your input first.
> >
> > Like using intval() on your input or mysql_escape_string


-- 
Matthew Weier O'Phinney   | WEBSITES:
Webmaster and IT Specialist   | http://www.garden.org
National Gardening Association| http://www.kidsgardening.com
802-863-5251 x156 | http://nationalgardenmonth.org
mailto:[EMAIL PROTECTED] | http://vermontbotanical.org

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Between Query (0T)

2005-05-08 Thread Ryan A

On 5/8/2005 5:33:46 PM, Richard Collyer ([EMAIL PROTECTED]) wrote:
> Ryan A wrote:
>
> > Hi,
>
> > Sorry I know this is OT but I'm hoping someone will still help...it
should
> > be quite simple :-)
> > I have a field in the database called "age" which is a DATE field.
> >
> > I also have a webform where the user can select between which ages he
wants
> > the records shown...
> > eg: if he types 23,25 then I should get all results where
> > age >=23 and age <=25
> >
> > Thanks,
> > Ryan
> >
> >
> >
> What are you wanting? An sql query or a form?


Hey Richard,
Thanks for replying.

I have the form without a problem, I dont know how to format the SQL
query...
the birthdates in the DB are like this:

12-01-1979
05-03-7955
etc

Thanks,
Ryan



-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.11.6 - Release Date: 5/6/2005

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Between Query (0T)

2005-05-08 Thread Ryan A

On 5/8/2005 4:31:18 PM, Duncan Hill ([EMAIL PROTECTED]) wrote:
> On Sunday 08 May 2005 14:20, Ryan A wrote:
>
> > Hi,
>
> > Sorry I know this is OT but
> I'm hoping someone will still help...it should
> > be quite simple :-)
> > I have a field in the database called "age" which is a DATE field.
>
> http://dev.mysql.com/doc/mysql/en/comparison-operators.html
>
> 'BETWEEN'
>
Thanks,
But I already know how to use BETWEEN, just dont know how to format it when
I am getting 2 numbers like this:

20
66
and query a DATE field

Thanks,
Ryan




-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.11.6 - Release Date: 5/6/2005

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Between Query (0T)

2005-05-08 Thread Richard Collyer
Ryan A wrote:
On 5/8/2005 5:33:46 PM, Richard Collyer ([EMAIL PROTECTED]) wrote:
Ryan A wrote:

Hi,

Sorry I know this is OT but I'm hoping someone will still help...it
should
be quite simple :-)
I have a field in the database called "age" which is a DATE field.
I also have a webform where the user can select between which ages he
wants
the records shown...
eg: if he types 23,25 then I should get all results where
age >=23 and age <=25
Thanks,
Ryan

What are you wanting? An sql query or a form?

Hey Richard,
Thanks for replying.
I have the form without a problem, I dont know how to format the SQL
query...
the birthdates in the DB are like this:
12-01-1979
05-03-7955
etc
Thanks,
Ryan

Your looking at something like. For ages between 21 and 23
$Upper = date("m-d-Y", mktime(0,0,0,date("m"),date("d"),date("y")-22));
$Lower = date("m-d-Y", mktime(0,0,0,date("m"),date("d"),date("y")-23));
$sql = "SELECT field1,field2,field3 FROM `table_name` WHERE `age` 
BETWEEN " . $Lower . " AND " . $Upper;

$result = myqsl_query($sql);
etc
Cheers
Richard
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Between Query (0T)

2005-05-08 Thread Ryan A

Your looking at something like. For ages between 21 and 23

$Upper = date("m-d-Y", mktime(0,0,0,date("m"),date("d"),date("y")-22));
$Lower = date("m-d-Y", mktime(0,0,0,date("m"),date("d"),date("y")-23));

$sql = "SELECT field1,field2,field3 FROM `table_name` WHERE `age`
BETWEEN " . $Lower . " AND " . $Upper;

$result = myqsl_query($sql);

etc

Cheers
Richard


Hey Rich,
Thanks! That is EXACTLY what I was looking for and instead I got around 10
people sending me
a link to the mySql manual's BETWEEN syntax :-)

Thanks mate, it works perfectly.

Cheers,
Ryan



-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.11.6 - Release Date: 5/6/2005

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Fastest templating mechanism

2005-05-08 Thread Evert | Rooftop Solutions
[EMAIL PROTECTED] wrote:
On 8 May 2005 Evert | Rooftop Solutions wrote:
 

What I really need is a fast lookup mechanism, to 'translate'
statements. 

For example:
setOutputType('xhtml');
echo(translate('authorstart'));
the function translate opens xhtml.data, which contains:
authorstart : 
authorend : 
so, the translate function looks 'authorstart' up and returns ''

or if you had specified 'wml' as the outputtype, the file could like like:
authorstart : 
authorend :  
and the function would return ''
This is all no problem, except that these lists can be pretty big. And I 
wouldn't like to load them all into the memory, or have to loop through 
the file every time translate is called.

So I need a very fast mechanism to overcome this problem.
   

I think it's called a database.  The fields are outputtype, key, and 
text to output, with an index on outputtype + key, then you do 
something like this:

select OutputText from TranslateTable where OutputType = 'wml'
and key = 'authorstart';
I wonder how many of these you really have.  If on each script 
invocation you will be looking up many of them (dozens or hundreds) it 
might be more efficient to load all the ones for the outputtype you are 
using into a PHP array at the start, whether that's in a hard-coded 
array or loaded from the database.  If you're only looking up a couple 
then a separate database lookup for each one is probably more 
efficient.
 

Yes I thought of this, but in my case a flat file would be better. The 
same problem applies though:
[quote]
This is all no problem, except that these lists can be pretty big. And I
wouldn't like to load them all into the memory, or have to loop through
the file every time translate is called.
[/quote]

I don't know how much lookups there will be (can either be many or some) 
and I need the fastest solution there is, because the function _can_ be 
called loads of times. I think it will be hundreds per page, and 
thousands in total.

I'm already thinking of cache mechanisms, because it has to work 
efficiently on very high loads.

Incidentally I would say this is not a templating problem.  It's simply 
a translation or lookup problem.

 

True =)
grt,
Evert
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Fastest templating mechanism

2005-05-08 Thread James Williams
> Hi everyone,
> 
> Thanks for your replies. I Think I haven't been very clear about what I
> really need. First of all, I don't need an existing templating system,
> because I am working on my own templating system.
> And regarding Satyam's post. This looks a lot like what I'm developing
> right now, but also not my issue =)
> 
> What I really need is a fast lookup mechanism, to 'translate' statements.
> 
> For example:
> 
> setOutputType('xhtml');
> echo(translate('authorstart'));
> 
> the function translate opens xhtml.data, which contains:
> 
> authorstart : 
> authorend : 

So, is you're entire website template going to just look like those
keywords???  If you ask me that seems kinda pointless and if anything,
just extra overhead for your app

> 
> so, the translate function looks 'authorstart' up and returns ' class="author">'
> 
> or if you had specified 'wml' as the outputtype, the file could like like:
> 
> authorstart : 
> authorend :  
> 
> and the function would return ''
> 
> This is all no problem, except that these lists can be pretty big. And I
> wouldn't like to load them all into the memory, or have to loop through
> the file every time translate is called.
> 
> So I need a very fast mechanism to overcome this problem.

If you're deadset on doing this, I would go with a database and
str_replace().  str_replace() is always better than a regex solution
because it doesn't incur the overhead of the regex engine.  Only use
regex when you need a complex solution.

> Any ideas?
> 
> grt,
> Evert



-- 
jamwil.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Question about acessing databases and formatting output

2005-05-08 Thread The Doctor
On Sun, May 08, 2005 at 08:56:25PM +0530, bala chandar wrote:
> On 5/8/05, The Doctor <[EMAIL PROTECTED]> wrote:
> > On Thu, May 05, 2005 at 05:49:38AM -0600, The Doctor wrote:
> > > On Thu, May 05, 2005 at 10:11:14AM +0530, bala chandar wrote:
> > > > hi,
> > > >
> > > > On 5/5/05, The Doctor <[EMAIL PROTECTED]> wrote:
> > > > > This is probably easy, but how does
> > > > > one access a database, mysql or oracle or postgresql,
> > > > > and
> > > > > present the data in a tabular format?
> > > > >
> > > > > --
> > > > >
> > > >
> > > > check out http://in2.php.net/mysql
> > > >
> > >
> > > Looks good to me.
> > >
> > 
> > So far so good except my blobs are appearing as is instead of
> > as an interpret item.  What next?
> > > > --
> 
> what are you storing in BLOB? 
>

First a .tgf and then a jpg.
 
> 
> -- 
> bala> balachandar muruganantham
> blog> lynx http://chandar.blogspot.com
> web> http://www.chennaishopping.com
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

-- 
Member - Liberal International  
This is [EMAIL PROTECTED]   Ici [EMAIL PROTECTED]
God Queen and country! Beware Anti-Christ rising!
BC, Vote Liberal!!

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Sending htm as it's being generated

2005-05-08 Thread Kirsten
How do I make the browser to display data as it being generated? I've
noticed some websites do this with cgi.
For example:



XXX



<%
$i = 0;
while (true){
  echo "" . $i++ . "";
  sleep(1);
}
%>



This scripts does not work: It only shows 0,1,2,3[29] when the timeout
limit is reached.
Any ideas?

Thanks.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Any alternative to POST method FTP uploads from client computer?

2005-05-08 Thread Murray @ PlanetThoughtful
Hi All,

 

I need to implement the ability to ftp upload files from client machines via
a form in a web application I'm developing.

 

>From reading the PHP help, all I can find to perform this is the POST method
for handling file uploads
(http://au2.php.net/manual/en/features.file-upload.php).

 

>From my perspective, while this seems to work, there are a couple of
drawbacks, most important of which is that it seems you can only do
comparisons of the uploaded file, against the potential that the file has
already been uploaded, once the file has already been uploaded and is
sitting in the server temp directory.

 

This is a drawback to our application because the files can typically vary
on a daily basis in size from 20mb thru to 400mb, and 400mb seems like a lot
of bandwidth to consume to discover that the file already exists on our
server.

 

I had hoped there was a way in which I could retrieve stats of the file
being uploaded prior to beginning the upload, to compare against files in
the target directory, so that the application can advise the user that the
file already exists and to give them the option to cancel the upload.

 

Another minor drawback is that it seems the Post upload method changes the
file datetime to the datetime of the upload. 

 

So, can anyone confirm that there is no other way to upload files from a
client machine using a form? (and assuming they don't have an ftp server at
their end).

 

Much warmth,

 

Murray

 



[PHP] API Number

2005-05-08 Thread Cole Ashcraft
Hi.

I need to know what PHP version had API # 20001222.

Thanks,
Cole

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: Bug, erreurs ou non =?iso-8859-1?q?document=E9?=

2005-05-08 Thread Andy Pieters
On Wednesday 04 May 2005 22:47, Amir Mohammad Saied wrote:
Bonjour Amir

C'est liste est en Anglais.

Cependant, la réponse:

Il est necessaire de 'eschapper' le character '\' 
 
Au lieux d'ecrire '\', il faut ecrire '\\'

Donc si le chemin est

\\srvdfs00\partages\0-50\M7\05_APValidation\Forfait_Entreprise

Il faut le changer en 

srvdfs00\\partages\\0-50\\M7\\05_APValidation\\Forfait_Entreprise

Svp, repondéz en ANGLAIS


> [EMAIL PROTECTED] wrote:
> > Bonjour,
> >
> > J'utilise php en profondeur depuis peu.
> > Je viens d'utiliser les fonctions sur les fichier tel que is_file(),
> > is_dir() ou encore file_exists().
> >
> > J'obtiens des résultat qui ne correspondent pas à la documentation.
> > Apparement la longueur de chaîne influe sur le résultat obtenu.
> > En effet voici le test simple que j'ai effectuer :
> >
> > $file =
> > "\\\srvdfs00\\partages\\0-50\\M7\\05_APValidation\\Forfait_Entreprise
> >_Chaîne_de_Valeur"; echo "len : " . strlen($file) ."";
> > echo "file : " . $file . "";
> > if (is_dir($file)) {
> > echo "false";
> > } else {
> > echo "true";
> > }
> > echo "";
> >
> >
> > $file =
> > "\\\srvdfs00\\partages\\0-50\\M7\\05_APValidation\\Forfait_Entreprise
> >_Chaîne_de_Valeur\\Entreprise"; echo "len : " . strlen($file) ."";
> > echo "file : " . $file . "";
> > if (is_dir($file)) {
> > echo "false";
> > } else {
> > echo "true";
> > }
> > echo "";
> >
> > Voici le résultat :
> >
> > len : 83
> > file :
> > \\srvdfs00\partages\0-50\M7\05_APValidation\Forfait_Entreprise_Chaîne
> >_de_Valeur false
> >
> >
> > len : 94
> > file :
> > \\srvdfs00\partages\0-50\M7\05_APValidation\Forfait_Entreprise_Chaîne
> >_de_Valeur\Entreprise true
> >
> >
> >
> > Il est evident que j'ai tester les 2 repertoires dans un explorateur
> > windows et que les chemins sont les bons.
> > Je suis sous NT et le partage réseau doit surement être sous windows
> >
> > Merci de votre réponse.
> >
> > Jérémy Hennegrave (Pour Bouygues Telecom)
>
> Here is an english newsgroup, please ask your question in english, or go
> to your language sections

-- 
Registered Linux User Number 379093
-- --BEGIN GEEK CODE BLOCK-
Version: 3.1
GAT/O/>E$ d-(---)>+ s:(+)>: a--(-)>? C$(+++) UL>$ P-(+)>++
L+++>$ E---(-)@ W+++>+++$ !N@ o? !K? W--(---) !O !M- V-- PS++(+++)
PE--(-) Y+ PGP++(+++) t+(++) 5-- X++ R*(+)@ !tv b-() DI(+) D+(+++) G(+)
e>$@ h++(*) r-->++ y--()>
-- ---END GEEK CODE BLOCK--
--
Check out these few php utilities that I released
 under the GPL2 and that are meant for use with a 
 php cli binary:
 
 http://www.vlaamse-kern.com/sas/
--

--

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] select statement

2005-05-08 Thread Andy Pieters
On Thursday 05 May 2005 10:10, Anasta wrote:
> Why doesnt this work, it shows the username but not the balance of the
> users money.here is the mysql table:
>
>  include("connect.php");
> $uname=$_SESSION['username'];
> $user_balance=mysql_query($sql);
> $sql = "Select  FROM users ,user_balance WHERE user_id =$uname";
> $result = mysql_query();
>
> ?>
> 
> 


Hi Anasta

In your code, when you issue the mysql_query command the first time, the 
variable $sql is still empty.

You should rewrite your script like this:
0))
{
$data=mysql_fetch_assoc($result);
mysql_free_result($result);
$user_balance=$data['user_balance'];
$found=true;
}
if(!(isset($found))
echo "Sorry, I could not find a record for user id $uname";
else
{
echo "User: $uname
 Balance:   $user_balance";
}
?>

Notes: 
* just because it comes from SESSION doesn't mean that it cannot be spoofed.  
That's why you should escape uname before including it in a query.
* in mysql commands, it is better to explicitally specify the resource link 
identifier you obtained when you opened the connection 
($link=mysql_connect(...))
* if you include a critical script, better use 'require' because it will cause 
php to stop parsing the page if it cannot find the script.


With kind regards

Andy
-- 
Registered Linux User Number 379093
-- --BEGIN GEEK CODE BLOCK-
Version: 3.1
GAT/O/>E$ d-(---)>+ s:(+)>: a--(-)>? C$(+++) UL>$ P-(+)>++
L+++>$ E---(-)@ W+++>+++$ !N@ o? !K? W--(---) !O !M- V-- PS++(+++)
PE--(-) Y+ PGP++(+++) t+(++) 5-- X++ R*(+)@ !tv b-() DI(+) D+(+++) G(+)
e>$@ h++(*) r-->++ y--()>
-- ---END GEEK CODE BLOCK--
--
Check out these few php utilities that I released
 under the GPL2 and that are meant for use with a 
 php cli binary:
 
 http://www.vlaamse-kern.com/sas/
--

--

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Sending htm as it's being generated

2005-05-08 Thread Andy Pieters
On Sunday 08 May 2005 22:17, Kirsten wrote:
I think you need to use ob_start first, then ob_flush on each update

Haven't tested it, but I think it's like this:

Note: I recommend using  instead of <% %> (this is because not every 
php server will recognize the asp style tags.



XXX


" . $i++ . "";
  ob_flush();
  sleep(1);
}
?>




Kind regards


Andy

-- 
Registered Linux User Number 379093
-- --BEGIN GEEK CODE BLOCK-
Version: 3.1
GAT/O/>E$ d-(---)>+ s:(+)>: a--(-)>? C$(+++) UL>$ P-(+)>++
L+++>$ E---(-)@ W+++>+++$ !N@ o? !K? W--(---) !O !M- V-- PS++(+++)
PE--(-) Y+ PGP++(+++) t+(++) 5-- X++ R*(+)@ !tv b-() DI(+) D+(+++) G(+)
e>$@ h++(*) r-->++ y--()>
-- ---END GEEK CODE BLOCK--
--
Check out these few php utilities that I released
 under the GPL2 and that are meant for use with a 
 php cli binary:
 
 http://www.vlaamse-kern.com/sas/
--

--

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Sending htm as it's being generated

2005-05-08 Thread Rasmus Lerdorf
http://au.php.net/flush

Kirsten wrote:
> How do I make the browser to display data as it being generated? I've
> noticed some websites do this with cgi.
> For example:
> 
> 
> 
> XXX
> 
> 
> 
> <%
> $i = 0;
> while (true){
>   echo "" . $i++ . "";
>   sleep(1);
> }
> %>
> 
> 
> 
> This scripts does not work: It only shows 0,1,2,3[29] when the timeout
> limit is reached.
> Any ideas?
> 
> Thanks.
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Sending htm as it's being generated

2005-05-08 Thread Richard Davey
Hello Kirsten,

Sunday, May 8, 2005, 9:17:22 PM, you wrote:

K> How do I make the browser to display data as it being generated? I've
K> noticed some websites do this with cgi.

You need to use output buffering, have a look at the OB functions in
the PHP manual to get you started.

Best regards,

Richard Davey
-- 
 http://www.launchcode.co.uk - PHP Development Services
 "I do not fear computers. I fear the lack of them." - Isaac Asimov

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Any alternative to POST method FTP uploads from client computer?

2005-05-08 Thread Richard Davey
Hello Murray,

Sunday, May 8, 2005, 9:20:58 PM, you wrote:

MP> So, can anyone confirm that there is no other way to upload files
MP> from a client machine using a form? (and assuming they don't have
MP> an ftp server at their end).

Forms can only POST (or GET, but we'll ignore that for now) data.
That's it. Welcome to the HTTP protocol, I'm afraid there is no
getting around this.

You can try using a signed Java applet to allow local uploading,
otherwise teach the end users how to use FTP clients? Your options
run out right about here. PHP being a server side language can only
deal with a file once it hits the server, if you want to check files
client side before they're uploaded, you need a client side language.

Best regards,

Richard Davey
-- 
 http://www.launchcode.co.uk - PHP Development Services
 "I do not fear computers. I fear the lack of them." - Isaac Asimov

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Any alternative to POST method FTP uploads from client computer?

2005-05-08 Thread Marek Kilimajer
Murray @ PlanetThoughtful wrote:
Hi All,
 

I need to implement the ability to ftp upload files from client machines via
a form in a web application I'm developing.
 

From reading the PHP help, all I can find to perform this is the POST method
for handling file uploads
(http://au2.php.net/manual/en/features.file-upload.php).
 

From my perspective, while this seems to work, there are a couple of
drawbacks, most important of which is that it seems you can only do
comparisons of the uploaded file, against the potential that the file has
already been uploaded, once the file has already been uploaded and is
sitting in the server temp directory.
 

This is a drawback to our application because the files can typically vary
on a daily basis in size from 20mb thru to 400mb, and 400mb seems like a lot
of bandwidth to consume to discover that the file already exists on our
server.
 

I had hoped there was a way in which I could retrieve stats of the file
being uploaded prior to beginning the upload, to compare against files in
the target directory, so that the application can advise the user that the
file already exists and to give them the option to cancel the upload.

PHP script starts once the upload is finished, but this is not true for 
some other languages, for example perl.

Another minor drawback is that it seems the Post upload method changes the
file datetime to the datetime of the upload. 
Browsers don't send file's modificaton time, so it's not available.
 

So, can anyone confirm that there is no other way to upload files from a
client machine using a form? (and assuming they don't have an ftp server at
their end).
Cliens need ftp client software, some sort is for sure installed on 
every machine.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] select statement

2005-05-08 Thread Josip Dzolonga
On ÐÐÐ, 2005-05-08 at 23:16 +0200, Andy Pieters wrote:
> Notes: 
> * just because it comes from SESSION doesn't mean that it cannot be spoofed.  
> That's why you should escape uname before including it in a query.

Is there something I do not know ? :). As far as I know, it can be
spoofed only if you have access to session data, which is held on the
server-side, so only someone with server access can spoof. Any other way
of doing it ?

Josip Dzolonga
http://josip.dotgeek.org

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] API Number

2005-05-08 Thread Marek Kilimajer
Cole Ashcraft wrote:
Hi.
I need to know what PHP version had API # 20001222.
Thanks,
Cole
4.0.5
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Sending htm as it's being generated

2005-05-08 Thread Josip Dzolonga
On ÐÐÐ, 2005-05-08 at 17:17 -0300, Kirsten wrote:
> This scripts does not work: It only shows 0,1,2,3[29] when the timeout
> limit is reached.
> Any ideas?

Yes, take a look at the AJAX method. For a beginning, the following link
http://www.adaptivepath.com/publications/essays/archives/000385.php
would be fine. Google for more, there are tons of AJAX articles out
there ;-)

Hope this helps,
Josip Dzolonga
http://josip.dotgeek.org

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] select statement

2005-05-08 Thread Richard Lynch
On Sun, May 8, 2005 3:20 pm, Josip Dzolonga said:
> On нед, 2005-05-08 at 23:16 +0200, Andy Pieters wrote:
>> Notes:
>> * just because it comes from SESSION doesn't mean that it cannot be
>> spoofed.
>> That's why you should escape uname before including it in a query.
>
> Is there something I do not know ? :). As far as I know, it can be
> spoofed only if you have access to session data, which is held on the
> server-side, so only someone with server access can spoof. Any other way
> of doing it ?

Are you on a shared server?

Then your session data is open to the other 199 clients on that server...

If you are *NOT* on a shared server, and if you are 100% confident that
nobody will ever compromise your server, and make your $_SESSION data a
priority to hack, well then, you're "safe"...

How much effort does it take to scrub your $_SESSION data, though?

What are you storing in there?

How "Bad" will it be if a Bad Guy breaks in and snarfs it?

Only you can answer these for a dedicated server/application.

Not scrubbing $_SESSION on a shared server...  That's just wrong, IMHO.

-- 
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] Sending htm as it's being generated

2005-05-08 Thread Rory Browne
either follow each echo call with a flush() function call, or enable
the implicit_flush in php.ini, or ini_set().

I don't think output buffering as described in the php docs is
particularly relevent in this case.

Bare in mind that some browsers don't display data either until they
have received a certain amount, or have closed the connection AFAIK.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Any alternative to POST method FTP uploads from client computer?

2005-05-08 Thread Richard Lynch

JavaScript *might* let the user choose a file and get its modification
date/time...

And then you could upload pieces of it at a time via JavaScript, I think.

Incredibly inefficient, most likely, but you *COULD*

You may want to just give the users training in some EZ ftp client, freely
available.

At any rate, it's unlikely that PHP will fit in to your solution for the
features you need...

On Sun, May 8, 2005 1:20 pm, Murray @ PlanetThoughtful said:
> Hi All,
>
>
>
> I need to implement the ability to ftp upload files from client machines
> via
> a form in a web application I'm developing.
>
>
>
> From reading the PHP help, all I can find to perform this is the POST
> method
> for handling file uploads
> (http://au2.php.net/manual/en/features.file-upload.php).
>
>
>
> From my perspective, while this seems to work, there are a couple of
> drawbacks, most important of which is that it seems you can only do
> comparisons of the uploaded file, against the potential that the file has
> already been uploaded, once the file has already been uploaded and is
> sitting in the server temp directory.
>
>
>
> This is a drawback to our application because the files can typically vary
> on a daily basis in size from 20mb thru to 400mb, and 400mb seems like a
> lot
> of bandwidth to consume to discover that the file already exists on our
> server.
>
>
>
> I had hoped there was a way in which I could retrieve stats of the file
> being uploaded prior to beginning the upload, to compare against files in
> the target directory, so that the application can advise the user that the
> file already exists and to give them the option to cancel the upload.
>
>
>
> Another minor drawback is that it seems the Post upload method changes the
> file datetime to the datetime of the upload.
>
>
>
> So, can anyone confirm that there is no other way to upload files from a
> client machine using a form? (and assuming they don't have an ftp server
> at
> their end).
>
>
>
> Much warmth,
>
>
>
> Murray
>
>
>
>


-- 
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] apache with php\fastcgi

2005-05-08 Thread Solotony
From: Solotony <[EMAIL PROTECTED]>
Subject: Apache 2.0 + mod_fastcgi + PHP
Newsgroups: gmane.comp.apache.user
Summary: 
Keywords: 

I have Apache 2.0.52 with mod_fastcgi 2.4.2 and PHP 4.3.11 installed on Gentoo 
box.

When starting apache (php as fast-cgi) it runs w/o any problems, but after 
some requests (500 - 1500) php die. 
It doesn't depend on method fastcgi server is started (FastCgiServer or 
FastCgiExternalServer) - in both cases it die.

How to repare it?


Apache config (part related to fastcgi):
--

ScriptAlias /std-cgi/ "/usr/std-cgi/"

LoadModule fastcgi_module extramodules/mod_fastcgi.so


AddHandler fastcgi-script .fcg .fcgi .fpl
AddHandler php-script .php
FastCgiConfig -maxClassProcesses 5 -maxProcesses 1000 -restart 
-killInterval 10
FastCgiServer /usr/std-cgi/php-fcgi -processes 1
#FastCgiExternalServer /usr/std-cgi/php-fcgi -host localhost:8002

SetHandler fastcgi-script

Action php-script /std-cgi/php-fcgi


---

error_log
---
[Sat May 07 22:48:49 2005] [notice] Digest: generating secret for digest 
authentication ...
[Sat May 07 22:48:49 2005] [notice] Digest: done
[Sat May 07 22:48:50 2005] [notice] FastCGI: process manager initialized (pid 
19004)
[Sat May 07 22:48:50 2005] [warn] FastCGI: server "/usr/std-cgi/php-fcgi" 
started (pid 7450)
[Sat May 07 22:48:50 2005] [warn] pid file /var/run/apache2.pid overwritten -- 
Unclean shutdown of previous Apache run?
[Sat May 07 22:48:50 2005] [notice] Apache/2.0.52 (Gentoo/Linux) 
mod_fastcgi/2.4.2 configured -- resuming normal operations
[Sat May 07 22:49:18 2005] [warn] FastCGI: server "/usr/std-cgi/php-fcgi" (pid 
7450) terminated by calling exit with status '0'
[Sat May 07 22:49:18 2005] [warn] FastCGI: server "/usr/std-cgi/php-fcgi" 
restarted (pid 8374)
[Sat May 07 22:50:01 2005] [warn] FastCGI: server "/usr/std-cgi/php-fcgi" (pid 
8374) terminated by calling exit with status '0'
[Sat May 07 22:50:01 2005] [warn] FastCGI: server "/usr/std-cgi/php-fcgi" 
restarted (pid 30308)
[Sat May 07 22:50:35 2005] [warn] FastCGI: server "/usr/std-cgi/php-fcgi" (pid 
30308) terminated by calling exit with status '0'
[Sat May 07 22:50:35 2005] [warn] FastCGI: server "/usr/std-cgi/php-fcgi" 
restarted (pid 1591)
[Sat May 07 22:51:24 2005] [warn] FastCGI: server "/usr/std-cgi/php-fcgi" (pid 
1591) terminated by calling exit with status '0'
[Sat May 07 22:51:24 2005] [warn] FastCGI: server "/usr/std-cgi/php-fcgi" has 
remained running for more than 30 seconds, its restart interval has been 
restored to 5 seconds
[Sat May 07 22:51:24 2005] [warn] FastCGI: server "/usr/std-cgi/php-fcgi" 
restarted (pid 8757)
[Sat May 07 22:52:58 2005] [warn] FastCGI: server "/usr/std-cgi/php-fcgi" (pid 
8757) terminated by calling exit with status '0'
[Sat May 07 22:52:58 2005] [warn] FastCGI: server "/usr/std-cgi/php-fcgi" 
restarted (pid 21006)
[Sat May 07 22:53:35 2005] [warn] FastCGI: server "/usr/std-cgi/php-fcgi" (pid 
21006) terminated by calling exit with status '0'
[Sat May 07 22:53:35 2005] [warn] FastCGI: server "/usr/std-cgi/php-fcgi" 
restarted (pid 5268)
[Sat May 07 22:54:03 2005] [warn] FastCGI: server "/usr/std-cgi/php-fcgi" (pid 
5268) terminated by calling exit with status '0'
[Sat May 07 22:54:03 2005] [warn] FastCGI: server "/usr/std-cgi/php-fcgi" 
restarted (pid 1000)
[Sat May 07 22:54:22 2005] [warn] FastCGI: server "/usr/std-cgi/php-fcgi" (pid 
1000) terminated by calling exit with status '0'
[Sat May 07 22:54:22 2005] [warn] FastCGI: server "/usr/std-cgi/php-fcgi" has 
failed to remain running for 30 seconds given 3 attempts, its restart interval 
has been backed off to 600 seconds
[Sat May 07 22:54:31 2005] [warn] FastCGI: server "/usr/std-cgi/php-fcgi" has 
failed to remain running for 30 seconds given 3 attempts, its restart interval 
has been backed off to 600 seconds
[Sat May 07 22:54:41 2005] [warn] FastCGI: server "/usr/std-cgi/php-fcgi" has 
failed to remain running for 30 seconds given 3 attempts, its restart interval 
has been backed off to 600 seconds
[Sat May 07 22:54:51 2005] [warn] FastCGI: server "/usr/std-cgi/php-fcgi" has 
failed to remain running for 30 seconds given 3 attempts, its restart interval 
has been backed off to 600 seconds
[Sat May 07 22:54:52 2005] [error] [client 192.168.1.115] FastCGI: comm with 
server "/usr/std-cgi/php-fcgi" aborted: idle timeout (30 sec)
[Sat May 07 22:54:52 2005] [error] [client 192.168.1.115] FastCGI: incomplete 
headers (0 bytes) received from server "/usr/std-cgi/php-fcgi"
[Sat May 07 22:55:01 2005] [warn] FastCGI: server "/usr/std-cgi/php-fcgi" has 
failed to remain running for 30 seconds given 3 attempts, its restart interval 
has been backed off to 600 seconds
[Sat May 07 22:55:11 2005] [warn] FastCGI: server "/usr/std-cgi/php-fcgi" has 
failed to remain running for 30 seconds given 3

Re: [PHP] using sockets to load a streaming windows media file

2005-05-08 Thread Richard Lynch
On Sat, May 7, 2005 8:05 pm, Dan Rossi said:
> Hi there, is there anyway possible to load a streaming windows media
> file via a socket connecting to output its contents to the browser or a
> windows media object. My issue is I am spitting out an asx playlist
> file however for some freak reason, whenever i put control logic around
> where i am outputting the playlist the player craps out saying playlist
> file format not recognised. Which is why I want to try out this way
> execpt socket transport doesnt understand mms :) Ie the file would look
> like mms://thefile

Sounds like maybe you have a PHP error message printing out in the stream...

What happens when you wget the URL with its headers?  Does the data look
right?

You may also need to "fool" MS by naming your PHP script as "thefile.wmv"
and then using .htaccess and ForceType to make it be a PHP script.

MS is really dumb about URLs versus file extensions.  really really dumb.

-- 
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] Random but ordered..

2005-05-08 Thread Richard Lynch
Check the MySQL manual for how to order randomly.

They might have a way to do it.

However...

If there are a fairly number of consistent plans in each company, you
might be better off with something that just chooses N companies at
random, enough to fill a page, and that's it.

One wrinkle is this:  If user X goes forward a page, can they see the same
company again, or does the order need to be fixed after they see page 1?

If it must be fixed, I think you'd be best served with making a @TEMP
table in MySQL and then assigning each company ID a random place in it,
and using that as your ordering for company IDs.

On Sat, May 7, 2005 5:52 am, Ryan A said:
> Hey,
>
> I have been screwing around with this code for around a day and am hitting
> a
> wall, any
> help would be appreciated.
>
>
> Basically, I am working on a site that queries the DB for companies and
> the
> plans the company
> is offering, the DB is quite big (a few thousand records in each of the 20
> tables)
>
> The parameters are taken from the client in the form of a search box and
> usually gives around 1000 results per query, they results are then
> displayed
> like this:
>
>
> company 1
> [] plan
> [] plan
> [] plan
> [] plan
> company 2
> [] plan
> [] plan
> [] plan
> company 3
> [] plan
> company 4
> [] plan
> [] plan
>
> So far, no problems (even though the code and the design are mixed
> together
> in the page)
> but so far the code is getting the results grouping via $cno, which
> results
> in the lowest being displayed first which gives the first companies who
> joined an edge as they are always getting displayed.
>
>
> Heres the kicker, he wants to have the same display as abovebut
> randomly
> from the DB *while still* having pagination.. so new joined companies too
> get displayed and not shoved at the end of the results.
>
>
> To see the code used presently (stripped down to a few lines) :
> http://jappz.com/testing.phpp
>
> To see the output from the above :
> http://jappz.com/testing.html
>
>
> Any suggestions, classes, code, links or general help would be
> appreciated.
>
> Thanks,
> Ryan
>
>
>
> --
> No virus found in this outgoing message.
> Checked by AVG Anti-Virus.
> Version: 7.0.308 / Virus Database: 266.11.6 - Release Date: 5/6/2005
>
> --
> 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] PHP 5, mySQL and Win XP. I NEED HELP

2005-05-08 Thread Richard Lynch
On Sat, May 7, 2005 4:56 am, Deep said:
> Hi,
>
>  If you are using localhost, i dont think u need to
> specify the port number. Localhost would be enough.
> Also pls check the user privileges and all in the
> database.
>
> ..Deep..
>
> --- Oscar Andersson <[EMAIL PROTECTED]>
> wrote:
>
>> I have made a instal of the latest mySQL and PHP 5
>> on my computer.
>> I have made the following changes to my php.ini file
>>
>> extension=php_mysql.dll
>> extension_dir = "c:\php\"
>>
>> and i have put the php_mysql. and libmysql.dll in
>> c:\php\ and in c:\windows
>> to
>>
>> Now i try this in my php-file
>> $con = mysql_connect("localhost:3306", "buddy",
>> "bestbuddy");
>>
>> I cant connect to mySQL. I dont know what is wrong.
>> mySQL listen to port
>> 3306. I have tried with my IP to. I get this warning
>> Warning: mysql_connect() [function.mysql-connect]:
>> Too many open links (0)
>> in myfilename.php.

Too many open links sounds to me like you've set up MySQL to only allow X
connections, and you are trying to open up X+1 connection.

The 0 would make me guess that X is 0.

So I'd *GUESS* you have a setting in my.cnf that says to limit number of
connections to 0, and that means you can't have any connections at all...

Just a GUESS.

-- 
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] Question about acessing databases and formatting output

2005-05-08 Thread The Doctor
On Sun, May 08, 2005 at 01:49:08PM -0600, The Doctor wrote:
> On Sun, May 08, 2005 at 08:56:25PM +0530, bala chandar wrote:
> > On 5/8/05, The Doctor <[EMAIL PROTECTED]> wrote:
> > > On Thu, May 05, 2005 at 05:49:38AM -0600, The Doctor wrote:
> > > > On Thu, May 05, 2005 at 10:11:14AM +0530, bala chandar wrote:
> > > > > hi,
> > > > >
> > > > > On 5/5/05, The Doctor <[EMAIL PROTECTED]> wrote:
> > > > > > This is probably easy, but how does
> > > > > > one access a database, mysql or oracle or postgresql,
> > > > > > and
> > > > > > present the data in a tabular format?
> > > > > >
> > > > > > --
> > > > > >
> > > > >
> > > > > check out http://in2.php.net/mysql
> > > > >
> > > >
> > > > Looks good to me.
> > > >
> > > 
> > > So far so good except my blobs are appearing as is instead of
> > > as an interpret item.  What next?
> > > > > --
> > 
> > what are you storing in BLOB? 
> >
> 
> First a .tgf and then a jpg.
>

Is their a way to embed the third column?

And what changes do I need to make to the php code?
  
> > 
> > -- 
> > bala> balachandar muruganantham
> > blog> lynx http://chandar.blogspot.com
> > web> http://www.chennaishopping.com
> > 
> 
> -- 

-- 
Member - Liberal International  
This is [EMAIL PROTECTED]   Ici [EMAIL PROTECTED]
God Queen and country! Beware Anti-Christ rising!
BC, Vote Liberal!!

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] expression between vertical bars

2005-05-08 Thread Richard Lynch
On Fri, May 6, 2005 12:25 pm, Jan said:
> Could someone explain to me the use of the vertical bar in
> expressions like "|<[^>]+>(.*)]+>|U". I understand that the
> vertical bars are used to separate the expression from the modifier,
> but can't find any documentation about the reasons and rules to do
> this.

The rule is that the first character, whatever it is, is THE character to
mark beginning and end of the expression.

The following are all the SAME:
"|<[^>]+>(.*)]+>|U"
"?<[^>]+>(.*)]+>?U"
"X<[^>]+>(.*)]+>XU"

/ is a common character to use, but he needed / in his expression, so he
picked | instead.

http://php.net/pcre

-- 
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] array diff with both values returned

2005-05-08 Thread Richard Lynch
On Fri, May 6, 2005 7:03 am, blackwater dev said:
> Hello,
>
> Is there a good way to get the difference in two arrays and have both
> values returned?  I know I can use array_dif to see what is in one and
> not the other but...I need it to work a bit differently.

I believe you want array_union followed by array_unique (or whatever those
are called)



-- 
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] Question about acessing databases and formatting output

2005-05-08 Thread bala chandar
Hi

On 5/9/05, The Doctor <[EMAIL PROTECTED]> wrote:
> On Sun, May 08, 2005 at 01:49:08PM -0600, The Doctor wrote:
> > On Sun, May 08, 2005 at 08:56:25PM +0530, bala chandar wrote:
> > > On 5/8/05, The Doctor <[EMAIL PROTECTED]> wrote:
> > > > On Thu, May 05, 2005 at 05:49:38AM -0600, The Doctor wrote:
> > > > > On Thu, May 05, 2005 at 10:11:14AM +0530, bala chandar wrote:
> > > > > > hi,
> > > > > >
> > > > > > On 5/5/05, The Doctor <[EMAIL PROTECTED]> wrote:
> > > > > > > This is probably easy, but how does
> > > > > > > one access a database, mysql or oracle or postgresql,
> > > > > > > and
> > > > > > > present the data in a tabular format?
> > > > > > >
> > > > > > > --
> > > > > > >
> > > > > >
> > > > > > check out http://in2.php.net/mysql
> > > > > >
> > > > >
> > > > > Looks good to me.
> > > > >
> > > >
> > > > So far so good except my blobs are appearing as is instead of
> > > > as an interpret item.  What next?
> > > > > > --
> > >
> > > what are you storing in BLOB?
> > >
> >
> > First a .tgf and then a jpg.

hey, check out this. this might help you

http://www.zend.com/zend/trick/tricks-sept-2001.php

> >
> 
> Is their a way to embed the third column?
> 
> And what changes do I need to make to the php code?
> 


-- 
bala> balachandar muruganantham
blog> lynx http://chandar.blogspot.com
web> http://www.chennaishopping.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Fastest lookup mechanism

2005-05-08 Thread trlists
[Note that I changed the thread title to reflect that this isn't really 
about templating.]

> Yes I thought of this, but in my case a flat file would be better. The 
> same problem applies though:
> [quote]
> This is all no problem, except that these lists can be pretty big. And I
> wouldn't like to load them all into the memory, or have to loop through
> the file every time translate is called.
> [/quote]

I don't understand your comments.  Why would a flat file be better?  
Unless you have fixed-length lines and a sorted file so that you can do 
a binary search, a database is going to be several orders of magnitude 
faster than a flat file.

Look, fundamentally you have a simple problem -- to find a needle in a 
very well-defined, orderly haystack.  This is a problem that many 
people have solved in the past and for which very robust solutions 
exist.  Those solutions are things like tree search, binary search, and 
hash table lookups.  An indexed database might use any of these, arrays 
in memory use hashing.

So these solutions exist but it seems you are saying "I cannot use any 
of those, I need to use a flat file, now tell me how to make it fast 
enough to be able to do perhaps hundreds of lookups per page".  My 
guess is you simply can't meet that goal with nothing but a flat file, 
unless your standards for page display time are very low.

The best way to make it faster is to convert your flat file to a 
database and/or load it as an array.  So my first question is, *why* 
are you objecting to these tried and true methods of answering exactly 
the question you are asking?

If you must use a pure flat file, the fastest search method I know of 
is to maintain it in sorted order with fixed-length lines and then do a 
binary search.  Algorithms for this are readily available if you are 
not familiar with the technique [a great if expensive source for 
algorithms of this type is the classic book "The Art of Computer 
Programming", volume 3, Searching and Sorting by Donald E. Knuth].  But 
binary search on a large flat file is still likely to be unacceptably 
slow for hundreds of lookups per page.

Caching will help but you will have the exact same problem with the 
cache -- how do you find the data you want within the cache?

--
Tom

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Any alternative to POST method FTP uploads from client computer?

2005-05-08 Thread bala chandar
Hi,

On 5/9/05, Murray @ PlanetThoughtful <[EMAIL PROTECTED]> wrote:
> Hi All,
> 
> I need to implement the ability to ftp upload files from client machines via
> a form in a web application I'm developing.
> 
> From reading the PHP help, all I can find to perform this is the POST method
> for handling file uploads
> (http://au2.php.net/manual/en/features.file-upload.php).
> 
> From my perspective, while this seems to work, there are a couple of
> drawbacks, most important of which is that it seems you can only do
> comparisons of the uploaded file, against the potential that the file has
> already been uploaded, once the file has already been uploaded and is
> sitting in the server temp directory.

Instead use the dynamic file names

say you upload a file filename.jpg

when u upload it name it dynamiccaly by appending date and time before
the file name
 like this

2005050501010-filename.jpg


> 
> This is a drawback to our application because the files can typically vary
> on a daily basis in size from 20mb thru to 400mb, and 400mb seems like a lot
> of bandwidth to consume to discover that the file already exists on our
> server.
> 
> I had hoped there was a way in which I could retrieve stats of the file
> being uploaded prior to beginning the upload, to compare against files in
> the target directory, so that the application can advise the user that the
> file already exists and to give them the option to cancel the upload.
> 
> Another minor drawback is that it seems the Post upload method changes the
> file datetime to the datetime of the upload.
> 
> So, can anyone confirm that there is no other way to upload files from a
> client machine using a form? (and assuming they don't have an ftp server at
> their end).
> 
> Much warmth,
> 
> 
> Murray
> 
> 


-- 
bala> balachandar muruganantham
blog> lynx http://chandar.blogspot.com
web> http://www.chennaishopping.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Question about acessing databases and formatting output

2005-05-08 Thread bala chandar
On 5/9/05, bala chandar <[EMAIL PROTECTED]> wrote:
> Hi
> 
> On 5/9/05, The Doctor <[EMAIL PROTECTED]> wrote:
> > On Sun, May 08, 2005 at 01:49:08PM -0600, The Doctor wrote:
> > > On Sun, May 08, 2005 at 08:56:25PM +0530, bala chandar wrote:
> > > > On 5/8/05, The Doctor <[EMAIL PROTECTED]> wrote:
> > > > > On Thu, May 05, 2005 at 05:49:38AM -0600, The Doctor wrote:
> > > > > > On Thu, May 05, 2005 at 10:11:14AM +0530, bala chandar wrote:
> > > > > > > hi,
> > > > > > >
> > > > > > > On 5/5/05, The Doctor <[EMAIL PROTECTED]> wrote:
> > > > > > > > This is probably easy, but how does
> > > > > > > > one access a database, mysql or oracle or postgresql,
> > > > > > > > and
> > > > > > > > present the data in a tabular format?
> > > > > > > >
> > > > > > > > --
> > > > > > > >
> > > > > > >
> > > > > > > check out http://in2.php.net/mysql
> > > > > > >
> > > > > >
> > > > > > Looks good to me.
> > > > > >
> > > > >
> > > > > So far so good except my blobs are appearing as is instead of
> > > > > as an interpret item.  What next?
> > > > > > > --
> > > >
> > > > what are you storing in BLOB?
> > > >
> > >
> > > First a .tgf and then a jpg.
> 
 hey, check out this. this might help you
 
 http://www.zend.com/zend/trick/tricks-sept-2001.php

http://forum.100megswebhosting.com/archive/index.php/t-2971.html
> 
> > >
> >
> > Is their a way to embed the third column?
> >
> > And what changes do I need to make to the php code?
> >
> 
 

-- 
bala> balachandar muruganantham
blog> lynx http://chandar.blogspot.com
web> http://www.chennaishopping.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Between Query (0T)

2005-05-08 Thread Matthew Weier O'Phinney
* Richard Collyer <[EMAIL PROTECTED]> :
> Ryan A wrote:
> > On 5/8/2005 5:33:46 PM, Richard Collyer ([EMAIL PROTECTED]) wrote:
> > > Ryan A wrote:
> > > > Sorry I know this is OT but I'm hoping someone will still
> > > > help...it should be quite simple :-)
> > > > I have a field in the database called "age" which is a DATE field.
> > > > I also have a webform where the user can select between which
> > > > ages he wants the records shown...
> > > > eg: if he types 23,25 then I should get all results where
> > > > age > =23 and age <=25
> > > 
> > > What are you wanting? An sql query or a form?
> > 
> > Thanks for replying.
> > 
> > I have the form without a problem, I dont know how to format the SQL
> > query...
> > the birthdates in the DB are like this:
> > 
> > 12-01-1979
> > 05-03-7955
> > etc
>
> Your looking at something like. For ages between 21 and 23
>
> $Upper = date("m-d-Y", mktime(0,0,0,date("m"),date("d"),date("y")-22));
> $Lower = date("m-d-Y", mktime(0,0,0,date("m"),date("d"),date("y")-23));

Easier than mktime() is strtotime:

$upper = date("m-d-Y", strtotime("-22 years"));
$lower = date("m-d-Y", strtotime("-23 years"));

However... since the OP will be using this in MySQL, use "Y-m-d" as the
date format (see the MySQL manual for valid date formats for comparisons).

-- 
Matthew Weier O'Phinney   | WEBSITES:
Webmaster and IT Specialist   | http://www.garden.org
National Gardening Association| http://www.kidsgardening.com
802-863-5251 x156 | http://nationalgardenmonth.org
mailto:[EMAIL PROTECTED] | http://vermontbotanical.org

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] compiling dynamic extensions without root access

2005-05-08 Thread Richard Lynch
On Fri, May 6, 2005 5:37 am, Dan Rossi said:
> I was going to ask, without the need of requesting our admins to
> recompile php all the time is there a way in the meantime to compile
> extensions and load them dynamically without the need for root access
> to some of the php libraries ? I have always compiled in personally so
> have never tried it. But there a few things i'd like which would take
> forever to get requested. Let me know.

Your admin may also have set up permissions so that you can't dl() the
module you compile...

You may find it easier to just install Apache/PHP/MySQL on your own
desktop or laptop and play with all the fun extensions there.

-- 
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] sort by date

2005-05-08 Thread Richard Lynch
On Thu, May 5, 2005 10:42 pm, William Stokes said:
> I made a mistake and stored date information to DB as varchar values
> (dd.mm.yyy). When I read the DB is it still possible to sort the data by
> date with SQL query (ORDER BY date ASC)? Or is it nessessary to have the
> date information to be stored as a date in the DB? Will it work or is the
> output going to be sorted randomly?

As noted, your best solution is to fix the database.

A short-term hack would be to:
order by substring(your_field, 6, 4), substring(your_Field, 3, 2),
substring(your_field, 1, 2)

Read the MySQL manual to check the actual numbers for substring in MySQL

-- 
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] Sending htm as it's being generated

2005-05-08 Thread Richard Lynch
On Sun, May 8, 2005 6:02 pm, Rory Browne said:
> Bare in mind that some browsers don't display data either until they
> have received a certain amount, or have closed the connection AFAIK.

Actually...

First, the web server may well have some kind of buffering going on,
though current Apache/PHP play well together to allow flush() to flush(),
I do believe.  Older versions of Apache/PHP, not so much, as I recall.

Next, there could be other buffers involved, over which you have no control.

Squid, for example, could conceivably be configured/designed to buffer
some data. (I have no idea if it *does* but it *could* have been designed
to do so)

Finally, many browsers will not display things like TABLE tags until they
have all the TABLE so they know how to lay it out to give enough column
space to each element.

So your HTML can drastically affect the user's perception of how fast a
slow process works.

-- 
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] Any alternative to POST method FTP uploads from client computer?

2005-05-08 Thread Murray @ PlanetThoughtful
> Hi,
> 
> On 5/9/05, Murray @ PlanetThoughtful <[EMAIL PROTECTED]> wrote:
> > Hi All,
> >
> > I need to implement the ability to ftp upload files from client machines
> via
> > a form in a web application I'm developing.
> >
> > From reading the PHP help, all I can find to perform this is the POST
> method
> > for handling file uploads
> > (http://au2.php.net/manual/en/features.file-upload.php).
> >
> > From my perspective, while this seems to work, there are a couple of
> > drawbacks, most important of which is that it seems you can only do
> > comparisons of the uploaded file, against the potential that the file
> has
> > already been uploaded, once the file has already been uploaded and is
> > sitting in the server temp directory.
> 
> Instead use the dynamic file names
> 
> say you upload a file filename.jpg
> 
> when u upload it name it dynamiccaly by appending date and time before
> the file name
>  like this
> 
> 2005050501010-filename.jpg

Hi, yes, I'm already doing this. Conflict of filename isn't my issue -- it's
whether or not the file should be uploaded at all, in the first place.

The difficulty being that you can't examine the file until *after* it has
been uploaded.

As others have suggested, using an ftp client application is one way to
handle it, however, users being users, the feedback has been "Why do we need
to upload the files via an ftp client, *then* go to the web application and
attach the filename to a job entry? Why can't we do it all at once?"

The answer being, "Well, you can, but I bet you're going to be even more
annoyed when you've uploaded a huge file via the web application using the
POST upload method, only to find that the file is already there. Serves you
right for having too many stakeholders in uploading the files, dunnit?"

Sometimes, you just can't win. Not that I don't understand the
practicalities involved, but this one feature would have been nice.

Regards,

Murray

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Reducing size of htm output

2005-05-08 Thread Prathaban Mookiah
Oops. Sorry, you are correct. I did not look at the ob_gzhandler. I just 
thought of the ob_start function.

But I remember gz encoding works fine with IE 5. Shouldn't be a problem with 
5.5.

Cheers,

Prathap


-- Original Message ---
From: Rasmus Lerdorf <[EMAIL PROTECTED]>
To: Prathaban Mookiah <[EMAIL PROTECTED]>
Cc: Kirsten <[EMAIL PROTECTED]>, php-general@lists.php.net
Sent: Fri, 06 May 2005 14:31:04 -0700
Subject: Re: [PHP] Reducing size of htm output

> Prathaban Mookiah wrote:
> > Is it true that ob_start("ob_gzhandler") can cause problems on IE 5.5+?
> > 
> > Since IE  is on the client side, it shouldn't cause any 
problems 
> > to ob_start(), in that case any other PHP function.
> 
> That's not true.  ob_gzhandler is extremely browser-dependant since 
> it needs to check to see if the browser sent an appropriate accept-encoding
> header.  Some of the early IE versions sent accept-encoding: gzip but
> didn't correctly implement it, so you can run into problems if you 
> use ob_gzhandler with certain older browsers.  It is fine for all 
> the recent releases though.
> 
> -Rasmus
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
--- End of Original Message ---

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php