diff options
author | Chaoyi Zha <summermontreal@gmail.com> | 2015-06-01 23:14:50 +0300 |
---|---|---|
committer | Chaoyi Zha <summermontreal@gmail.com> | 2015-06-01 23:14:50 +0300 |
commit | e40a17cef6450868a354f9263c308281cf6692e5 (patch) | |
tree | 57e7783e65f0aae1d97efce28369b5b72026a136 | |
parent | e7810f1ae5f0599caf84a5e81e3ffb263959f97a (diff) |
Fix bell curve issue with pagination fix #84
-rw-r--r-- | admin/index.php | 24 | ||||
-rw-r--r-- | js/index.js | 2 |
2 files changed, 12 insertions, 14 deletions
diff --git a/admin/index.php b/admin/index.php index f219836..f2cf1f3 100644 --- a/admin/index.php +++ b/admin/index.php @@ -74,7 +74,7 @@ if (!is_array($auth->islogged())) { function fetchurls($lstart = 0, $limit = 30) { global $userinfo; global $mysqli; - $sqr = "SELECT `baseval`,`rurl`,`date`,`lkey` FROM `redirinfo` WHERE user = '{$mysqli->real_escape_string($userinfo['username'])}' LIMIT {$lstart} , {$limit};"; + $sqr = "SELECT `baseval`,`rurl`,`date`,`lkey` FROM `redirinfo` WHERE user = '{$mysqli->real_escape_string($userinfo['username'])}' ORDER BY `rid` LIMIT {$lstart} , 30;"; $res = $mysqli->query($sqr); $links = mysqli_fetch_all($res, MYSQLI_ASSOC); @@ -100,8 +100,8 @@ if (!is_array($auth->islogged())) { $links_page = intval($links_page); if ($links_page < $links_total_pages && $links_page > 0) { $ls = (30 * $links_page); - $limit = ($lstart + 30); - $linkshtml = fetchurls($ls, $limit); + $lim = 30; + $linkshtml = fetchurls($ls, $lim); } } if ($linkshtml == false) { @@ -122,7 +122,7 @@ if (!is_array($auth->islogged())) { function fetchurlsadmin($lstart = 0, $limit = 30) { global $mysqli; - $sqr = "SELECT `baseval`,`rurl`,`date`,`user`,`ip`,`lkey` FROM `redirinfo` LIMIT {$lstart} , {$limit};"; + $sqr = "SELECT `baseval`,`rurl`,`date`,`user`,`ip`,`lkey` FROM `redirinfo` ORDER BY `rid` LIMIT {$lstart} , 30;"; $res = $mysqli->query($sqr); $links = mysqli_fetch_all($res, MYSQLI_ASSOC); $linkshtml = '<table class="table table-hover"><tr><th>Link ending</th><th>Long Link</th><th>Date</th><th>Link Owner</th><th>IP</th><th>Secret</th><th>Disable/Enable</th></tr>'; @@ -155,7 +155,7 @@ if (!is_array($auth->islogged())) { function fetchusersadmin($lstart = 0, $limit = 30) { global $mysqli; - $sqr = "SELECT `username`,`email`,`valid` FROM `auth` LIMIT {$lstart} , {$limit};"; + $sqr = "SELECT `username`,`email`,`valid` FROM `auth` ORDER BY `uid` LIMIT {$lstart} , 30;"; $res = $mysqli->query($sqr); $links = mysqli_fetch_all($res, MYSQLI_ASSOC); $usershtml = '<table class="table table-hover"><tr><th>Username</th><th>Email</th><th>Activated?</th></tr>'; @@ -175,9 +175,9 @@ if (!is_array($auth->islogged())) { $users_page = intval($users_page); if ($users_page < $users_total_pages && $users_page > 0) { $ls1 = (30 * $users_page); - $limit = ($ls1 + 30); + $lim1 = 30; - $usersadmin = fetchusersadmin($ls1, $limit); + $usersadmin = fetchusersadmin($ls1, $lim1); } } @@ -195,9 +195,9 @@ if (!is_array($auth->islogged())) { // If valid users page $users_page = intval($admin_links_page); if ($admin_links_page < $admin_links_total_pages && $admin_links_page > 0) { - $lstart = (30 * $users_page); - $limit = ($lstart + 30); - $linksadmin = fetchurlsadmin($lstart, $limit); + $ls2 = (30 * $users_page); + $lim2 = 30; + $linksadmin = fetchurlsadmin($ls2, $lim2); } } @@ -244,8 +244,8 @@ if (!is_array($auth->islogged())) { </div>'; if ($isadmin == true) { echo '<div class="tab-pane" id="adminpanel"><br />'; - echo 'Polr Links:' . $linksadmin . '<br>Polr Users' . $usersadmin. '<script src="../js/ucp.js"></script>'; - echo 'Disable a Link<br />'; + echo '<p>Polr Links:</p>' . $linksadmin . '<br><p>Polr Users</p>' . $usersadmin. '<script src="../js/ucp.js"></script>'; + echo '<p>Disable a Link</p>'; echo '<input type="text" id="linkAction" placeholder="Link ending" style="width:30%;" class="form-control" />'; echo '<div class="linkActionBtn"><a href="javascript:void()" onclick="customDisableLink();" class="btn btn-sm btn-danger">Disable</a> '; echo '<a href="javascript:void()" onclick="customEnableLink();" class="btn btn-sm btn-success">Enable</a></div>'; diff --git a/js/index.js b/js/index.js index 09e37b8..5a8680e 100644 --- a/js/index.js +++ b/js/index.js @@ -4,8 +4,6 @@ $(function() { $('#options').hide(); var slid=0; optionsbutton.click(function() { - //var absfoot = $('#polrfooter').html(); - //var pfoot = '<p id="footer">© Copyright 2014 Polr</p>'; if (slid===0) { $("#options").slideDown(); slid = 1; |