Re: [PHP] acerca de extensiones SQL Server

2007-07-14 Thread Paul Scott

On Sat, 2007-07-14 at 19:57 +0200, M. Sokolewicz wrote:
> That's assuming he wanted specifically MySQL. The OP's post did not 
> actually state _which_ extension he wants to use, nor to which RDBMS he 
> wants to connect (at all). To the OP: SQL is simply a language, what you 
> want is a database-system which works with that language. There are a 
> lot of good DataBase Management Systems, of which MySQL is a commonly 
> available one.
> 

What you want to do on debian is to aptitude install either:

php5-mysql OR php5-pgsql OR oci8 or something else for a different
RDBMS. If your db server is a separate machine, you will want the client
code as well, which will mean an install of, say, libmysqlclient as well
for mysql.

If you want both php and db on the same box, simply do an aptitude
install mysql-server-5.0 and mysql-client-5.0 as these meta packages
will install what you need as well as php5-mysql and/or php5-mysqli

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm 

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

Re: [PHP] Unlink file older then 7 days

2007-07-14 Thread Ray
On Saturday 14 July 2007 9:16:06 pm [EMAIL PROTECTED] wrote:
> I have a directory with .txt and .txt.asc files.
>
> What I want to do is..
>
> Check the age of all files ending in .txt.asc
>
> and if the file *.txt.asc is older then 7 days
>
> delete thatfile.txt.asc and also thatfile.txt
>

look at these functions (and also related functions, the bar on the right hand 
side):
http://ca3.php.net/manual/en/function.opendir.php
http://ca3.php.net/manual/en/function.fileatime.php
http://ca3.php.net/manual/en/function.unlink.php
HTH 
Ray

>
> Thanks
> Chris

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



[PHP] Unlink file older then 7 days

2007-07-14 Thread chris
I have a directory with .txt and .txt.asc files. 


What I want to do is..

Check the age of all files ending in .txt.asc 

and if the file *.txt.asc is older then 7 days 


delete thatfile.txt.asc and also thatfile.txt


Thanks
Chris

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



Re: [PHP] acerca de extensiones SQL Server

2007-07-14 Thread Stut

Robert Degen wrote:

I think you should install at least

  php5-mysql

and if you're using PEAR's db connection you'll need

  php-db

too.


"SQL Server" usually means "Microsoft SQL Server". There is plenty of 
documentation on the PHP website regarding getting the MSSQL extension 
installed.


-Stut

--
http://stut.net/


On Sa, Jul 14, 2007 at 10:39:40 -0400, Lic. Eduardo R. Hern?ndez Osorio wrote:
 


Hi:

I need use the SQL extension on PHP to connect to any SQL Server database.
How I configure PHP on Linux to use that extension? I use debian with
apache2 and PHP5 installed on it.

Waiting for your help,

Richard

 




Eduardo Ricardo Hernández Osorio

Técnico Telecomunicaciones Aeronáuticas

U.T.B Servicios Aeronáuticos, ECASA s.a.

Aeropuerto Internacional "Frank País García"

Tel: (53) (24) 474569

 


email: [EMAIL PROTECTED]

 


"...de buenas intenciones está empedrado el camino al infierno..."

 



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



[PHP] I am lost

2007-07-14 Thread Grant
Previously I had PHP on my older computer using IIS 5.1 it worked fine. But 
I'm on my new computer using IIS 7 and features like include or completely 
normal scripts that use to work no longer work. I have try to see if it's 
the web server and some of the times for the exception of the include 
function  it is. How would I fix my main server IIS 7, is the new PHP 5.2 
fully compatible with it? If not when will a fully functional PHP be 
available for work with IIS 7. In my php.ini file I began by using the 
recommended file and slightly modifying it enabling gd2, openssl and mysql.




Thanks,

Grant

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



Re: [PHP] preg_replace() help

2007-07-14 Thread Richard Heyes

What am I doing wrong?


Using regular expressions when you don't need to:

$txt = str_replace(' ', ' ', substr($txt, strpos($txt, --)));

Might be a few typos in there. And I may have mixed up the args.

--
Richard Heyes
+44 (0)844 801 1072
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



[PHP] Re: preg_replace() help

2007-07-14 Thread Al

What do you want out?

$txt = 'A promise is a debt. -- Irish Proverb'; =>

[1] $txt = 'A promise is a debt. --Irish Proverb';

OR [2] $txt = 'A promise is a debt. --IrishProverb';

for [1] $txt= preg_replace("%--\x20+%", '--', $txt); //The \x20+ is one or more 
spaces



Rick Pasotto wrote:

I have quotes like the following:

$txt = 'A promise is a debt. -- Irish Proverb';

I'd like to replace all the spaces afer the '--' with  

This is what I've tried:

$pat = '/( --.*)(\s|\n)/U';
$rpl = '$1$2 ';
while (preg_match($pat,$txt,$matches) > 0) {
print "$txt\n";
printf("[0]: <%s>\n",$matches[0]);
printf("[1]: <%s>\n",$matches[1]);
printf("[2]: <%s>\n",$matches[2]);
preg_replace($pat,$rpl,$txt);
}

The prints are for debugging. $matches contains what I expect but
nothing gets replaced and $txt stays the same so it loops forever.

What am I doing wrong?



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



[PHP] Re: Multiple Session Buffers

2007-07-14 Thread Al

You guys confirmed my understanding, it can't be done in a reasonable manner.

I'm adding a simple CAPTCHA to an existing page and don't want to bother tracing the code that 
modifies the session buffer.  It's obvious that the code is resetting the buffer, so it messes up my 
saving of the security number.  Obviously, I don't want it exposed with GET or shown in the HTML 
source.


I'll just make my own simple session-like buffer with a tmpfile() outside the 
webspace.

Al wrote:
Is there a way to instigate 2 separate named session buffers? They will 
contain different data.


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



Re: [PHP] acerca de extensiones SQL Server

2007-07-14 Thread M. Sokolewicz
That's assuming he wanted specifically MySQL. The OP's post did not 
actually state _which_ extension he wants to use, nor to which RDBMS he 
wants to connect (at all). To the OP: SQL is simply a language, what you 
want is a database-system which works with that language. There are a 
lot of good DataBase Management Systems, of which MySQL is a commonly 
available one.


- Tul

Robert Degen wrote:

Hi,

I think you should install at least

  php5-mysql

and if you're using PEAR's db connection you'll need

  php-db

too.

Robert



On Sa, Jul 14, 2007 at 10:39:40 -0400, Lic. Eduardo R. Hern?ndez Osorio wrote:
 


Hi:

I need use the SQL extension on PHP to connect to any SQL Server database.
How I configure PHP on Linux to use that extension? I use debian with
apache2 and PHP5 installed on it.

Waiting for your help,

Richard

 




Eduardo Ricardo Hernández Osorio

Técnico Telecomunicaciones Aeronáuticas

U.T.B Servicios Aeronáuticos, ECASA s.a.

Aeropuerto Internacional "Frank País García"

Tel: (53) (24) 474569

 


email: [EMAIL PROTECTED]

 


"...de buenas intenciones está empedrado el camino al infierno..."

 



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



[PHP] Re: Multiple Session Buffers

2007-07-14 Thread Tony Marston
The only way to do that is for each session to use a different session name 
other than the default PHPSESSID as a session_id is tied to a particular 
session_name, but then you would have to include a method of propagating 
this new session name between pages in the same session, either through the 
URL or a hidden field in each HTML form.

This is the technique that I use in the Radicore framework, as described in 
http://www.tonymarston.net/php-mysql/client-clones.html

-- 
Tony Marston
http://www.tonymarston.net
http://www.radicore.org

"Al" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Is there a way to instigate 2 separate named session buffers? They will 
> contain different data. 

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



Re: [PHP] acerca de extensiones SQL Server

2007-07-14 Thread Robert Degen
Hi,

I think you should install at least

  php5-mysql

and if you're using PEAR's db connection you'll need

  php-db

too.

Robert



On Sa, Jul 14, 2007 at 10:39:40 -0400, Lic. Eduardo R. Hern?ndez Osorio wrote:
>  
> 
> Hi:
> 
> I need use the SQL extension on PHP to connect to any SQL Server database.
> How I configure PHP on Linux to use that extension? I use debian with
> apache2 and PHP5 installed on it.
> 
> Waiting for your help,
> 
> Richard
> 
>  
> 
> 
> 
> Eduardo Ricardo Hernández Osorio
> 
> Técnico Telecomunicaciones Aeronáuticas
> 
> U.T.B Servicios Aeronáuticos, ECASA s.a.
> 
> Aeropuerto Internacional "Frank País García"
> 
> Tel: (53) (24) 474569
> 
>  
> 
> email: [EMAIL PROTECTED]
> 
>  
> 
> "...de buenas intenciones está empedrado el camino al infierno..."
> 
>  
> 

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



Re: [PHP] Alter an Array Key

2007-07-14 Thread Robert Cummings
On Sat, 2007-07-14 at 14:09 +0100, Stut wrote:
> 
> > 3. I'm not sure Roberts solution would work. I think it might result
> > in an endless loop, and timeout your script.
> 
> I always worry about adding or removing elements while iterating through 
> an array. I generally build up an array of keys to remove and remove 
> them in a separate loop afterwards just to be on the safe side.

I'm, not entirely sure, but I think foreach may grab a copy of the keys
before iteration. I've never worried about that in foreach although I
can remember issues back in the old days with the reset(), next(), end()
set of array traversal functions :)

If you're at all worried anyways, you can always do:



Cheers,
Rob.
-- 
...
SwarmBuy.com - http://www.swarmbuy.com

Leveraging the buying power of the masses!
...

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



Re: [PHP] Alter an Array Key

2007-07-14 Thread Robert Cummings
On Sat, 2007-07-14 at 01:57 -0400, Craige Leeder wrote:
>
> 3. I'm not sure Roberts solution would work. I think it might result
> in an endless loop, and timeout your script.

It works fine.

Cheers,
Rob.
-- 
...
SwarmBuy.com - http://www.swarmbuy.com

Leveraging the buying power of the masses!
...

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



Re: [PHP] Array Question

2007-07-14 Thread Robert Cummings
On Sat, 2007-07-14 at 00:55 -0500, Richard Lynch wrote:
> On Fri, July 13, 2007 2:15 am, Richard Lynch wrote:
> > On Thu, July 12, 2007 8:29 am, Robert Cummings wrote:
> >> Hmmm, I thought using an explicit cast was very self explanatory --
> >> especially when the name of the cast is "array". Maybe I'm alone in
> >> that
> >> thought. I mean if you convert a scalar to an array what do you
> >> expect
> >> to get? An array with the scalar. *shrug* I can't see how it would
> >> be
> >> anything else.
> >
> > $foo = (array) 'foo';
> > var_dump($foo);
> >
> > A couple perfectly reasonable (though wrong) outputs:
> >
> > #1
> > array (3){
> >   0 => 'f',
> >   1 => 'o',
> >   2 => 'o'
> > );
> >
> > And, actually, PHP having been derived (partially) from C, one could
> > almost argue this is the EXPECTED output. :-)
> 
> In retrospect, given that $foo[1] is 'o' and that you can treat $foo
> JUST like an array of characters, the EXPECTED output from a C->PHP
> perspective might be:
> 
> string (3) 'foo'
> 
> It already *IS* an array, to a large extent.
> 
> :-)

When in Rome do as the Romans. PHP has a very distinct definition for an
array and for a string. If you think you're using C then maybe you
should go read the documentation. Assumptions based on previous
experience only go as far as they are right. Since you explicitly cast
to an array and not to a string, it can only be expected that you have
an array -- or an exception as you previously offered. But we know you
get an array because it's documented.

:)

Cheers,
Rob.
-- 
...
SwarmBuy.com - http://www.swarmbuy.com

Leveraging the buying power of the masses!
...

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



RE: [PHP] Time formatting issues

2007-07-14 Thread Melissa W. Dickens


Thank you, Jay, that is interesting.

I am looking for the am / pm denomination, which I do not see in mktime()

I am essentially trying to have the TIME type which is a 24 hour clock
display instead as a 12 hour clock with am and pm.

I AM A TOTAL NEWBIE, (2ND DAY ever) so if I misunderstood the answer, I am
sorry!

Melissa

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



[PHP] acerca de extensiones SQL Server

2007-07-14 Thread Lic. Eduardo R. Hernández Osorio
 

Hi:

I need use the SQL extension on PHP to connect to any SQL Server database.
How I configure PHP on Linux to use that extension? I use debian with
apache2 and PHP5 installed on it.

Waiting for your help,

Richard

 



Eduardo Ricardo Hernández Osorio

Técnico Telecomunicaciones Aeronáuticas

U.T.B Servicios Aeronáuticos, ECASA s.a.

Aeropuerto Internacional "Frank País García"

Tel: (53) (24) 474569

 

email: [EMAIL PROTECTED]

 

"...de buenas intenciones está empedrado el camino al infierno..."

 



RE: [PHP] Time formatting issues

2007-07-14 Thread Jay Blanchard
[snip]
I have a DB

with a field type DATE (called TideDATE)

and a field type TIME (one of which is called highFIRST)



How can I format the time fields from displaying 00:00:00 (a 24 hour
clock) 
to HH:MM am/pm format?
[/snip]

Have a look at http://www.php.net/mktime

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



[PHP] Time formatting issues

2007-07-14 Thread Melissa
I have a DB

with a field type DATE (called TideDATE)

and a field type TIME (one of which is called highFIRST)



How can I format the time fields from displaying 00:00:00 (a 24 hour clock) 
to HH:MM am/pm format?



The DATE function has all kinds of neat formatters, but I do not find any 
for TIME

In DATE, I would say "g:i A"



If I try it with a TIME field, I get errors!



I HAVE NEVER USED A NEWSGROUP BEFORE, SO I HOPE I HAVE DONE THIS 
CORRECTLY...

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



Re: [PHP] Alter an Array Key

2007-07-14 Thread Stut

Craige Leeder wrote:

1. Don't modify $_POST


Why not?


2. You controll the name of the array keys with the form. Why is there
any need to change them form PHP's side of things?


That's an assumption. A reasonable one in most cases, but not 
necessarily the case.



3. I'm not sure Roberts solution would work. I think it might result
in an endless loop, and timeout your script.


I always worry about adding or removing elements while iterating through 
an array. I generally build up an array of keys to remove and remove 
them in a separate loop afterwards just to be on the safe side.


-Stut

--
http://stut.net/

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



Re: [PHP] Re: Announcing Xaja, a PHP Reverse Ajax framework

2007-07-14 Thread David Négrier
Indeed, Xaja relies on the keeping of an open connexion between the server
and the browser.
In fact, it uses, the Comet approach (which is a pain to implement in
Javascript because the IE code and the Firefox code are completely
different).
(more information here:
http://www.thecodingmachine.com/cmsDoc/xaja/trunk/architecture.html)

The whole idea behind Xaja is to built a complete framework on top of the
Comet-like javascript library that will enable the developer to write as
few Javascript as possible. So, indeed, through the "XajaController"
object, we are implementing a "data driven programming" library on top of
the classical request/response HTTP protocol.

Regarding performances: Indeed, since a connexion is kept open for each
browser, this consumes a few connexions on the server (that's not a big
problem). Each process also takes some memory. Xaja is still in an early
stage of development and I haven't had the opportunity to run a full
performance test, but basically, right now, I can tell that a simple
applications takes 5 Mo of RAM per client. Which means that for 100
concurrent users, you need 500 Mo of RAM on your server. Now, the vast
majority of the servers have less than 100 concurrent users, and at this
early point in the development cycle of Xaja, I wouldn't recommend
installing Xaja on a server that has more than 100 concurrent users! ;)

Regards,
David.


Nathan Nobbe a écrit :
> I understand the use of AJAX to only update a subset of the DOM on a page,
> rather than rebuild the entire page.  What i was getting at though is
> eliminating
> the busy-wait model by using the Observer pattern to push changes to the
> client
> only when the data has changed on the server side.  This is decidedly more
> efficient in general and is more commonly referred to as *event driven
> programming*
> or *data driven programming*.  it sounds like the only way to implement
such
> a model
> over HTTP is by keeping the connection open; which in some circumstances
may
> be appropriate.
> I have to say though, I never thought of using busy waiting to update
just a
> portion
> of the DOM.  It seems like almost a no-brainier, but since i havent worked
> w/ AJAX
> much it just never crossed my mind.  That sounds like the most practical
> approach in
> general.
>
> -nathan
>
>
> On 7/13/07, Tijnema <[EMAIL PROTECTED]> wrote:
>>
>> On 7/13/07, Nathan Nobbe <[EMAIL PROTECTED]> wrote:
>> > > On 7/13/07, Robert Cummings <[EMAIL PROTECTED]> wrote:
>> > > This isn't possible since you can't request a connection to the
>> client's
>> > > machine. Only the other way around.
>> >
>> > hmm...  in that case perhaps the open connection could be employed and
>> > the feature used selectively; only on certain pages for instance ?
>> > im thinking mainly of a monitoring page; like an app that shows a
>> servers
>> > state,
>> > or stock quotes or something.
>> > the main reason i dont like a javascript timer refreshing the page is
>> > sometimes you
>> > dont want the whole page refreshed; especially when halfway through
>> filling
>> > out a
>> > form on the page ;)
>> >
>> > -nathan
>>
>> Well, that's why AJAX is there, you do a check to a server to see if
>> there's any new data to parse, if so, then you update (and probably
>> only one or two divs on your site, and not the whole page)
>>
>> Keeping connection open isn't quite bad for sites that are visited a
>> lot, as for each connection, a new port is opened to handle a client
>> connection. While you think you're connected to port 80, it is
>> actually redirected to another port (mostly from 3000 onwards). So, if
>> you have a lot of visiters, you might reach the limit of ports, 65536
>> (0-65535). Some of them are already in use, so you end up to have a
>> limit of about 65530 connections to keep open. For a normal site this
>> isn't a problem, but if you count on shared hosts, with let's say 20
>> sites, then they can all handle about 3200 connections. Half of the
>> users has probably more then one window open, which means another
>> connection. So you end up to have a maximum of about 2000 visiters at
>> same time for each site.
>>
>>
>> Tijnema
>>
>> >
>> > On 7/13/07, Robert Cummings <[EMAIL PROTECTED]> wrote:
>> > >
>> > > On Fri, 2007-07-13 at 14:59 -0400, Nathan Nobbe wrote:
>> > > > > On 7/13/07, Robert Cummings <[EMAIL PROTECTED]> wrote:
>> > > > > I haven't looked at the code for Xaja and in no way do I want to
>> > > > > subtract from its potential, but I'm going to guess that in some
>> way
>> > > > it
>> > > > > holds the HTTP connection open and as such is an expensive
>> feature.
>> > > > > Also, I'm not entirely sure, but isn't that the principle that
>> > > > Comet
>> > > > > uses?
>> > > >
>> > > > As i said ive only imagined such a feature.  In my imagination i
>> > > > wonder if it is possible to
>> > > > track the clients address in a data structure within the
>> application.
>> > > > Then a connection could be
>> > > > established whenever a push w