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:/a|\[/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: beginners-cgi@perl.org
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|img border=0 src=$Pics/Camera.gif width=$Game{CameraW}
height=$Game{CameraH}BR|;
  print qq|BR|;
  print qq|a target=$Game{Page} href=$Pics/$Game{Page}.jpg|;
  print qq|img border=0 src=$Pics/Camera.gif width=$Game{CameraW}
height=$Game{CameraH}BR|;
  print qq|/a|;
  print qq|BR|;
  if (-e $Pics/$Game{Page}.jpg)
  {
  print qq|img border=0 src=$Pics/Camera.gif width=$Game{CameraW}
height=$Game{CameraH}BR|;
   }

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]
http://learn.perl.org/ http://learn.perl.org/first-response




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]
http://learn.perl.org/ http://learn.perl.org/first-response




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]
http://learn.perl.org/ http://learn.perl.org/first-response




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]
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]
http://learn.perl.org/ http://learn.perl.org/first-response