what is the best / latest .CGI to handle safe form parsing?

2008-11-17 Thread Lou Hernsen
what is the best / latest .CGI to handle safe form parsing?
Lou

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Testing an array for a match

2008-04-09 Thread Lou Hernsen
Hallo

I have an array
@Treasures
and I want to match anywhere in it for
/:1:2:3:/
can I
if (@Treasures =~ /:1:2:3:/){}
or do i have to change (@Treasures to $Treasures and then
$Treasures = @Treasures ;
if ($Treasures =~ /:1:2:3:/){}

Just thought I'd ask first, I have to take mother in law to Dr. so I don't
have time to test right now...
I'll check email in a few hours...
thanks
Lou


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: How to detect if a text body contains forbidden words

2007-11-20 Thread Lou Hernsen
Hallo
I'm just an amature perl writer..
but I would think that using the m// (match) would help. somthing like
# $CONFIG{'Feedback'} = the body of the message, change to whatever it is in
the program
if ($CONFIG{'Feedback'} =~  /href=|http:/i ) #i = ignore case
{
# reject code goes here
exit;
}

As to preventing cusswords... good luck...
you could do a string substitution manure is replaced by fertilizer

s/manure/fertilizer/i;

this way the offender never knows what words are being replaced and is less
likely to try to get around this code with words like schist, or phuque or
the like.. I think you get my drift.

And I would do the word check right when the words are being parsed.
Thats how I would do it, but then what do I know..
I'm sure there are better ways... and that certain people on this list will
be quick to shoot me down
while offering no help of there own... but I wanted to get my "good deed"
for the day thing out of the way
this morning ;)
hope it helps.
Lou



> > So I want to expand the script to block sending altogether if the body
> > contains forbidden words like 'href=' or 'http://'.

> > I think that the textbox contents can be retrieved by the following
> > function:
> > $CONFIG{'Feedback'}

> > What I would like to do is to add a new function right before the mail
> > send call inside the main procedure which could set an error if the
> > feedback contains the forbidden words.
> >
> > The main procedure now looks like this:
> >
> >
> > # Check Referring URL
> > &check_url;
> >
> > # Retrieve Date
> > &get_date;
> >
> > # Parse Form Contents
> > &parse_form;
> >
> > # Check Required Fields
> > &check_required;
> >
> > # Return HTML Page or Redirect User
> > &return_html;
> >
> > # Send E-Mail
> > &send_mail;
> >
> > I would like to have a checking procedure right in front of
> > &send_mail, which will fail the script if the forbidden words are
> > present.
>
>
> That's one of Matt's scripts and maybe you missed the world wide movement
> to get everyone off Matt's scripts. Anyway, if you got that going, you
> would find
>  Gunnar Hjalmarsson Contact Form a better and easier choice, and more
> secure. See:
> http://search.cpan.org/~gunnar/CGI-ContactForm-1.42/lib/CGI/ContactForm.pm
>
> You set up your form in half a dozen lines, and that's it!
>
> I am sure that you can set up spam filters to do what you want. There is a
> optional argument called spamfilter where you set up a regex and the
> example in the doco is  '(?i:|\[/url])' but you can adjust that
> yourself
>
> To modify Formmail.pl, you would need to;
> a: Set up a hash of banned words including the url form
> b: Take the output of the form and discard it if it matches anything in
> the banned word list.
>
> Owen
>
>
>
>
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> http://learn.perl.org/
>
>
>
>
> -- 
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.5.503 / Virus Database: 269.16.0/1135 - Release Date: 11/16/07
10:58 PM
>
>


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: FLOCK

2007-05-29 Thread Lou Hernsen
As much as I would like to use a database, like MySQL, I can't find an
example of the code
that isn't in a perl formay I can read and understand, I don't know alot
about perl and its assumed
vars like $_ and the super compressed codes using {[\f\t\t/t/y/g/d/d\.s1?]}
.. yeah.. i jusy made that up
but it looks like the perl code I see ... super secret coded perl

so I use semephore files and flock...maybe it will help you.

Lou Hernsen



- Original Message - 
From: "Akbar Ehsan" <[EMAIL PROTECTED]>
To: 
Sent: Tuesday, May 29, 2007 4:33 PM
Subject: FLOCK


> Hello Everyone,
>
> I am attempting to lock a file using FLOCK. I understand the FLOCK is an
> advisory lock and that it does not prevent any other process/program
> from "clobbering" the file even when the lock in on the file.
>
> Is there anything I should look into to apply a lock on a file so that
> it does not get written to when the lock is in place?
>
> Any thoughts or ideas would be appreciated.
>
> Thanks.
>
> Akbar Ehsan
> Internet Services Coordinator
> Central Office
> Ivy Tech Community College
> 9301 E. 59th St.
> Indianapolis, IN 46216
> Phone: 1 317 921-4872
>
>
>
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> http://learn.perl.org/
>
>
>
>
>
> -- 
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.5.446 / Virus Database: 269.8.0/821 - Release Date: 5/27/07
3:05 PM
>
>


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




-e question

2006-12-15 Thread Lou Hernsen
I use the -e to check to see if a file is present

  if (-e "$Pics/$Game{Page}.jpg")
  {
   }

Question
I can get it to work looking for .pl and .gif but not .jpg

I have checked all the directorie vars and even did this

  print qq||;
  print qq||;
  print qq||;
  print qq||;
  print qq||;
  print qq||;
  if (-e "$Pics/$Game{Page}.jpg")
  {
  print qq||;
   }

I get the first two images but not the last one.. so I know i have the dirs
correct
are .jpg's not -e able???

yeah.. i'm nonprofessional hobbiest  my style suck... can someone answer
the question, please?
Lou


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: figuring out if a number/character string is null in Perl

2006-09-01 Thread Lou Hernsen
Well... he's right
Its confusing and overly complicated, in its multiple syntaxes, for a
compiled language.

I'm personally of the opinion that it was written by a grad student who
purposely created it to be confusing to keep the market limited of perl
programmers, and/or to show off of just how complex he could make
something.. but it sure as hell wasn't designed to be user friendly, IMHO.

If nothing else there should be a compiler that would take a user friendly
syntax into a tighter code and back again.

Personally I wish I had learned Java or PHP but I don't have the time
right now to learn a new language.

Rev. Lou Hernsen
self employed

- Original Message - 
From: "Paul Archer" <[EMAIL PROTECTED]>
To: "Derek Ash" <[EMAIL PROTECTED]>
Cc: 
Sent: Friday, September 01, 2006 10:07 AM
Subject: Re: figuring out if a number/character string is null in Perl


> Derek, it was nice of you to include your title and all. That way when a
> future (potential) employer Googles you, they'll know for sure that it was
> you that was this childish and immature.
>
>
> 8:13am, Derek Ash wrote:
>
> > Perl Sucks!
> >
> > Derek Ash
> > Application Programmer II
> > University of Illinois College of Medicine at Peoria
> > One Illini Drive, Box 1649
> > Peoria, Illinois 61656-1649
> >
> >
>
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> <http://learn.perl.org/> <http://learn.perl.org/first-response>
>
>
>
>
> -- 
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.1.405 / Virus Database: 268.11.6/428 - Release Date: 8/25/06
>
>


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Re: Regex Help.

2006-06-24 Thread Lou Hernsen
and if I want to include certain german umlutted vowels like ö and ä i would
add them like this?
$string =~ tr/-_a-zA-Z0-9öä//cd;

then what does this do? (from parsing SDTIN)

$name =~ tr/+/ /; ### I know this replaces +'s for spaces
$name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; ### no clue
at all
$name =~ tr/\0//d; ### replaces zero values to empty

I know you want me to use modules, but I am trying to learn the syntax,
please help with a real answer. I want to be able to filter out undesired
charecters so I think I should add

$name =~ tr/-_a-zA-Z0-9öä//cd;

to the code so it look like this.

 @pairs = split ( /&/, $Input );
   foreach $pair(@pairs)
   {
  ( $name, $value ) = split ( /=/, $pair );
  $name =~ tr/+/ /; #changes plus sign to space
  $name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
  $name =~ tr/\0//d;
  $name =~ tr/-_a-zA-Z0-9öä//cd;
  $value =~ tr/+/ /;#changes plus sign to space
  $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
  $value =~ tr/\0//d;
  $value =~ tr/-_a-zA-Z0-9öä//cd;
  $Input{$name} = $value;
 }

in a previous question I asked at what point an input with a lynx command
like sys or exec is acted on by the program.
Never got an answer. can I filter out these commands using tr/ or s/ or that
taken care of with -T in hte shebang line?

thanks
Lou


- Original Message - 
From: "Charles K. Clarkson" <[EMAIL PROTECTED]>
To: 
Sent: Saturday, June 24, 2006 4:15 PM
Subject: RE: Regex Help.


> Sara wrote:
>
> : Need help to remove EVERY thing (non-alphabets, symbols,
> : ASCII codes etc) from a string except for a-zAZ, 0-9,
> : dash and underscore.
> :
> : $string =~ s/??
>
>
> Read perlop: Quote and Quote-like Operators
>
>
> $string =~ tr/-_a-zA-Z0-9//cd;
>
>
> HTH,
>
> Charles K. Clarkson
> -- 
> Mobile Homes Specialist
> Free Market Advocate
> Web Programmer
>
> 254 968-8328
>
> Don't tread on my bandwidth. Trim your posts.
>
>
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>  
>
>
>
>
> -- 
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.1.394 / Virus Database: 268.9.2/372 - Release Date: 6/21/06
>
>


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




FTP from my web ssite question

2006-03-14 Thread Lou Hernsen
Hallo
I would like to offer my guest a way to download fonts and art
from my web site... I use perl / cgi's to create my HTML web pages.
What is the CGI code that creates the link to allow people to do this?
I'll even use a modual if I have to.. as I am more commfortable with them
now.
Thanks
Lou



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: Lou's Code - need a little more help on mod questions.

2005-11-29 Thread Lou Hernsen
I did some testing tonight
when I take out
use stats;
and take out
stats;
the program runs perfect.

and the stats.pm runs just fine in my editor.

so what the command to run the mod in it entirity?
or does it have to be run as one big subroutine?
I will experient with that tommorrow

Lou


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: Lou's Code - need a little more help on mod questions.

2005-11-29 Thread Lou Hernsen

- Original Message - 
From: "Charles K. Clarkson" <[EMAIL PROTECTED]>
To: 
Sent: Monday, November 28, 2005 3:10 PM
Subject: RE: Lou's Code - need a little more help on mod questions.


> Lou Hernsen <mailto:[EMAIL PROTECTED]> wrote:
> 
> : Bareword "stats" not allowed while "strict subs" in use at
> : C:\WWW\MYSTIC~1\CGI-BIN\TEST-N~1\MA.CGI line 4359. Execution of
> : C:\WWW\MYSTIC~1\CGI-BIN\TEST-N~1\MA.CGI aborted due to compilation
> : errors 
> 
> What's on the lines near line 4359?

stats; 
the command to call the module.

There is nothing wrong with the other lines of code.
I cut the stats subroutine and pasted it into  the mod...

I have removes the "stats;" call and the main program runs fine.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Lou's Code - need a little more help on mod questions.

2005-11-28 Thread Lou Hernsen
OK...

I have put the mod in the same dir as the main prog.
chmod 644 on mod
chmod 755 on main

however there is an error.
the mod does nothing more that produce HTML and a few calculations.
the mod works fine with out error in my editor.
however the main program does not like how I call stats.pm
i use the following line.
stats;
and the error

Bareword "stats" not allowed while "strict subs" in use at
C:\WWW\MYSTIC~1\CGI-BIN\TEST-N~1\MA.CGI line 4359. Execution of
C:\WWW\MYSTIC~1\CGI-BIN\TEST-N~1\MA.CGI aborted due to compilation errors

and I have , at the top after the shebang
use strict;
use stats;

how do I call a mod and not ask to return any var or value?
I just want the mod to run...

thanks
lou



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: our..... Lou's code

2005-11-28 Thread Lou Hernsen

- Original Message - 
From: "Bob Showalter" <[EMAIL PROTECTED]>
To: "Lou Hernsen" <[EMAIL PROTECTED]>
Cc: 
Sent: Sunday, November 27, 2005 12:36 PM
Subject: Re: our..


> Lou Hernsen wrote:
> > ok after reading about "our"
> > 
> > fact:
> > I use all global vars in the main program.
> > conclusion
> > I need to list all the vars in the module as our
> > 
> > in main
> > my $foo
> > in mod
> > our $foo
> > 
> > this will allow the vars to be used by both programs?
> 
> No.
> 
> A variable declared with "my" is only accessible within the enclosing 
> file, block, or eval.

File is the entire program.. like a global var?
Block is the "if" or "while" or other {} framed code?
what is an eval? 
if (my $var=0;$var>10;$var++)
is that when you mean? an evaluation?

> 
> "our" is a declaration that allows you to use a global (symbol-table) 
> variable name without a package qualifier when "use strict" is in effect.
> 

from what you say "our" is used in the main program
so I don't have to declare them again in the mod?
So if I run the mod as one big ad-in program to main
and not calling subs in the mod, I don't have to pass vars in the ()'s?
stats;
and not
stats::sub($var1, $var2, etc);

this mode only does some calulations and print to the HTML code...


thanks
Lou






-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Modules update

2005-11-27 Thread Lou Hernsen
since $Speed is the output i have to call on the sub in the mod as
 $Speed = stats::Speed($Spy,$Army,$Hero,$Horse,$Wagon);
and pass the vars to the mod and in the mod
return $Speed;

I also discovered the mod will print HTML code with out returning it.

Now i have to experiment with the workings of our and my...
i have read all the docs suggested and either they were no help or
i didn't understand them or they are wrong.

Funny thing.. most of the time i just have to experiment or find working
code
to see examples of... the docs are never any use..hmmm

anyway,, you pros have seen how I code.. scarey huh?

Lou



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




our..

2005-11-27 Thread Lou Hernsen
ok after reading about "our"

fact:
I use all global vars in the main program.
conclusion
I need to list all the vars in the module as our

in main
my $foo
in mod
our $foo

this will allow the vars to be used by both programs?

Lou


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: Need help with making a Modules

2005-11-27 Thread Lou Hernsen
I am trying to create a module that will print the Stats of the player of my
on line game.
all it should do is take the vars, do some calulations and print the HTML

since the Stats is used in every time i don't want to duplicate it in each
program.

The main program has all your players vars loaded...
the Stats subroutine (which I want to make into a mod)
puts the HTML code in the  of the web page...
from what I have read this should not be a hard things to do.

Module= a piece of code that is repeated in several programs.
Each location in the town is a separate program
If I can't get this to work I'll just leave the sub Stats()  in each program
and not worry about it.

Thanks
Lou



- Original Message - 
From: "Charles K. Clarkson" <[EMAIL PROTECTED]>
To: 
Sent: Sunday, November 27, 2005 12:46 AM
Subject: RE: Need help with making a Modules


> Lou Hernsen <mailto:[EMAIL PROTECTED]> wrote:
>
> : I am studying modules.. I am seeking a mentor to help.
>
> What do you mean by "module"? I ask because many people have very
> different ideas about what one is.
>
> For example, some people think about a library.
>
> require 'my_perl_module.pl";
>
>
> When I say "module", I am usually thinking of an object.
>
> use TemplateVariables;
>
> my $vars = TemplateVariables
> -> new()
> -> select_categories();
>
>
> Others think of a library of subroutines and variables.
>
> use CGI qw(:standard center);
>
> print
> header(),
> start_html('foo'),
> center(h1('foo')),
> end_html();
>
> In your own words, define "module."
>
>
> : I have very simple questions like ...
> : Do I need to pass vars into the mod?
>
> That depends on what you are attempting to do. It also depends
> on what you want the module to do. The CGI example above passed
> variables into the module to tell it which subroutines should be
> exported. An object may require variables to be added when it is
> constructed.
>
>
> : Do i need to declare vars in the mod?
>
> It is often very difficult to write an entire module without
> declaring a variable, but it is not impossible.
>
>
> : What is "our"? something like "my" and "local"?
>
>  Yes. Have you read perlfunc?
>
>
> : Do I need to return vars?
>
> Not usually. Most modules return values.
>
>
> : The code I am writing creates part of a web page,
> : so I can print it in the mod or in the main.
> : (I wold prefer to print it in the mod.. if possible)
> :
> : I have been reading for 2 weeks now and can't find a simple working
> : model to disect that I can understand all the parts of.
>
> Give us  a more detailed idea of what you are attempting and
> perhaps we could write an example for you.
>
>
> HTH,
>
> Charles K. Clarkson
> -- 
> Mobile Homes Specialist
> 254 968-8328
>
>  . . . With Liberty and Justice for all (heterosexuals).
>
>
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> <http://learn.perl.org/> <http://learn.perl.org/first-response>
>
>
>



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Re: Need help with making a Modules

2005-11-27 Thread Lou Hernsen
This small piece of the Stats sub calculates the
speed at which you are traveling.
I have in the main program.

use stats

and I call on it just like a regular sub
Speed();
or should it be
stats::Speed;


When I call on the entire mod, i want the whole thing to run.
I could just put all the subs in the mod into one sub and call on that.. i
guess.

thanks
Lou

ps.. i know my coding sucks.. i'm a beginner
its the best i can do given my understanding





package stats;

sub BEGIN
{
   use Exporter();
   @ISA = qw(Exporter);
   @EXPORT = qw(Speed)
}

sub Speed
{
 $v0 = 1+$Army+$Hero+$Spy;
 $v1 = 1+$Army+$Hero+$Spy+$Wagon;
 if  ($Wagon < 1 && $Horse >= $v0
  && $Saddle >= $v0 && $Blanket >= $v0
  && $Load <= 100)
{$Speed = "1.5";}
 elsif ($Wagon == 0 && $Horse >= $v0 && $Load <= 100)
{$Speed = "2";}
 elsif ($Wagon > 0 && $Horse >= $v1 && $Load <= 100)
  {$Speed = "2.5";}
 elsif ($Wagon == 0 && $Load <= 100)
  {$Speed = "3";}
 elsif ($Load > 100)
  {$Speed = (int(.3 * $Load))/10;}
 else {$Speed=3;}
}
return 1;


#3



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Need help with making a Modules

2005-11-27 Thread Lou Hernsen
I am studying modules.. I am seeking a mentor to help.
I have very simple questions like ...
Do I need to pass vars into the mod?
Do i need to declare vars in the mod?
What is "our"? something like "my" and "local"?
Do I need to return vars?

The code I am writing creates part of a web page,
so I can print it in the mod or in the main.
(I wold prefer to print it in the mod.. if possible)

I have been reading for 2 weeks now and can't find a simple working model
to disect that I can understand all the parts of.

I have read what CPAN has, and a CGI101 and Visuals Perl book and O'Rielys
Mods and objects(or something like that) .. and I can't figure it out.

Please reply 
Thanks
Lou




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]