Is this Secure?
Posted: Mon Nov 07, 2005 1:21 pm
I'm aware that absolutely nothing is encrypted, but besides that, is this a security flaw?
// My included security check function.
// This is before the header include in every page that needs protection, this particular example checks for admin rights, checking for user rights is 0.
// My included security check function.
Code: Select all
// Return true if logged in.
function bverify_login($bIsAdmin = 0)
{
global $logins_table;
if ( (isset($_COOKIE["tj_email"])) && (isset($_COOKIE["tj_password"])) )
{
$input_email = $_COOKIE["tj_email"];
$input_password = $_COOKIE["tj_password"];
}
else if ( (isset($_POST["login"])) && (isset($_POST["password"])) )
{
$input_email = $_POST["login"];
$input_password = $_POST["password"];
}
else
return false;
$result = mysql_query(" SELECT * FROM $logins_table WHERE email = '$input_email' ");
$found = mysql_fetch_row($result);
if ( $found[12] != '') // is activated?
return false;
if ( $found[2] == $input_password )
{
if ( $found[10] >= $bIsAdmin )
return true;
return false;
}
return false;
}// This is before the header include in every page that needs protection, this particular example checks for admin rights, checking for user rights is 0.
Code: Select all
if ( !bverify_login(1) )
header("Location: index.php?message=no_permissions");