PDA

View Full Version : #&^@#&*(@^#&^@ Cgi !!!!!!!!!!!!!



SlashTek.com
November 30th, 2001, 16:20
God I'm *** at cgi now!

lol

I ant get this damn thing to work on my new server.
It workd fine under xp (with apache), but dosnt work with my new server (cabalt)

Ok, heres what it does:

Heres the login script:

-------------------------------------------------

sub Login {
$yytitle = "$txt{'34'}";
&header;
print <<"EOT";
<BR><BR>
<form action="$cgi\&action=login2" method="POST">
<table border="0" width="400" cellspacing="1" cellpadding="0" bgcolor="$color{'bordercolor'}" class="bordercolor" align="center">
<tr>
<td class="windowbg" bgcolor="$color{'windowbg'}" width="100%">
<table width="100%" cellspacing="0" cellpadding="3">
<tr>
<td class="titlebg" bgcolor="$color{'titlebg'}" colspan="2">
<img src="$imagesdir/login_sm.gif">
<font size=2 class="text1" color="$color{'titletext'}"><b>$txt{'34'}</b></font></td>
</tr><tr>
<td align="right" class="windowbg" bgcolor="$color{'windowbg'}"><font size=2><b>$txt{'35'}:</b></font></td>
<td class="windowbg" bgcolor="$color{'windowbg'}"><font size=2><input type=text name="username" size=20></font></td>
</tr><tr>
<td align="right" class="windowbg" bgcolor="$color{'windowbg'}"><font size=2><b>$txt{'36'}:</b></font></td>
<td class="windowbg" bgcolor="$color{'windowbg'}"><font size=2><input type=password name="passwrd" size=20></font></td>
</tr><tr>
<td align="right" class="windowbg" bgcolor="$color{'windowbg'}"><font size=2><b>$txt{'497'}:</b></font></td>
<td class="windowbg" bgcolor="$color{'windowbg'}"><font size=2><input type=text name="cookielength" size=4 maxlength="4" value="$Cookie_Length"></font></td>
</tr><tr>
<td align="right" class="windowbg" bgcolor="$color{'windowbg'}"><font size=2><b>$txt{'508'}:</b></font></td>
<td class="windowbg" bgcolor="$color{'windowbg'}"><font size=2><input type=checkbox name="cookieneverexp"></font></td>
</tr><tr>
<td align=center colspan=2 class="windowbg" bgcolor="$color{'windowbg'}"><BR><input type=submit value="$txt{'34'}"></td>
</tr><tr>
<td align=center colspan=2 class="windowbg" bgcolor="$color{'windowbg'}"><small><small><a href="$reminderurl?action=input_user">$txt{'315'}</small></small></a><BR><BR></td>
</tr>
</table>
</td>
</tr>
</table>
</form>
EOT
&footer;
exit;
}

sub Login2 {
&fatal_error("Enter username") if($FORM{'username'} eq "");
&fatal_error("Enter Password") if($FORM{'passwrd'} eq "");
$FORM{'username'} =~ s/\s/_/g;
$username = $FORM{'username'};
&fatal_error("$txt{'240'}$username") if($username !~ /^[\s0-9A-Za-z#%+,-\.:=?@^_]+$/);
&fatal_error("$txt{'337'}") if($FORM{'cookielength'} !~ /^[0-9]+$/);

if(-e("$memberdir/$username.dat")) {
fopen(FILE, "$memberdir/$username.dat");
@settings = <FILE>;
fclose(FILE);
$settings[0] =~ s/[\n\r]//g;
if($settings[0] ne "$FORM{'passwrd'}") { $username = "Guest"; &fatal_error("$txt{'39'}"); }
$settings[0] = "$settings[0]\n";
}
else { $username = "Guest"; &fatal_error("$txt{'40'}"); }

if($FORM{'cookielength'} < 1 || $FORM{'cookielength'} > 9999) { $FORM{'cookielength'} = $Cookie_Length; }
if($FORM{'cookieneverexp'} ne 'on') {
$Cookie_Length = $FORM{'cookielength'};
&SetCookieExp;
}
else { $Cookie_Exp_Date = 'Sun, 17-Jan-2038 00:00:00 GMT'; }
$password = crypt("$FORM{'passwrd'}",$pwseed);

$yySetCookies = qq~Set-Cookie: $cookieusername=$username; path=/; expires=$Cookie_Exp_Date;\n~;
$yySetCookies .= qq~Set-Cookie: $cookiepassword=$password; path=/; expires=$Cookie_Exp_Date;\n~;
&LoadUserSettings;
&WriteLog;
&redirectinternal;
}

----------------------------------

When it loads, it shows the username/password box, but it dosnt pass the info entered any further.

To try to debug it,I did this:

&fatal_error("<SCRIPT LANGUAGE=\"JavaScript\">alert(\"$FORM{'username'} : $FORM{'passwrd'}\")</script>") if($FORM{'username'} eq "");

(commented 1st line and added under it line login2 sub)

and it pops up ":"
Nothing : Nothing.
It dosnt send/pass the info further for the login2 sub to process it.
It says "Enter Userame".

What should I do?

Thanks

FL/\SH