YaWK  24.1
Yet another WebKit
logins.php
Go to the documentation of this file.
1 <?php
2 
3 use YAWK\backend;
4 use YAWK\db;
5 use YAWK\language;
6 use YAWK\sys;
7 use YAWK\user;
8 
9 /** @var $db db */
10 /** @var $lang language */
11 
12 ?>
13 <script type="text/javascript">
14  $(document).ready(function() {
15  $('#table-sort').dataTable( {
16  "bPaginate": false,
17  "bLengthChange": false,
18  "bFilter": true,
19  "bSort": true,
20  "bInfo": true,
21  "bAutoWidth": false
22  } );
23  } );
24 </script>
25 <?php
26 // TEMPLATE WRAPPER - HEADER & breadcrumbs
27 echo "
28  <!-- Content Wrapper. Contains page content -->
29  <div class=\"content-wrapper\" id=\"content-FX\">
30  <!-- Content Header (Page header) -->
31  <section class=\"content-header\">";
32 /* draw Title on top */
33 echo backend::getTitle($lang['LOGINS'], $lang['LOGINS_SUBTEXT']);
34 echo"<ol class=\"breadcrumb\">
35  <li><a href=\"index.php\" title=\"$lang[DASHBOARD]\"><i class=\"fa fa-dashboard\"></i> $lang[DASHBOARD]</a></li>
36  <li class=\"active\"><a href=\"index.php?page=logins\" title=\"$lang[LOGINS]\"> $lang[LOGINS]</a></li>
37  </ol>
38  </section>
39  <!-- Main content -->
40  <section class=\"content\">";
41 /* page content start here */
42 ?>
43 
44 <table style="width:100%;" class="table table-striped table-hover table-responsive" id="table-sort">
45  <thead>
46  <tr>
47  <td style="width:3%;"><strong>&nbsp;</strong></td>
48  <td style="width:3%;" class="text-center"><strong><?php echo $lang['ID']; ?></strong></td>
49  <td style="width:15%;" class="text-center"><strong><?php echo $lang['DATE']; ?></strong></td>
50  <td style="width:14%;" class="text-center"><strong><?php echo $lang['IP']; ?></strong></td>
51  <td style="width:15%;" class="text-center"><strong><?php echo $lang['USERNAME']; ?></strong></td>
52  <td style="width:10%;" class="text-center"><strong><?php echo $lang['PASSWORD']; ?></strong></td>
53  <td style="width:10%;" class="text-center"><strong><?php echo $lang['LOGIN_FROM']; ?></strong></td>
54  <td style="width:2%;" class="text-center"><strong><?php echo $lang['FAILED']; ?></strong></td>
55  <td style="width:28%;" class="text-center"><strong><?php echo $lang['BROWSER']; ?></strong></td>
56  </tr>
57  </thead>
58  <tbody>
59  <?php
60  // check if a user is specified via get param
61  if (isset($_GET['user']) && (!empty($_GET['user'])))
62  { $user = $_GET['user']; } else { $user = ''; } // if not, show all logins
63 
64  $loginData = user::getLoginData($db, $user);
65  if (is_array($loginData) && (!empty($loginData)))
66  {
67  foreach ($loginData as $row)
68  {
69  if ($row['failed'] === '0')
70  {
71  $pub = "success"; $pubtext="OK";
72  $text = "text-success text-center";
73  } else {
74  $pub = "danger"; $pubtext = "failed";
75  $text = "text-danger text-center";
76  }
77  if ($row['location'] === "backend"){
78  $locationText = "text-info text-center";
79  } else {
80  $locationText = "text-muted text-center";
81  }
82  if (isset($row['useragent']) && (!empty($row{'useragent'})))
83  {
84  $row['useragent'] = sys::getBrowser($row['useragent']);
85  }
86 
87  echo "<tr class=\"".$text."\" >
88  <td class=\"text-center\">
89  <i class=\"label label-$pub\">$pubtext</i></a>&nbsp;</td>
90  <td class=\"text-center\">".$row['id']."</td>
91  <td>".$row['datetime']."</td>
92  <td class=\"".$text."\" class=\"text-center\">".$row['ip']."</td>
93  <td>".$row['username']."</td>
94  <td class=\"".$text."\">".$row['password']."</td>
95  <td class=\"".$locationText."\">".$row['location']."</td>
96  <td class=\"".$text."\">".$row['failed']."</td>
97  <td class=\"text-center\">".$row['useragent']['name']." <small>".$row['useragent']['version']."</small></td>
98 
99  </tr>";
100  }
101  }
102 
103  ?>
104  </tbody>
105 </table>
print $lang['FILEMAN_UPLOAD']
Backend class serves a few useful functions for the admin backend.
Definition: backend.php:27
Mysqli database class; returns db connection object.
Definition: db.php:16
The language class - support multilingual backend.
Definition: language.php:17
The sys class - handles yawk's system core functions.
Definition: sys.php:17
The default user class. Provide all functions to handle the user object.
Definition: user.php:17
$loginData
Definition: logins.php:64
type
Definition: menu-new.php:35
print $_GET['id']
Definition: page-edit.php:357
<!-- backend language -->< h3 >< i class="fa fa-language"></i > & nbsp
document ready(function() { $('a[data-confirm]').click(function(ev) { modal='#dataConfirmModal';var href=$(this).attr('href');var title=$(this).attr('title');var icon=$(this).attr('data-icon');if(!icon) { icon='fa fa-trash-o';} if(!$(modal).length) { $('body').append('< div id="dataConfirmModal" class="modal fade" role="dialog" aria-labelledby="dataConfirmLabel" aria-hidden="true">< div class="modal-dialog">< div class="modal-content">< div class="modal-header">< button type="button" class="close" data-dismiss="modal" aria-hidden="true">< i class="fa fa-times"></i ></button >< br >< div class="col-md-1">< h3 class="modal-title">< i class="'+icon+'"></i ></h3 ></div >< div class="col-md-11">< h3 class="modal-title" id="dataConfirmLabel">'+title+'</h3 ></div ></h3 ></div >< div class="modal-body"></div >< div class="modal-footer">< button type="button" class="btn btn-default" data-dismiss="modal" aria-hidden="true">Abbrechen</button >< a type="button" class="btn btn-danger" id="dataConfirmOK">< i class="'+icon+'"></i > L &ouml;schen</a ></div ></div ></div ></div >');} $(modal).find('.modal-body').text($(this).attr('data-confirm'));$('#dataConfirmOK').attr('href', href);$(modal).modal({show:true});return false;});$('#terminateUser').click(function() { var terminate=window.confirm("ACHTUNG!\nDas wird Deinen Account permanent deaktivieren.\n"+"Bist Du Dir sicher, dass Du das tun willst?");if(terminate===true) { var terminateUser=window.confirm("Bist Du Dir wirklich ganz sicher?\n"+"Diese Aktion kann nicht rueckgaengig gemacht werden.");if(terminateUser===true) { $.get('system/templates/YaWK-bootstrap3/js/terminate-user.php', function(data) { if(data==="true") { setTimeout("window.location='logout.html'", 0);} else { alert("Fehler: "+data);} });} } });function dismissNotifications() { $.ajax({ url:'js/dismiss-notifications.php', type:'POST', success:function(data) { if(!data) { alert('Something went wrong!');return false;} } });$("#bell-label").fadeOut();$('#notification-header').html('You have 0 notifications');$('#notification-menu').fadeOut();} $("#dismiss").click(function() { dismissNotifications();});function disableButtons(delay) { $('#loginButton').removeClass().addClass('btn btn-success disabled').attr('id', 'LOGIN_FORBIDDEN');$('#resetPasswordButton').removeClass().addClass('btn btn-danger disabled');setTimeout(function() { $('#LOGIN_FORBIDDEN').attr('id', 'loginButton').removeClass().addClass('btn btn-success');$('#resetPasswordButton').removeClass().addClass('btn btn-danger');}, delay);} $("#loginButton").click(function(){ if($('#loginButton').length > 0) { if($('#loginButton').hasClass('btn') &&$('#loginButton').hasClass('btn-success') &&$('#loginButton').hasClass('disabled')) { } else { $("#loginForm").submit();disableButtons(10000);} } else if($('#LOGIN_FORBIDDEN').length > 0) { if($('#LOGIN_FORBIDDEN').hasClass('btn') &&$('#LOGIN_FORBIDDEN').hasClass('btn-success') &&$('#LOGIN_FORBIDDEN').hasClass('disabled')) { } else { } } });$("#blockedBtn").hover(function() { $("#blockedBtn").hide();$("#askBtn").fadeIn(820);});})