Location: PHPKode > projects > phpMyPrepaid > phpmyprepaid/www/include/tabs/debugreply.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			//
	//////////////////////////////////////////////////////////
					
	//////////////////////////////////////////////////////////
	//	THIS WAS THE 0.1X CODE.  INCLUDED IF NO MSG	//
	//////////////////////////////////////////////////////////

echo "<br>
<table border=2 width=\"540\" bordercolordark=#ffffe0 bordercolorlight=#000000 width=100% cellpadding=2 cellspacing=0 bgcolor=\"#ffffe0\" valign=top>
<tr bgcolor=\"#666699\" valign=top>
<td class=\"bl\ width=340></td>
<td  class=\"bl\  width=200>";
$q1 = "select Attribute,Value From radreply WHERE UserName='$pullUser'"; // get all the timed cards
$result=$oreon->database->database->query($q1);  // <------ FIGURE OUT HOW MANY RESULTS WE ARE PULLING
$numrows=$oreon->database->database->result_num_rows($result);
if ($numrows>0)
while( $row = $oreon->database->database->fetch_array($result)) 
if ($_POST[$row['Attribute']]=='Del')
  {
	  $attr=$row['Attribute'];
	  
  $q="DELETE From radreply Where Attribute='$attr' AND UserName='". $pullUser ."'";
   $result=$oreon->database->database->query($q);  // <------ FIGURE OUT HOW MANY RESULTS WE ARE PULLING
   echo "</small>Successful delete Attribute <b>$attr</b> for user $pullUser !!!!!"; 
  }

if ($_POST['debugreply']!='')
{
    $q1 = "select Attribute,Value From radreply WHERE UserName='$pullUser'"; // get all the timed cards
    $result=$oreon->database->database->query($q1);  // <------ FIGURE OUT HOW MANY RESULTS WE ARE PULLING
    
    $i=0; 
    $tmp='';
    $attr='';
    $numrows=$oreon->database->database->result_num_rows($result);
    if ($numrows>0)
    while( $row = $oreon->database->database->fetch_array($result)) 
    {
     $attr=$row['Attribute'];
     $tmp="Value='".$_POST[$attr]."'";
     $q1 = "UPDATE radreply SET $tmp Where Attribute='$attr' AND UserName='".$pullUser."'";
     $res= $oreon->database->database->query($q1) or die("Query database error !");
    }
    echo " Modification successfully apply  !!";
    
}

echo "<table border=2 width=100% cellpadding=2 cellspacing=0>
        <tr bgcolor=\"#666699\" align=right valign=top><th>
	         <font color=\"white\">Attribute from radreply table for $pullUser</font>&nbsp
		 </th></tr>
		 </table>
		 </td></tr>
		 <tr bgcolor=\"#666699\" valign=top><td colspan=2>";
		 
$q1 = "select Attribute,Value From radreply WHERE UserName='$pullUser'"; // get all the timed cards
	
$result=$oreon->database->database->query($q1);  // <------ FIGURE OUT HOW MANY RESULTS WE ARE PULLING
$numrows=$oreon->database->database->result_num_rows($result); 
echo "<table border=4 cellpadding=1 cellspacing=1>";
printf('<form  name="center" id="center"  method="post">');
echo "<input type=hidden name=tab value='d'>
      <input type=hidden name=login value=$pullUser>";


if ($numrows>0)
while( $row = $oreon->database->database->fetch_array($result)) {
$attr=$row['Attribute'];
$val=$row['Value'];
echo "<tr>";
echo "<td class=\"bl\" width=200>";
echo "<b>$attr</b>"; 
echo "</td>";
			
echo('<td class=\"bl\" width=\"200\">'); 
echo("<input width=\"400\" type=\"text\"  name=\"$attr\" value=\"$val\">");
echo("</td>");
echo('<td  class=\"bl\" width=50>');
echo("<input type=\"submit\"  name=\"$attr\" class=\"button\" value=Del>");
echo("</tr>");
}
echo ('<td class=\"bl\" align="right"><tr>');
echo ("<input type=\"submit\" name=\"debugreply\" class=\"button\" value=\"Modify Field \"/>");
echo ('</td>');
echo '</tr></form>';
echo '<br>';			  
echo '</table>';
echo '</table>';

?>		
Return current item: phpMyPrepaid