Home  |  Linux  | Mysql  | PHP  | XML
From:Adam Jimerson Date:Mon Dec  7 22:34:14 2009
Subject:Re: Showing errors with user input
Greg Jetter wrote:

> 
> You are trying to use a local scoped var as a global , line 93 
$GoodMail
> is
> used  out of its scope ,
> 
> if ( $user[5] =~ /^([-\@\w.]+)$/ ) {
> $user[5] = $1;
> eval {
> my $GoodMail = Email::Valid->address( -address => "$user[5]", -
mxcheck =>
> 1);
> return;
> }
> #push @errors, "<p>Error: Double check your email address</p>" if 
$@;
> $user[5] = $GoodMail;
>              }
> 
> 
> it should read
> 
> if ( $user[5] =~ /^([-\@\w.]+)$/ ) {
>                 my $GoodMail ;
> $user[5] = $1;
> eval {
> $GoodMail = Email::Valid->address( -address => "$user[5]", -mxcheck 
=> 1);
> return;
> }
> #push @errors, "<p>Error: Double check your email address</p>" if 
$@;
> $user[5] = $GoodMail;
>              }
> 
> or even declare it  up with the other globals  if you want , but the 
way
> you
> have it  now it is out of scope after that eval { } block completes.
> 
> 
> there may be other errors , fix that one first and try it again  and 
see
> what else pops up.
> 
> have fun
> 
> Greg

Ok I fixed that issue, can't even remember why I tried to declare it 
in the eval block I guess that is what I get for writing code while 
half asleep.  The only other change that I made was I uncommitted out 
the "push @errors, "<p>Error: Double check your email address</p>" if 
$@;" line and here is the new error I get

[Mon Dec  7 22:24:30 2009] register.cgi: Illegal character in 
prototype for main::form_verify : @user at register.cgi line 43.
[Mon Dec  7 22:24:30 2009] register.cgi: main::form_verify() called 
too early to check prototype at register.cgi line 36.
Content-type: text/html

<h1>Software error:</h1>
<pre>syntax error at register.cgi line 93, near &quot;push&quot;
register.cgi had compilation errors.
</pre>
<p>
For help, please send mail to this site's webmaster, giving this error 
message
and the time and date of the error.

</p>
[Mon Dec  7 22:24:30 2009] register.cgi: syntax error at register.cgi 
line 93, near "push"
[Mon Dec  7 22:24:30 2009] register.cgi: register.cgi had compilation 
errors.

There is something about this push statement that Perl doesn't like, 
the only thing I can think of is the if $@ part.

-- 
"We must plan for freedom, and not only for security, if for no other 
reason than only freedom can make security more secure."  Karl Popper
Navigate in group perl.beginners.cgi at sever nntp.perl.org
Previous Next


Your recent visits
Re: [PHP-WIN] problem with PEAR , windows platform , php 5.2.9-2 , IIS Version 6
Re: Cannot update null values into ase using AseCommand
Re: [PHP] generally, where in cPanel can one set the default page to load?
Zend_execute.lo causing Out Of Memory error during compile
cvs: phpdoc-tr /reference/uodbc/functions odbc-columnprivileges.xml odbc-columns.xml odbc-fetch-array.xml odbc-fetch-into.xml odbc-fetch-object.xml odbc-fetch-row.xml odbc-field-len.xml odbc-field-name.xml odbc-field-num.xml odbc-field-precision.xml odbc-


  
© No Copyright
You are free to use Anything
Site Maintained by Zareef Ahmed
Powered By PHP Consultants