Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Please Help - No Clue What's Wrong

Status
Not open for further replies.

mtorbin

Technical User
Nov 5, 2002
369
US
Hey all,

I have the following script that is running as an SSI. In it's current state, it gives me the following error, but still processes through:

[Mon Dec 29 16:16:06 2003] [error] [client xxx.xx.x.xx] Use of uninitialized value in concatenation (.) or string at /xxx/xxxxx/xxxxx/cgi-bin/ccForm.cgi line 14.

If I remove the "-wT" it won't process at all. This is a simple script, so it should not be a problem, but for some reason, I can't figure it out. Two things you will notice with this script:

1) The IP addresses have been replaced with "X".
2) There is some unncessary information that has been commented out.

Any advice?

============================================================


#!/usr/bin/perl -wT

use strict;
use CGI ':standard';

my $userInfo = "$ENV{'HTTP_USER_AGENT'}";
my $macInfo = "Mozilla/5.0 (Macintosh\; U\; PPC Mac OS X Mach-O\; en-US\; rv:1.4) Gecko/20030624 Netscape/7.1";
my $userIP = "$ENV{REMOTE_ADDR}";

my $userName = param('username');

my $passWord = param('password');

my $url = " . $userName . ":" . $passWord . "\@xxx.xx.x.xx/controlCenter/redirect.html";

#if ($userInfo eq $macInfo) {

#THE IF STATEMENT BELOW IS USED FOR IP ADDRESS AUTHENTICATION ONLY
#
if ($userIP eq 'xxx.xx.x.xx') {
#
print "Content-type: text/html\n\n";
print &quot;<form name=\&quot;login\&quot;>\n&quot;;
# print &quot;<form action=\&quot;cgi-bin/ccForm.cgi\&quot; method=\&quot;post\&quot;>\n&quot;;
print &quot;<input type=\&quot;hidden\&quot; name=\&quot;server\&quot; value=\&quot;xxx.xx.x.xx/controlCenter/redirect.html\&quot;>\n&quot;;
print &quot;<strong>Log into<br>The Control Center</strong>\n&quot;;
print &quot;<br>\n&quot;;
print &quot;<br>\n&quot;;
print &quot;<table width=\&quot;100\&quot; height=\&quot;100\&quot; border=\&quot;2\&quot; cellpadding=\&quot;2\&quot; cellspacing=\&quot;0\&quot; bordercolor=\&quot;#000000\&quot; bgcolor=\&quot;#cccccc\&quot;>\n&quot;;
print &quot;<tr>\n&quot;;
print &quot;<td height=\&quot;20\&quot; valign=\&quot;top\&quot;>Username</td>\n&quot;;
print &quot;</tr>\n&quot;;
print &quot;<tr>\n&quot;;
print &quot;<td height=\&quot;20\&quot; valign=\&quot;top\&quot;><input name=\&quot;username\&quot; type=text id=\&quot;username\&quot; size=11 ></td>\n&quot;;
print &quot;</tr>\n&quot;;
print &quot;<tr>\n&quot;;
print &quot;<td height=\&quot;20\&quot; valign=\&quot;top\&quot;>Password</td>\n&quot;;
print &quot;</tr>\n&quot;;
print &quot;<tr>\n&quot;;
print &quot;<td height=\&quot;20\&quot; valign=\&quot;top\&quot;><input name=\&quot;password\&quot; type=password id=\&quot;password\&quot; size=11></td>\n&quot;;
print &quot;</tr>\n&quot;;
print &quot;<tr>\n&quot;;
print &quot;<td height=\&quot;1\&quot; valign=\&quot;top\&quot; bgcolor=\&quot;#000000\&quot;><img src=\&quot;images/spacer.gif\&quot; width=\&quot;1\&quot; height=\&quot;1\&quot;></td>\n&quot;;
print &quot;</tr>\n&quot;;
print &quot;<tr>\n&quot;;
print &quot;<td height=\&quot;19\&quot; align=\&quot;center\&quot; valign=\&quot;top\&quot;><input type=button value=\&quot;Login\&quot; onClick=\&quot;Login(this.form)\&quot; name=\&quot;button\&quot;></td>\n&quot;;
print &quot;</tr>\n&quot;;
print &quot;</table>\n&quot;;
print &quot;</form>&quot;;
}

else {
print &quot;Content-type: text/html\n\n&quot;;
print &quot; &quot;;
}
 
You're not creating an instance of the CGI object to be able to read the variables $userName and $passWord

Print these values before the concatenation.

It's only a warning and should disappear when you use
$object=new CGI;
fairly close to the start of your script

HTH
--Paul
 
Paul,

I don't know that I totally understand you. This is what I currently have, where do I put the code that you suggested?

#!/usr/bin/perl -wT

use strict;
use CGI ':standard';

my $userIP = &quot;$ENV{REMOTE_ADDR}&quot;;

my $userName = param('username');

my $passWord = param('password');

my $url = &quot; . $userName . &quot;:&quot; . $passWord . &quot;\@172.25.1.9/controlCenter/redirect.html&quot;;

#if ($userInfo eq $macInfo) {

#THE IF STATEMENT BELOW IS USED FOR IP ADDRESS AUTHENTICATION ONLY
#
if ($userIP eq '172.25.1.35') {
#
print &quot;Content-type: text/html\n\n&quot;;
print &quot;<form name=\&quot;login\&quot;>\n&quot;;
print &quot;<input type=\&quot;hidden\&quot; name=\&quot;server\&quot; value=\&quot;172.25.1.9/controlCenter/redirect.html\&quot;>\n&quot;;
print &quot;<strong>Log into<br>The Control Center</strong>\n&quot;;
print &quot;<br>\n&quot;;
print &quot;<br>\n&quot;;
print &quot;<table width=\&quot;100\&quot; height=\&quot;100\&quot; border=\&quot;2\&quot; cellpadding=\&quot;2\&quot; cellspacing=\&quot;0\&quot; bordercolor=\&quot;#000000\&quot; bgcolor=\&quot;#cccccc\&quot;>\n&quot;;
print &quot;<tr>\n&quot;;
print &quot;<td height=\&quot;20\&quot; valign=\&quot;top\&quot;>Username</td>\n&quot;;
print &quot;</tr>\n&quot;;
print &quot;<tr>\n&quot;;
print &quot;<td height=\&quot;20\&quot; valign=\&quot;top\&quot;><input name=\&quot;username\&quot; type=text id=\&quot;username\&quot; size=11 ></td>\n&quot;;
print &quot;</tr>\n&quot;;
print &quot;<tr>\n&quot;;
print &quot;<td height=\&quot;20\&quot; valign=\&quot;top\&quot;>Password</td>\n&quot;;
print &quot;</tr>\n&quot;;
print &quot;<tr>\n&quot;;
print &quot;<td height=\&quot;20\&quot; valign=\&quot;top\&quot;><input name=\&quot;password\&quot; type=password id=\&quot;password\&quot; size=11></td>\n&quot;;
print &quot;</tr>\n&quot;;
print &quot;<tr>\n&quot;;
print &quot;<td height=\&quot;1\&quot; valign=\&quot;top\&quot; bgcolor=\&quot;#000000\&quot;><img src=\&quot;images/spacer.gif\&quot; width=\&quot;1\&quot; height=\&quot;1\&quot;></td>\n&quot;;
print &quot;</tr>\n&quot;;
print &quot;<tr>\n&quot;;
print &quot;<td height=\&quot;19\&quot; align=\&quot;center\&quot; valign=\&quot;top\&quot;><input type=button value=\&quot;Login\&quot; onClick=\&quot;Login(this.form)\&quot; name=\&quot;button\&quot;></td>\n&quot;;
print &quot;</tr>\n&quot;;
print &quot;</table>\n&quot;;
print &quot;</form>&quot;;
}
else {
print &quot;Content-type: text/html\n\n&quot;;
print &quot;&nbsp;&quot;;
}



- MT
 
Before
Code:
my $userIP = &quot;$ENV{REMOTE_ADDR}&quot;;

HTH
--Paul
 
Additionally, would this error be enough to bog down a high-end server running Apache 2?

- MT
 
It's only a warning, so you should have no reason to worry, worst case is you'll probably have two lines in the log files instead of one.

It is a salient warning in that no data is being logged with respect to $userName and $passWord


HTh
--Paul
 
I put that in the top of the script where you suggested but all of a sudden the script bombed:

#!/usr/bin/perl -wT

use strict;
use CGI ':standard';


my $userInfo = &quot;$ENV{'HTTP_USER_AGENT'}&quot;;
my $macInfo = &quot;Mozilla/5.0 (Macintosh\; U\; PPC Mac OS X Mach-O\; en-US\; rv:1.4) Gecko/20030624 Netscape/7.1&quot;;

$object=new CGI;

my $userIP = &quot;$ENV{REMOTE_ADDR}&quot;;
my $userName = param('username');
my $passWord = param('password');

.
.
.


Did I miss something? We're coming to the conclusion that Apache 2.0 does not work as well as 1.3. Thanks for your help.

- MT
 
When you say bombed what is the error message now?

--Paul
 
It should not have anything to do with apache 1.3 vs 2.0, they are pretty much identical for what you are doing.

Your problem is that you are not using 'my' on your $object.

Change $object=new CGI;

to

my $object=new CGI;

Your error log would have said something about this.

 
LOL... Ok, I'm starting to think this is an Apache 2.0 issue since we're having hoards of trouble with it already. This is what I have and I'm getting the same results (thank you for being patient BTW):

#!/usr/bin/perl -wT

use strict;
use CGI ':standard';

my $userInfo = &quot;$ENV{'HTTP_USER_AGENT'}&quot;;
my $macInfo = &quot;Mozilla/5.0 (Macintosh\; U\; PPC Mac OS X Mach-O\; en-US\; rv:1.4) Gecko/20030624 Netscape/7.1&quot;;
my $object = new CGI;
my $userIP = &quot;$ENV{REMOTE_ADDR}&quot;;
my $userName = param('username');
my $passWord = param('password');
my $url = &quot; . $userName . &quot;:&quot; . $passWord . &quot;\@XXX.XX.X.XXX/controlCenter/redirect.html&quot;;

if ($userIP eq 'XXX.XX.X.XXX') {
print &quot;Content-type: text/html\n\n&quot;;
print &quot;<form name=\&quot;login\&quot;>\n&quot;;
print &quot;<input type=\&quot;hidden\&quot; name=\&quot;server\&quot; value=\&quot;XXX.XX.X.XXX/controlCenter/redirect.html\&quot;>\n&quot;;
print &quot;<strong>Log into<br>The Control Center</strong>\n&quot;;
print &quot;<br>\n&quot;;
print &quot;<br>\n&quot;;
print &quot;<table width=\&quot;100\&quot; height=\&quot;100\&quot; border=\&quot;2\&quot; cellpadding=\&quot;2\&quot; cellspacing=\&quot;0\&quot; bordercolor=\&quot;#000000\&quot; $
print &quot;<tr>\n&quot;;
print &quot;<td height=\&quot;20\&quot; valign=\&quot;top\&quot;>Username</td>\n&quot;;
print &quot;</tr>\n&quot;;
print &quot;<tr>\n&quot;;
print &quot;<td height=\&quot;20\&quot; valign=\&quot;top\&quot;><input name=\&quot;username\&quot; type=text id=\&quot;username\&quot; size=11 ></td>\n&quot;;
print &quot;</tr>\n&quot;;
print &quot;<tr>\n&quot;;
print &quot;<td height=\&quot;20\&quot; valign=\&quot;top\&quot;>Password</td>\n&quot;;
print &quot;</tr>\n&quot;;
print &quot;<tr>\n&quot;;
print &quot;<td height=\&quot;20\&quot; valign=\&quot;top\&quot;><input name=\&quot;password\&quot; type=password id=\&quot;password\&quot; size=11></td>\n&quot;;
print &quot;</tr>\n&quot;;
print &quot;<tr>\n&quot;;
print &quot;<td height=\&quot;1\&quot; valign=\&quot;top\&quot; bgcolor=\&quot;#000000\&quot;><img src=\&quot;images/spacer.gif\&quot; width=\&quot;1\&quot; height=\&quot;1\&quot;></$
print &quot;</tr>\n&quot;;
print &quot;<tr>\n&quot;;
print &quot;<td height=\&quot;19\&quot; align=\&quot;center\&quot; valign=\&quot;top\&quot;><input type=button value=\&quot;Login\&quot; onClick=\&quot;Login(this.form$
print &quot;</tr>\n&quot;;
print &quot;</table>\n&quot;;
print &quot;</form>&quot;;
}

else {
print &quot;Content-type: text/html\n\n&quot;;
print &quot;&nbsp;&quot;;
}



What am I missing?

- MT
 
mtorbin,

wrap your code in [ code] [/ code] tags, there's some hookey looking stuff in here with out the code formatting

--Paul
 
shouldn't you have single quotes around the environment variable

my $userIP = &quot;$ENV{REMOTE_ADDR}&quot;;

my $userIP = &quot;$ENV{'REMOTE_ADDR'}&quot;;

Duncan
 
FOUND IT

my $url = &quot; . $userName . &quot;:&quot; . $passWord . &quot;\@XXX.XX.X.XXX/controlCent
er/redirect.html&quot;;


You have a semi-colon after ' (my $url = &quot; .)

That is causing you heartaches

Dont blame apache, its your fault.
 
Thank you.... LOL... it's always the little things...


- MT
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top