Location: PHPKode > projects > phpMyPrepaid > phpmyprepaid/www/include/radius/SqlCounter_html.php
<?php
if(!isset($msg)){
    if ($buttonID=="sql_counter") {

  printf('<form action="phpmyprepaid.php" method="post">');
         if($shade == 1) { echo('<td STYLE="background-color: #F2F7FB">'); }
         else{ echo('<td STYLE="background-color: #cde5f4">'); }
         echo("<input type=\"hidden\" name=\"buttonID\" value=\"cr_sql_counter\">");
         echo("<input type=\"submit\" value=\"Create sql counter\" class=\"smallButton\"  name=\"submit\" >");
         echo("</td>");
         echo("</form>");

 $q1 = "select ID,name,description From SqlCounter WHERE location_id='$lid'";
 $result1=$oreon->database->database->query($q1);  // <------ FIGURE OUT HOW 
 if ($result1) {
     $numrows=$oreon->database->database->result_num_rows($result1);
     if ($numrows == 0)
      {
       echo '<p class="information"> No Sql counter found, please create one or more';
       return;
       }

     echo "<p class=\"information\">Available Sql Counter :</p>";
     echo "<table width=\"650\" border=2>";
     echo"<tr>";
    echo "<td class=\"bpcell\" width=180>";
    echo "<b>Name</b>";
    echo "</td>";
    echo "<td class=\"bpcell\" width=80>";
    echo "<b>Description</b>";
    echo "</td>";
    echo "<td class=\"bpcell\" width=80>";
    echo "<b>Description</b>";
    echo "</td>";
    echo "</tr>";

    while ($row = $oreon->database->database->fetch_object($result1)) {
        $sc_name=$row->name;
        $sc_id=$row->ID;
        $sc_desc=$row->description;

          printf('<form action="phpmyprepaid.php" method="post">');
         if($shade == 1) { echo('<td STYLE="background-color: #F2F7FB">'); }
         else{ echo('<td STYLE="background-color: #cde5f4">'); }
         echo("<input type=\"hidden\" name=\"buttonID\" value=\"mod_slq_counter\">");
         echo("<input type=\"hidden\" name=\"locID\" value=\"$lid\">");
         echo("<input type=\"hidden\" name=\"sql_counter_id\" value=\"$sc_id\">");
         echo("<input type=\"button\" value='$sc_name' class=\"smallButton\"  name=\"submit\" >");
         echo("</td>");
         echo("</form>");
         if($shade == 1) { echo('<td STYLE="background-color: #F2F7FB">'); }
         else{ echo('<td STYLE="background-color: #cde5f4">'); }
         echo($sc_desc);
         echo("</td>");
         echo("</tr>");
     }

         echo("</table");
 }else 
     echo '<p class="error"> Sql error </p>';

}
if ($buttonID=="cr_sql_counter" or $buttonID=="mod_sql_counter") {
    if (isset($_POST['sql_counter_id'])) {
        $sc_id=$_POST['sql_counter_id'];
    $opt=getSqlCounter($sc_id,$_SESSION['locID']);
    }
        echo "
<form action=\"phpmyprepaid.php\" method=\"post\">
<br>
<hr>
<big><big  style=\"font-family: Aircut\"><span style=\"font-weight: bold;\"><b>Sql Counter creation</span></b></big></big><br>
<table>
<tr>
<td >Name : </td>
<td><input name=\"name\" value=\"".$opt['name']."\"></td>
</tr><tr>
<td>Description : </td>
<td><input name=\"description\" value=\"".$opt['description']."\"></td>
</tr><tr>
<td>Key : </td>
<td><input name=\"sckey\" value=\"".$opt['sckey']."\"></td>
</tr><tr>
<td>File name : </td>
<td><input name=\"file_name\" value=\"".$opt['file_name']."\"></td>
</tr><tr>
<td>Count attribute : </td>
<td><input name=\"count_attribute\" value=\"".$opt['count_attribute']."\"></td>
</tr><tr>
<td>Reset : </td>
<td><input name=\"reset\" value=\"".$opt['reset']."\"></td>
</tr><tr>
<td>Check name : </td>
<td><input name=\"check_name\" value=\"".$opt['check_name']."\"></td>
</tr><tr>
<td>Query : </td>
<td><input size=\"80\" name=\"query\" value=\"".$opt['query']."\"></td>
</tr><tr>
<td>Reply message : </td>
<td><input size=\"50\"name=\"reply\" value=\"".$opt['reply']."\"></td>
	   </tr>

<hr>

</tr>
</table>

<hr>
<table>
<tr>";

 print "<td><input type=\"hidden\" name=\"buttonID\" value=\"save_sql_counterf\">
     <input name=\"submit\" class=\"smallButton\" type=\"submit\" value=\"Save Configuration\" >
</form>
</td></tr>
</table>
";
}
}
else echo $msg;
Return current item: phpMyPrepaid