Location: PHPKode > projects > phpMyPrepaid > phpmyprepaid/www/include/users/deleteuser.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.
*/

$q1 = "select user_id,user_alias,user_firstname,user_lastname From user where user_status<='".$oreon->user->get_status()."'"; // get all the timed cards
echo "<p class=\"information\">Users list :</p>";
	$result1=$oreon->database->database->query($q1);  // <------ FIGURE OUT HOW MANY RESULTS WE ARE PULLING
	
	if (!$result1) {
		$_SESSION['error']='Invalid request : ' . "Query database error !";
		echo "<script Language=\"JavaScript\"> window.location.href='".$_SERVER['HTTP_REFERER']."';</script>";
		return;
	}
	
	$numrows=$oreon->database->database->result_num_rows($result1);
	
	if ($numrows == 0) 
	{
		$_SESSION['error']=" No user found, please create one or more !";
		echo "<script Language=\"JavaScript\"> window.location.href='".$_SERVER['HTTP_REFERER']."';</script>";
		return;
	}
	if ($numrows == 1 ) 
	{
		$_SESSION['error']="Only one user left, you can't delete all user !";
		echo "<script Language=\"JavaScript\"> window.location.href='".$_SERVER['HTTP_REFERER']."';</script>";
		return;
	}
	

	echo "<table border=2>";
	echo"<tr>";
	
	echo "<td class=\"bpcell\" width=180>";
	echo "<b>Alias</b>";
	echo "</td>";
	echo "<td class=\"bpcell\" width=180>";
	echo "<b>Fistname</b>";
	echo "</td>";
	echo "<td class=\"bpcell\" width=180>";
	echo "<b>Lastname</b>";
	echo "</td>";
	echo "</tr>";
	
	
	printf('<form  name="center" id="center" action="phpmyprepaid.php" method="post">');
	
	while ($row = $oreon->database->database->fetch_object($result1)) {
		if(!isset($shade)) { $shade = 2;}
		$array[] = $row; 
		$Id= ($row->user_id);
		$alias= ($row->user_alias);
		$lastname=($row->user_lastname);
		$firstname=($row->user_firstname);
		echo("<tr>");
		
		if($shade == 1) { echo('<td STYLE="background-color: #F2F7FB">'); }
			else{ echo('<td STYLE="background-color: #cde5f4">'); }
    		 printf('<input type="radio" name="deleteuser" value="%s" %s/> %s<br />',
	                 $row->user_id,
		         (isset($_REQUEST['deluser']) and $_REQUEST['deluser'] == $row->user_alias) ? 'checked="checked" ' : '',
		         $alias);
		echo("</td>");
		if($shade == 1) { echo('<td STYLE="background-color: #F2F7FB">'); }
		else{ echo('<td STYLE="background-color: #cde5f4">'); }
		echo $lastname;
			echo("</td>");
		if($shade == 1) { echo('<td STYLE="background-color: #F2F7FB">'); }
		else{ echo('<td STYLE="background-color: #cde5f4">'); }
		echo $firstname;
			echo("</td></tr>");
		$count++ ; // <--- adds 0ne to the page number
		if($shade == 1) { $shade = 2;}else{ $shade = 1; }
               }

	echo "</table>";

	echo('<input type="hidden" name="buttonID" value="delUser">');
	echo "<br>";
	echo ('<td align="right"><tr>');
	echo ("<input type=\"submit\" name=\"submit\" class=\"smallButton\" value=\"Delete user \"/>");
	echo ('</td></tr>');
        echo '</form>';
							  

	echo "<br>";
?>		
Return current item: phpMyPrepaid