php-general Digest 15 Jul 2007 11:19:31 -0000 Issue 4904

Topics (messages 258868 through 258876):

Re: Multiple Session Buffers
        258868 by: Al

Re: preg_replace() help
        258869 by: Al
        258870 by: Richard Heyes

I am lost
        258871 by: Grant

Re: acerca de extensiones SQL Server
        258872 by: Stut
        258875 by: Paul Scott

Unlink file older then 7 days
        258873 by: chris.aquanuke.com
        258874 by: Ray

problem with array
        258876 by: Ross

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message ---
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.

--- End Message ---
--- Begin Message ---
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?


--- End Message ---
--- Begin Message ---
What am I doing wrong?

Using regular expressions when you don't need to:

$txt = str_replace(' ', '&nbsp;', 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

--- End Message ---
--- Begin Message --- 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

--- End Message ---
--- Begin Message ---
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..."


--- End Message ---
--- Begin Message ---
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 

--- End Message ---
--- Begin Message --- 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

--- End Message ---
--- Begin Message ---
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

--- End Message ---
--- Begin Message ---
I am using postcode anywhere for a 'where's my nearest' function.

All the geographical info is contained in an array, which when dumped looks 
like this

var_dump ($result);

array(1) { [0]=> array(13) { ["origin_postcode"]=> string(7) "EH2 2BE" 
["destination_postcode"]=> string(6) "EH2 2BE" ["distance"]=> string(3) 
"0.0" ["id"]=> string(1) "1" ["description"]=> string(8) "good man" 
["grid_east_m"]=> string(6) "326513" ["grid_north_m"]=> string(6) "675115" 
["longitude"]=> string(17) "-3.17731851516552" ["latitude"]=> string(16) 
"55.9634587262473" ["os_reference"]=> string(14) "NT 26513 75115" 
["wgs84_longitude"]=> string(17) "-3.17876048499117" ["wgs84_latitude"]=> 
string(16) "55.9634451567764" ["name"]=> string(12) "Jim Smith" } }

however, when I try and echo out a single index by name I get an undefined 
index.

echo $result["description"];

I can't seem to extract the bits I want from it.


Thanks,


R. 

--- End Message ---

Reply via email to