Advertisement
Guest User

Untitled

a guest
May 11th, 2017
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 12.82 KB | None | 0 0
  1. <?
  2. // Database Connection
  3. $username = "";
  4. $password = "";
  5. $host = "localhost";
  6. mysql_connect($host,$username,$password);
  7.  
  8. // Define slug
  9. $slug = "headline";
  10.  
  11. /* BOF Blog Secition */
  12.  
  13.     // Check HOME Install for SHARE Tag
  14.     @mysql_select_db('harmonyv_home') or die("Unable to select database");
  15.     $result = mysql_query("SELECT * FROM wp_terms WHERE slug='$slug' LIMIT 0,1");
  16.     if (mysql_num_rows($result) > 0) {
  17.         $row = mysql_fetch_array($result);
  18.         $result2 = mysql_query("SELECT * FROM wp_term_relationships WHERE term_taxonomy_id='{$row['term_id']}' ORDER BY object_id DESC LIMIT 0,10");
  19.             if (mysql_num_rows($result2) > 0) {
  20.                 while ($row2 = mysql_fetch_array($result2)) {
  21.                     $result3 = mysql_query("SELECT * FROM wp_posts WHERE ID='{$row2['object_id']}'");
  22.                     $row3 = mysql_fetch_array($result3);
  23.                     $date = substr($row3['post_date'], 0, -9);
  24.                     $postInfo[] = array(
  25.                         'postDate'=>$date,
  26.                         'postTitle'=>$row3['post_title'],
  27.                         'postUrl'=>$row3['guid']
  28.                     );
  29.                 }
  30.             } else {
  31.                 // Skip, Nothing Here Share
  32.             }
  33.     } else {
  34.         // Skip, Nothing Here to Share
  35.     }
  36.  
  37. /* EOF Blog Section */
  38.  
  39. /* BOF Blog Secition */
  40.  
  41.     // Check ABOUT Install for SHARE Tag
  42.     $result = mysql_query("SELECT * FROM wpabout_terms WHERE slug='$slug' LIMIT 0,1");
  43.     if (mysql_num_rows($result) > 0) {
  44.         $row = mysql_fetch_array($result);
  45.         $result2 = mysql_query("SELECT * FROM wpabout_term_relationships WHERE term_taxonomy_id='{$row['term_id']}' ORDER BY object_id DESC LIMIT 0,10");
  46.             if (mysql_num_rows($result2) > 0) {
  47.                 while ($row2 = mysql_fetch_array($result2)) {
  48.                     $result3 = mysql_query("SELECT * FROM wpabout_posts WHERE ID='{$row2['object_id']}'");
  49.                     $row3 = mysql_fetch_array($result3);
  50.                     $date = substr($row3['post_date'], 0, -9);
  51.                     $postInfo[] = array(
  52.                         'postDate'=>$date,
  53.                         'postTitle'=>$row3['post_title'],
  54.                         'postUrl'=>$row3['guid']
  55.                     );
  56.                 }
  57.             } else {
  58.                 // Skip, Nothing Here Share
  59.             }
  60.     } else {
  61.         // Skip, Nothing Here to Share
  62.     }
  63.  
  64. /* EOF Blog Section */
  65.  
  66. /* BOF Blog Secition */
  67.  
  68.     // Check CONTACT Install for SHARE Tag
  69.     $result = mysql_query("SELECT * FROM wpcontact_terms WHERE slug='$slug' LIMIT 0,1");
  70.     if (mysql_num_rows($result) > 0) {
  71.         $row = mysql_fetch_array($result);
  72.         $result2 = mysql_query("SELECT * FROM wpcontact_term_relationships WHERE term_taxonomy_id='{$row['term_id']}' ORDER BY object_id DESC LIMIT 0,10");
  73.             if (mysql_num_rows($result2) > 0) {
  74.                 while ($row2 = mysql_fetch_array($result2)) {
  75.                     $result3 = mysql_query("SELECT * FROM wpcontact_posts WHERE ID='{$row2['object_id']}'");
  76.                     $row3 = mysql_fetch_array($result3);
  77.                     $date = substr($row3['post_date'], 0, -9);
  78.                     $postInfo[] = array(
  79.                         'postDate'=>$date,
  80.                         'postTitle'=>$row3['post_title'],
  81.                         'postUrl'=>$row3['guid']
  82.                     );
  83.                 }
  84.             } else {
  85.                 // Skip, Nothing Here Share
  86.             }
  87.     } else {
  88.         // Skip, Nothing Here to Share
  89.     }
  90.  
  91. /* EOF Blog Section */
  92.  
  93. /* BOF Blog Secition */
  94.  
  95.     // Check MINISTRIES Install for SHARE Tag
  96.     $result = mysql_query("SELECT * FROM wpministries_terms WHERE slug='$slug' LIMIT 0,1");
  97.     if (mysql_num_rows($result) > 0) {
  98.         $row = mysql_fetch_array($result);
  99.         $result2 = mysql_query("SELECT * FROM wpministries_term_relationships WHERE term_taxonomy_id='{$row['term_id']}' ORDER BY object_id DESC LIMIT 0,10");
  100.             if (mysql_num_rows($result2) > 0) {
  101.                 while ($row2 = mysql_fetch_array($result2)) {
  102.                     $result3 = mysql_query("SELECT * FROM wpministries_posts WHERE ID='{$row2['object_id']}'");
  103.                     $row3 = mysql_fetch_array($result3);
  104.                     $date = substr($row3['post_date'], 0, -9);
  105.                     $postInfo[] = array(
  106.                         'postDate'=>$date,
  107.                         'postTitle'=>$row3['post_title'],
  108.                         'postUrl'=>$row3['guid']
  109.                     );
  110.                 }
  111.             } else {
  112.                 // Skip, Nothing Here Share
  113.             }
  114.     } else {
  115.         // Skip, Nothing Here to Share
  116.     }
  117.  
  118. /* EOF Blog Section */
  119.  
  120. /* BOF Blog Secition */
  121.  
  122.     // Check NEWS Install for SHARE Tag
  123.     $result = mysql_query("SELECT * FROM wpnews_terms WHERE slug='$slug' LIMIT 0,1");
  124.     if (mysql_num_rows($result) > 0) {
  125.         $row = mysql_fetch_array($result);
  126.         $result2 = mysql_query("SELECT * FROM wpnews_term_relationships WHERE term_taxonomy_id='{$row['term_id']}' ORDER BY object_id DESC LIMIT 0,10");
  127.             if (mysql_num_rows($result2) > 0) {
  128.                 while ($row2 = mysql_fetch_array($result2)) {
  129.                     $result3 = mysql_query("SELECT * FROM wpnews_posts WHERE ID='{$row2['object_id']}'");
  130.                     $row3 = mysql_fetch_array($result3);
  131.                     $date = substr($row3['post_date'], 0, -9);
  132.                     $postInfo[] = array(
  133.                         'postDate'=>$date,
  134.                         'postTitle'=>$row3['post_title'],
  135.                         'postUrl'=>$row3['guid']
  136.                     );
  137.                 }
  138.             } else {
  139.                 // Skip, Nothing Here Share
  140.             }
  141.     } else {
  142.         // Skip, Nothing Here to Share
  143.     }
  144.  
  145. /* EOF Blog Section */
  146.  
  147. /* BOF Blog Secition */
  148.  
  149.     // Check RESOURCES Install for SHARE Tag
  150.     $result = mysql_query("SELECT * FROM wpresources_terms WHERE slug='$slug' LIMIT 0,1");
  151.     if (mysql_num_rows($result) > 0) {
  152.         $row = mysql_fetch_array($result);
  153.         $result2 = mysql_query("SELECT * FROM wpresources_term_relationships WHERE term_taxonomy_id='{$row['term_id']}' ORDER BY object_id DESC LIMIT 0,10");
  154.             if (mysql_num_rows($result2) > 0) {
  155.                 while ($row2 = mysql_fetch_array($result2)) {
  156.                     $result3 = mysql_query("SELECT * FROM wpresources_posts WHERE ID='{$row2['object_id']}'");
  157.                     $row3 = mysql_fetch_array($result3);
  158.                     $date = substr($row3['post_date'], 0, -9);
  159.                     $postInfo[] = array(
  160.                         'postDate'=>$date,
  161.                         'postTitle'=>$row3['post_title'],
  162.                         'postUrl'=>$row3['guid']
  163.                     );
  164.                 }
  165.             } else {
  166.                 // Skip, Nothing Here Share
  167.             }
  168.     } else {
  169.         // Skip, Nothing Here to Share
  170.     }
  171.  
  172. /* EOF Blog Section */
  173.  
  174. /* BOF Blog Secition */
  175.  
  176.     // Check SERMONS Install for SHARE Tag
  177.     $result = mysql_query("SELECT * FROM wpsermons_terms WHERE slug='$slug' LIMIT 0,1");
  178.     if (mysql_num_rows($result) > 0) {
  179.         $row = mysql_fetch_array($result);
  180.         $result2 = mysql_query("SELECT * FROM wpsermons_term_relationships WHERE term_taxonomy_id='{$row['term_id']}' ORDER BY object_id DESC LIMIT 0,10");
  181.             if (mysql_num_rows($result2) > 0) {
  182.                 while ($row2 = mysql_fetch_array($result2)) {
  183.                     $result3 = mysql_query("SELECT * FROM wpsermons_posts WHERE ID='{$row2['object_id']}'");
  184.                     $row3 = mysql_fetch_array($result3);
  185.                     $date = substr($row3['post_date'], 0, -9);
  186.                     $postInfo[] = array(
  187.                         'postDate'=>$date,
  188.                         'postTitle'=>$row3['post_title'],
  189.                         'postUrl'=>$row3['guid']
  190.                     );
  191.                 }
  192.             } else {
  193.                 // Skip, Nothing Here Share
  194.             }
  195.     } else {
  196.         // Skip, Nothing Here to Share
  197.     }
  198.  
  199. /* EOF Blog Section */
  200.  
  201. /* BOF Blog Secition */
  202.  
  203.     // Check HARMONY BLOG for SHARE Tag
  204.     @mysql_select_db('harmonyv_wrdp6') or die("Unable to select database");
  205.     $result = mysql_query("SELECT * FROM wp_terms WHERE slug='$slug' LIMIT 0,1");
  206.     if (mysql_num_rows($result) > 0) {
  207.         $row = mysql_fetch_array($result);
  208.         $result2 = mysql_query("SELECT * FROM wp_term_relationships WHERE term_taxonomy_id='{$row['term_id']}' ORDER BY object_id DESC LIMIT 0,10");
  209.             if (mysql_num_rows($result2) > 0) {
  210.                 while ($row2 = mysql_fetch_array($result2)) {
  211.                     $result3 = mysql_query("SELECT * FROM wp_posts WHERE ID='{$row2['object_id']}'");
  212.                     $row3 = mysql_fetch_array($result3);
  213.                     $date = substr($row3['post_date'], 0, -9);
  214.                     $postInfo[] = array(
  215.                         'postDate'=>$date,
  216.                         'postTitle'=>$row3['post_title'],
  217.                         'postUrl'=>$row3['guid']
  218.                     );
  219.                 }
  220.             } else {
  221.                 // Skip, Nothing Here Share
  222.             }
  223.     } else {
  224.         // Skip, Nothing Here to Share
  225.     }
  226.  
  227. /* EOF Blog Section */
  228.  
  229. /* BOF Blog Secition */
  230.  
  231.     // Check VIDEOS BLOG for SHARE Tag
  232.     @mysql_select_db('harmonyv_wrdp5') or die("Unable to select database");
  233.     $result = mysql_query("SELECT * FROM wp_terms WHERE slug='$slug' LIMIT 0,1");
  234.     if (mysql_num_rows($result) > 0) {
  235.         $row = mysql_fetch_array($result);
  236.         $result2 = mysql_query("SELECT * FROM wp_term_relationships WHERE term_taxonomy_id='{$row['term_id']}' ORDER BY object_id DESC LIMIT 0,10");
  237.             if (mysql_num_rows($result2) > 0) {
  238.                 while ($row2 = mysql_fetch_array($result2)) {
  239.                     $result3 = mysql_query("SELECT * FROM wp_posts WHERE ID='{$row2['object_id']}'");
  240.                     $row3 = mysql_fetch_array($result3);
  241.                     $date = substr($row3['post_date'], 0, -9);
  242.                     $postInfo[] = array(
  243.                         'postDate'=>$date,
  244.                         'postTitle'=>$row3['post_title'],
  245.                         'postUrl'=>$row3['guid']
  246.                     );
  247.                 }
  248.             } else {
  249.                 // Skip, Nothing Here Share
  250.             }
  251.     } else {
  252.         // Skip, Nothing Here to Share
  253.     }
  254.  
  255. /* EOF Blog Section */
  256.  
  257. /* BOF Blog Secition */
  258.  
  259.     // Check MISSIONS BLOG for SHARE Tag
  260.     @mysql_select_db('harmonyv_wrdp3') or die("Unable to select database");
  261.     $result = mysql_query("SELECT * FROM wp_terms WHERE slug='$slug' LIMIT 0,1");
  262.     if (mysql_num_rows($result) > 0) {
  263.         $row = mysql_fetch_array($result);
  264.         $result2 = mysql_query("SELECT * FROM wp_term_relationships WHERE term_taxonomy_id='{$row['term_id']}' ORDER BY object_id DESC LIMIT 0,10");
  265.             if (mysql_num_rows($result2) > 0) {
  266.                 while ($row2 = mysql_fetch_array($result2)) {
  267.                     $result3 = mysql_query("SELECT * FROM wp_posts WHERE ID='{$row2['object_id']}'");
  268.                     $row3 = mysql_fetch_array($result3);
  269.                     $date = substr($row3['post_date'], 0, -9);
  270.                     $postInfo[] = array(
  271.                         'postDate'=>$date,
  272.                         'postTitle'=>$row3['post_title'],
  273.                         'postUrl'=>$row3['guid']
  274.                     );
  275.                 }
  276.             } else {
  277.                 // Skip, Nothing Here Share
  278.             }
  279.     } else {
  280.         // Skip, Nothing Here to Share
  281.     }
  282.  
  283. /* EOF Blog Section */
  284.  
  285. /* BOF Blog Secition */
  286.  
  287.     // Check QUEST BLOG for SHARE Tag
  288.     @mysql_select_db('harmonyv_wrdp4') or die("Unable to select database");
  289.     $result = mysql_query("SELECT * FROM wp_terms WHERE slug='$slug' LIMIT 0,1");
  290.     if (mysql_num_rows($result) > 0) {
  291.         $row = mysql_fetch_array($result);
  292.         $result2 = mysql_query("SELECT * FROM wp_term_relationships WHERE term_taxonomy_id='{$row['term_id']}' ORDER BY object_id DESC LIMIT 0,10");
  293.             if (mysql_num_rows($result2) > 0) {
  294.                 while ($row2 = mysql_fetch_array($result2)) {
  295.                     $result3 = mysql_query("SELECT * FROM wp_posts WHERE ID='{$row2['object_id']}'");
  296.                     $row3 = mysql_fetch_array($result3);
  297.                     $date = substr($row3['post_date'], 0, -9);
  298.                     $postInfo[] = array(
  299.                         'postDate'=>$date,
  300.                         'postTitle'=>$row3['post_title'],
  301.                         'postUrl'=>$row3['guid']
  302.                     );
  303.                 }
  304.             } else {
  305.                 // Skip, Nothing Here Share
  306.             }
  307.     } else {
  308.         // Skip, Nothing Here to Share
  309.     }
  310.  
  311. /* EOF Blog Section */
  312.  
  313. /* BOF Blog Secition */
  314.  
  315.     // Check WOMEN BLOG for SHARE Tag
  316.     @mysql_select_db('harmonyv_wrdp1') or die("Unable to select database");
  317.     $result = mysql_query("SELECT * FROM wp_terms WHERE slug='$slug' LIMIT 0,1");
  318.     if (mysql_num_rows($result) > 0) {
  319.         $row = mysql_fetch_array($result);
  320.         $result2 = mysql_query("SELECT * FROM wp_term_relationships WHERE term_taxonomy_id='{$row['term_id']}' ORDER BY object_id DESC LIMIT 0,10");
  321.             if (mysql_num_rows($result2) > 0) {
  322.                 while ($row2 = mysql_fetch_array($result2)) {
  323.                     $result3 = mysql_query("SELECT * FROM wp_posts WHERE ID='{$row2['object_id']}'");
  324.                     $row3 = mysql_fetch_array($result3);
  325.                     $date = substr($row3['post_date'], 0, -9);
  326.                     $postInfo[] = array(
  327.                         'postDate'=>$date,
  328.                         'postTitle'=>$row3['post_title'],
  329.                         'postUrl'=>$row3['guid']
  330.                     );
  331.                 }
  332.             } else {
  333.                 // Skip, Nothing Here Share
  334.             }
  335.     } else {
  336.         // Skip, Nothing Here to Share
  337.     }
  338.  
  339. /* EOF Blog Section */
  340.  
  341. /* BOF Blog Secition */
  342.  
  343.     // Check YOUTH BLOG for SHARE Tag
  344.     @mysql_select_db('harmonyv_wrdp2') or die("Unable to select database");
  345.     $result = mysql_query("SELECT * FROM wp_terms WHERE slug='$slug' LIMIT 0,1");
  346.     if (mysql_num_rows($result) > 0) {
  347.         $row = mysql_fetch_array($result);
  348.         $result2 = mysql_query("SELECT * FROM wp_term_relationships WHERE term_taxonomy_id='{$row['term_id']}' ORDER BY object_id DESC LIMIT 0,10");
  349.             if (mysql_num_rows($result2) > 0) {
  350.                 while ($row2 = mysql_fetch_array($result2)) {
  351.                     $result3 = mysql_query("SELECT * FROM wp_posts WHERE ID='{$row2['object_id']}'");
  352.                     $row3 = mysql_fetch_array($result3);
  353.                     $date = substr($row3['post_date'], 0, -9);
  354.                     $postInfo[] = array(
  355.                         'postDate'=>$date,
  356.                         'postTitle'=>$row3['post_title'],
  357.                         'postUrl'=>$row3['guid']
  358.                     );
  359.                 }
  360.             } else {
  361.                 // Skip, Nothing Here Share
  362.             }
  363.     } else {
  364.         // Skip, Nothing Here to Share
  365.     }
  366.  
  367. /* EOF Blog Section */
  368.  
  369.  
  370. // Close MySQL Connection
  371. mysql_close();
  372.  
  373.  
  374. // Sort Array by Date DESC
  375. foreach ($postInfo as $key => $row) {
  376.     $dates[$key] = $row['postDate'];
  377. }
  378. @array_multisort($dates, SORT_DESC, $postInfo);
  379.  
  380. // Set Limit for displayed results
  381. $limit = 10;
  382.  
  383. // Get each result by Date (which is now sorted DESC) and parse results of other Arrays
  384. foreach ($postInfo as $key => $value) {
  385.     if ($count == $limit) {
  386.         break;
  387.     } else {
  388.         echo "<a href='".$value['postUrl']."'>".$value['postTitle']."</a><br>";
  389.         $count++;
  390.     }
  391. }
  392. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement