Forum Moderators: coopster
function get_user_type($user)
{
// grabs the main info for a given user
global $conn, $config, $lang;
require_once($config['basepath'] . '/include/misc.inc.php');
$misc = new misc();
$display = '';
$user = $misc->make_db_extra_safe($user);
$sql = "SELECT userdb_is_agent,userdb_is_admin FROM " . $config['table_prefix'] . "userdb WHERE (userdb_id = $user)";
$recordSet = $conn->Execute($sql);
if ($recordSet === false) {
$misc->log_error($sql);
}
// get main listings data
while (!$recordSet->EOF) {
$agent = $misc->make_db_unsafe ($recordSet->fields['userdb_is_agent']);
$admin = $misc->make_db_unsafe ($recordSet->fields['userdb_is_admin']);
$recordSet->MoveNext();
} // end while
if($admin=='yes'){
CODE TO LOAD TEMPLATE 1 HERE
}elseif($agent=='yes'){
CODE TO LOAD TEMPLATE 1 HERE
}
CODE TO LOAD TEMPLATE 2 HERE
}
if (isset($_SESSION["template"]))
{
$config["template"] = $_SESSION["template"];
} else {
$config["template"] = $misc->make_db_unsafe($recordSet->fields["controlpanel_template"]);
}
function get_user_type($user)
{
// grabs the main info for a given user
global $conn, $config, $lang;
require_once($config['basepath'] . '/include/misc.inc.php');
$misc = new misc();
$display = '';
$user = $misc->make_db_extra_safe($user);
$sql = "SELECT userdb_is_agent,userdb_is_admin FROM " . $config['table_prefix'] . "userdb WHERE (userdb_id = $user)";
$recordSet = $conn->Execute($sql);
if ($recordSet === false) {
$misc->log_error($sql);
}
// get main listings data
while (!$recordSet->EOF) {
$agent = $misc->make_db_unsafe ($recordSet->fields['userdb_is_agent']);
$admin = $misc->make_db_unsafe ($recordSet->fields['userdb_is_admin']);
$recordSet->MoveNext();
} // end while
if ($admin == 'yes') {
$type = "admin";
//CODE TO LOAD TEMPLATE 1 HERE
} elseif ($agent == 'yes') {
$type = "agent";
//CODE TO LOAD TEMPLATE 1 HERE
} else {
$type = "default";
//CODE TO LOAD TEMPLATE 2 HERE
}
switch($type"]) {
case 'admin':
include "basepath/template/template1";
break;
case 'agent':
include "basepath/template/template1";
break;
default:
include "basepath/template/template2";
break;
}