php-general Digest 29 Oct 2008 07:47:06 -0000 Issue 5761

Topics (messages 282533 through 282557):

Re: clear a mysql table
        282533 by: Jim Lucas
        282550 by: Lupus Michaelis

Waste of storage space?
        282534 by: Frank Arensmeier
        282542 by: Chris
        282543 by: Maciek Sokolewicz
        282547 by: Bastien Koert
        282557 by: Frank Arensmeier

Regex validation
        282535 by: VamVan
        282536 by: Daniel P. Brown
        282537 by: Richard Heyes
        282538 by: Micah Gersten
        282539 by: Boyd, Todd M.
        282540 by: Yeti
        282541 by: Nitsan Bin-Nun
        282544 by: VamVan
        282545 by: Micah Gersten
        282548 by: Ashley Sheridan
        282549 by: VamVan
        282551 by: Lupus Michaelis
        282552 by: Micah Gersten
        282553 by: VamVan
        282554 by: Micah Gersten

Re: clean data
        282546 by: Shawn McKenzie

FImage $aSubDir
        282555 by: John Taylor-Johnston
        282556 by: John Taylor-Johnston

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 ---
Lupus Michaelis wrote:
> Daniel P. Brown a écrit :
>>     In direct response to your question, you're looking for the
>> TRUNCATE command.
> 
>   I hope he doesn't have any foreign keys nor triggers.
> 

I would ass-u-me that if someone had foreign keys and/or triggers setup that
they would not need to ask how to clear/empty a table

-- 
Jim Lucas

   "Some men are born to greatness, some achieve greatness,
       and some have greatness thrust upon them."

Twelfth Night, Act II, Scene V
    by William Shakespeare


--- End Message ---
--- Begin Message ---
Jim Lucas a écrit :
I would ass-u-me that if someone had foreign keys and/or triggers setup that
they would not need to ask how to clear/empty a table

I never assume that kind of thing, because he could be cleaning a database he didn't designed. It happends. :)

--
Mickaël Wolff aka Lupus Michaelis
http://lupusmic.org

--- End Message ---
--- Begin Message ---
Hi all.

In short, I am working on a system that allows me to keep track of changes to a large amount of short texts (a couple of thousand text snippets, two or three sentences per text). All text is stored in a database. As soon as a user changes some text (insert, delete, update), this action is recorded. Look at an article on e.g. Wikipedia and click "History". This is more or less what I am trying to accomplish.

Right now, my "history" class that takes care of all changes, is working pretty much as I want. The thing is that both the original text and the altered text is stored in the database every time the text is changed. My concern is that this will eventually evolve into a serious problem regarding amount of storage and performance. So, I am looking for a more efficient way to store all changes.

Ideas I have come up with so far are:

1) Store the "delta" (=the actual change) of a text change. This could be done by utilizing the Pear package TextDiff. My idea was to compare the old with the new text with help of the TextDiff class. I would then grab the array containing the changes from TextDiff, serialize it and store this data into the db. The problem is that this is every thing else but efficient when it comes to smaller text (the serialized array holding the changes was actually larger than the two texts combined).

2) Do some kind of compression on the text to be stored. However, it seems that the build-in compression functions from PHP5 are more efficient when it comes to large texts.

Any other ideas?

thank you.
//frank

ps. I notice that Mediawiki also stores complete articles in the db (every time an article is updated, the hole article is stored in the database). ds.
--- End Message ---
--- Begin Message ---

1) Store the "delta" (=the actual change) of a text change. This could be done by utilizing the Pear package TextDiff. My idea was to compare the old with the new text with help of the TextDiff class. I would then grab the array containing the changes from TextDiff, serialize it and store this data into the db. The problem is that this is every thing else but efficient when it comes to smaller text (the serialized array holding the changes was actually larger than the two texts combined).

What happens when you want to restore a particular version? You have to go through each edition and apply patches. Could get very messy.

I'd say you're on the right track in just storing each version.

2) Do some kind of compression on the text to be stored. However, it seems that the build-in compression functions from PHP5 are more efficient when it comes to large texts.

All compression techniques (in or out of php) will work better on more text.

--
Postgresql & php tutorials
http://www.designmagick.com/


--- End Message ---
--- Begin Message ---
Frank Arensmeier wrote:
Hi all.

In short, I am working on a system that allows me to keep track of changes to a large amount of short texts (a couple of thousand text snippets, two or three sentences per text). All text is stored in a database. As soon as a user changes some text (insert, delete, update), this action is recorded. Look at an article on e.g. Wikipedia and click "History". This is more or less what I am trying to accomplish.

Right now, my "history" class that takes care of all changes, is working pretty much as I want. The thing is that both the original text and the altered text is stored in the database every time the text is changed. My concern is that this will eventually evolve into a serious problem regarding amount of storage and performance. So, I am looking for a more efficient way to store all changes.

Ideas I have come up with so far are:

1) Store the "delta" (=the actual change) of a text change. This could be done by utilizing the Pear package TextDiff. My idea was to compare the old with the new text with help of the TextDiff class. I would then grab the array containing the changes from TextDiff, serialize it and store this data into the db. The problem is that this is every thing else but efficient when it comes to smaller text (the serialized array holding the changes was actually larger than the two texts combined).

2) Do some kind of compression on the text to be stored. However, it seems that the build-in compression functions from PHP5 are more efficient when it comes to large texts.

Any other ideas?

thank you.
//frank

ps. I notice that Mediawiki also stores complete articles in the db (every time an article is updated, the hole article is stored in the database). ds.

Hi Frank,

why don't you simply make use of systems specifically designed for such things. eg. CVS or SVN (subversion.tigris.org). You could pretty easily tie it in with your application. It's quite compact, and pretty fast too.

- Tul

--- End Message ---
--- Begin Message ---
On Tue, Oct 28, 2008 at 4:24 PM, Frank Arensmeier <[EMAIL PROTECTED]>wrote:

> Hi all.
>
> In short, I am working on a system that allows me to keep track of changes
> to a large amount of short texts (a couple of thousand text snippets, two or
> three sentences per text). All text is stored in a database. As soon as a
> user changes some text (insert, delete, update), this action is recorded.
> Look at an article on e.g. Wikipedia and click "History". This is more or
> less what I am trying to accomplish.
>
> Right now, my "history" class that takes care of all changes, is working
> pretty much as I want. The thing is that both the original text and the
> altered text is stored in the database every time the text is changed. My
> concern is that this will eventually evolve into a serious problem regarding
> amount of storage and performance. So, I am looking for a more efficient way
> to store all changes.
>
> Ideas I have come up with so far are:
>
> 1) Store the "delta" (=the actual change) of a text change. This could be
> done by utilizing the Pear package TextDiff. My idea was to compare the old
> with the new text with help of the TextDiff class. I would then grab the
> array containing the changes from TextDiff, serialize it and store this data
> into the db. The problem is that this is every thing else but efficient when
> it comes to smaller text (the serialized array holding the changes was
> actually larger than the two texts combined).
>
> 2) Do some kind of compression on the text to be stored. However, it seems
> that the build-in compression functions from PHP5 are more efficient when it
> comes to large texts.
>
> Any other ideas?
>
> thank you.
> //frank
>
> ps. I notice that Mediawiki also stores complete articles in the db (every
> time an article is updated, the hole article is stored in the database). ds.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Save just the new version each time

table like
record_id  //PK
relates_to //FK
item_text
author_id
timestamp


much easier to work with

-- 

Bastien

Cat, the other other white meat

--- End Message ---
--- Begin Message ---
Från: Yeti <[EMAIL PROTECTED]>
Datum: ti 28 okt 2008 23.07.11 GMT+01:00
Till: "Frank Arensmeier" <[EMAIL PROTECTED]>
Ämne: Re: [PHP] Waste of storage space?

Hej,

why not do a simple strlen() before comparison?
Like if strlen (or mb_strlen()) is less than 50 do not serialize/ compare.

Or Like levenchtein(), You could do :
<?php
(strlen($string2) - similar_text($string,$string2))
?>
to see how much characters have been changed.



Thank you for your respons.

I have thought of such a sorting mechanism too. But on the other hand, the biggest drawback would be that even minor changes that might be really important could get lost. And my goal is to really keep track on everything my users do. And, in the long run, the problem with the database that eventually could/will grow very large in size, is not solved.

//frank

..please keep responses on list.



--- End Message ---
--- Begin Message ---
Hello Team of Nerds,

I need help in writing a regular expression for this:

invalid character set is:

INVALID_STRING={"/","*","+","(",")","'\'","<",">",",",":",";","~","..",".@","@."};

I want to a pregmatch for these characters on my whole email address and if
match is found I need to return false.

Thank you

--- End Message ---
--- Begin Message ---
On Tue, Oct 28, 2008 at 4:10 PM, VamVan <[EMAIL PROTECTED]> wrote:
> Hello Team of Nerds,
>
> I need help in writing a regular expression for this:
>
> invalid character set is:
>
> INVALID_STRING={"/","*","+","(",")","'\'","<",">",",",":",";","~","..",".@","@."};

    Then you need to STFW and RTFM.  PHP uses Perl-style regexp's, by the way.

    The best place to start, in my opinion, and a site you should
bookmark, is Jan Goyvaerts'[1] site.  He's done a fantastic job for
people of varying degrees of /regexpertise/:

        http://www.regular-expressions.info/


    1: [MEDIA] http://www.just-great-software.com/special/JanGoyvaerts.wav

-- 
</Daniel P. Brown>
http://www.parasane.net/ [New Look]
[EMAIL PROTECTED] || [EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
> Hello Team of Nerds,

Not the best way  to start your request for help.

> I need help in writing a regular expression for this:
>
> invalid character set is:
>
> INVALID_STRING={"/","*","+","(",")","'\'","<",">",",",":",";","~","..",".@","@."};
>
> I want to a pregmatch for these characters on my whole email address and if
> match is found I need to return false.

Based on what you've said, you might not need a regex, there may well
be an str* function that you can use. Maybe strpos().

-- 
Richard Heyes

HTML5 Graphing for FF, Chrome, Opera and Safari:
http://www.rgraph.org (Updated October 25th)

--- End Message ---
--- Begin Message ---
VamVan wrote:
> Hello Team of Nerds,
>
> I need help in writing a regular expression for this:
>
> invalid character set is:
>
> INVALID_STRING={"/","*","+","(",")","'\'","<",">",",",":",";","~","..",".@","@."};
>
> I want to a pregmatch for these characters on my whole email address and if
> match is found I need to return false.
>
> Thank you
>
>   

If your trying to filter E-Mail addresses, then filter_var is what you
should use:

http://php.net/filter_var

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com




--- End Message ---
--- Begin Message ---
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
> Behalf Of Richard Heyes
> Sent: Tuesday, October 28, 2008 4:30 PM
> To: VamVan
> Cc: php List
> Subject: Re: [PHP] Regex validation
> 
> > Hello Team of Nerds,
> 
> Not the best way  to start your request for help.
> 
> > I need help in writing a regular expression for this:
> >
> > invalid character set is:
> >
> >
>
INVALID_STRING={"/","*","+","(",")","'\'","<",">",",",":",";","~","..",
> ".@","@."};
> >
> > I want to a pregmatch for these characters on my whole email address
> and if
> > match is found I need to return false.
> 
> Based on what you've said, you might not need a regex, there may well
> be an str* function that you can use. Maybe strpos().

I thought so at first, but it appears the final 3 array members of
INVALID_STRING are two characters wide. That could, of course, be
handled with a different algorithm from the other, one-character
members.


Todd Boyd
Web Programmer



--- End Message ---
--- Begin Message ---
> If your trying to filter E-Mail addresses, then filter_var is what you
> should use:
>
> http://php.net/filter_var

If the OP (original poster) got PHP5+

--- End Message ---
--- Begin Message ---
Good to know filter_var() exists in PHP5

Unless you have PHP5 you better validate the string in the way of checking
if it is fit's to your allowed characters and not checking if it contains
the NOT allowed charaters.

You better use: [a-z0-9A-Z\_\.]+ instead of [^\)\(\*\&[EMAIL PROTECTED] and I
haven't started yet with the weirdy ones....

HTH,
Nitsan

On Wed, Oct 29, 2008 at 12:10 AM, Yeti <[EMAIL PROTECTED]> wrote:

> > If your trying to filter E-Mail addresses, then filter_var is what you
> > should use:
> >
> > http://php.net/filter_var
>
> If the OP (original poster) got PHP5+
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---
Thank Guys,

I at least got part of it working , not the double words but almost
everything else than that:

function _email_validate($mail_address){
  $invalid_charset_pattern = "[(*+?)|~<>:;{}/ ]";
  if(ereg($invalid_charset_pattern, $mail_address)){
    return false;
  }else{
    return true;
  }
}

Thanks for the inputs

On Tue, Oct 28, 2008 at 3:31 PM, Nitsan Bin-Nun <[EMAIL PROTECTED]> wrote:

> Good to know filter_var() exists in PHP5
>
> Unless you have PHP5 you better validate the string in the way of checking
> if it is fit's to your allowed characters and not checking if it contains
> the NOT allowed charaters.
>
> You better use: [a-z0-9A-Z\_\.]+ instead of [^\)\(\*\&[EMAIL PROTECTED] and
> I
> haven't started yet with the weirdy ones....
>
> HTH,
> Nitsan
>
> On Wed, Oct 29, 2008 at 12:10 AM, Yeti <[EMAIL PROTECTED]> wrote:
>
> > > If your trying to filter E-Mail addresses, then filter_var is what you
> > > should use:
> > >
> > > http://php.net/filter_var
> >
> > If the OP (original poster) got PHP5+
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>

--- End Message ---
--- Begin Message ---
Keep in mind that ereg will disappear with PHP 6.  You might want to use
the preg functions:
http://www.making-the-web.com/2007/09/21/becoming-php-6-compatible/

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



VamVan wrote:
> Thank Guys,
>
> I at least got part of it working , not the double words but almost
> everything else than that:
>
> function _email_validate($mail_address){
>   $invalid_charset_pattern = "[(*+?)|~<>:;{}/ ]";
>   if(ereg($invalid_charset_pattern, $mail_address)){
>     return false;
>   }else{
>     return true;
>   }
> }
>
> Thanks for the inputs
>
> On Tue, Oct 28, 2008 at 3:31 PM, Nitsan Bin-Nun <[EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>> wrote:
>
>     Good to know filter_var() exists in PHP5
>
>     Unless you have PHP5 you better validate the string in the way of
>     checking
>     if it is fit's to your allowed characters and not checking if it
>     contains
>     the NOT allowed charaters.
>
>     You better use: [a-z0-9A-Z\_\.]+ instead of
>     [^\)\(\*\&[EMAIL PROTECTED] and I
>     haven't started yet with the weirdy ones....
>
>     HTH,
>     Nitsan
>
>     On Wed, Oct 29, 2008 at 12:10 AM, Yeti <[EMAIL PROTECTED]
>     <mailto:[EMAIL PROTECTED]>> wrote:
>
>     > > If your trying to filter E-Mail addresses, then filter_var is
>     what you
>     > > should use:
>     > >
>     > > http://php.net/filter_var
>     >
>     > If the OP (original poster) got PHP5+
>     >
>     > --
>     > PHP General Mailing List (http://www.php.net/)
>     > To unsubscribe, visit: http://www.php.net/unsub.php
>     >
>     >
>
>

--- End Message ---
--- Begin Message ---
On Tue, 2008-10-28 at 18:07 -0500, Micah Gersten wrote:
> Keep in mind that ereg will disappear with PHP 6.  You might want to use
> the preg functions:
> http://www.making-the-web.com/2007/09/21/becoming-php-6-compatible/
> 
> Thank you,
> Micah Gersten
> onShore Networks
> Internal Developer
> http://www.onshore.com
> 
> 
> 
> VamVan wrote:
> > Thank Guys,
> >
> > I at least got part of it working , not the double words but almost
> > everything else than that:
> >
> > function _email_validate($mail_address){
> >   $invalid_charset_pattern = "[(*+?)|~<>:;{}/ ]";
> >   if(ereg($invalid_charset_pattern, $mail_address)){
> >     return false;
> >   }else{
> >     return true;
> >   }
> > }
> >
> > Thanks for the inputs
> >
> > On Tue, Oct 28, 2008 at 3:31 PM, Nitsan Bin-Nun <[EMAIL PROTECTED]
> > <mailto:[EMAIL PROTECTED]>> wrote:
> >
> >     Good to know filter_var() exists in PHP5
> >
> >     Unless you have PHP5 you better validate the string in the way of
> >     checking
> >     if it is fit's to your allowed characters and not checking if it
> >     contains
> >     the NOT allowed charaters.
> >
> >     You better use: [a-z0-9A-Z\_\.]+ instead of
> >     [^\)\(\*\&[EMAIL PROTECTED] and I
> >     haven't started yet with the weirdy ones....
> >
> >     HTH,
> >     Nitsan
> >
> >     On Wed, Oct 29, 2008 at 12:10 AM, Yeti <[EMAIL PROTECTED]
> >     <mailto:[EMAIL PROTECTED]>> wrote:
> >
> >     > > If your trying to filter E-Mail addresses, then filter_var is
> >     what you
> >     > > should use:
> >     > >
> >     > > http://php.net/filter_var
> >     >
> >     > If the OP (original poster) got PHP5+
> >     >
> >     > --
> >     > PHP General Mailing List (http://www.php.net/)
> >     > To unsubscribe, visit: http://www.php.net/unsub.php
> >     >
> >     >
> >
> >
> 
Also, according to the official spec, +, < and > are all valid email
address characters.


Ash
www.ashleysheridan.co.uk


--- End Message ---
--- Begin Message ---
Yeah, I understand that its allowed in RFC. But unfortunately I use SSO
layer which decrypts the Cookie to get email address.

This is where it messes up. So I have decided not to allow people to use
that as well.

Thanks

On Tue, Oct 28, 2008 at 5:10 PM, Ashley Sheridan
<[EMAIL PROTECTED]>wrote:

> On Tue, 2008-10-28 at 18:07 -0500, Micah Gersten wrote:
> > Keep in mind that ereg will disappear with PHP 6.  You might want to use
> > the preg functions:
> > http://www.making-the-web.com/2007/09/21/becoming-php-6-compatible/
> >
> > Thank you,
> > Micah Gersten
> > onShore Networks
> > Internal Developer
> > http://www.onshore.com
> >
> >
> >
> > VamVan wrote:
> > > Thank Guys,
> > >
> > > I at least got part of it working , not the double words but almost
> > > everything else than that:
> > >
> > > function _email_validate($mail_address){
> > >   $invalid_charset_pattern = "[(*+?)|~<>:;{}/ ]";
> > >   if(ereg($invalid_charset_pattern, $mail_address)){
> > >     return false;
> > >   }else{
> > >     return true;
> > >   }
> > > }
> > >
> > > Thanks for the inputs
> > >
> > > On Tue, Oct 28, 2008 at 3:31 PM, Nitsan Bin-Nun <[EMAIL PROTECTED]
> > > <mailto:[EMAIL PROTECTED]>> wrote:
> > >
> > >     Good to know filter_var() exists in PHP5
> > >
> > >     Unless you have PHP5 you better validate the string in the way of
> > >     checking
> > >     if it is fit's to your allowed characters and not checking if it
> > >     contains
> > >     the NOT allowed charaters.
> > >
> > >     You better use: [a-z0-9A-Z\_\.]+ instead of
> > >     [^\)\(\*\&[EMAIL PROTECTED] and I
> > >     haven't started yet with the weirdy ones....
> > >
> > >     HTH,
> > >     Nitsan
> > >
> > >     On Wed, Oct 29, 2008 at 12:10 AM, Yeti <[EMAIL PROTECTED]
> > >     <mailto:[EMAIL PROTECTED]>> wrote:
> > >
> > >     > > If your trying to filter E-Mail addresses, then filter_var is
> > >     what you
> > >     > > should use:
> > >     > >
> > >     > > http://php.net/filter_var
> > >     >
> > >     > If the OP (original poster) got PHP5+
> > >     >
> > >     > --
> > >     > PHP General Mailing List (http://www.php.net/)
> > >     > To unsubscribe, visit: http://www.php.net/unsub.php
> > >     >
> > >     >
> > >
> > >
> >
> Also, according to the official spec, +, < and > are all valid email
> address characters.
>
>
> Ash
> www.ashleysheridan.co.uk
>
>

--- End Message ---
--- Begin Message ---
VamVan a écrit :

This is where it messes up. So I have decided not to allow people to use
that as well.

  By that way, you're making a lot of ennemies on this very list :D

--
Mickaël Wolff aka Lupus Michaelis
http://lupusmic.org

--- End Message ---
--- Begin Message ---
What are you talking about with a cookie and an E-Mail address?

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



VamVan wrote:
> Yeah, I understand that its allowed in RFC. But unfortunately I use
> SSO layer which decrypts the Cookie to get email address.
>
> This is where it messes up. So I have decided not to allow people to
> use that as well.
>
> Thanks
>
>

--- End Message ---
--- Begin Message ---
SSO process:

$_POST the Email Address and password

Get Authenticated, Get the COOKIE ( Through Oracle IDM suite SOAP call)

Decrypt the COOKIE ( Through Oracle Enterprise business suite SOAP call)

and get the profile Info

Thats what happens now.

But there is a glitch in the decryption algorithm we currently have. And
when we decrypt + or some thing else comes with funny characters and does
not authenticate.

So I need to restrict them for now. When the algorithm gets corrected then I
will use standard RFC.




On Tue, Oct 28, 2008 at 5:41 PM, Micah Gersten <[EMAIL PROTECTED]> wrote:

> What are you talking about with a cookie and an E-Mail address?
>
> Thank you,
> Micah Gersten
> onShore Networks
> Internal Developer
> http://www.onshore.com
>
>
>
> VamVan wrote:
> > Yeah, I understand that its allowed in RFC. But unfortunately I use
> > SSO layer which decrypts the Cookie to get email address.
> >
> > This is where it messes up. So I have decided not to allow people to
> > use that as well.
> >
> > Thanks
> >
> >
>

--- End Message ---
--- Begin Message ---
How is anything but your webserver decrypting the $_POST data?  PHP
should get it after that as is.

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



VamVan wrote:
> SSO process:
>
> $_POST the Email Address and password
>
> Get Authenticated, Get the COOKIE ( Through Oracle IDM suite SOAP call)
>
> Decrypt the COOKIE ( Through Oracle Enterprise business suite SOAP call)
>
> and get the profile Info
>
> Thats what happens now.
>
> But there is a glitch in the decryption algorithm we currently have. And
> when we decrypt + or some thing else comes with funny characters and does
> not authenticate.
>
> So I need to restrict them for now. When the algorithm gets corrected then I
> will use standard RFC.
>
>
>
>
> On Tue, Oct 28, 2008 at 5:41 PM, Micah Gersten <[EMAIL PROTECTED]> wrote:
>
>   
>> What are you talking about with a cookie and an E-Mail address?
>>
>> Thank you,
>> Micah Gersten
>> onShore Networks
>> Internal Developer
>> http://www.onshore.com
>>
>>
>>
>> VamVan wrote:
>>     
>>> Yeah, I understand that its allowed in RFC. But unfortunately I use
>>> SSO layer which decrypts the Cookie to get email address.
>>>
>>> This is where it messes up. So I have decided not to allow people to
>>> use that as well.
>>>
>>> Thanks
>>>
>>>
>>>       
>
>   

--- End Message ---
--- Begin Message ---
blackwater dev wrote:
> I have a project now where we would like to properly remove unwanted data
> before it goes into the db such as ` and of course slashes.  The problem is
> I have tons of pages.  Is there an easy way to add in a clean up routine on
> the db side to clean it going in and coming out without having to touch each
> page that inserts it into the db and each page that presents it?
> 
> I'm using a MySQL db.
> 
> 
> Thanks!
> 

Just do a global search/replace on all of your files replacing
mysql_query with to mysafe_query.  Then in one of your always included
files create a mysafe_query() function to do the sanitizing that you
want.  There are lots of free tools to do this.  I use kfilereplace on
kubuntu.  I wrote a simple one for windows in C# which you can have.

If needed, you could also extend this to mysql_fetch_row() etc...

-Shawn

-- 
Thanks!
-Shawn
http://www.spidean.com

--- End Message ---
--- Begin Message --- I have http://www.flash-here.com/downloads/fhimage.html installed. I like it just the way it is.
But instead of displaying (see function below).
Instead of displaying the file name under the photo, weak excuse for a caption,
I would like to open and nl2br the contents of a like named text file.

$chopped= strlen($aFn) - 4;
$openthis = $chopped.".txt";

How do I proceed?
John

---original code----
   echo "<br><center>";
   if($aSubDir == "") {
     $l = strlen($aFn) - 4;
     echo substr($aFn, 0, $l);
   } else {
     echo $aSubDir."[dir]";
   }
   echo "</center>";

--- End Message ---
--- Begin Message ---
Could it be this easy?

$chopped= strlen($aFn) - 4;
$filename = $chopped.".txt";

print"<br><font face='Arial, Helvetica, sans-serif' size=2 color='#999999'>";
      include($filename);
print"</font>";

John Taylor-Johnston wrote:
I have http://www.flash-here.com/downloads/fhimage.html installed. I like it just the way it is.
But instead of displaying (see function below).
Instead of displaying the file name under the photo, weak excuse for a caption,
I would like to open and nl2br the contents of a like named text file.

$chopped= strlen($aFn) - 4;
$openthis = $chopped.".txt";

How do I proceed?
John

---original code----
   echo "<br><center>";
   if($aSubDir == "") {
     $l = strlen($aFn) - 4;
     echo substr($aFn, 0, $l);
   } else {
     echo $aSubDir."[dir]";
   }
   echo "</center>";


--- End Message ---

Reply via email to