Location: PHPKode > projects > WH Community > wh_community/admin/posts.php
<?php include('files/header.php'); ?>
<div id="content-outer">
<div id="content">

	<div id="page-heading">
		<h1><?php echo $lang_admin['posts']; ?></h1>
	</div>
	
	<table border="0" width="100%" cellpadding="0" cellspacing="0" id="content-table">
	<tr>
		<th rowspan="3" class="sized"><img src="files/shared/side_shadowleft.jpg" width="20" height="300" alt="shadow_l"></th>
		<th class="topleft"></th>
		<td id="tbl-border-top">&nbsp;</td>
		<th class="topright"></th>
		<th rowspan="3" class="sized"><img src="files/shared/side_shadowright.jpg" width="20" height="300" alt="shadow_r"></th>
	</tr>
	<tr>
		<td id="tbl-border-left"></td>
		<td><div id="content-table-inner">
			<div id="table-content">
			<p><?php
			
			$pfad = $_SERVER['PHP_SELF'];
			$query = mysql_query("SELECT post_id FROM posts");
			$datensaetze_pro_seitea = "15";
			$p = "5";
			$total = intval(mysql_num_rows($query));
			$seiten = ceil($total / $datensaetze_pro_seitea);
		
			if(empty($_GET['go'])){
				$go = 1;
			}elseif($_GET['go'] <= 0 || $_GET['go'] > $seiten){
				$go = 1;
			}else{
				$go = mysql_real_escape_string($_GET['go']);
			}
			$links = array();
		
			if(($go - $p) < 1){ $davor = $go - 1;  }else { $davor = $p; }            
			if(($go + $p) > $seiten){ $danach = $seiten - $go; }else{ $danach = $p; }        
				$off = ($go - $davor);              
			if($go- $davor > 1){
				$first = 1;
				   $links[] = "<a href=\"$pfad?go=$first\">&laquo; " . $lang_admin['first'] . " ...</a>\n";      
					}      
		
			if($go != 1){
				$prev = $go-1;
				$links[] = "<a href=\"$pfad?go=$prev\"> &laquo;</a>\n";     
				}    
			
			for($i = $off; $i <= ($go + $danach); $i++){
		
			  if($i != $go){
					$links[] = "<a href=\"$pfad?go=$i\">$i</a>\n";
			  }elseif($i == $seiten) {
					$links[] = "<span class=\"current\">[ $i ]</span>\n";  
			  }elseif($i == $go){
					$links[] = "<span class=\"current\">[ $i ]</span>\n";
			  		}
			}                
		
			if($go != $seiten){
				$next = $go+1;
				$links[] = "<a href=\"$pfad?go=$next\"> &raquo;</a>\n";
				}      
			
			if($seiten - $go - $p > 0 ){
				$last = $seiten; 
				$links[] = "<a href=\"$pfad?go=$last\">... " . $lang_admin['last'] . " &raquo;</a>\n";
				}      
		
			$start = ($go-1) * $datensaetze_pro_seitea;
			$link_string = implode(" ", $links);
		   
		   $query = "SELECT * FROM posts ORDER BY post_id DESC LIMIT $start,$datensaetze_pro_seitea"; 
		   $result = mysql_query($query);
		
		   if($result) {
		   
		   echo '<table width="100%" class="maintable">
				 <tr>
				 <td width="5%"><strong>ID</strong></td>
				 <td width="50%"><strong>' . $lang_admin['post_o'] . '</strong></td>
				 <td width="15%"><strong>' . $lang_admin['date'] . '</strong></td>
				 <td width="10%"><strong>Topic-ID</strong></td>
				 <td width="10%"><strong>User-ID</strong></td>
				 <td width="10%"><span class="false">' . $lang_admin['delete'] . '</span></td>
				 </tr>
				 </table>';
			
		   while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
		   
		   echo '<table width="100%" class="maintable">
				 <tr>
				 <td width="5%"><strong>' . htmlentities($row['post_id']) . '</strong></td>
				 <td width="50%">' . ((strlen($row['post_content'])<6) ? $row['post_content'] : substr($row['post_content'],0,70).'...') . '</td>
				 <td width="15%">' . date('d.m.Y', strtotime($row['post_date'])) . '</td>
				 <td width="10%">' . htmlentities($row['post_topic']) . '</td>
				 <td width="10%">' . htmlentities($row['post_by']) . '</td>   
				 <td width="10%"><a href="posts_delete.php?post_id=' . $row['post_id'] . '"><img src="files/delete.png" width="16" height="16" border="0" title="' . $lang_admin['delete'] . '"></a></td>
				 </tr>
				 </table>';
				 }
			
			}else{
			echo '<p>' . $lang_admin['no_records'] . '.</p>';
			}
			
			echo "<br><div id=\"navigation\">";
			echo "<span class=\"pages\">" . $lang_admin['page'] . " " . $go . " " . $lang_admin['of'] . " " . $seiten . "</span>";
			echo $link_string;
			echo "</div>";
		
			?></p>
			</div>
		</div></td>
		<td id="tbl-border-right"></td>
	</tr>
	<tr>
		<th class="sized bottomleft"></th>
		<td id="tbl-border-bottom">&nbsp;</td>
		<th class="sized bottomright"></th>
	</tr>
	</table>
			
	<div class="clear"></div>
		 
	</div>

	<div class="clear">&nbsp;</div>

</div>
<div class="clear">&nbsp;</div>
</div>
<?php include('files/footer.php'); ?>
Return current item: WH Community