mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/ARCHIVED-IZYIM.git
synced 2026-08-19 12:24:06 +00:00
82 lines
2.4 KiB
PHP
Executable File
82 lines
2.4 KiB
PHP
Executable File
<?php
|
|
|
|
function pwdCorrect($password){
|
|
global $db;
|
|
$db->bind("user_id",$_SESSION["user_id"]);
|
|
$db->bind("password",$password);
|
|
$profile = $db->query("SELECT * FROM users WHERE user_id=:user_id AND password = :password");
|
|
if(count($profile)>0){
|
|
return true;
|
|
}else{
|
|
return false;
|
|
}
|
|
}
|
|
function getActiveGroup($user_id,$data){
|
|
global $db;
|
|
$db->bind("user_id",$user_id);
|
|
$user = $db->query("SELECT * FROM users WHERE user_id=:user_id");
|
|
// GET GROUPS NAME
|
|
$db->bind("group_id",$user[0]["group_id"]);
|
|
$groups = $db->query("SELECT * FROM groups WHERE group_id = :group_id");
|
|
return $groups[0][$data];
|
|
}
|
|
function deleteDir($dirPath) {
|
|
if (! is_dir($dirPath)) {
|
|
throw new InvalidArgumentException("$dirPath must be a directory");
|
|
}
|
|
if (substr($dirPath, strlen($dirPath) - 1, 1) != '/') {
|
|
$dirPath .= '/';
|
|
}
|
|
$files = glob($dirPath . '*', GLOB_MARK);
|
|
foreach ($files as $file) {
|
|
if (is_dir($file)) {
|
|
$this->deleteDir($file);
|
|
} else {
|
|
unlink($file);
|
|
}
|
|
}
|
|
rmdir($dirPath);
|
|
return '';
|
|
}
|
|
function lastLoginAttempt($max){
|
|
global $db;
|
|
$db->bind("user_id",$_SESSION["user_id"]);
|
|
$db->bind("limit",$max);
|
|
$log = $db->query("SELECT * FROM login_log WHERE user_id = :user_id ORDER BY id DESC LIMIT :limit");?>
|
|
<table id="log-tbl" class="footable table-bordered table-striped table-condensed" data-sort="false">
|
|
<thead>
|
|
<tr>
|
|
<th>IP Address</th>
|
|
<th>Status</th>
|
|
<th data-hide="phone,tablet">Date & Time</th>
|
|
<th data-hide="phone,tablet">Action</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody id="down-tbl-content">
|
|
<?php
|
|
foreach ($log as $key => $value) { ?>
|
|
<tr>
|
|
<td><?php echo $value["ip_address"]; ?></td>
|
|
<td><?php echo ($value["status"]=="SUCCESS" ? "<span class='label label-success'>SUCCESS</span>" : "<span class='label label-danger'>FAILED</span>"); ?></td>
|
|
<td><?php echo $value["date"]; ?></td>
|
|
<td><a href="http://www.infosniper.net/index.php?ip_address=<?php echo $value["ip_address"]; ?>&map_source=1&overview_map=1&lang=1&map_type=1&zoom_level=7" target="_blank">TRACK LOCATION</a></td>
|
|
</tr>
|
|
<?php } ?>
|
|
</tbody>
|
|
</table>
|
|
<?php
|
|
}
|
|
|
|
|
|
function tempnam_sfx($path, $suffix){
|
|
do {
|
|
$file = $path."/".mt_rand().$suffix;
|
|
$fp = @fopen($file, 'x');
|
|
}
|
|
while(!$fp);
|
|
|
|
fclose($fp);
|
|
return $file;
|
|
}
|
|
|