-
Notifications
You must be signed in to change notification settings - Fork 6
/
functions.php
65 lines (55 loc) · 1.71 KB
/
functions.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?php
session_start();
include('config.php');
function thousandsCurrencyFormat($num) {
if($num>1000) {
$x = round($num);
$x_number_format = number_format($x);
$x_array = explode(',', $x_number_format);
$x_parts = array(' k', ' m', ' b', ' t');
$x_count_parts = count($x_array) - 1;
$x_display = $x;
$x_display = $x_array[0] . ((int) $x_array[1][0] !== 0 ? '.' . $x_array[1][0] : '');
$x_display .= $x_parts[$x_count_parts - 1];
return $x_display;
}
return $num;
}
function updateUserInfo($data){
global $link;
$action = $data['action'];
$value = $data[$action];
$userId = $data['userid'];
$sql = "UPDATE users SET {$action} = '{$value}' WHERE id = '{$userId}' ";
if ($link->query($sql) === TRUE) {
$msg = $action . ' updated!';
} else {
$msg = 'Error';
}
}
function checkIfBanned($steamid){
global $link;
$sql = "SELECT * FROM ea_bans WHERE steam = '{$steamid}'";
$result = $link->query($sql);
$countRows = $result->num_rows;
if($countRows > 0){
return true;
}else{
return false;
}
}
function inlineEdit($action,$userid,$currentValue){
ob_start();
?>
<div class="update-input <?=$action?> row">
<form id="<?=$action?>" method="POST" class="inline-form" enctype="multipart/form-data">
<input type="hidden" name="action" value="<?=$action?>">
<input type="hidden" name="userid" value="<?=$userid?>">
<div class="col-lg-8"><input name="<?=$action?>" type="text" value="<?=$currentValue?>"></div>
<div class="col-lg-4"><input type="submit" name="save_<?=$action?>" value="save"></div>
</form>
</div>
<?php
$data = ob_get_contents();
ob_end_flush();
}