Read Write to file .. need help
I need to read and write to a file before allowing the anyone else to read or write. I found this on the web.. but it does not work...maybe its my version of perl? http://htmlfixit.com/cgi-tutes/tutorial_Perl_Primer_011_File_manipulation_with_Perl.php File Operation modes: open: $filepath Read access only (The same as not specifying a mode.) $filepath Write access, create if nonexistant, and overwrite existing data. $filepathWrite access, append to existing data. +$filepathRead and Write only, no file creation/appending. Overwrite existing data. I tried this one +$filepathRead, Write, Create, overwrites rather then appending. +$filepath Read, Write, Create, Append, no overwriting. | SYSCOMMANDWrite data to external command only. SYSCOMAND | Read data from external command only. Anyone know about this? or can I just: #Open to read open (DataFile, $_[0])||die Sorry, I can't open $_[0]\n; flock (DataFile,2); @Data =DataFile; #open to write open DataFile, $_[0])||DieNice3(Can't write to $_[0]); flock (DataFile,2); foreach $Data(@Data) { print DataFile $Data\n; } close (DataFile)||die Sorry, I can't close $_[0]\n; -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: screen size...
Ok.. now how do I get the screen size info to a hidden input (in a form) or send back to a cgi ? I'm guessing as a hiiden input with in a form or as part of the link command, which calls the game.cgi?W=WvarH=Hvar p + A HREF='game.cgi?W= + screensize . width + $H= screensize . height 'click here/A+ /p yes ?yes? did I do it.. I really don't know JS : ( just guessing... BTW .. thanks for your help! Lou. - Original Message - From: Chasecreek Systemhouse [EMAIL PROTECTED] To: Luinrandir Hernsen [EMAIL PROTECTED]; [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Thursday, November 04, 2004 8:27 PM Subject: Re: screen size... On Thu, 4 Nov 2004 10:48:12 -0500, Luinrandir Hernsen [EMAIL PROTECTED] wrote: It there a way to get the screen size info using perl? As a CGI, not really. Try: blockquotetable border=3 bgcolor=#00trtd script toolkit = java . awt . Toolkit . getDefaultToolkit (); screensize = toolkit . getScreenSize (); document . writeln ( p + You screen is + screensize . width + pixels wide. + /p ); document . writeln ( p + You screen is + screensize . height + pixels tall. + /p ); /script /td/tr/table /blockquote HOWEVER, The remote client must have JS enabled and have Java installed =/ -- WC -Sx- Jones http://youve-reached-the.endoftheinternet.org/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Files -read write - an epiphany and question
I have been studying W/R to files... W/R to a string and to an array. and I must say I think I have it. I can read a file into an array IF i wrote the file using \n between vars, yes and I can read the entire file into a string (to later be split) by using delimiters like ,yes??? I have some data files that hold lists (like cities) that I want in an array. and some files that hold a collection of vars (name, city, color, cartype, etc) that I want to delimit and later read as a string ($Slurp) and then ($name, $city, $color, $cartype, $etc)=split (,,$Slurp) my question is if I write a file using delimiters like , can I later read the entire file into a string and then @Cities = split (,,$Slurp) ?? but how do I read a file that used the \n and then split it later??? right now i wold have to open file... @Array=read entire file into @Array close file and then... $name=$Array[1]; $city=$Array[2]; $color=$Array[3]; $cartype=$Array[4]; $etc=$Array[5]; there must be a better way like ? $name, $city, $color, $cartype, $etc)[EMAIL PROTECTED]; of can I split using the special var $\ or \n as a delimiter ?? am I making the example clear? or am i trying to do the impossible? Comment WITH example correction welcome.. the above syntax may not be completely correct but it gives you the idea...so please dont crusify me for it... Lou
Re: Need to check file
sigh.. so sorry for not being more exact... I did use the quotes if (-e 'filename.dat') I guess I will have to find out the full path... Thanks Lou - Original Message - From: Bee [EMAIL PROTECTED] To: Luinrandir Hernsen [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, October 14, 2004 4:54 PM Subject: Re: Need to check file I have successfully checked a file in the same dir , my question is do I have to chdir when doing a if (-e filename.dat) I don't think you will get success without a quote for 'filename.dat'. It could be the return value for sub filename concating sub dat, be nothing. I tried looking for files in other dirs using if (-e .../html) etc.. but with no success. By giving the full path ( not url ) of the file, you will get your job done without chdir. HTH, Bee -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Need to check file
I have successfully checked a file in the same dir , my question is do I have to chdir when doing a if (-e filename.dat) and then change back to the cgi-bin dir? www.mysite.com/cgi-bin is where my perl files are. www.mysite.com/html is where the file I want to check is. chdir /html; if (-e filename.html) {print qq|File Found|; } else {print qq|File NOT found|;} chdir/cgi-bin; I tried looking for files in other dirs using if (-e .../html) etc.. but with no success. do I make sence? Lou -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Do you use OptiPerl???
Any one here use OptiPerl to make CGI?? I have questions if you do. Lou -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
cgi question
I am writing a perl cgi online game. I would like to load the graphic.gif's to the players computer and then call them from there.. ideas? JS? perl? something else? can it be done at all? where do I start looking? thnaks -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: CGI and mySQL book, any recommendation.
Real information to your answer.. I use these... CGI Programming on the world wide web / O'Reilly CGI by example / Niles Dwight CGI Programming / Hamilton www.MySQL.com If you are new to perl.. avoid the O'Reilly books... there are, IMHO, written by PhD's for PhD's the Visual books , Read less, Learn More are really good. the Dewey Dec. Number at my library is 651.84's the CGI books mention the SQL's and you can go from there. something you need to know about perl that confused me for a year... there is the long way of writing code and a shorthand form. for instance... I now squat about CGI.pm so answers that reffer to CGI.pm are usless to me. I will be happy to help you as much as I can. I am wrting a web site just for beginners like usyou could help. Lou -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Array Question
Can I do something like this? @CityA=Suburb1, Suburb2, Suburb3; @CityB=Suburb1, Suburb4, Suburb5; $Var=TownCurrent; $NewVar=$($TownCurrent)[1]; I am trying to construct a sting from a variable. make sence? 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: Questions about game design in perl
Hey What ever I did I'm sorry. Obvisious ly it upset someone... I'm gone.. you guys are way to uptight about little shit L Hernsen - Original Message - From: WC -Sx- Jones [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, April 07, 2004 12:00 PM Subject: Re: Questions about game design in perl Morbus Iff wrote: I suspect a good amount of people have no clue the purpose of a Message-ID/References, much less how replying to the wrong one (ie. I don't feel like typing the To: address myself) and then rewriting the subject line can cause havoc with archivers and threaders. Just as bad are MUAs which do not honor the Message-ID/References and start a new thread EVEN when they actually do reply to a post in a proper manner... SUN's dtmail - even within Solaris 9 - is guilty of this... You listening SUN? -- http://www.usenix.org/publications/perl/ -- 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
Questions about game design in perl
Hallo I am trying to build a game in perl. I have questions. This is a story book game... here is the story, make a choice next page..here is the story, make a choice 1-Do I set up the login file (password name and your game details) in one big file, or in many files, one file per player? 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: More Details --- Re: Questions about game design in perl
I went to www.MySQL.com Do I download for windows and DBI for perl do I need Contributed APIs: DBI -- for connecting to MySQL from Perl I downloaded MySQL 4.0 I have OptiPerl, which I use top write perl I have windows 98. My Web Host has Unix. I kow how to parse a variable... but still need to know how to pass variables with the HIDDEN INPUT command from web page to web page that perl generates. Thanks for your help again Lou - Original Message - From: James Edward Gray II [EMAIL PROTECTED] To: Luinrandir Hernsen [EMAIL PROTECTED] Cc: Perl Beginners [EMAIL PROTECTED] Sent: Tuesday, April 06, 2004 4:48 PM Subject: Re: More Details --- Re: Questions about game design in perl Let's keep this discussion on the list so all can learn and help. On Apr 6, 2004, at 3:08 PM, Luinrandir Hernsen wrote: This will be a multi player game Interactive fiction-yes No audio files Have you ever heard of Zork Books? No, but I believe I'm getting the idea now. Basically, you get a piece of the story, make a decision, and click on the link to that decision. more story, more choices... but in a large , multi city setting. many players I agree with what others have said. A database backend is probably the way to go. James The players file will be reffereenced to see what tools you have, and allow for movement options accordingly. I am working on a simple sample game to show you Thanks Lou - Original Message - From: James Edward Gray II [EMAIL PROTECTED] To: Luinrandir Hernsen [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Tuesday, April 06, 2004 3:26 PM Subject: Re: Questions about game design in perl On Apr 6, 2004, at 2:11 PM, Luinrandir Hernsen wrote: Hallo Howdy. I am trying to build a game in perl. I have questions. This is a story book game... here is the story, make a choice next page..here is the story, make a choice Are we talking Interactive Fiction, or where you referring to actual audio files? Sounded like a Choose your own Adventure Audio Book, am I right? Is this online, or an actual executable? 1-Do I set up the login file (password name and your game details) in one big file, or in many files, one file per player? How many users are we talking about here? How much information is included in game details? James -- 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
File question
I want to write an online game... I need a to make a logon page and a new person page. I think I can do this with little help... however on the map... Do I keep one big file with all the info.. of several little files.. which is better? 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
Deleting a file(s) with variables _HELP!
I have a group of files I need to delete. They have a format like this. c:\game\data\(variable)info.file(variable) the actual file name is c:[EMAIL PROTECTED] I need to delete all files in this directory with the partial name of info.file where the (variable) is a wildcard. In dos it would be *file*.* What is it in perl? I found the delete command as unlink $gamedata=?player.dat?; unlink($gamedata); will this delete the file on the players computer or on my server I want it to delete the file on the players computer. Thanks for your help. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
capturing a webpage in a variable
IS this how I capture a web page code to a variable? #!/usr/bin/perl use LWP::UserAgent; my $req; my $ua = LWP::UserAgent-new; $req = HTTP::Request-new(GET = 'http://www.yahoo.com'); print $req; ## ? from here I can print at the code for the web page? 3 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Simple Perl code/syntax question
Hallo everyone and thank you for your previous help in basic the code would be for x=1 to 100 Select Case Case=10,20,30,40,50,60,70,80,90 then do this else else do this end select next x how is this done in perl? foreach (10,20,30,40,50,60,70,80,90); { do this; } I think I need to unpack my books! (i'm moving)LOL 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: Program to write code
I use OptiPerl from www.xakra.com Any one else use this? L Hernsen - Original Message - From: McMahon, Chris [EMAIL PROTECTED] To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, January 22, 2004 2:32 PM Subject: RE: Program to write code I like jEdit: www.jedit.org . It runs anywhere Java runs, is lightweight, knows syntax for most major programming languages (including Perl) out of the box, and even gets plugins written for it from weirdos like Tandem people. I got turned on to jEdit because a vendor I was working with had written jEdit plugins for the Tandem-specific scripting language TACL. It's not a full IDE, but it's way better than Notepad/Word, easy to use, and is extremely portable, if you don't always work on Windows. -Chris -Original Message- From: Owen [mailto:[EMAIL PROTECTED] Sent: Thursday, January 22, 2004 1:03 AM To: [EMAIL PROTECTED] Subject: Re: Program to write code On Wed, 21 Jan 2004 19:32:56 -0300 Marcelo [EMAIL PROTECTED] wrote: Hi, could anyone recommend a good program to write code, currently using notepad. If you are using Windows, there are a number of Notepad improved editors. Google for windows text editors and you will get them all I guess. Some of these like NoteTabPro have libraries to assist in programming, some better than others. There is also windows versions of Emacs or Vim which are unix originated editors. -- Owen -- 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
Join strings problem
Hallo and thank in advance. what am I doing wrong? I'm new to Perl. my Building string is not being built. is it that I need to declare the joined strings a string?How? Lou #!/usr/local/bin/perl print qq|Content-type: text/html\n\n|; my $EW5NS5=TEST.gif; ##this is the string I need to build. print qq|TABLE\n|; for ($row=0; $row10; $row++) { print qq|TR\n|; for ($col=0; $col 10; $col++) { ##build variable $Building=join(.EW.$row.NS.$col); print qq|TD bgcolor=black$Building/TDTD/TD\n|; } print qq|/TR\n|; } print qq|/TABLE\n|; print qq|x $EW5NS5 x br\n|; print qq|x $Building x\n|;
Re: need help/ advice
Yes thanks... I want to capture the code of a webpage to a string so I can pick out the stuff I want and put the code into another of my design. I will try your suggestion Is there another way to do this? with out the LWP::UserAgent I see you are using a get command.. ok I know about those to say it better I want to get the output / HTML code from another web site... the stuff between the HEAD to /BODY commands... clearer? many thanks.. I am real new to this... I'll look up the perldoc stuff too. Lou my $ua = LWP::UserAgent-new(); my $response = $ua-get($host_port); The perl code above is what I want ? yes? Thanks Lou The code below just gets me the name of your home page as a string. correct? but were I to do something like say my $url = URI-new(); $url-scheme('http'); $url-host($host_port); $url-path('/drieux'); my $response = $ua-get($url-as_string()); would get you my 'home page' of that site. So it's rather important which part of that process you were trying to 'solve'. cf perldoc URI perldoc LWP::UserAgent ciao drieux --- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: how to create a submit button in perl?
the submit button is part of the form command in HTML. I use perl to: print qq|formhtml commands like the submit button/form|; if thats what you are looking for check out your HTML commands for FORM Luinrandir - Original Message - From: Scot Robnett [EMAIL PROTECTED] To: Annie [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Friday, June 06, 2003 5:09 PM Subject: RE: how to create a submit button in perl? perldoc CGI -Original Message- From: Annie [mailto:[EMAIL PROTECTED] Sent: Friday, June 06, 2003 3:57 PM To: [EMAIL PROTECTED] Subject: how to create a submit button in perl? hi i need to create a submit button on one of my web page and i need the code to create that in perl? can anyone help me!! - Do you Yahoo!? Free online calendar with sync to Outlook(TM). -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Any one who knows Formmail by Matts Scripts
Hallo I need to have my form mail to 2 or 3 addresses. Anyone familiar enough with this popular program to advise??? Thanks Lou -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
self refreshing web page question
I want to create a web page that calls on another web page and automatically refresh the other webpage every minute. can I do this in JS alone? Perl alone? or do I have to use both? Thanks for the help, I just need to be pointed in a direction... Lou -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
screen size question
how do I find the current screen size of someone running my perl program? many thanks Lou
question about perl.
How do I run another perl program from within another perl program? if (x=0) { perl_ program_ 1.pl } else { perl_program_2 } exit;
Re: screen size question
Ok i tried it... do I have to parse the info or what? or do I set it up in an if/ifels/else ? sorry if I sound dumb, but i'm just learning perl. thanks Lou - Original Message - From: Jeff Westman [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, March 27, 2003 3:16 PM Subject: Re: screen size question system(stty -a) should get you what you want I don't know if perl has anything 'built-in'. -JW --- Luinrandir Hernsen [EMAIL PROTECTED] wrote: how do I find the current screen size of someone running my perl program? many thanks Lou __ Do you Yahoo!? Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop! http://platinum.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
File Transfer
Is there a way in Perl to make a directory and transfer files to it? Lou -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Images in memory
I am writing in Perl, to create a web page. The CGI calls on itself repeatedly as you move on the map. I need to preload some small images in memory of the players computer. Javascript has a way of doing this, but since the cgi calls on itself, if I put the code in my cgi the images would only be reloaded every time the cgi ran. I have come up with two possiblities. Have a separate window open (minimized) with the images being loaded on it but would the other window be able to call on them??? or use a frame with the images loaded on a window in a frame that can't be seen. any ideas anyony? can perl load and call on images in the clients computer? or do I have to find a way to do this in JS? Thanks for your time Lou -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
HTML for my perl CGI
Can anyone direct me to HTML help? Re: Tables, backround, and images Thanks Lou -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Max Len for string in perl???
Hallo What is the maximum number of charecters in a string? $A=123456789 Lou -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Random access files in Perl????
Long ago in GW Basic there were sequential files and random access files. Does perl have the latter? I only to get (and then put) certain info in a certain place every time. If I can avoid writing the whole file every time I bet my web site hoster would appreciate it! Just point me in a direction... Thanks Lou
Re: Max Len for string in perl???
I just did the math 250x300 is the size of the data file thats only 75,000 - Original Message - From: Fred Sahakian To: [EMAIL PROTECTED] ; [EMAIL PROTECTED] Sent: Tuesday, March 04, 2003 3:05 PM Subject: Re: Max Len for string in perl??? I think I read the other day that it was unlimited, but I could be wrong (might have been PHP). Just keep it as short as possible. Luinrandir Hernsen [EMAIL PROTECTED] 03/04/03 05:43AM Hallo What is the maximum number of charecters in a string? $A=123456789 Lou -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Parsing variables
Hallo I need simple parsing code for a get not a post. that will yeild 4 or 5 variables. Lou #I know I need to get rid of the # Split the name-value pairs @pairs = split(//, $ENV{'QUERY_STRING'}); foreach $pair (@pairs) { # Split the pair up into individual variables. ($name, $value) = split(/=/, $pair); } -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
please please comfirm (was Parsing variables)
Thank you for your help but I want to learn this too Here is the code from the HTML GET a href=move.pl?direction=NWamp;cx=5amp;cy=10amp;player=Lou;North West/a And here I think is the CGI code $input=$ENV{QUERY_STRING}; @pairs = split(//, $input); foreach $pair (@pairs) { ($name, $value)=split(/=/,$pair); $form{$name}= $value; } $direction=$form(direction); $cx=$form(cx); $cy=$form(cy); $player=$form(player); This should break it down so $direction=NW $cx=5 $cy=10 $player=Lou -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: converting a list into array
Hallo I had to replace the pull down menues to text boxes on my order form. This means I need to filter out unwanted text. I need to make it alphanumeric only.for security reasons. I have red/bold the two lines I changed last time to eliminate all 0 zero orders. if you are not receiving this in HTML mode look for the ## ## ## next line marker in the code. This is a Matt's Script is there an easy way to do this? Thanks for your help... i will be checking out the books now L Hernsen sub return_html { # Local variables used in this subroutine initialized. # local($key,$sort_order,$sorted_field); # Now that we have finished using form values for any e-mail related # # reasons, we will convert all of the form fields and config values # # to remove any cross-site scripting security holes. # local($field); foreach $field (keys %Config) { $safeConfig{$field} = clean_html($Config{$field}); } foreach $field (keys %Form) { $Form{$field} = clean_html($Form{$field}); } # If redirect option is used, print the redirectional location header. # if ($Config{'redirect'}) { print Location: $safeConfig{'redirect'}\n\n; } # Otherwise, begin printing the response page. # else { # Print HTTP header and opening HTML tags. # print Content-type: text/html\n\n; print html\n head\n; # Print out title of page# if ($Config{'title'}) { print title$safeConfig{'title'}/title\n } else { print titleCatalog-Order form/title\n} print /head\n body; # Get Body Tag Attributes# body_attributes; # Close Body Tag # print \n center\n; # Print custom or generic title. # if ($Config{'title'}) { print h1$safeConfig{'title'}/h1\n } else { print h1Thank You For Placing an Order/h1\n } print /center\n; print Below is the order submitted to www.xyz.com on ; print $datephr size=1 width=75\%p\n; # If a sort order is specified, sort the form fields based on that. # if ($Config{'sort'} =~ /^order:.*,.*/) { # Set the temporary $sort_order variable to the sorting order, # # remove extraneous line breaks and spaces, remove the order:# # directive and split the sort fields into an array. # $sort_order = $Config{'sort'}; $sort_order =~ s/(\s+|\n)?,(\s+|\n)?/,/g; $sort_order =~ s/(\s+)?\n+(\s+)?//g; $sort_order =~ s/order://; sorted_fields = split(/,/, $sort_order); # For each sorted field, if it has a value or the print blank# # fields option is turned on print the form field and value. # foreach $sorted_field (sorted_fields) { local $sfname = clean_html($sorted_field); if ($Config{'print_blank_fields'} || $Form{$sorted_field} ne '') { print b$sfname:/b $Form{$sorted_field}p\n; } } } # Otherwise, use the order the fields were sent, or alphabetic. # else { # Sort alphabetically if requested. if ($Config{'sort'} eq 'alphabetic') { Field_Order = sort Field_Order; } # For each form field, if it has a value or the print blank # # fields option is turned on print the form field and value. # foreach $field (Field_Order) { local $fname = clean_html($field); ### ### ### next line if ( ($Config{'print_blank_fields'}) or ($Form{$field}) ) { ## if ($Config{'print_blank_fields'} || $Form{$field} ne '0') { print b$fname:/b $Form{$field}p\n; } } } print phr size=1 width=75%p\n; # Check for a Return Link and print one if found.# if ($Config{'return_link_url'} $Config{'return_link_title'}) { print ul\n; print lia href=\$safeConfig{'return_link_url'}\$safeConfig{'return_link_title'}/a\n; print /ul\n; } # Print the page footer. # print (END HTML FOOTER); hr size=1 width=75%p centerfont size=-1a href=http://www.worldwidemart.com/scripts/formmail.shtml;FormMail/a V1.92 copy; 1995 - 2002 Matt Wrightbr A Free Product of a href=http://www.worldwidemart.com/scripts/;Matt's Script Archive,
need help ... text boxes/form .... alphanumeric input only
Hallo I had to replace the pull down menues to text boxes on my order form. This means I need to filter out unwanted text. I need to make it alphanumeric only.for security reasons. I have red/bold the two lines I changed last time to eliminate all 0 zero orders. if you are not receiving this in HTML mode look for the ## ## ## next line marker in the code. This is a Matt's Script is there an easy way to do this? Thanks for your help... i will be checking out the books now L Hernsen sub return_html { # Local variables used in this subroutine initialized. # local($key,$sort_order,$sorted_field); # Now that we have finished using form values for any e-mail related # # reasons, we will convert all of the form fields and config values # # to remove any cross-site scripting security holes. # local($field); foreach $field (keys %Config) { $safeConfig{$field} = clean_html($Config{$field}); } foreach $field (keys %Form) { $Form{$field} = clean_html($Form{$field}); } # If redirect option is used, print the redirectional location header. # if ($Config{'redirect'}) { print Location: $safeConfig{'redirect'}\n\n; } # Otherwise, begin printing the response page. # else { # Print HTTP header and opening HTML tags. # print Content-type: text/html\n\n; print html\n head\n; # Print out title of page# if ($Config{'title'}) { print title$safeConfig{'title'}/title\n } else { print titleCatalog-Order form/title\n} print /head\n body; # Get Body Tag Attributes# body_attributes; # Close Body Tag # print \n center\n; # Print custom or generic title. # if ($Config{'title'}) { print h1$safeConfig{'title'}/h1\n } else { print h1Thank You For Placing an Order/h1\n } print /center\n; print Below is the order submitted to www.xyz.com on ; print $datephr size=1 width=75\%p\n; # If a sort order is specified, sort the form fields based on that. # if ($Config{'sort'} =~ /^order:.*,.*/) { # Set the temporary $sort_order variable to the sorting order, # # remove extraneous line breaks and spaces, remove the order:# # directive and split the sort fields into an array. # $sort_order = $Config{'sort'}; $sort_order =~ s/(\s+|\n)?,(\s+|\n)?/,/g; $sort_order =~ s/(\s+)?\n+(\s+)?//g; $sort_order =~ s/order://; sorted_fields = split(/,/, $sort_order); # For each sorted field, if it has a value or the print blank# # fields option is turned on print the form field and value. # foreach $sorted_field (sorted_fields) { local $sfname = clean_html($sorted_field); if ($Config{'print_blank_fields'} || $Form{$sorted_field} ne '') { print b$sfname:/b $Form{$sorted_field}p\n; } } } # Otherwise, use the order the fields were sent, or alphabetic. # else { # Sort alphabetically if requested. if ($Config{'sort'} eq 'alphabetic') { Field_Order = sort Field_Order; } # For each form field, if it has a value or the print blank # # fields option is turned on print the form field and value. # foreach $field (Field_Order) { local $fname = clean_html($field); ### ### ### next line if ( ($Config{'print_blank_fields'}) or ($Form{$field}) ) { ## if ($Config{'print_blank_fields'} || $Form{$field} ne '0') { print b$fname:/b $Form{$field}p\n; } } } print phr size=1 width=75%p\n; # Check for a Return Link and print one if found.# if ($Config{'return_link_url'} $Config{'return_link_title'}) { print ul\n; print lia href=\$safeConfig{'return_link_url'}\$safeConfig{'return_link_title'}/a\n; print /ul\n; } # Print the page footer. # print (END HTML FOOTER); hr size=1 width=75%p centerfont size=-1a href=http://www.worldwidemart.com/scripts/formmail.shtml;FormMail/a V1.92 copy; 1995 - 2002 Matt Wrightbr A Free Product of a href=http://www.worldwidemart.com/scripts/;Matt's Script Archive,
need help
This line is from a script if ($Config{'print_blank_fields'} || $Form{$field} ne '0') I need to change the last part (in bold) to read for both 0 and the empty set '' so the logic should read if ($Config{'print_blank_fields'} || $Form{$field} ne '0' or '' ) Or to say it another way I need the following two lines to be one. if ($Config{'print_blank_fields'} || $Form{$field} ne '0') if ($Config{'print_blank_fields'} || $Form{$field} ne '' ) I have tried if ($Config{'print_blank_fields'} || $Form{$field} ne '0,') if ($Config{'print_blank_fields'} || $Form{$field} ne '0' || $Form{$field} ne '' ) if ($Config{'print_blank_fields'} || $Form{$field} ne '0','') and it doen't work help? ideas? Thanks