Advertisement
Guest User

Untitled

a guest
Aug 5th, 2010
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.73 KB | None | 0 0
  1. <?php
  2. //simpilotgroup addon module for phpVMS virtual airline system
  3. //
  4. //simpilotgroup addon modules are licenced under the following license:
  5. //Creative Commons Attribution Non-commercial Share Alike (by-nc-sa)
  6. //To view full icense text visit http://creativecommons.org/licenses/by-nc-sa/3.0/
  7. //
  8. //@author David Clark (simpilot)
  9. //@copyright Copyright (c) 2009-2010, David Clark
  10. //@license http://creativecommons.org/licenses/by-nc-sa/3.0/
  11. ?>
  12.  
  13. <table width="100%">
  14.         <tr>
  15.             <td width="50%"><h3>Screenshot Gallery</h3></td>
  16.             <td width="50%" align="right">
  17.                 <?php
  18.                 if(Auth::LoggedIn())
  19.                     {
  20.                         if(PilotGroups::group_has_perm(Auth::$usergroups, ACCESS_ADMIN))
  21.                         {
  22.                             echo '<form method="link" action="'.SITE_URL.'/index.php/screenshots/approval_list">
  23.                                <input class="mail" type="submit" value="Screenshot Approval List"></form><br />';
  24.                         }
  25.                         echo '<form method="link" action="'.SITE_URL.'/index.php/screenshots/upload">
  26.                        <input class="mail" type="submit" value="Upload A New Screenshot"></form></td>';
  27.                      }
  28.                      else
  29.                      {
  30.                          echo 'Login to rate or upload screenshots.';
  31.                      }
  32.                      ?>
  33.         </tr>
  34.     </table>
  35.     <hr />
  36.    
  37. <?php
  38. //max displayed per page
  39. $per_page = 12;
  40.  
  41. //get start variable
  42. $start = $_GET['start'];
  43.  
  44. //count records
  45. $record_count = mysql_num_rows(mysql_query("SELECT * FROM screenshots"));
  46.  
  47. //count max pages
  48. $max_pages = $record_count / $per_page; //may come out as decimal
  49.  
  50. if (!$start)
  51.    $start = 0;
  52.    
  53. //display data
  54. $get = mysql_query("SELECT * FROM screenshots LIMIT $start, $per_page");
  55. while ($row = mysql_fetch_assoc($get))
  56. {
  57.  // get data
  58.  $image = $row['id'];
  59.  $pilot = $row['pilot_id'];
  60.  
  61. echo "<table width 700px>";
  62. echo "<tr>";
  63.   echo "<td><img src =\"../pics/" . $row['file_name']."\"></td>";
  64. echo "</tr>";
  65. echo "</table>";
  66. }
  67.  
  68. //setup prev and next variables
  69. $prev = $start - $per_page;
  70. $next = $start + $per_page;
  71.  
  72. //show prev button
  73. if (!($start<=0))
  74.        echo "<a href='?start=$prev'>Prev</a> ";
  75.  
  76. //show page numbers
  77.  
  78. //set variable for first page
  79. $i=1;
  80.  
  81. for ($x=0;$x<$record_count;$x=$x+$per_page)
  82. {
  83.  if ($start!=$x)
  84.     echo " <a href='?start=$x'>$i</a> ";
  85.  else
  86.     echo " <a href='?start=$x'><b>$i</b></a> ";
  87.  $i++;
  88. }
  89.  
  90. //show next button
  91. if (!($start>=$record_count-$per_page))
  92.        echo " <a href='?start=$next'>Next</a>";
  93.  
  94. ?>
  95.  
  96.  <center>
  97.         <b>Click on any image to view fullsize.</b><br /><br />
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement