You are here: PHP connection problem, I can't get success with loging in though I think I use corect login and password... « PHP Programming Language « IT news, forums, messages
PHP connection problem, I can't get success with loging in though I think I use corect login and password...

Posted by MIUSS on 04/26/07 21:07

Hi

need an advice, I'm beginner with PHP. I got little problem:

I use this solution as login to get administration of my pages:

<?php
// if authorization isn't done we request it
if (!IsSet($PHP_AUTH_USER))
{
Header("HTTP/1.0 401 Unauthorized");
Header("WWW-Authenticate: Basic realm=\"RS - Admin Center\"");
echo "Unauthorized access (a)";
exit;
}
// if user filled up the form we continue with checking data in
database
else
{
// connect to database
include "../conn.php";
// looking for the login and password records that are set in
authorizing form
// we off-course looking for active users only
$sql = mysql_query("SELECT * FROM autori
WHERE login LIKE '$PHP_AUTH_USER'
AND pass = '".md5($PHP_AUTH_PW)."'
AND stav = 'a'");
// if we won't find anyone with requested conditions we stop
if (mysql_num_rows($sql) == 0)
{
Header("HTTP/1.0 401 Unauthorized");
Header("WWW-Authenticate: Basic realm=\"RS - Admin Center\"");
echo "Unauthorized access (b)";
mysql_close($conn);
exit;
}
// we don't need the connection with database so we end
mysql_close($conn);
}
// continue with opening frames
?>

The problem is that I can not get success with login on my pages
though I use correct login and password. The dialog is opened three
times and then I get the message Unauthorized access (a). It seems
that the part after else command is never done. Why is it?

Thank you very much for your hints!

Have a nice day!

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация