jun 24
This commit is contained in:
23
php/core.inc.php
Normal file → Executable file
23
php/core.inc.php
Normal file → Executable file
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
ob_start();
|
||||
session_start();
|
||||
$current_file = $_SERVER['SCRIPT_FILENAME'];
|
||||
@@ -15,6 +16,28 @@ function loggedin(){
|
||||
}
|
||||
}
|
||||
|
||||
function is_admin(){
|
||||
include 'connect.inc.php';
|
||||
|
||||
if (isset($_SESSION['user_id'])) {
|
||||
$user_id = $_SESSION['user_id'];
|
||||
$query = "SELECT `admin` FROM `globaly_accounts` WHERE `id` = $user_id";
|
||||
if ($query_run = mysqli_query($con, $query)) {
|
||||
$row = mysqli_fetch_assoc($query_run);
|
||||
$admin = $row['admin'];
|
||||
if($admin == 1) {
|
||||
return true;
|
||||
} else{
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
echo 'query run problem';
|
||||
}
|
||||
} else {
|
||||
echo 'no user loged in ';
|
||||
}
|
||||
}
|
||||
|
||||
function getuserfield($field){
|
||||
global $con;
|
||||
$query = "SELECT `$field` FROM `globaly_accounts` WHERE `id`= '" . $_SESSION['user_id']. "'";
|
||||
|
||||
Reference in New Issue
Block a user