  <?php require_once('../Connections/BE2.php'); ?>
<?php
 
$currentPage = "mypoint.html";//$_SERVER["PHP_SELF"];  
$maxRows_Rt2 = 20;
$pageNum_Rt2 = 0;
if (isset($_GET['pageNum_Rt2'])) {
  $pageNum_Rt2 = $_GET['pageNum_Rt2'];
}
$startRow_Rt2 = $pageNum_Rt2 * $maxRows_Rt2;
 
 
  
$colname_Rt2 = $_SESSION['login_memid'];
 
mysql_select_db($database_BE2, $BE2);
$query_Rt2 = sprintf("SELECT * FROM mem_point WHERE mem_num= '%s' ORDER BY mem_auto DESC",$colname_Rt2);
$query_limit_Rt2 = sprintf("%s LIMIT %d, %d", $query_Rt2, $startRow_Rt2, $maxRows_Rt2);
$Rt2 = mysql_query($query_limit_Rt2, $BE2) or die(mysql_error());
$row_Rt2 = mysql_fetch_assoc($Rt2);

if (isset($_GET['totalRows_Rt2'])) {
  $totalRows_Rt2 = $_GET['totalRows_Rt2'];
} else {
  $all_Rt2 = mysql_query($query_Rt2);
  $totalRows_Rt2 = mysql_num_rows($all_Rt2);
}
$totalPages_Rt2 = ceil($totalRows_Rt2/$maxRows_Rt2)-1;


$queryString_Rt2 = "";
if (!empty($_SERVER['QUERY_STRING'])) {
  $params = explode("&", $_SERVER['QUERY_STRING']);
  $newParams = array();
  foreach ($params as $param) {
    if (stristr($param, "pageNum_Rt2") == false && 
	//   stristr($param, "act") == false && 
        stristr($param, "totalRows_Rt2") == false) {
      array_push($newParams, $param);
    }
  }
  if (count($newParams) != 0) {
    $queryString_Rt2 = "&" . htmlentities(implode("&", $newParams));
  }
}
$queryString_Rt2 = sprintf("&totalRows_Rt2=%d%s", $totalRows_Rt2, $queryString_Rt2);
?> 
					    
 <div class="main "> 
 
 <div class="row">
 <div class="col-lg-12">				    
<a style="cursor: pointer" ><b><font color="blue">來源雲點數資訊</font></b></a></p>




<table width="604" class="table table-bordered table-striped table-condensed table-hover" style="min-width:1500px;">
	<thead>
		<tr>
			<th width="46" height="25">ID</th>
			<th width="136">日期</th>
			<th width="99">類別</th>
			<th width="87">來源點數</th>
			<th width="104">&nbsp;</th>
			<th width="104">管理</th>
		</tr>
	</thead>
	<tbody>
  <?php do {   ?>
  <tr>
    <td><?= $row_Rt2['mem_auto'];?></td>
    <td><?= $row_Rt2['mem_time'];?></td>
    <td><?= $row_Rt2['mem_kid1']; ;?></td>
    <td><?= $row_Rt2['mem_code'];?></td>
    <td>&nbsp;</td>
    <td align="center"><a href="editcard-<?= $row_Rt2['mid']; ?>.html" target="_self"><img src="../icon/edit.jpg" width="30" height="30" /></a></td>
  </tr>
    <?php } while ($row_Rt2 = mysql_fetch_assoc($Rt2)); ?>
    <tbody>
</table>
 </div>
 <ul class="pagination">
                    <?   
                     if( $totalPages_Rt2 >1){	 
						    //分頁程式
if($totalPages_Rt2<5){
		 $start=0;
		 $end=$totalPages_Rt2;
		}else{  
	    $start=$pageNum_Rt2-5;
		$end=$pageNum_Rt2+5;
        if ($start<0){
		 $start=0;
		 $end=10; } 
		 else { $end=$start+10 ;}
		 if ($end>$totalPages_Rt2){ 
		   $start = $end-$totalPages_Rt2-5;
		   $end=$totalPages_Rt2;
		   }
		 if ($end-$start>10){ 
		   $start = $end-10;
		   }  
		 } ?> 
                     <?php if ($pageNum_Rt2 > 0) { // Show if not first page ?>
                     <li><a href="<?php printf("%s?pageNum_Rt2=%d%s", $currentPage, max(0, $pageNum_Rt2 - 1), $queryString_Rt2); ?>">上一頁</a></li><?php } // Show if not first page ?>
                    	<?	   
		for($i=$start;$i<=$end;$i++){
		if($i==$pageNum_Rt2){ echo '<li class="active"><a href="#">'.($i+1).'</a></li>';} else {?>
            <li><a href="<?php printf("%s?pageNum_Rt2=%d%s", $currentPage, min($totalPages_Rt2, $i), $queryString_Rt2); ?>"><? echo $i+1 ;?></a></li>
                 
                        <?	}   }  ?>

                      <?php if ($pageNum_Rt2 < $totalPages_Rt2) { // Show if not last page ?>
                          <li><a href="<?php printf("%s?pageNum_Rt2=%d%s", $currentPage, min($totalPages_Rt2, $pageNum_Rt2 + 1), $queryString_Rt2); ?>">下一頁</a></li>
                        <?php }  
						             } ?>
								
						  </ul>
   </div> 
		</div>
<?php
mysql_free_result($Rt2);
  
?>        
        
 