The code is part of a script that checks the memberstatus in the database and returns an errorpage if a user is set to another status then 1.
Problem is that other statusses are ok for approval also.
It needs to be set to status 1 or 5 and only throw up an error when a user has status 2 or 3 or 4.
I tried it myself by using AND status ='1' or status ='5' but then it came up with another member ???
Please help!??
Thanks
Marc
<?
$f_profile = f(q("SELECT name, email, member_id FROM dt_profile WHERE id='$profile_id'"));
$f_user = f(q("SELECT system_status, system_status_end FROM dt_members WHERE id='$f_profile[member_id]'"));
$f_balance = f(q("SELECT balance FROM dt_stamps_balance WHERE member_id='$fMember[id]'"));
// Checking to see if the current user has a profile.
$f_profile_user = f(q("SELECT id FROM dt_profile WHERE member_id = '$fMember[id]' AND STATUS = '1' "));
if(!($f_profile_user['id'] != 0))
{
include "templates/cannot_contact.ihtml";
return;
}
if($fMember[ unlimited ] && $fMember[ unlimited_end ] > strtotime(date("d M Y H:i:s")))
{
$free_profile = 1;
$can_contact = 0;
}
else
{
$free_profile = (int)($f_user[ system_status ] && ($f_user[ system_status_end ] >= strtotime(date("d M Y H:i:s"))));
$can_contact = (int)((int)$f_balance[ balance ] > 1);
}
if(!$free_profile && !$can_contact)
{
include "templates/cannot_contact.ihtml";
return;
}
$profile_name = $f_profile[ name ];
$profile_email = $f_profile[ email ];
$f_address_book = f(q("SELECT id FROM dt_address_book WHERE contact_profile_id='$profile_id' AND member_id='$fMember[id]'"));
if($f_address_book != "")
{
$free_profile = 1;
}
else
{
$sql = "
INSERT INTO dt_address_book
(member_id, contact_profile_id) VALUES
('$fMember[id]', '$profile_id')
";
q($sql);
}
if($free_profile)
{
include "engine/pages/send_message.pml";
return;
}
if($can_contact)
{
q("UPDATE dt_stamps_balance SET balance=balance-1 WHERE member_id='$fMember[id]'");
include "engine/pages/send_message.pml";
return;
}
?>