Location: PHPKode > projects > phpMyPrepaid > phpmyprepaid/scrape/Group.php
<?php
 /*     This file is used to display all cards that have been created
	It is expected that in production, this feature will be rather
	useless because of the number of accounts that will build up
	over time.  Some sort of method for clearing old accounts will
	need to be implemented.  For now, AllCards is the first step
	in building a reporting system.

	This file C. Carl H. Peterson 2004 and released under the GPL.
	If you didn't get a copy of the GPL with this, do a search for
	GPL and find it your self.  Remember, I copyrighted this so if
	you are using it you better have a license to use it.  GPl 
	works for me.
*/

	//////////////////////////////////////////////////////////
	//	THIS SCRIPT DISPLAYS ACCOUNTS FOR A LOCATION	//
	//	First we pull the session location ID and then	//
	//	use it to pull the correct cards.  		//
	//	we use the button ID to figure out which type	//
	//	of cards we want to pull			//
	//////////////////////////////////////////////////////////
	if(isset($msg)){ unset($msg);}

	if(isset($_SESSION['locID'])){
		$loc = $_SESSION['locID'];
		}else{
			$msg= "<p class=\"error\">Please Select a Location</p>";
			if(!isset($include)) { $include = "ShowLoc.php";}
			}
	$LocName = $_SESSION['LocName'];
	if(!isset($buttonID)) {
		$msg= "$msg <p class=\"error\">No button ID was sent</p>"; // this shouldn't happen
		}
	
	if(!isset($msg)){  // no errors? ...  hit it.  Need to reset button id
	
	if(isset($_POST['limit'])) { $limit = $_POST['limit']; }else{ $limit = 200; } // <-- Hook for later feature
					
	//////////////////////////////////////////////////////////
	//	THIS WAS THE 0.1X CODE.  INCLUDED IF NO MSG	//
	//////////////////////////////////////////////////////////



	if(isset($_GET[$so])) { $sort = $_GET[$so]; } // <--- This currently does nothing FIXME
                                                      // <--- so that paged sorting works

	
	$q1 = "select GroupName From radgroupcheck GROUP BY GroupName"; // get all the timed cards
	

	echo "All Group are listed here <br><br>";
	

 
	$numresults=mysql_query($q1);  // <------ FIGURE OUT HOW MANY RESULTS WE ARE PULLING
        $numrows=mysql_num_rows($numresults);

        if (empty($s)) {  // <---- Requires the wierd non functional echo above FIXME
        $s=0;             // <---- I think an if(!isset($s) might work if we pull the GET
        }



echo "<table border=\"1\">";
echo"<tr>";

    echo "<td width=180>";
	echo "<b>Name of the group</b>";
    echo "</td>";
    echo "</tr>";



       $result1 = mysql_query($q1) or die(mysql_error());
	$count = 1 + $s; // <-- sets the page number
	if(isset($_POST['ID'])) { $pullUser=$_POST['ID'];
		unset($_POST['ID']);}

	while ($row = mysql_fetch_object($result1)) {
		if(!isset($shade)) { $shade = 2;}
		$array[] = $row; 
		$Name= ($row->GroupName);
		echo("<tr>");
		
		if($shade == 1) { echo('<td STYLE="background-color: #F2F7FB">'); }
			else{ echo('<td STYLE="background-color: #cde5f4">'); }
			 //echo('<form action="index.php" method="post">');
			 echo($Name);
			 echo("</td>");
						   
			echo("</tr>");
		$count++ ; // <--- adds 0ne to the page number
		if($shade == 1) { $shade = 2;}else{ $shade = 1; }
                        }
        $currPage = (($s/$limit) + 1);


	echo "</table>";

        //////////////////////////////////////////////////////////////////
        //      SET UP THE REST OF THE RESULTS PAGES                    //
        //   Some of this code once came from an online tutorial        //
        //   I used when I was building a website.  I will find         //
        //   The author later or re-write.  CP                          //
        //////////////////////////////////////////////////////////////////

        if ($s>=1) { // <---- Don't need a back button if this is the first page
                $prevs=($s-$limit);
                print "&nbsp;<a href=\"index.php&so=$sort&s=$prevs&q=$var\">&lt;&lt;
                Prev 10</a>&nbsp&nbsp;";
        }

        $pages=intval($numrows/$limit); // <--This figures out how many pages we have

        // $pages now contains int of pages needed unless there is a remainder from division

        if ($numrows%$limit) {
        // has remainder so add one page
        $pages++;
        }

        // check to see if last page
        if (!((($s+$limit)/$limit)==$pages) && $pages!=1) {

        // not last page so give NEXT link
        $next=$s+$limit;

        echo "&nbsp;<a href=\"index.php?&so=$sort&s=$next&q=$var\">Next 10 &gt;&gt;</a>";
        }

        $a = $s + ($limit) ;
        if ($a > $numrows) { $a = $numrows ; }
        $b = $s + 1 ;
        echo "<p>Showing results $b to $a of $numrows</p>";

	//////////////////////////////////////////////////////////////////
	//	END VERSION 0.1X CODE					//
	//////////////////////////////////////////////////////////////////

	}else{
		echo($msg);
		}

























?>		















Return current item: phpMyPrepaid