Advertisement
Guest User

Untitled

a guest
Mar 30th, 2015
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 9.19 KB | None | 0 0
  1. <?php
  2. /**
  3.  * The template for displaying all pages.
  4.  *
  5.  * This is the template that displays all pages by default.
  6.  * Please note that this is the WordPress construct of pages
  7.  * and that other 'pages' on your WordPress site will use a
  8.  * different template.
  9.  *
  10.  * @package impact
  11.  */
  12.  
  13. get_header(); ?>
  14.  
  15.     <?php // Top A
  16.     if ( is_active_sidebar( 'top-a' ) ) : ?>
  17.         <div class="top-a">
  18.             <?php dynamic_sidebar( 'top-a' ); ?>
  19.         </div>
  20.     <?php endif; ?>
  21.  
  22.     <?php // Top B
  23.     if ( is_active_sidebar( 'top-b' ) ) : ?>
  24.         <div class="top-b">
  25.             <?php dynamic_sidebar( 'top-b' ); ?>
  26.         </div>
  27.     <?php endif; ?>
  28.  
  29.     <?php // Top C
  30.     if ( is_active_sidebar( 'top-c' ) ) : ?>
  31.         <div class="top-c">
  32.             <?php dynamic_sidebar( 'top-c' ); ?>
  33.         </div>
  34.     <?php endif; ?>
  35.  
  36.     <?php // Top D
  37.     if ( is_active_sidebar( 'top-d' ) ) : ?>
  38.         <div class="top-d">
  39.             <?php dynamic_sidebar( 'top-d' ); ?>
  40.         </div>
  41.     <?php endif; ?>
  42.    
  43.     <?php // Top E
  44.     if ( is_active_sidebar( 'top-e' ) ) : ?>
  45.         <div class="top-e">
  46.             <?php dynamic_sidebar( 'top-e' ); ?>
  47.         </div>
  48.     <?php endif; ?>
  49.  
  50.     <header class="entry-header">
  51.         <?php the_title( '<h1 class="entry-title">', '</h1>' ); ?>
  52.     </header><!-- .entry-header -->
  53.  
  54.  
  55.  
  56.     <div id="primary" class="content-area">
  57.  
  58.         <main id="main" class="site-main" role="main">
  59.  
  60. <?php
  61.  
  62. error_reporting(1);
  63.  
  64.  
  65.  
  66. //db
  67. $con=mysqli_connect($_ENV['DB_HOST'] . ':' . $_ENV['DB_PORT'], $_ENV['DB_USER'], $_ENV['DB_PASSWORD'], $_ENV['DB_NAME']);
  68. // Check connection
  69. if (mysqli_connect_errno()){
  70.     echo "Failed to connect to MySQL: " . mysqli_connect_error($con);
  71. }else{
  72.  
  73. }
  74.  
  75.  
  76. if(2==$_GET['author_page']){
  77.     $sql="select * from authors order by last_name limit 10,10";
  78. }else if(3==$_GET['author_page']){
  79.     $sql="select * from authors order by last_name limit 20,10";
  80. }else if(4==$_GET['author_page']){
  81.     $sql="select * from authors order by last_name limit 40,10";
  82. }else if(5==$_GET['author_page']){
  83.     $sql="select * from authors order by last_name limit 50,10";
  84. }else if(6==$_GET['author_page']){
  85.     $sql="select * from authors order by last_name limit 60,10";
  86. }else if(7==$_GET['author_page']){
  87.     $sql="select * from authors order by last_name limit 70,10";
  88. }else if(8==$_GET['author_page']){
  89.     $sql="select * from authors order by last_name limit 80,10";
  90. }else if(9==$_GET['author_page']){
  91.     $sql="select * from authors order by last_name limit 90,10";
  92. }else if(10==$_GET['author_page']){
  93.     $sql="select * from authors order by last_name limit 100,10";
  94. }else{
  95.     $sql="select * from authors order by last_name limit 10";
  96. }
  97.  
  98.  
  99. if(isset($_GET['filter']) && $_GET['filter'] != ""){
  100.     $sql="select * from authors order by last_name limit " . $_GET['filter'];
  101. }
  102. if(isset($_GET['letter']) && $_GET['letter'] != ""){
  103.     $sql = "select * from authors where UPPER(SUBSTRING(last_name,1,1)) ='" . $_GET['letter']  . "'";
  104. }else if(isset($_GET['search-name'])){
  105.     //$sql = "select * from authors where first_name + ' ' + last_name like '%" . $_GET['search-name']  . "%' or first_name like '%" . $_GET['search-name'] . "%'";
  106.     $sql ="select * from authors where full_name like '%" . $_GET['search-name'] . "%'";
  107. }
  108.  
  109. if(isset($_GET['author_id']) && $_GET['author_id'] != ""){
  110.     $sql = "select * from authors where author_id = " . $_GET['author_id'];
  111.    
  112. }
  113.  
  114.  
  115. $result = mysqli_query($con,$sql);
  116. mysqli_close($con);
  117.  
  118. ?>
  119.  
  120. <div id="system">
  121.  
  122.     <?php if (have_posts()) : ?>
  123.         <?php while (have_posts()) : the_post(); ?>
  124.        
  125.         <article class="item no-date">
  126.             <header>
  127.                 <?php // Top E
  128.                 if ( is_active_sidebar( 'inner-top' ) ) : ?>
  129.                     <div class="inner-top">
  130.                         <?php dynamic_sidebar( 'inner-top' ); ?>
  131.                     </div>
  132.                 <?php endif; ?>
  133.             </header>
  134.             <div class="content clearfix">
  135.                 <div class="box-note" style="overflow:hidden; padding: 10px;">
  136.                     <span>Filter by first letter of the Last Name</span>
  137.                     <div class="terms-nav">
  138.                         <a class="term-letter" href="?letter=A">A</a> |
  139.                         <a class="term-letter" href="?letter=B">B</a> |
  140.                         <a class="term-letter" href="?letter=C">C</a> |
  141.                         <a class="term-letter" href="?letter=D">D</a> |
  142.                         <a class="term-letter" href="?letter=E">E</a> |
  143.                         <a class="term-letter" href="?letter=F">F</a> |
  144.                         <a class="term-letter" href="?letter=G">G</a> |
  145.                         <a class="term-letter" href="?letter=H">H</a> |
  146.                         <a class="term-letter" href="?letter=I">I</a> |
  147.                         <a class="term-letter" href="?letter=J">J</a> |
  148.                         <a class="term-letter" href="?letter=K">K</a> |
  149.                         <a class="term-letter" href="?letter=L">L</a> |
  150.                         <a class="term-letter" href="?letter=M">M</a> |
  151.                         <a class="term-letter" href="?letter=N">N</a> |
  152.                         <a class="term-letter" href="?letter=O">O</a> |
  153.                         <a class="term-letter" href="?letter=P">P</a> |
  154.                         <a class="term-letter" href="?letter=Q">Q</a> |
  155.                         <a class="term-letter" href="?letter=R">R</a> |
  156.                         <a class="term-letter" href="?letter=S">S</a> |
  157.                         <a class="term-letter" href="?letter=T">T</a> |
  158.                         <a class="term-letter" href="?letter=U">U</a> |
  159.                         <a class="term-letter" href="?letter=V">V</a> |
  160.                         <a class="term-letter" href="?letter=W">W</a> |
  161.                         <a class="term-letter" href="?letter=X">X</a> |
  162.                         <a class="term-letter" href="?letter=Y">Y</a> |
  163.                         <a class="term-letter" href="?letter=Z">Z</a>
  164.                     </div>
  165.                     <form action="?" method="GET">
  166.                         Search by Name
  167.                         <input style="font-size: 11px; " type="text" placeholder="Enter First or Last Name" name="search-name"/>
  168.                         <a href="?"><input type="button" class="button button-white" value="Show All"/></a>
  169.                         <input type="submit" class="button button-white" value="Search"/>
  170.                        
  171.                     </form>
  172.    
  173.                 </div>
  174.                
  175.            
  176.                 <?php
  177.                     //echo $sql;
  178.                     $row_cnt = mysqli_num_rows($result);
  179.                     if($row_cnt <1){
  180.                         echo "<span style='color:red'>There are no matches for the name you entered. Please try a different name</span>";
  181.                     }
  182.                     while($row = mysqli_fetch_array($result)){ ?>
  183.  
  184.                         <div class="team-profile" id="first-last">
  185.                                 <div class="profile-left">
  186.                                     <h2 class="profile-name"><img class="alignnone size-full" alt="" src="<?php echo $row['image'] ?>" /><br /><?php echo $row['first_name'] . "   " . $row['last_name'] ?></h2>
  187.                                     <h3 class="profile-title"><?php echo $row['title'] ?><span class="role"></span></h3>
  188.                                 </div>
  189.                             <div class="profile-content">
  190.                                 <?php
  191.                                
  192.                                 if(strlen($row['bio']) >= 600 && $_GET['author_id'] == "" ){
  193.                                     echo substr($row['bio'],0,600) . "...";
  194.                                     echo "<div style='text-align:right'><a href='?author_id=" . $row['author_id'] . "' class='button-primary'>Read Full Bio</a></div>";
  195.                                 }else{
  196.                                         echo ($row['bio']);
  197.                                 }
  198.                                 echo  "<br><br>";
  199.                                 if($row['article_url'] != "")
  200.                                     //echo "<a href='" . $row['articles_url'] . "' class='blue'>Read ". trim($row['first_name']) ."'s articles:</a><br>";
  201.                                     if(substr_count($row['article_name'],'#') > 0){
  202.                                                                             echo "<span class='blue'>Read ". trim($row['first_name']) ."'s Articles:</span><br>";
  203.                                     }else{
  204.                                         echo "<span class='blue'>Read ". trim($row['first_name']) ."'s Article:</span><br>";
  205.                                     }
  206.                                     ?>
  207.                                     <ul class="guest-articles">
  208.                                     <?php
  209.                                     if(substr_count($row['article_name'],'#') > 0){
  210.  
  211.                                         $articles_list = explode('#',$row['article_name']);
  212.                                         $url_list = explode('#',$row['article_url']);
  213.                                    
  214.  
  215.                                         for( $i=0; $i < count($articles_list); $i++ ){
  216.                                             echo "<li><a href='" . $url_list[$i] ."'>" . $articles_list[$i] . "</a></li>";
  217.                                         }
  218.                                     }else{
  219.                                         echo "<li><a href='" . $row['article_url'] ."'>" . $row['article_name'] . "</a></li>";
  220.                                     }
  221.                                     ?>
  222.                                     </ul>
  223.                             </div>
  224.                         </div>
  225.  
  226.  
  227.                     <?php } ?>
  228.                 <?php if(!isset($_GET['letter']) && !isset($_GET['author_id']) && !isset($_GET['search-name'])){ ?>
  229.                     <div class="float-left" style="margin-right: 10px">Page</div>
  230.                     <div class="float-left" style="margin-right: 10px"><a href="?author_page=1">1</a></div>
  231.                     <div class="float-left" style="margin-right: 10px"><a href="?author_page=2">2</a></div>
  232.                     <div class="float-left" style="margin-right: 10px"><a href="?author_page=3">3</a></div>
  233.                     <div class="float-left" style="margin-right: 10px"><a href="?author_page=4">4</a></div>
  234.                     <div class="float-left" style="margin-right: 10px"><a href="?author_page=5">5</a></div>
  235.                     <div class="float-left" style="margin-right: 10px"><a href="?author_page=6">6</a></div>
  236.                     <div class="float-left" style="margin-right: 10px"><a href="?author_page=7">7</a></div>
  237.                     <div class="float-left" style="margin-right: 10px"><a href="?author_page=8">8</a></div>
  238.                     <div class="float-left" style="margin-right: 10px"><a href="?author_page=9">9</a></div>
  239.                     <div class="float-left" style="margin-right: 10px"><a href="?author_page=10">10</a></div>
  240.                 <?php } ?>
  241.             </div>
  242.  
  243.             <?php edit_post_link(__('Edit this post.', 'warp'), '<p class="edit">','</p>'); ?>
  244.    
  245.         </article>
  246.  
  247.        
  248.         <?php endwhile; ?>
  249.     <?php endif; ?>
  250.    
  251.     <?php comments_template(); ?>
  252.  
  253.  
  254.         </main><!-- #main -->
  255.     </div><!-- #primary -->
  256.  
  257.  
  258. <?php get_sidebar(); ?>
  259.  
  260. <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement