Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > input validation

Reply
Thread Tools

input validation

 
 
Alexandre Jaquet
Guest
Posts: n/a
 
      09-27-2005
Hi,

I've a trouble when I parse web page input, I want to accept only
alphanumeric char (with accent) and ignore it when the datas is equal
is to "Toutes les catégories"

I do the following :

local our $category = $query->param("categories");
$category =~ s/[^\w]//g;

local our $test = $SERVER{'all_categories'};
if ($category ne $test) {
$add .= " AND ref_categorie = id_categorie AND categorie_$lang.nom =
'$category'";
$from .= "article, categorie_$lang,statut_$lang";
}else {
$add .= "AND article.ref_statut = id_statut AND ref_statut = '3' AND
ref_categorie = id_categorie ";
$from .= "article,statut_$lang,categorie_$lang"
}
but I the following part "$add .= " AND ref_categorie = id_categorie AND
categorie_$lang.nom = " is still executed

any help

many thanks

 
Reply With Quote
 
 
 
 
Paul Lalli
Guest
Posts: n/a
 
      09-27-2005
Alexandre Jaquet wrote:
> I've a trouble when I parse web page input, I want to accept only
> alphanumeric char (with accent) and ignore it when the datas is equal
> is to "Toutes les catégories"
>
> I do the following :
>
> local our $category = $query->param("categories");
> $category =~ s/[^\w]//g;


You know that [^\w] is more quickly written as \W, right?

> local our $test = $SERVER{'all_categories'};
> if ($category ne $test) {
> $add .= " AND ref_categorie = id_categorie AND categorie_$lang.nom =
> '$category'";
> $from .= "article, categorie_$lang,statut_$lang";
> }else {
> $add .= "AND article.ref_statut = id_statut AND ref_statut = '3' AND
> ref_categorie = id_categorie ";
> $from .= "article,statut_$lang,categorie_$lang"
> }
> but I the following part "$add .= " AND ref_categorie = id_categorie AND
> categorie_$lang.nom = " is still executed


.... and? Is that not what you want? You haven't shown us what *any*
of these variables are. How are we supposed to know how or why this
isn't the "correct" behavior?

Please, include some debugging statements that show us the values of
$category before the s///, $category after the s///, and $test. Then
post the results of that debugging as a followup.

Paul Lalli

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Displaying a Validation Error in a Validation Summary Control Lucas Tam ASP .Net 2 02-26-2004 07:49 PM
ASP.NET Web Forms Validation Controls are Server-Side or Client-Side Validation? Matt ASP .Net 14 01-30-2004 09:15 AM
Web form validation vs object validation Colin Basterfield ASP .Net 1 11-29-2003 12:10 AM
validation summary doesnt display when there's client-side validation Libs ASP .Net 0 06-25-2003 03:05 PM
Re: only custom validation control does server side validation? Colin Mackay ASP .Net 0 06-25-2003 07:54 AM



Advertisments