Skip to content

Commit

Permalink
Added limit, starting point to browse tokens (ie: show 100 records st…
Browse files Browse the repository at this point in the history
…arting from 50, << and >> buttons)

git-svn-id: file:///Users/Shitiz/Downloads/lssvn/trunk/unstable@179 b72ed6b6-b9f8-46b5-92b4-906544132732
  • Loading branch information
jcleeland committed Apr 2, 2003
1 parent 26d2334 commit 81b089f
Showing 1 changed file with 32 additions and 3 deletions.
35 changes: 32 additions & 3 deletions admin/tokens.php
Expand Up @@ -184,6 +184,27 @@

if ($action == "browse")
{

if (!$_GET['limit']) {$_GET['limit'] = "100";}
if (!$_GET['start']) {$_GET['start'] = "1";}

//ALLOW SELECTION OF NUMBER OF RECORDS SHOWN
echo "<table cellpadding='1' cellspacing='1' align='center' border='0'>\n";
echo "<form method='GET' action='tokens.php'>\n";
echo "<input type='hidden' name='sid' value='$sid'>\n";
echo "<input type='hidden' name='action' value='browse'>\n";
echo "\t<tr>\n";
echo "\t\t<td>{$setfont}Showing</td>\n";
echo "\t\t<td><input type='text' $slstyle name='limit' size='4' value='{$_GET['limit']}'></td>\n";
echo "\t\t<td>{$setfont}records starting at</td>\n";
echo "\t\t<td><input type='text' $slstyle name='start' size='4' value='{$_GET['start']}'></td>\n";
echo "\t\t<td><input type='submit' value='Show' $btstyle>\n";
echo "\t</tr>\n";
echo "</form>\n";
echo "</table>\n";

$_GET['start']--;

echo "<table width='600' cellpadding='1' cellspacing='1' align='center' bgcolor='#CCCCCC'>\n";
//COLUMN HEADINGS
echo "\t<tr>\n";
Expand All @@ -197,12 +218,10 @@
echo "\t\t<th align='left' colspan='2'>$setfont"."Action</th>\n";
echo "\t</tr>\n";

//HANDLE LIMITED NUMBER OF ROWS AT A TIME


$bquery = "SELECT * FROM tokens_$sid";
if (!$_GET['order']) {$bquery .= " ORDER BY tid";}
else {$bquery .= " ORDER BY {$_GET['order']}";}
$bquery .= " LIMIT {$_GET['start']}, {$_GET['limit']}";
$bresult = mysql_query($bquery);
while ($brow = mysql_fetch_array($bresult))
{
Expand Down Expand Up @@ -241,6 +260,16 @@
}
echo "\t</tr>\n";
}
//MOVE NEXT AND LAST
$movelast = $_GET['start'] - $_GET['limit'];
if ($movelast < 1) {$movelast = 0;}
$movenext = $_GET['start'] + $_GET['limit'] + 1;
if ($movenext > $tkcount) {$movenext = $tkcount;}
echo "\t<tr>\n";
echo "\t\t<td colspan='4' align='left'><input type='submit' value='<<' $btstyle onClick=\"window.open('tokens.php?action=browse&sid=$sid&start=$movelast&limit={$_GET['limit']}', '_top')\"></td>\n";
echo "\t\t<td colspan='5' align='right'><input type='submit' value='>>' $btstyle onClick=\"window.open('tokens.php?action=browse&sid=$sid&start=$movenext&limit={$_GET['limit']}', '_top')\"></td>\n";
echo "\t</tr>\n";

echo "</table>\n";
}

Expand Down

0 comments on commit 81b089f

Please sign in to comment.