Advertisement
ividen

Untitled

Jul 9th, 2017
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 6.45 KB | None | 0 0
  1.  
  2. <?php
  3. session_start();
  4. include "head.php";
  5. include "config.php";
  6. global $_CONFIG;
  7. define("MONO_ON", 1);
  8. require "class/class_db_{$_CONFIG['driver']}.php";
  9. $db=new database;
  10. $db->configure($_CONFIG['hostname'],
  11.  $_CONFIG['username'],
  12.  $_CONFIG['password'],
  13.  $_CONFIG['database'],
  14.  $_CONFIG['persistent']);
  15. $db->connect();
  16. $c=$db->connection_id;
  17. $set=array();
  18. $settq=$db->query("SELECT * FROM settings");
  19. while($r=$db->fetch_row($settq))
  20. {
  21. $set[$r['conf_name']]=$r['conf_value'];
  22. }
  23. print <<<EOF
  24. <script language="JavaScript">
  25. <!--
  26.  
  27. function getCookieVal (offset) {
  28.   var endstr = document.cookie.indexOf (";", offset);
  29.   if (endstr == -1)
  30.     endstr = document.cookie.length;
  31.   return unescape(document.cookie.substring(offset, endstr));
  32. }
  33. function GetCookie (name) {
  34.   var arg = name + "=";
  35.   var alen = arg.length;
  36.   var clen = document.cookie.length;
  37.   var i = 0;
  38.   while (i < clen) {
  39.     var j = i + alen;
  40.     if (document.cookie.substring(i, j) == arg)
  41.       return getCookieVal (j);
  42.     i = document.cookie.indexOf(" ", i) + 1;
  43.     if (i == 0) break;
  44.   }
  45.   return null;
  46. }
  47. function SetCookie (name,value,expires,path,domain,secure) {
  48.   document.cookie = name + "=" + escape (value) +
  49.     ((expires) ? "; expires=" + expires.toGMTString() : "") +
  50.     ((path) ? "; path=" + path : "") +
  51.     ((domain) ? "; domain=" + domain : "") +
  52.     ((secure) ? "; secure" : "");
  53. }
  54.  
  55. function DeleteCookie (name,path,domain) {
  56.   if (GetCookie(name)) {
  57.     document.cookie = name + "=" +
  58.       ((path) ? "; path=" + path : "") +
  59.       ((domain) ? "; domain=" + domain : "") +
  60.       "; expires=Thu, 01-Jan-70 00:00:01 GMT";
  61.   }
  62. }
  63. // -->
  64. </script>
  65.  
  66. <script language="JavaScript">
  67. var usr;
  68. var pw;
  69. var sv;
  70. function getme()
  71. {
  72. usr = document.login.username;
  73. pw = document.login.password;
  74. sv = document.login.save;
  75.  
  76.     if (GetCookie('player') != null)
  77.     {
  78.         usr.value = GetCookie('username')
  79.         pw.value = GetCookie('password')
  80.         if (GetCookie('save') == 'true')
  81.         {
  82.             sv[0].checked = true;
  83.         }
  84.     }
  85.  
  86. }
  87. function saveme()
  88. {
  89.     if (usr.value.length != 0 && pw.value.length != 0)
  90.     {
  91.         if (sv[0].checked)
  92.         {
  93.             expdate = new Date();
  94.             expdate.setTime(expdate.getTime()+(365 * 24 * 60 * 60 * 1000));
  95.             SetCookie('username', usr.value, expdate);
  96.             SetCookie('password', pw.value, expdate);
  97.             SetCookie('save', 'true', expdate);
  98.         }
  99.         if (sv[1].checked)
  100.         {
  101.             DeleteCookie('username');
  102.             DeleteCookie('password');
  103.             DeleteCookie('save');
  104.         }
  105.     }
  106.         else
  107.     {
  108.         alert('You must enter a username/password.');
  109.         return false;
  110.     }
  111. }
  112. </script>
  113.  
  114.  
  115. <TITLE>{$set['game_name']}</TITLE>
  116. <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
  117. <style type="text/css">
  118. <!--
  119.  
  120. body {
  121.     background-color: #c1cdc1;
  122. }
  123.  
  124. A:link {
  125.     FONT-SIZE: 11px; COLOR: #197201; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif; TEXT-DECORATION: none
  126. }
  127. A:active {
  128.     FONT-SIZE: 11px; COLOR: #197201; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif; TEXT-DECORATION: none
  129. }
  130. A:visited {
  131.     FONT-SIZE: 11px; COLOR: #197201; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif; TEXT-DECORATION: none
  132. }
  133. A:hover {
  134.     FONT-SIZE: 11px; COLOR: #ffffff; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif; TEXT-DECORATION: underline overline
  135. }
  136. TD {
  137.     FONT-WEIGHT: normal; FONT-SIZE: 11px; COLOR: #000000; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif
  138. }
  139.  
  140. .input {
  141.     BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; FONT-SIZE: 8px; BORDER-LEFT: #000000 1px solid; COLOR: #ffffff; BORDER-BOTTOM: #000000 1px solid; FONT-FAMILY: verdana;
  142. }
  143. -->
  144. </style>
  145. </HEAD>
  146.  
  147. EOF;
  148. print "
  149. <center>
  150. <legend>{$set['game_name']}</legend>
  151. <form action=authenticate.php method=post name=login onsubmit=\"return saveme();\">
  152. Username: <input type=text name=username>
  153. Password: <input type=password name=password>
  154. <input type=submit value=Login></form><br />";
  155.  
  156.  
  157. $dir = "pictures/";
  158. $extensions = "gif,png,jpg,jpeg";
  159. $imagesPerPage = "{$set['perpage']}";
  160. if(!isset($_GET['page'])){
  161.     $page = 1;
  162. }else{
  163.     $page = $_GET['page'];
  164. }
  165. $images = glob($dir."*.{".$extensions."}", GLOB_BRACE);
  166. $totalImages = count($images);
  167. $totalPages = ceil($totalImages / $imagesPerPage);
  168. if($page > $totalPages){
  169. $page = $totalPages;
  170. }
  171. $from = ($page * $imagesPerPage) - $imagesPerPage;
  172. for($i = $from; $i < ($from + $imagesPerPage); $i++){
  173.  
  174.  
  175.  
  176.     if($i == $totalImages){
  177.         echo "<td width='250' align='center'><img src='{$images[$i]}' alt='{$images[$i]}' width='450' height='250' />
  178. </td>";
  179.     }
  180.  
  181.     if($i < $totalImages){
  182.  
  183. $filename=$images[$i];
  184. $name = pathinfo($filename)['filename'];
  185. $tt=$db->query("SELECT * FROM images WHERE id=$name ORDER BY id ASC");
  186. $q=$db->fetch_row($tt);
  187.         echo "<td width='250' align='center'>
  188. <h3><b>{$q['imagetitle']}</b></h3>
  189. <img src='{$images[$i]}' alt='{$images[$i]}' width='{$q['imagewidth']}' height='{$q['imageheight']}' /><br />
  190. <b>Owner:</b> {$q['owner']}<br/>
  191. <b>Description: </b>{$q['imagedesc']}<br />
  192. <b>Type: </b>{$q['imagetype']}<br />
  193. <b>Image Size:</b>{$q['imagewidtho']}x{$q['imageheighto']}<br />
  194. <b>Cost:</b> {$q['imagecost']} GBP<br />
  195. <form action='https://www.paypal.com/cgi-bin/webscr' method='post'>
  196. <input type=hidden name=cmd value=_xclick>
  197. <input type='hidden' name='business' value='{$set['paypal']}'>
  198. <input type='hidden' name='item_name' value='{$domain}|Picture|{$q['imagetitle']}'>
  199. <input type='hidden' name='amount' value='{$q['imagecost']}'>
  200. <input type='hidden' name='shipping' value='0'>
  201. <input type='hidden' name='return' value='http://{$domain}/{$images[$i]}'>
  202. <input type='hidden' name='cancel_return' value='http://{$domain}/donatordone.php?action=cancel'>
  203. <input type='hidden' name='notify_url' value='http://{$domain}/ipn_donator.php'>
  204. <input type='hidden' name='cn' value='Your E-mail'>
  205. <input type='hidden' name='currency_code' value='GBP'>
  206. <input type='hidden' name='tax' value='0'>
  207. <input type='image' src='https://www.paypalobjects.com/webstatic/en_US/i/btn/png/gold-pill-paypalcheckout-26px.png' border='0' name='submit' alt='Make payments with PayPal - it's fast, free and secure!'>
  208. </form>
  209.  
  210.  
  211.  
  212. </td>
  213. </tr><tr><td>
  214.  
  215.  
  216. ";
  217. }}
  218.  
  219. for($p = 1; $p <= $totalPages; $p++){
  220.     if($p == $page){
  221.         $tmp_pages[] = "<font color='grey' size='+1'><strong>{$p}</strong></font>";
  222.     }else{
  223.         $tmp_pages[] = "<a href='?page={$p}'>{$p}</a>";
  224.     }
  225. }
  226. echo "
  227. </td></tr></table>";
  228. echo "<br />" . implode(" . ", $tmp_pages);
  229.  
  230. print "</center>";
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246. print <<<OUT
  247. </BODY>
  248. </HTML>
  249. OUT;
  250. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement