Forums
This topic is locked
Undefined variables
Posted 10 Aug 2001 23:17:22
1
has voted
10 Aug 2001 23:17:22 Keith Slater posted:
I just uploaded my site off my computer to a NT box and Im getting a few errors. I'm getting stuff like this:Warning: Undefined variable: QUERY_STRING in D:\caricat\login.php on line 14
Warning: Undefined variable: textfield in D:\caricat\login.php on line 15
Only the pages with variables give me errors so I dont know whats going on hopefully some one else does.
thanks
Keith Slater
Replies
Replied 10 Aug 2001 23:46:55
10 Aug 2001 23:46:55 Keith Slater replied:
I know you probably want the script so here it is:
<?php
// *** Start the session
session_start();
// *** Validate request to log in to this site.
$KT_LoginAction = $PHP_SELF;
if ($QUERY_STRING!="" $KT_LoginAction .= "?".$QUERY_STRING;
$KT_valUsername=$textfield;
if (isset($KT_valUsername)) {
$KT_fldUserAuthorization="ACCESS_1";
$KT_redirectLoginSuccess="admin.php";
$KT_redirectLoginFailed="invalid.php";
$KT_rsUser_Source="SELECT USER_NAME, PASSWORD_1 ";
if ($KT_fldUserAuthorization != "" $KT_rsUser_Source .= "," . $KT_fldUserAuthorization;
$KT_rsUser_Source .= " FROM LOGIN_1 WHERE USER_NAME='" . $KT_valUsername . "' AND PASSWORD_1='" . $textfield2 . "'";
$KT_rsUser=$CaricaturePHP->Execute($KT_rsUser_Source) or DIE($CaricaturePHP->ErrorMsg());
if (!$KT_rsUser->EOF) {
// username and password match - this is a valid user
$KT_Username=$KT_valUsername;
session_register("KT_Username"
if ($KT_fldUserAuthorization != "" {
$KT_UserAuthorization=$KT_rsUser->Fields($KT_fldUserAuthorization);
} else {
$KT_UserAuthorization="";
}
session_register("KT_UserAuthorization"
if (isset($accessdenied) && false) {
$KT_redirectLoginSuccess = $accessdenied;
}
$KT_rsUser->Close();
session_register("KT_login_failed"
$KT_login_failed = false;
header ("Location: $KT_redirectLoginSuccess"
exit;
}
$KT_rsUser->Close();
session_register("KT_login_failed"
$KT_login_failed = true;
header ("Location: $KT_redirectLoginFailed"
exit;
}
?>
I dont understand why its doing this it has a connection to the database and its the same version of php. But it dont work on the NT box and it works on my windows 98
thanks
Keith Slater
<?php
// *** Start the session
session_start();
// *** Validate request to log in to this site.
$KT_LoginAction = $PHP_SELF;
if ($QUERY_STRING!="" $KT_LoginAction .= "?".$QUERY_STRING;
$KT_valUsername=$textfield;
if (isset($KT_valUsername)) {
$KT_fldUserAuthorization="ACCESS_1";
$KT_redirectLoginSuccess="admin.php";
$KT_redirectLoginFailed="invalid.php";
$KT_rsUser_Source="SELECT USER_NAME, PASSWORD_1 ";
if ($KT_fldUserAuthorization != "" $KT_rsUser_Source .= "," . $KT_fldUserAuthorization;
$KT_rsUser_Source .= " FROM LOGIN_1 WHERE USER_NAME='" . $KT_valUsername . "' AND PASSWORD_1='" . $textfield2 . "'";
$KT_rsUser=$CaricaturePHP->Execute($KT_rsUser_Source) or DIE($CaricaturePHP->ErrorMsg());
if (!$KT_rsUser->EOF) {
// username and password match - this is a valid user
$KT_Username=$KT_valUsername;
session_register("KT_Username"
if ($KT_fldUserAuthorization != "" {
$KT_UserAuthorization=$KT_rsUser->Fields($KT_fldUserAuthorization);
} else {
$KT_UserAuthorization="";
}
session_register("KT_UserAuthorization"
if (isset($accessdenied) && false) {
$KT_redirectLoginSuccess = $accessdenied;
}
$KT_rsUser->Close();
session_register("KT_login_failed"
$KT_login_failed = false;
header ("Location: $KT_redirectLoginSuccess"
exit;
}
$KT_rsUser->Close();
session_register("KT_login_failed"
$KT_login_failed = true;
header ("Location: $KT_redirectLoginFailed"
exit;
}
?>
I dont understand why its doing this it has a connection to the database and its the same version of php. But it dont work on the NT box and it works on my windows 98
thanks
Keith Slater
Replied 11 Aug 2001 20:51:57
11 Aug 2001 20:51:57 Bruno Mairlot replied:
You're trying to use the value of an undefined variable. (two actually : $QUERY_STRING and $textfield)
There's probably some code missing before. This piece of code (at line 14 and 15) is trying to define the KT_LoginAction variable, though this variable is never used after.
This is very strange. I suppose this is Phakt code, isn't it ? Very strange. The line 15 defines a variable, then check if it is defined ????
This might only come from the fact that $textfield isn't passed as a GET or POST from the precedent page. First make sure there is an input called textfield in it. (You've probably renamed it), and do the same for $QUERY_STRING...
Could you post then entire code ?
"First they laugh at you, then they fight you, then you Win..." Ghandi
There's probably some code missing before. This piece of code (at line 14 and 15) is trying to define the KT_LoginAction variable, though this variable is never used after.
This is very strange. I suppose this is Phakt code, isn't it ? Very strange. The line 15 defines a variable, then check if it is defined ????
This might only come from the fact that $textfield isn't passed as a GET or POST from the precedent page. First make sure there is an input called textfield in it. (You've probably renamed it), and do the same for $QUERY_STRING...
Could you post then entire code ?
"First they laugh at you, then they fight you, then you Win..." Ghandi
Replied 11 Aug 2001 23:31:47
11 Aug 2001 23:31:47 Tim Green replied:
Actually, the fact that these variables are undefined when first used is neither here nor there.
This particular problem has been dealt with before in another thread in this Forum. I have already mentioned this thread once in the last couple of days in response to a similar query.
The problem is that the PHP Server needs some modifications made in the PHP.ini file.
As always, please make sure that you actually look for the answer to your question first, rather than getting into the habit of just asking.
If you are in any need of help regarding sources for possible answers then please check out the Forum FAQ (click the link in my sig).
Tim Green
Extension & PHP TalkZone Manager
<font size=1>-------------------------------------------
<i>Please read the Forum FAQ before posting
a question to this TalkZone.</i>
-------------------------------------------
www.UDzone.com : A dynamic Dreamweaver,
Ultradev and Fireworks site for developers
by developers.
-------------------------------------------</font id=size1>
Edited by - rawveg on 08/11/2001 23:32:55
This particular problem has been dealt with before in another thread in this Forum. I have already mentioned this thread once in the last couple of days in response to a similar query.
The problem is that the PHP Server needs some modifications made in the PHP.ini file.
As always, please make sure that you actually look for the answer to your question first, rather than getting into the habit of just asking.
If you are in any need of help regarding sources for possible answers then please check out the Forum FAQ (click the link in my sig).
Tim Green
Extension & PHP TalkZone Manager
<font size=1>-------------------------------------------
<i>Please read the Forum FAQ before posting
a question to this TalkZone.</i>
-------------------------------------------
www.UDzone.com : A dynamic Dreamweaver,
Ultradev and Fireworks site for developers
by developers.
-------------------------------------------</font id=size1>
Edited by - rawveg on 08/11/2001 23:32:55