Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //simpilotgroup addon module for phpVMS virtual airline system
- //
- //simpilotgroup addon modules are licenced under the following license:
- //Creative Commons Attribution Non-commercial Share Alike (by-nc-sa)
- //To view full icense text visit http://creativecommons.org/licenses/by-nc-sa/3.0/
- //
- //@author David Clark (simpilot)
- //@copyright Copyright (c) 2009-2010, David Clark
- //@license http://creativecommons.org/licenses/by-nc-sa/3.0/
- ?>
- <table width="100%">
- <tr>
- <td width="50%"><h3>Screenshot Gallery</h3></td>
- <td width="50%" align="right">
- <?php
- if(Auth::LoggedIn())
- {
- if(PilotGroups::group_has_perm(Auth::$usergroups, ACCESS_ADMIN))
- {
- echo '<form method="link" action="'.SITE_URL.'/index.php/screenshots/approval_list">
- <input class="mail" type="submit" value="Screenshot Approval List"></form><br />';
- }
- echo '<form method="link" action="'.SITE_URL.'/index.php/screenshots/upload">
- <input class="mail" type="submit" value="Upload A New Screenshot"></form></td>';
- }
- else
- {
- echo 'Login to rate or upload screenshots.';
- }
- ?>
- </tr>
- </table>
- <hr />
- <?php
- //max displayed per page
- $per_page = 12;
- //get start variable
- $start = $_GET['start'];
- //count records
- $record_count = mysql_num_rows(mysql_query("SELECT * FROM screenshots"));
- //count max pages
- $max_pages = $record_count / $per_page; //may come out as decimal
- if (!$start)
- $start = 0;
- //display data
- $get = mysql_query("SELECT * FROM screenshots LIMIT $start, $per_page");
- while ($row = mysql_fetch_assoc($get))
- {
- // get data
- $image = $row['id'];
- $pilot = $row['pilot_id'];
- echo "<table width 700px>";
- echo "<tr>";
- echo "<td><img src =\"../pics/" . $row['file_name']."\"></td>";
- echo "</tr>";
- echo "</table>";
- }
- //setup prev and next variables
- $prev = $start - $per_page;
- $next = $start + $per_page;
- //show prev button
- if (!($start<=0))
- echo "<a href='?start=$prev'>Prev</a> ";
- //show page numbers
- //set variable for first page
- $i=1;
- for ($x=0;$x<$record_count;$x=$x+$per_page)
- {
- if ($start!=$x)
- echo " <a href='?start=$x'>$i</a> ";
- else
- echo " <a href='?start=$x'><b>$i</b></a> ";
- $i++;
- }
- //show next button
- if (!($start>=$record_count-$per_page))
- echo " <a href='?start=$next'>Next</a>";
- ?>
- <center>
- <b>Click on any image to view fullsize.</b><br /><br />
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement