Hi,
I don't want to tweak up my conifguration because i have already struggled with PHP configuration so i have decided to continue with the same odbc.
here is my PHP Code,
function verifyLogin($username, $password, $client_code)
{
$returnval = $GLOBALS["LOGIN_SUCCESS"];
$conn = odbc_connect('server','Admin','passwrod');
//see if client exists
$client_code = "*";
$sql = "SELECT COUNT(*) FROM clients WHERE client_code='$client_code'";
$result = odbc_exec($conn, $sql);
$num_rows = odbc_num_rows($result); // Here I get 1 rows after using count(*)...thats ok.
if ((odbc_num_rows($result) > 0) || ($client_code == "*"))
{
$sql = "SELECT active, password FROM users WHERE LOWER(username)='" . strtolower($username) . "' AND (client_code='*' or client_code='$client_code')";
//here we get the user status and his password";
$result = odbc_exec($conn, $sql);
echo "<br>total num of rows :".odbc_num_rows($result);
// here i get -1 rows.. However if we use select count(*) instead of filed name i get 1 row. i can use count(*) but when i use count(*) then i get errror
// Notice: Undefined index: active in c:\Inetpub\wwwroot\dev\lib\login_functions.php on line 421.
//when i try $row["active"].
if (odbc_num_rows($result) > 0)
{
$row = odbc_fetch_array($result);
if ($row["active"] == false)
{
$returnval = $GLOBALS["LOGIN_USER_INACTIVE"];
}
//see if password is correct
else if ($row["password"] != $password) //need to store md5 password in database in the future
{
$returnval = $GLOBALS["LOGIN_PASSWORD_INCORRECT"];
}
}
else
{
$returnval = $GLOBALS["LOGIN_USERNAME_NOT_FOUND"];
}
}
else
{
$returnval = $GLOBALS["LOGIN_CLIENT_NOT_FOUND"];
}
return $returnval;
}
please friends i desperately need help. Please help me out to sort this issues