Re: Checkbox values and regex
Never mind, got my !~ and =~ mixed up. The following code does not seem to allow multiple variables passed by checkbox multiple variables. The test always evaluates true and prints my error msg. Help is much appreciated. #TEST FOR BAD CHARS my ($name, $value); foreach $name ($q-param()) {foreach $value ($q-param( $name )) {if ($value=~/^([\w\s\:\/\@\,\.\'-]+)$/i) { print PrintTag; html head STYLE type=text/css !-- BODY { background-color: #cc; font-size: 12pt; color: #66; text-align: center } H1 { font-size: 14pt } -- /STYLE /head body center h3Alert!/h3 p align=centerI'm sorry but only letters, numbers, underscores, b#064;/b, hyphens, commas, single apostrophes, and periods. are allowed in your form fields./p p align=centerPlease hit the back button of your browser and try again./p /center /body /html PrintTag exit(0); } } } --- - Teresa Raymond - - [EMAIL PROTECTED] - - http://www.mariposanet.com - --- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --- - Teresa Raymond - - [EMAIL PROTECTED] - - http://www.mariposanet.com - --- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Not enough space
Hello, Can anyone help me to identify where the problem is in the below code. = Error Msg : Not enough space at 1.pl line 2. = #!c:/iperl/cgi-bin/perl.exe open (FHAN, z:\\amro\\log\\sa.txt) or die ($!); $abn=FHAN; while ($abn ne ) { printf $abn\n; $abn=FHAN; } close (FHAN); = My Machine Config is Windows 95 and 32-bit perl, v5.6.1 = File details of sa.txt 1350 byte and 18 lines. When the file is copied to the local hard disk it is working file. I can't understand why ? Thanks for the help in advance. = Thanks SureshA -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
problem with redirect
This is what my error log says on my redhat 7.1 [Sun Sep 16 13:18:33 2001] [error] Undefined subroutine main::redirect called at /var/www/cgi-bin/sobt/add.cgi line 38. [Sun Sep 16 13:18:44 2001] [error] [client 192.168.1.8] Premature end of script here is my code: $dbh =DBI -connect($data_source, $username, $password); my $sth1 = $dbh - prepare(insert into media(serial,name,desc1)values('$serial' ,'$name','$desc1')); $sth1 - execute ; #$sth1 - finish; $dbh-disconnect; ### # re direct page back ### print redirect('sobt_admin.cgi'); thanks for your time Jim -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
stdin doesn't see the first keystroke+enter
Hi, I have a program with 2 while loops in there. The problem being is that when ever I run the program (Unix) the program doesn't see the first information added. After asking the Q, I need to press enter, then (w/o that the programs continue's) I can answer the Q and the program picks it up. However: every other Q in the loop gets picked up fine. So it is just the first answer to the Q that is not picked up. (instead of enter I can also sent any other keystroke+enter. A dirty work around will be asking the people to hit enter twice at the beginning of the program I quess but that would be a really dirty work around. Is this a known problem for anyone? I haven't included the file because to run it you need a company application. open file (which is basicly: OPEN (HANDLE, rlogin someserver ./someprogram | grep something | head -3 | ); while (and continue while there is data in the file) open file while (and continue while there is data in the file) if (if this statement is met: do nothing) else ask a Q with input from stdin print the answer to the Q close close Danny -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: problem with redirect
--- FLAHERTY, JIM-CONT [EMAIL PROTECTED] wrote: This is what my error log says on my redhat 7.1 [Sun Sep 16 13:18:33 2001] [error] Undefined subroutine main::redirect called at /var/www/cgi-bin/sobt/add.cgi line 38. [Sun Sep 16 13:18:44 2001] [error] [client 192.168.1.8] Premature end of script here is my code: $dbh =DBI -connect($data_source, $username, $password); my $sth1 = $dbh - prepare(insert into media(serial,name,desc1)values('$serial','$name','$desc1')); $sth1 - execute ; #$sth1 - finish; $dbh-disconnect; ### # re direct page back ### print redirect('sobt_admin.cgi'); redirect is one of the functions from CGI.pm. If this is what you intended to use, you'll either need to import it or declare an object and call it as a method: use CGI qw/:standard/; print redirect($someplace); # or # use CGI; my $q = CGI-new; print $q-redirect($someplace); I'm extremely concerned about your variables. You don't show yourself using the DBI::quote method, so you could be potentially allowing a huge security hole if the data you're adding is submitted by a user. Quoting your data or using placeholders should prevent this security hole: my $sth1 = $dbh-prepare(insert into media (serial,name,desc1) values(?,?,?)); $sth1-execute( $serial, $name, $desc1 ) ; # or # $serial = $dbh-quote( $serial ); $name= $dbh-quote( $name ); $desc1 = $dbh-quote( $desc1 ); my $sth1 = $dbh-prepare(insert into media(serial,name,desc1)values($serial,$name,$desc1)); The reason this is a problem is that many databases allow you to execute multiple SQL statements at once. If someone puts a terminating quote mark followed by appropriate input data, they can potentially execute arbitrary SQL against the database. Again, placeholders or the $dbh-quote method should prevent this. Cheers, Curtis Ovid Poe = Senior Programmer Onsite! Technology (http://www.onsitetech.com/) Ovid on http://www.perlmonks.org/ __ Terrorist Attacks on U.S. - How can you help? Donate cash, emergency relief information http://dailynews.yahoo.com/fc/US/Emergency_Information/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Help Request
Hello, Can somebody tell me how to get a cgi script that would read information from a file on the server, allow this info to be edited and then resaved into the same file? I'm trying to accomplish something like: http://www.excelgames.com/sample2.htm Where the GDP would be loaded from a file and be uneditable, tax rate would be loaded from the file, but be editable, and the income field would be GDP times the tax rate, then saved to the file. Thanks for the help! Duston -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: stdin doesn't see the first keystroke+enter
Fixed it myself. The problem is rlogin someserver/someprogram. If I run the script itself on 'someserver' and just use someprogram as input everything works fine Danny On Sun, 16 Sep 2001, Danny Haberer wrote: Hi, I have a program with 2 while loops in there. The problem being is that when ever I run the program (Unix) the program doesn't see the first information added. After asking the Q, I need to press enter, then (w/o that the programs continue's) I can answer the Q and the program picks it up. However: every other Q in the loop gets picked up fine. So it is just the first answer to the Q that is not picked up. (instead of enter I can also sent any other keystroke+enter. A dirty work around will be asking the people to hit enter twice at the beginning of the program I quess but that would be a really dirty work around. Is this a known problem for anyone? I haven't included the file because to run it you need a company application. open file (which is basicly: OPEN (HANDLE, rlogin someserver ./someprogram | grep something | head -3 | ); while (and continue while there is data in the file) open file while (and continue while there is data in the file) if (if this statement is met: do nothing) else ask a Q with input from stdin print the answer to the Q close close Danny -- 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]
telnet need help
Hi everyone, I downloaded this module Net::Telnetim not really good working with module but i made it work for now but it doesnt meet my objective.Which is ..1. open a telenet port; 2. get supplied passwd and username for verification, execute desired command and wait for my exit command. my ($logname,$passwd); print (Login :); $logname = STDIN; chop($logname); print(Passwd:); $passwd = STDIN; chop($passwd); use Net::Telnet(); #use module blib/lib/Net/Telnet.pm $t= use Net::Telnet ( Timeout = 10,Prompt = '/bash\$ $/' ); $t-open(); #open port 23 $t-login($logname,$passwd); #pass variable to method login to verify @lines = $t-cmd(/bin/who | ls -l); #command requested print(@lines\n); #print the requested ouput from this code when logname or passwd has no match it terminate and also when requested command is outputted... Question is how can i make it running and wait till i terminate it myself? pls see Telnet.pm code at Net::Telnet thanks... Joe -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]