-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHistory.php
90 lines (81 loc) · 3.58 KB
/
History.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<?php require "MasterPage/header.php"; ?>
<?php
session_name('SESSION');
session_start();
$db = parse_ini_file("assets/ini/Config.ini");
$connectionInfo = array("Database" => $db['name'], "Uid" => $db['user'], "PWD" => $db['pass']);
$con = sqlsrv_connect($db['host'], $connectionInfo);
if( $_SESSION['CompteUSER']=='A'){
$queryHistory ="SELECT * FROM History order by IdHistory desc";
}else{
$queryHistory ="SELECT * FROM History where IdUSER=".$_SESSION['IdUser']." order by IdHistory desc";
}
$resultHistory = sqlsrv_query( $con, $queryHistory );
if( $resultHistory === false )
{
exit( '<pre class="error">' . print_r( sqlsrv_errors(), true ) . '</pre>' );
}
if( sqlsrv_num_fields( $resultHistory ) )
{ echo'
<div class="row">
<div class="col">
<div class="card shadow">
<div class="card-header border-0">
<div class="row">
<div class="col-md-8"><h3 class="mb-0" style="background: linear-gradient(to left, #7171fc 0%, #65abf3 100%);background-clip: border-box;-webkit-background-clip: text;-webkit-text-fill-color: transparent;"><i class="fas fa-history"></i> Historique</h3>
</div>
</div>
</div>
<div class="table-responsive">
<table id="myTable" class="table align-items-center table-flush">';?>
<tbody>
<?php
if(sqlsrv_has_rows($resultHistory) === false)
{
echo'
<tr>
<td>Votre historique s\'affiche ici</td>
</tr>';
}else{
while( $rowHs = sqlsrv_fetch_array( $resultHistory, SQLSRV_FETCH_ASSOC ) )
{
//IdHistory IdUSER History Url //1 supp 2 ajouter 3 modifier 4 active 5 show 6 accepter
echo'<tr>
<td ><a href="'. $rowHs['Url'].'" style="color: #525f7f;">';
if ($rowHs['mession']==1) {
echo '<i class="fas fa-trash"></i> ';
}elseif ($rowHs['mession']==2) {
echo '<i class="fas fa-plus"></i> ';
}elseif ($rowHs['mession']==3) {
echo '<i class="fas fa-pen"></i> ';
}elseif ($rowHs['mession']==4) {
echo '<i class="fas fa-lock"></i> ';
}elseif ($rowHs['mession']==5) {
echo '<i class="fas fa-eye"></i> ';
}elseif ($rowHs['mession']==6) {
echo '<i class="fas fa-check"></i> ';
}
echo $rowHs['History']; echo '</a></td> ';
$today = date("Y-m-d");
if ($today != $rowHs['date']->format('Y-m-d'))
{
echo' <td >'.$rowHs['date']->format('F j, g:i a').'</td>';
}
else
{
echo' <td>'.$rowHs['date']->format('g:i a').'</td>';
}
echo '</tr>';
}
}
?>
</tbody>
</table>
</div>
</div>
</div>
</div><?php
}
sqlsrv_close ( $con );
?>
<?php require "MasterPage/footer.php"; ?>