For starters, try and structure it so that it can be read easily. This usually helps when debugging:
Right, you have missed closing parenthesis off the end of each if / elseif statement at the end of the script.
elseif (db_result($result,0,'usergroupid') == '4'
should be:
elseif (db_result($result,0,'usergroupid') == '4')
hope this helps
L.
function user_login($username,$password)
{
global $feedback;
if (!$username || !$password)
{
$feedback .= ' ERROR - You do not have the correct access privilages to enter this area. Please try again. If you feel you have recieved this message in error, please contact Jonathan (j.dunn5@ntlworld.com) or another of the website administrators to resolve this error. ';
return false;
}
else
{
$username=strtolower($username);
$password=strtolower($password);
$sql="SELECT * FROM user WHERE username='$username' AND password='". md5($password) ."'";
$result=db_query($sql);
if (!$result || db_numrows($result) < 1)
{
$feedback .= ' ERROR - User not found or password incorrect ';
return false;
}
else
{
if (db_result($result,0,'usergroupid') == '0'
{
$feedback = 'You need to be a paid member to access this area.';
}
elseif (db_result($result,0,'usergroupid') == '1'
{
$feedback = 'You need to be a paid member to access this area.';
}
elseif (db_result($result,0,'usergroupid') == '2'
{
$feedback = 'You need to be a paid member to access this area.';
}
elseif (db_result($result,0,'usergroupid') == '3'
{
$feedback = 'You need to be a paid member to access this area.';
}
elseif (db_result($result,0,'usergroupid') == '4'
{
$feedback = 'You need to be a paid member to access this area.';
}
else
{
user_set_tokens($username);
$feedback .= '1';
return true;
}
}
}
}