reading in a CVS file

2004-11-02 Thread David Gilden
Hello, I am trying to do an import of a Tab De-limited file and then extract certain fields. I am looking to general comments and or a better more concise way of doing this, Thanks in advance... Dave Gilden -- Ft. Worth-less Texass Here is what I have so far (and it is not tested and my be inc

untainting data

2004-11-10 Thread David Gilden
Hello, Is the following all I need to untaint data? #!/usr/bin/perl use CGI qw/:standard/; my $name = param('name'); $name =~ s/(\w+)/$1/; What can I do limit string length to 40 characters? Thanks, Dave (kora musician / audiophile / webmaster @ www.coraconnection.com / Ft. Worth, TX

print $q->p(with CSS)

2005-01-16 Thread David Gilden
Happy New year out there, Is it possible to get CGI.pm to print text... I also need to print out the one these as well: but it has to be in the of the starting HTML? -- and I would like it before the and after the Is any of this possible and would be the correct syntax for this? Belo

SWITCH / CASE statements

2005-01-16 Thread David Gilden
Quick question here for the PERL gurus! What should be the order for these two statements? exit; last switch; i.e is this correct? Thanks!! Dave -- Ft. Worth __CODE__ SWITCH: { if ($action =~ /Update/) { print redirect("./import_clean_csv.php");

Insecure dependency in glob while running with -T switch

2005-01-16 Thread David Gilden
Last question here, #!/usr/bin/perl -wT Snip ... my @filesToRemove = <*>; The line above is causing: Insecure dependency in glob while running with -T switch What can I do still have this functionally and satisfy 'tainting' Thanks, Dave tel: 817-741-2327 fax: 972-916-3451 (kora

RE: Insecure dependency in glob ... with -T switch

2005-01-16 Thread David Gilden
I thought this would do it, but I am at stopping point: #!/usr/bin/perl -wT my @filesToRemove = map {$_ =~ /^(\w[\w.-]*)/} <*>; Still getting : Insecure dependency in glob while running with -T switch What can I do still have this functionally and satisfy 'tainting' Thanks, Dave tel: 817-

RE: Insecure dependency in glob ... with -T switch

2005-01-17 Thread David Gilden
Hi, The code below works fine if run like: using PERL version 5.00503 #!/usr/bin/perl -w but with #!/usr/bin/perl -wT I am still getting error: Insecure dependency in glob while running with -T switch Can I turn off 'tainting' for this block { # turn off taint for this block only ope

RE: Preventing CPU spikes / was switch confusion

2005-04-13 Thread David Gilden
Dear Perl Gurus, I have some problems that I think are a result of how my Switch statement is written. This script is invoked via a web browser to upload a file, and do a few other things. However it appears that the user system / network, or my script is stalling. So the user clicks the butt

CGI.PM and IF statment....

2005-09-09 Thread David Gilden
The if statement below does not seem to work as expected// Given in the HTML: Choose type message Comment about a recent performance or recording Concert or Event Booking inquiry Personal message and in the perl: #!/usr/local/bin/perl use CGI qw/:standard/; use strict; #and other stuff...

CGI Upload Code

2005-12-19 Thread David Gilden
Holiday Greetings, I copied this from a CGI web site, and while it does work, I was wondering what folks with more experience in PERL thought of this code. Thanks for any comments, Dave Gilden #!/usr/bin/perl -w use CGI qw/:standard/; use CGI; use Fcntl qw( :DEFAULT :flock ); use CGI::Carp qw(f

Preventing unauthorized use of a CGI script

2006-02-06 Thread David Gilden
Greetings, Just wanted hear opinions on how effective this is, as way of preventing email relaying stoping unauthorized use my script. This from a script that connects a page to sendmail #!/usr/bin/perl use CGI qw/:standard/; #..snip.. my $referer = referer; # what page called the scr

referer throwing Internal Server Error

2006-03-13 Thread David Gilden
Greetings from Cow Tow! Here is my little script and it throwing a Internal Server Error #!/usr/bin/perl use CGI qw/:standard/; use CGI::Carp qw(fatalsToBrowser); use POSIX 'strftime'; use strict; my $referer = referer; if ($referer !~ m|^https?://www\.coraconnection\.com|i) { pr

CGI.pm hidden field problem

2001-10-17 Thread David Gilden
Hello, I am taking a stab at a SQL driven guest-book, the problem is with getting the field to take the value of $message_num, (see the end of this script) I can see it in the ok, but not in the hidden field (I have tried with override and with out -- not sure what this is for!) I welcome a

RE: CGI.pm hidden field problem

2001-10-17 Thread David Gilden
Still can't get it to wrk! Do a view source, http://dowda.rockin.net/cgi/sqlguestbook.cgi It just ain't working no mater what I try! Lincoln Stein's CGI.pm book says that you can use default,value or values interchangeably. D. On Wednesday, October 17, 2001 at 1:04 PM, [EMAIL PROTECTED] (

RE: CGI.pm hidden field problem

2001-10-17 Thread David Gilden
Thanks! On Wednesday, October 17, 2001 at 3:40 PM, [EMAIL PROTECTED] (Bob Showalter) wrote: > > print "\n"; > > print hidden( > > -name => last_message_num, > > -value => $message_num, > > # -override=> 1 > > ); This works! > > Try this: > >param('last_message_num', $message_num); >

Dynamic html/frames frm PERL not working

2001-12-10 Thread David Gilden
Could someone point out why the CGI script below does not work? Thanks, Dave The CGI (shown below) is used to create a frameset.html file. http://dowda.rockin.net/final/ Click on one of the left menu choices, ( using Netscape ) This is what the hrefs look like: Intro Another File... This work

RE: Dynamic html/frames frm PERL not working

2001-12-11 Thread David Gilden
Duh, I found the problem, Perl comment was in side of the 'here' doc script works fine now, Dave # HTML Page out print header; print Frame Setter for \u$pageName old code with mistake print header; print

CGI.pm problem

2002-01-16 Thread David Gilden
Hello, Here is what I am trying to do, In my html etc I Have several buttons, that display the label 'Class Schedule' I want to use the 'name' as data. So in my CGI code (perl): $class_to_display = param('kayaking_intro'); $class_to_display = param('white_water_intro');

Date Functions

2002-01-31 Thread David Gilden
Hi, I am updating an old Script. Are there any problems or 'Y2k' bugs, in the following change? Thanks, Dave #!/usr/bin/perl use CGI qw/:standard/; use CGI::Carp qw(fatalsToBrowser); use POSIX 'strftime'; # NEW -- replaces the block below $date = strftime('%A, %B %1d, %Y %I:%M %p',

redirect script failling

2002-02-13 Thread David Gilden
Can someone point why the following is not working? Thanks Dave G. #!/usr/bin/perl -w use CGI qw/:standard/; use CGI::Carp qw(fatalsToBrowser); use POSIX 'strftime'; $which_button = lc(param('submit')); print header; print $which_button; if ($which_button eq "continue to next section") {

where to rename a file in this sub?

2002-02-14 Thread David Gilden
Hi, Am not sure where I should be renaming the $emailLog file in this sub, Am I on the right track? Thanks Dave sub addEmail{ my $emailLog = '/email_list/email_list.txt'; # append new email open(EL,">>$emailLog") || die "Problem: Could not append to $emailLog, $!"; print EL "$email ($realna

removing white space

2002-02-14 Thread David Gilden
Is this correct, I want to remove leading and trailing white space, Thanks Dave -- foreach $item (param()) { my $value = param($item); $value =~ s/^\s+//; $value =~ s/\s+$//; } better?? foreach $item (param()) { my $value = param($item); $value =~ s/^\s+(.*)\s+$/$1/; } -

regrex question

2002-02-15 Thread David Gilden
$key ="Departure date"; $key =~ s/([\w\w+])/\u$1/; ---> Desired result: Departure Date What is wrong the above regrex? Thanks! Dave ** * Cora Connection Your West African Music Source * * http://www.coraconnection.com/

Spaces in form values --> cgi

2002-02-15 Thread David Gilden
Hi, Is it ok to have spaces in the "value" of a form element? Kayak Touring Rescue Techniques Or do I need to use underscores, Kayak Touring Rescue Techniques Thanks Dave PS: TGIF! ** * Cora Connection Your West African Music Sou

removing white space revisited

2002-02-18 Thread David Gilden
Hi, My goal is to clean up the fields submitted from a form and then be able to use them in other places. Does the following modify the value of param('name') -- if I have a form element named 'name' -- permanently (like when you have an array) foreach my $key (param()){ $val = param($key)

Re: removing white space revisited

2002-02-18 Thread David Gilden
Departure date"; $key =~ s/([\w'-]+)/\u$1/g; print $key; > > >From: David Gilden <[EMAIL PROTECTED]> > >To: [EMAIL PROTECTED] > >Subject: removing white space revisited > >Date: Mon, 18 Feb 2002 13:48:46 -0500 > > > >Hi, > > > &

Nice Formatting for Email Issue

2002-02-23 Thread David Gilden
I got a small problem, from my perl script: print MAIL

Sendmail -f killing my script!

2002-05-13 Thread David Gilden
Hello, I have one updated a script to use the following '-f' flag as a way of preventing SPAM relaying, and it is working fine, open(MAIL,"|$mailprog -t -f" . $recipient); How ever in the following script &release_risk_html; never gets returned! # with # open(MAIL,"|$mailprog -t"); # i

POSIX 'strftime' issue

2002-06-20 Thread David Gilden
Good afternoon, I have small problem here, check out the following: #!/usr/bin/perl use CGI qw/:standard/; use CGI::Carp qw(fatalsToBrowser); use POSIX 'strftime'; # This works fine on Earthlink's servers using: print OUT strftime('%A, %B %1d, %Y %I:%M %p',localtime) ,"\n"; #returns: Wednes

Re: POSIX 'strftime' issue

2002-06-21 Thread David Gilden
look here, <http://www.coraconnection.com/cgi-bin/schedule.pl> what is going wrong? (see the date string) Thanks -- have great weekend Dave G. On 6/21/02 at 7:59 AM, fliptop <[EMAIL PROTECTED]> wrote: > David Gilden wrote: > > > I have small problem here, check out

IF statments

2002-12-22 Thread David Gilden
Holiday greetings, I would like to be able to test for either of the two secret words but it seems to fail, what am I missing? Thanks Dave #!/usr/bin/perl use CGI qw/:standard/; use CGI::Carp qw(fatalsToBrowser); use strict; my $qs = $ENV{'QUERY_STRING'}; my $secret_word = 'one'; my $secret

IF statments -- part 2

2002-12-23 Thread David Gilden
This is not working either # Goal, to check against two different passwords. #!/usr/bin/perl my $qs = 'c'; my $secret_word = 'a'; my $secret_word_guest = 'b'; if ($qs !~ /$secret_word_guest|$secret_word/) { print "fail\n"; } else { print "go, ok\n";} ... more code... What should happe

IF statments -- short circuit

2002-12-23 Thread David Gilden
PERL 5.6 OSX, Jaguar Goal, to check against two different passwords. I think my problem is the "or" is short 'circuited' is there a way for an IF statement to test for both values, so that either $secret_word or $secret_word_guest will be tested, (I am not looking for AND) What should happ

CGI.PM

2003-02-25 Thread David Gilden
I am using CGI.PM and can not seem to pull data from the form. What am I missing here Thanks Dave Gilden #!/usr/bin/perl use CGI qw/:standard/; use CGI::Carp qw(fatalsToBrowser); use POSIX 'strftime'; # use strict; my $mailprog = '/usr/sbin/sendmail'; my $recipient = '[EMAIL PROTECTED]'; m

lower casing email address

2003-02-25 Thread David Gilden
Quick question here, which one is better for lowercasing an email address? ($email= param('email')) =~ tr/A-Z/a-z/; ($email= param('email')) =~ s/(.+)/\L$1/g; Thanks! Dave Now taking the CGI course @ -- To unsubscribe, e-mail: [EMAIL PROT

CGI.pm strange results

2003-03-02 Thread David Gilden
Hello, I am not understanding why I am getting strange data from the my CGI. Please point out what I have done wrong. Thanks Dave Gilden In the HTML some descriptive text goes here. ORDER QUANTITY In the PERL #!/usr/bin/perl -w use CGI qw/:standard/; #... unre

using CGI.pm for catalog

2003-03-04 Thread David Gilden
Hello, I am having a problem understanding why I can't get the data from the form page to CGI script. Here is the page in question: In the HTML some descriptive text goes here. ORDER QUANTITY In the PERL #!/u

data structures

2003-03-04 Thread David Gilden
I am trying to build a data structure, and am tripping up here. any suggestions? Thx! Dave !/usr/bin/perl -w snip... @bags = param('handbag'); get all of the bags styles @bag_quantity = param('quantity'); get all of the bags quantity foreach my $bag (@bags){ ($bag_name,$imgName) = s

RE: data structures / CGI.pm

2003-03-04 Thread David Gilden
Good afternon, I am not seeing consistent results from my script below. It seems that sometimes it works and other times I get '0's in the quantity field. As I don't write PERL often enough this is probably poorly written code! Thanks for any help. Dave HTML at:

RE: data structures one more try

2003-03-05 Thread David Gilden
Rob, Good call! > You can print out the data in @bags and @bag_quantity > using Data::Dumper.. > print Dumper [EMAIL PROTECTED]; Check this out, 'order' second and third bag in the first row. and hit the CGI and see the results,

RE: data structures one more try

2003-03-05 Thread David Gilden
Rob and all the rest reading this, Here's what fixed the problem. The check boxes are only sent to CGI.pm if checked, while all the input fields are sent regardless. So @bag_quantity was filled with '0's ... get rid of 'o's @bag_quantity = grep(/[^0]/, @bag_quantity); ...this now seems to

my( $string )

2003-03-06 Thread David Gilden
Quick question: my( $string ) = "you ordered " . $q->param('quantity') . " foobars\n"; What with the '( )' do I need them every time I declare a variable? Thanks! Dave ( kora musician / audiophile / web master @ cora connection / Ft. Worth, TX, USA) ==

sprintf questions

2003-03-12 Thread David Gilden
Is the following considered ok as in good PERL style? #!/usr/bin/perl -w $num =1.12345; my $tax_formated = sprintf("%.2f", $num); # <--- THIS LINE print "$tax_formated " ,length($tax_formated), "\n"; Thanks Dave -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional comma

Re: formatting money $12.00

2003-03-13 Thread David Gilden
> > #!/usr/bin/perl -w > > > > $num =1.12345; > > > > my $tax_formated = sprintf("%.2f", $num); # <--- THIS LINE ### $tax_formated is used in a few places > The important thing is, does it do what youo are expecting it to do? Well yes, I think so. I wanted to cut down on the times I was

Re: Sending JavaScript variables to a perl program

2003-03-15 Thread David Gilden
Hwo about this: Software error: Couldn't chdir to pictures directory: Not a directory at /home/sites/site175/web/cgi-bin/rand_img.cgi line 11. Is there setting on Apache that I need to enable so this script will work? Thanks, Dave Gilden #!/usr/bin/perl # http://

Re: Script for random images -- problem

2003-08-01 Thread David Gilden
quot;\nNEW:$2"; ... snip. print redirect("$2/$lucky_one"); So I did see the problem you mention below!! Oliver Schnarchendorf <[EMAIL PROTECTED]>, > On Thu, 31 Jul 2003 17:58:43 -0500, David Gilden wrote: > > $PICTURE_PATH = path_translated(); > > $PICT

Guest Book design / mySql / perl

2003-09-19 Thread David Gilden
Hello, I am taking over a site that was on a M$ server and redoing the Guest book and form pages in PERL. Question I have is the design of database. I have the following fields: Name varchar(80) Date date email

guestbook mySQL / PERL

2003-09-24 Thread David Gilden
Helllo, I have some questions here about my code. (which is going to have some issues) I am going to send this as 2 emails so that you don't have to scroll endlessly :) Goal: display database in a table with checkboxes so that the user can delete selected messages Please let me know how I c

guestbook mySQL deleting and refreshing

2003-09-24 Thread David Gilden
Helllo, Here is part two: Goal: delete selected records and refresh display_guestbook.cgi page. So the users sees the changes made. Please let me know how I can Improve my script and if you see anything that is bad style/practice. Thanks in advance for the lists help this code, Regards from

HTML headers with CGI.pm

2003-09-24 Thread David Gilden
Hello, Having some issues with cgi.pm Here is my PERL: ### # Start HTML OUT ### print header; print start_html( -title => $title ); print qq|\n|; and here is the output: http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";> http://www.w3.org/199

radio buttons :: CGI.pm

2003-09-27 Thread David Gilden
Good evening, How would I write the following with having to create %sort_order HASH? Thanks, Dave -- FT Worth, Tx snip %sort_order = ( 0 => ' Newest --> Oldest ', 1 => ' Oldest --> Newest ', ); print radio_group( -name=> 'database_order', -values => [

SQL question // date_format

2003-09-27 Thread David Gilden
Good evening, The following mySQL query works fine, but the server is in California. I would like add 2 hours to %l, because the client is in Texas. I could just go to time in GMT and forget about it :) But I'm wondering if there is a simple solution here. "SELECT id, DATE_FORMAT(datecreated, '

SQL question escaping quotes

2003-09-27 Thread David Gilden
One final question here on my SQL -- PERL DBI the following is wrong -- it does not work ! $sql = qq|insert into $table_name values (null,now(),"$email","$name","$comments");|; $sql = $dbh->quote($sql); ## this line $sth = $dbh->prepare($sql); if I do this: $name = $dbh->quote(param('Name'));

SQL -- getting one row problem

2003-09-29 Thread David Gilden
Good afternoon, Here is the output of my script, and can’t understand why this is not working. Thanks for any and all pointers! Dave Gilden [EMAIL PROTECTED]:~/cgi-bin$ mail_guest_to_jk.cgi Use of uninitialized value in concatenation (.) or string at ./mail_guest_to_jk.cgi line 33. Use of uni

SQL -- getting one row problem -- clever mySQL trick

2003-09-29 Thread David Gilden
Hello out there... I wanted to thank everyone who has kindly offered their assistance with my current project. Of course I have more questions, But first I wanted to share how I solved my current issue. It's displays a clever mySQL trick! -- see script below: Dave Gilden ( kora musician / audiop

calling other cgi's in PERL

2003-09-29 Thread David Gilden
Can anyone enlighten me on how to do this: Goal: call different PERL scripts from current PERL script. Below is what I am trying to accomplish, but I am not sure I have the syntax correct. (can't seem to find anything this in my PERL books) Thanks, Dave - #!/usr/bin/perl -w #some code..

POSIX 'strftime' and time zones

2003-09-30 Thread David Gilden
Quick question, the server is on west coast time (California) client is in Texas, central time (+2 hours) How can I add two hours to offset for central time? Thx, Dave #!/usr/local/bin/perl use POSIX 'strftime'; my $date = strftime('%A, %B %d, %Y %I:%M %p',localtime); print $date; -- -- To

Send mail weirdness

2003-10-02 Thread David Gilden
Greetings, my client claims he never receives any email from his contact page! I however have set up a 'BCC' and am getting email via the script below. His connection to the 'net is via AOL, and when I mail him from my email client using [EMAIL PROTECTED] he receives it, but not from the script

CGI form button w/ images

2003-10-06 Thread David Gilden
Hello, Question concerning forms, I have buttons of the type: But I would like to use a button of type: The problem is I need to pass values from the hidden fields to the script. with the any suggestions? Thanks, Dave ( kora musician / audiophile / web master @ cora connection / Ft. Wo

CGI.pm unsecure / dangerous ?

2004-02-24 Thread David Gilden
I just had blow up with a sys. adm. who said my script (see below) is potentialy unsecure and dangerous and therefor unacceptable. They are going with this one :) note the line from my script: print MAIL "TO: [EMAIL PROTECTED]"; Is there away some

Re: CGI.pm unsecure / dangerous ?

2004-02-24 Thread David Gilden
Sx- Jones. > Yes, this script can be hijacked =/ Sorry. > > > > print MAIL "TO: [EMAIL PROTECTED]"; > > print MAIL "From: $name <$email>\n"; > > print MAIL "Subject: $subject\n\n"; The From is Hard wired so I donât understand you mention below. print MAIL "From: $name <$email

Re: A good book? Upgrade

2001-06-04 Thread David Gilden
from : Oreilly, We do have an Upgrade Policy, I'm happy to say. :) You may read about it at http://www.oreilly.com/order/upgrade.html . (http://www.oreilly.com/catalog/pperl3/desc.html) has written: "This third edition of Programming Perl has been expanded to cover version 5.6 of this maturi

javascript and perl/cgi

2001-06-06 Thread David Gilden
Hi, In the following: Name: Email:   Type your chat message Thanks for any pointers on these two issues, Thanks Dave ** * Cora Connection Your West African Music Source * * http://www.coraconnection.com/

Cookie help needed

2001-10-30 Thread David Gilden
The code below does seem to work, and someone please show where I went wrong. Thx Dave -- ### Set Cookie #!/usr/bin/perl -w use CGI qw/:standard/; my $new_cookie = cookie( -name => "bears", -values => ['Sweater','Seymore','Bearnard','Blondie'], ); pri

redundant code

2001-10-31 Thread David Gilden
Good afternoon, Can some one point out where I am off? use CGI qw/:standard/; @fields = param(); # I think it returns a list of all the fields, # maybe we want to inslist a hash to get the values. foreach (@fields){ if ( $_ ~= /(|\?+|\d)/ ) { # match "" or ??? or 0 # do something bl

rename((1,2) and file permissions

2001-11-09 Thread David Gilden
Hello, what is causing the renamed file to take permissions of 755 instead of 644? -- am I doing this correctly -- there will be only one user of the script .. do I need 'file lock' here? Thanks to Bob Showalter for the formatting info on 'strftime' "man 3c strftime" --> http://www.cs.princeto

CGI.pm ".cgifields"

2001-11-12 Thread David Gilden
What is causing CGI.pm to generate the following? There no print statements for hidden fields!!! Thanks, Dave # in my script --- use CGI qw/:standard/; use CGI::Carp qw(fatalsToBrowser); # later in the code checkbox( -name =>$gig_num, -checked =>0, -label=>' ' ,override=>1) # removing

Getting Stared with CGI.pm

2001-10-07 Thread David Gilden
Good afternoon, This is my first shot at using CGI.pm (using the function-oriented style). I can't seem to get my script to read values from my web page. http://dowda.rockin.net/cgi/sql_sort2.pl Here is part of the script. Your comments are welcome. Special thanks to [EMAIL PROTECTED] (Curtis Po

passing prams to a sub vers a if() block

2001-10-08 Thread David Gilden
Hello, Is there a better way of setting up the sort that happens in sort_name(), the 'if( .. )' looks a little verbose, I was thinking it would be better to just past a string, as in: sub sort_name() { my ($first_field,$second_field) =@_; $database{$a}{"${first_field}_name"}; $database{$

re: passing prams to a sub vers a if() block

2001-10-08 Thread David Gilden
Folks, Sorry about the earlier post, perhaps another newbie might get some benefit from this posting :) Here is part of the revised code without the if{} block. To see the exercise I have been working on point your browser to: http://dowda.rockin.net/cgi/sql_sort3.pl It does point another issu