Advertisement
Guest User

Untitled

a guest
Apr 10th, 2018
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.86 KB | None | 0 0
  1. <?php
  2. if(isset($_GET['error'])){
  3.     ini_set('display_errors', 1);
  4.     ini_set('display_startup_errors', 1);
  5.     error_reporting(E_ALL);
  6. }
  7.  
  8. date_default_timezone_set('America/Montreal');
  9.  
  10. $servername = "10.0.0.15";
  11. $username = "occash_trans";
  12. $password = "k7rA63F4R@;*66h3u3((7@^#gnz*v2/rU";
  13. $dbname = "occash_transerotica";
  14.  
  15. $conn = new mysqli($servername, $username, $password, $dbname);
  16.  
  17. //Latest Scenes
  18. $query = "SELECT * FROM plg_gb_galleries";
  19.  
  20. $galleries = $conn->query($query);
  21. $gallery_array = array();
  22.  
  23. while($gallery = $galleries->fetch_assoc())
  24. {
  25.  
  26.     $query2 = "SELECT * FROM plg_gb_galleries_extrafields WHERE  GalleryId =" . $gallery['Id'];
  27.     $result = $conn->query($query2);
  28.     while($gall = $result->fetch_assoc()) {
  29.         if($gall['ExtrafieldsId'] === 3){
  30.             $type = 'url';
  31.         } elseif ($gall['ExtrafieldsId'] === 4) {
  32.             $type = 'thumbnail';
  33.         } elseif ($gall['ExtrafieldsId'] === 10) {
  34.             $type = 'tags';
  35.         } elseif ($gall['ExtrafieldsId'] === 13) {
  36.             $type = 'title';=
  37.         } elseif ($gall['ExtrafieldsId'] === 6) {
  38.             $type = 'description';
  39.         }
  40.         elseif ($gall['ExtrafieldsId'] === 6){
  41.  
  42.         }
  43.         else {
  44.             continue;
  45.         }
  46.        
  47.         $gallery_array[$gallery['Id']][$type] = $gall['Value'];
  48.     }
  49.      $gallery_array[$gallery['Id']]['ReleaseDate'] = $gallery['ReleaseDate'];
  50.      $gallery_array[$gallery['Id']]['SiteId'] = $gallery['SiteId'];
  51.      $gallery_array[$gallery['Id']]['site'] = getNatsSite($gallery['SiteId']);
  52. }
  53.  
  54. echo json_encode($gallery_array);
  55.  
  56.  
  57. function getNatsSite($siteId){
  58.     switch ($siteId) {
  59.         case '2':
  60.             $site = "nataliemars.xxx";
  61.             break;
  62.        
  63.         default:
  64.             $site = "transerotica.com";
  65.             break;
  66.     }
  67.     return $site;
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement