-
Notifications
You must be signed in to change notification settings - Fork 0
/
accountMirror.php
executable file
·141 lines (112 loc) · 5.39 KB
/
accountMirror.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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
<?php
/*
==============================================================================
Copyright (c) 2013 Marc Augier
For a full list of contributors, see "credits.txt".
The full license can be read in "license.txt".
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
See the GNU General Public License for more details.
Contact: m.augier@me.com
==============================================================================
*/
require_once("models/config.php");
if (!securePage($_SERVER['PHP_SELF'])){die();}
require_once("inc/functions.php");
/* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
Page for permission level 1 (user)
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */
if ($loggedInUser->checkPermission(array(1))) {
openPage("Account Details");
if (isUserReady($loggedInUser->user_id))
{
echo "<p></p>";
accountBrowse($loggedInUser->user_id);
browseMyTeam($loggedInUser->team);
} else {
echo "<h4>Vous devez d'abord remplir votre profil dans <a href='user_settings.php'>User Settings</a></h4>";
}
}
/* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
Page for permission level 2 (professor)
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */
if ($loggedInUser->checkPermission(array(2)))
{
openPage("Les transactions en erreur");
$sql = "SELECT DISTINCT A1.`account1`, A1.`account2`,A1.`debit`, A1.`credit`, A1.`timestamp`, U1.display_name, U2.display_name FROM `account` A1, sk_users U1, sk_users U2 WHERE (A1.credit <= '0' OR A1.debit <= '0' OR A1.credit > '10000' OR A1.debit > '10000') AND U1.id = A1.account1 AND U2.id = A1.account2 ORDER BY A1.account1, A1.account2";
// echo $sql;
if ($result = mysqli_query($mysqli, $sql))
{
echo "<h2>Les transactions nulles ou négatives</h2>";
$i = 0;
echo "<table style='width:100%; border-spacing:0;'>".
"<tr>
<th>no</th>
<th>depuis Compte</th>
<th>vers Compte</th>
<th>Débit</th>
<th>Crédit</th>
<th>Timestamp</th>";
while (list($account1, $account2, $debit, $credit, $timestamp, $user1 , $user2) = mysqli_fetch_row($result))
{
$i += 1;
echo "<tr><td>$i</td><td><b>$user1</b></td><td><a href='accountDetail.php?id=$account2'>$user2</a></td><td>$debit</td><td>$credit</td><td>$timestamp</td></tr>";
}
echo "</table>
<br/>
* * * * End Of Report * * * *";
/* Libération du jeu de résultats */
mysqli_free_result($result);
}
// Flag these transactions as in error to remove them from account summary
$sql = "UPDATE `account` SET errorFlag = '1' WHERE (credit <= '0' OR debit <= '0')";
// echo $sql;
if ($result = mysqli_query($mysqli, $sql))
{
echo "<h2>Les transactions nulles ou négatives sont maintenant inactives</h2>";
}
/*
echo "<h2>Les transactions mirroirs</h2>";
$sql = "SELECT DISTINCT A1.`account1`, A1.`account2`,A1.`debit`, A1.`credit`, A1.`timestamp`, U1.display_name, U2.display_name FROM `account` A1, `account` A2, sk_users U1, sk_users U2 WHERE A1.credit = A2.debit and A1.account1 = A2.account2 AND U1.id = A1.account1 AND U2.id = A1.account2 ORDER BY A1.account1, A1.account2";
// echo $sql;
if ($result = mysqli_query($mysqli, $sql))
{
echo "<table style='width:100%; border-spacing:0;'>".
"<tr>
<th>depuis Compte</th>
<th>vers Compte</th>
<th>Débit</th>
<th>Crédit</th>
<th>Timestamp</th>";
while (list($account1, $account2, $debit, $credit, $timestamp, $user1 , $user2) = mysqli_fetch_row($result))
{
echo "<tr><td><b>$user1</b></td><td><a href='accountDetail.php?id=$account2'>$user2</a></td><td>$debit</td><td>$credit</td><td>$timestamp</td>";
// Display the timestamp of mirror transactions
$sql2 = "SELECT DISTINCT `timestamp` FROM `account` WHERE account1 = '$account2' AND account2 ='$account1' AND debit = '$credit'";
// echo $sql;
$result2 = mysqli_query($mysqli, $sql2);
while (list($timestamp) = mysqli_fetch_row($result2))
{
echo "<td>$timestamp</td>";
}
echo "</tr>";
}
echo "</table>
<br/>
* * * * End Of Report * * * *";
// Libération du jeu de résultats
mysqli_free_result($result);
}
*/
}
/* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
Page for permission level 3 (administrator)
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */
if ($loggedInUser->checkPermission(array(3)))
{
openPage("Les scores globaux des équipes");
}
closePage();
?>