MsqlCGI

 view release on metacpan or  search on metacpan

MsqlCGI-bin/MsqlCGI.pm  view on Meta::CPAN

	# the query type is "search"
    if ( ( $queryType eq "SEARCH" ) ||
         ( $queryType eq "MODIFY" ) ) {
      if ( $strValue =~ /[\%\\\^]/ ) {
	&main::Error ( "Sorry, you cannot use the characters <pre>
		% \\ ^ </pre> in your query" );
      }

      #$strValue =~ s/([\$\(\)?\[\|\]])/[$1]/gi;
      #$strValue =~ s/([\$?\[\|\]])/[$1]/gi;
      #$strValue =~ s/([_])/\\\\$1/gi;
    }

&main::DPrint ( "<b>$strValue</b>" );
    $strValue =~ s/(['])/\\$1/gi;
&main::DPrint ( "<b>$strValue</b>" );
    $strValue = "'$strValue'";

    if ( $strValue eq "''" ) {
      $strValue = "NULL";
    }

  } elsif ( $fieldType eq "int" ) {
    if ( $strValue =~ /\D/ ) {
      &main::Error ( "You must enter only a number in the numeric fields.");
    }

  } elsif ( $fieldType eq "real" ) {
    if ( $strValue !~ /[\d\.]/ ) {
      &main::Error ( "You must enter only a Real Numbers in the real
      number fields.");
    }
  }
  return $strValue;
}

#############################################################################
# ConvertFileName
#
# Just do expansions on a file name.  
#   First see if the first character is a "/" or a "~".  If it's not
#     either, prepend the DefDir variable on to it.
#   Then see if the first character is a "~".  If so, substitute the name
#     with a the directory as returned by "getpwnam";
#############################################################################
sub ConvertFileName {
  my ( $fileName, $defDir ) = @_;

  &main::DPrint ( "In ConvertFileName, file is; $fileName, defDir is $defDir" );
  $fileName = $defDir . "/" . $fileName 
  	if ( ( substr ( $fileName, 0, 1 ) ) !~ /[~\/]/ ) ;

  &main::DPrint ( "After first substitution: $fileName" );

  $fileName =~ s/^~(\w*)/
    if ( $1 ) {
      ($name,$passwd,$uid,$gid,$quota,$comment,$gcos,$dir,$shell) = 
      getpwnam ( $1 ); $dir
    } else {
      ($name,$passwd,$uid,$gid,$quota,$comment,$gcos,$dir,$shell) = 
      getpwuid ( $< ); $dir
    }/ge;
  &main::DPrint ( "After second substitution.  Returning: $fileName" );
  return $fileName;
}



#######################################################################
# DPrint
#
# A Debug print mechanism.  If the variable "main::debug" is turned on, it
# will print.
#######################################################################
sub main::DPrint {
  if ( $main::debug == 1 ) {
    print "DEBUG: $_[0]<br>\n";
  }
  return;
}


1;




( run in 1.589 second using v1.01-cache-2.11-cpan-39bf76dae61 )