<?php 
$sqlu = $db->query("SELECT * FROM users WHERE  users.username='$user' ") or die(mysql_error());
            $rowu = mysqli_fetch_array( $sqlu );
$userrole=$rowu['userrole'];
$stationid=$rowu['stationid'];
$userid=$rowu['id'];

$sql_role = "SELECT role_name FROM user_roles WHERE role_id = ?";
$stmt_role = $db2->prepare($sql_role);
$stmt_role->bind_param("i", $userrole);
$stmt_role->execute();
$result_role = $stmt_role->get_result();
$row_role = $result_role->fetch_assoc();

// Store the role name in a new variable
$userrole_name = $row_role['role_name'];
if($rowlv['ipblock']=='1'){
include('allowed_ips.php');}
            ?>