Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
  1. #1
    Master Coder
    Join Date
    Apr 2003
    Location
    in my house
    Posts
    5,211
    Thanks
    39
    Thanked 201 Times in 197 Posts

    regex for cleaning $cgi-Vars;

    Hi,
    Edit:
    If anyone finds my brain please return it. It has definately gone awol. fyi, my if statement used to be an unless and so the error message was saying the opposite of what it should have

    I am trying to ensure that the $params{$key} value includes only numbers and the \0 separator. I can't seem to get my regex to do it. There will be an indeterminate number of values and so also, an indeterminate number of \0.

    Code:
    foreach my $key (sort %params ) # loop through all sent params and show the completed form with errors
      {
        if ($key =~ /set_value/  && $params{$key} =~ /[0-9]+(\0)+/ ) 
        {  # clean the params and values passed to this sub.
          
        @values = split(/\0/, $params{$key} ); 
    
        print qq( params{key}=$params{$key} );
      
           print qq( <p>You have entered some invalid data causing this process to be terminated</p>);
           exit;
        }
      }
    The process error message always shows up. what should I be doing?

    bazz
    Last edited by bazz; 06-07-2009 at 01:35 AM.
    "The day you stop learning is the day you become obsolete"! - my late Dad.

    Why do some people say "I don't know for sure"? If they don't know for sure then, they don't know!
    Useful MySQL resource
    Useful MySQL link


 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •