Location: PHPKode > projects > phpMyPrepaid > phpmyprepaid/www/include/configuration/GeneralConfiguration.php
<?php

if(!isset($msg)){

if ($buttonID=="saveconfigg") {
 
  //GENERAL
   $opt->client_name=$_POST['ClientName'];
   $opt->banner_path=$_POST['BannerPath'];
   $opt->logo_path=$_POST['LogoPath'];
   $opt->main_text=$_POST['MainText'];
   $opt->crypt=$_POST['crypt'];
   $opt->display_date_format=$_POST['dateFormat'];
   $opt->gateway_type=$_POST['gatewayTypef'];
   $opt->default_currency=$_POST['default_currency'];
  //SPECIFIC
   $opt->default_timetofinish=$_POST['timetofinish'];
   $opt->location_nas_identifier=$_POST['location_nas_identifier'];
   $opt->use_caps=$_POST['use_caps'];
   $opt->use_numeric=$_POST['use_numeric'];
   $opt->use_domain_name=$_POST['usedomainname'];
   $opt->use_disconnect_feature=$_POST['usedisconnect'];
   $opt->use_pid=$_POST['use_pid'];
   $opt->use_pid_passwd=$_POST['use_pid_passwd'];
 //VALUE
  $opt->default_idle_timeout=$_POST['idletimeout'];
  $opt->default_accounting_interval=$_POST['acctinterim'];
  $opt->max_month_old=$_POST['mexpiredm'];
  $opt->maximun_cards=$_POST['maxcards'];
   $opt->minimun_time_sold=$_POST['mintime'];
   $opt->maximun_time_sold=$_POST['maxtime'];
   $opt->minimun_moctet_sold=$_POST['minoctets'];
   $opt->maximun_moctet_sold=$_POST['maxoctets'];
   $opt->reply_message=$_POST['replymessage'];
   $opt->redirection_url=$_POST['redirectionurl'];
   $opt->logoff_url=$_POST['logoffurl'];
   $opt->uam_allowed=$_POST['uamallowed'];
   $opt->mac_allowed=$_POST['macallowed'];
   $opt->octet_type=$_POST['octet_type'];
   
   $opt->default_simultanous_use=$_POST['simultanoususe'];
  $opt->location_id=$_SESSION['locID'];
  $opt->default_name_length=$_POST['default_name_length'];
  $opt->uname_prefix=$_POST['uname_prefix'];
  $opt->uname_suffix=$_POST['uname_suffix'];
  if ($opt->default_name_length<'4')
	  $opt->default_name_length=4;

  $opt->default_passwd_length=$_POST['default_passwd_length'];
  if ($opt->default_passwd_length<'4')
	  $opt->default_passwd_length=4;

  $oreon->database->savephpmyprepaid($opt);
  $oreon->phpmyprepaid=$oreon->database->getphpmyprepaid($opt->location_id);
  echo "<p class=\information\">Configuration have been saved</p>";
  unset($buttonID);
}

if (isset($_POST['load_default']))
{
	$lid=-1;
	unset($_POST['load_default']);
}

else
	$lid=$_SESSION['locID'];
$tab=$oreon->database->getphpmyprepaid($lid);
echo "
<form action=\"phpmyprepaid.php\"  enctype=\"multipart/form-data\" method=\"post\">
</tr><tr>
<big><big  style=\"font-family: Aircut\"><span style=\"font-weight: bold;\"><b>General configuration </span></b></big></big><br>
<hr>
<table>
<tr>
<td>Client Name : </td>
<td><input name=\"ClientName\" value=\"".$tab['client_name']."\"></td>
</tr><tr>
<td>Banner path : </td>
<td><input  name=\"BannerPath\" value=\"".$tab['banner_path']."\"></td>
</tr><tr>
<td>Logo path : </td>
<td><input  name=\"LogoPath\" value=\"".$tab['logo_path']."\"></td>
</tr><tr>
<td>Main text : </td>
<td><input name=\"MainText\" value=\"".$tab['main_text']."\"></td>
</tr>
</table>";

echo "<hr>
<big style=\"font-family: Aircut\"><span style=\"font-weight: bold;\">Specific configuration</span></big><br>

<table>
<tr>
<td>Time to finish : </td>";

if ($tab['default_timetofinish'])
     echo "<td><INPUT type=\"checkbox\" checked name=\"timetofinish\"  value=\"1\" alt=\"Time to finish\"></td>";
     else
	     echo "<td><INPUT type=\"checkbox\" name=\"timetofinish\"   value=\"1\" alt=\"Time to finish\"></td>";


echo "</tr><tr>
<td>Use domain name : </td>";

if ($tab['use_domain_name'])
     echo "<td><INPUT type=\"checkbox\" checked name=\"usedomainname\"   value=\"1\" alt=\"Use domain name\"></td>";     
     else
     echo "<td><INPUT type=\"checkbox\"  name=\"usedomainname\"  value=\"1\" alt=\"Use domain name\"></td>";     

echo "</tr><tr>
<td>Use nas identifier : </td>";
if ($tab['location_nas_identifier'])
     echo "<td><INPUT type=\"checkbox\" checked name=\"location_nas_identifier\"   value=\"1\" alt=\"Location nas identifier\"></td>";     
     else
     echo "<td><INPUT type=\"checkbox\"  name=\"location_nas_identifier\"  value=\"1\" alt=\"Location nas identifier\"></td>";     



echo "</tr><tr>
<td>Use disconect feature :</td>";
if ($tab['use_disconnect_feature'])
     echo "<td><INPUT type=\"checkbox\" checked name=\"usedisconnect\"  value=\"1\" alt=\"Use disconnect feature\"></td>";
     else
     echo "<td><INPUT type=\"checkbox\"  name=\"usedisconnect\"  value=\"1\" alt=\"Use disconnect feature\"></td>";
     echo "<td>*</td>";


echo "<tr>";
echo "<td>Display date format :</td>";
echo '<td >';
echo '<select name="dateFormat">';
$tab2=split(';',$dateFormatTab);
foreach ($tab2 as $val)
if ($tab['display_date_format']==$val)
echo "<option  selected=\"selected\" value=\"$val\">$val";
else
echo "<option value=\"$val\">$val";
echo '</select>';
echo "</td></tr>";

echo "<tr>";
echo "<td>Password crypt method :</td>";
echo '<td >';
echo '<select name="crypt">';
$tab2=split(';',$crypt_method);
foreach ($tab2 as $val)
if ($tab['crypt']==$val)
echo "<option  selected=\"selected\" value=\"$val\">$val";
else
echo "<option value=\"$val\">$val";
echo '</select>';

echo "<tr>";
echo "<td>Octet type based on :</td>";
echo '<td >';
echo '<select name="octet_type">';
$tab2=split(';',$octet_type_tab);
foreach ($tab2 as $val)
if ($tab['octet_type']==$val)
echo "<option  selected=\"selected\" value=\"$val\">$val";
else
echo "<option value=\"$val\">$val";
echo '</select>';
echo "</td></tr>";

echo "<tr>";
echo "<td>Gateway type :</td>";
echo '<td>';
echo '<select name="gatewayTypef">';
$tab2=split(';',$gateway_list);
foreach ($tab2 as $val)
if ($tab['gateway_type']==$val) 
echo "<option  selected=\"selected\" value=\"$val\">$val</option>";
else
echo "<option value=\"$val\">$val</option>";

echo '</select>';
echo "</td><td><b><small>Used for define default attribute .</b></small></td></tr><tr>";
echo '<td > Default currency </td>
			<td  style="text-align: left">
			<select name="default_currency">';

	    $tab2 = split (',', $currency);
	    foreach ($tab2 as $val)
	    {
	      if ($val == $tab['default_currency'])
		echo ("<option selected=\"selected\" value=\"$val\">$val");
	      else
		echo ("<option  value=\"$val\">$val");
	      echo ("</option>'");
	    }
	    echo '<end select>';
echo "</td></tr></table>";


echo "<hr>
<big style=\"font-family: Aircut\"><span style=\"font-weight: bold;\">Accounts creation</span></big><br>";

echo "<table><tr>
<td >Username prefix : </td>
<td ><input name=\"uname_prefix\" size=\"5\" value=\"".$tab['uname_prefix']."\"></td></tr>";
echo "<td >Username suffix : </td>
<td ><input name=\"uname_suffix\" size=\"5\" value=\"".$tab['uname_suffix']."\"></td></tr>";
echo "<tr>
<td >Username length : </td>
<td ><input name=\"default_name_length\" size=\"5\" value=\"".$tab['default_name_length']."\"></td><td><b><small> minimun length, 4 characters.</b></small></td></tr>";
echo "<tr>
<td >Password length : </td>
<td ><input name=\"default_passwd_length=\" size=\"5\" value=\"".$tab['default_passwd_length']."\"></td><td><b><small>  minimun 4 characters.</b></small></td></tr>";
echo "<tr>";
echo "<td>Use caps :</td>";
if ($tab['use_caps'])
     echo "<td><INPUT type=\"checkbox\" checked name=\"use_caps\"   value=\"1\" alt=\"Use caps\"></td>";     
     else
     echo "<td><INPUT type=\"checkbox\"  name=\"use_caps\"  value=\"1\" alt=\"Use caps\"></td>";     
echo "<tr>";
echo "<td>Use numeric :</td>";
if ($tab['use_numeric'])
     echo "<td><INPUT type=\"checkbox\" checked name=\"use_numeric\"   value=\"1\" alt=\"Use caps\"></td>";     
     else
     echo "<td><INPUT type=\"checkbox\"  name=\"use_numeric\"  value=\"1\" alt=\"Use caps\"></td>";     
echo "<tr>";
echo "<td>Use pid :</td>";
if ($tab['use_pid'])
     echo "<td><INPUT type=\"checkbox\" checked name=\"use_pid\"   value=\"1\" alt=\"Use pid instead of couple (login/passwd)\" onChange=\"change_pid();\"></td>";     
     else
	     echo "<td><INPUT type=\"checkbox\"  name=\"use_pid\"  value=\"1\" alt=\"Use pid instead of couple (login/passwd)\" onChange=\"change_pid();\"></td>";
echo "<td>Use pid password : </td>
<td ><input name=\"use_pid_passwd\" size=\"30\" value=\"".$tab['use_pid_passwd']."\"></td></tr>";

echo "<tr>";

echo "<br>

</tr>
</table>

<hr>
<big style=\"font-family: Aircut\"><span style=\"font-weight: bold;\">Hotspot value configuration</span></big><br>
<br>
<table style=\"text-align: left; height: 55px; width: 606px;\"  >
<tr>
<td >Delete expired account after : </td>
<td ><input name=\"mexpiredm\" size=\"5\" value=\"".$tab['max_month_old']."\"></td><td>months</td>

</tr><tr>
<td >Maximun cards : </td>
<td ><input name=\"maxcards\" size=\"5\" value=\"".$tab['maximun_cards']."\"></td><td>cards</td>
</tr><tr>
<td >Minimun time sold : </td>
<td ><input name=\"mintime\" size=\"5\" value=\"".$tab['minimun_time_sold']."\"></td>
<td >Maximun time sold : </td>
<td ><input name=\"maxtime\" size=\"5\" value=\"".$tab['maximun_time_sold']."\"></td>
</tr><tr>
<td >Minimun mega octets sold : </td>
<td ><input name=\"minoctets\" size=\"5\" value=\"".$tab['minimun_moctet_sold']."\"></td>
<td >Maximun mega octets sold : </td>
<td ><input name=\"maxoctets\" size=\"5\" value=\"".$tab['maximun_moctet_sold']."\"></td>
</tr>
</table>

<hr>
<big style=\"font-family: Aircut\"><span style=\"font-weight: bold;\">Some radius useful value !</span></big><br>
<br>
<table style=\"text-align: left; height: 55px; width: 606px;\"  >
<tr>
<td>Idle timeout : </td>
<td ><input name=\"idletimeout\" size=\"2\" value=\"".$tab['default_idle_timeout']."\"></td><td>minutes</td>
</tr><tr>
<td >Accounting interval : </td>
<td ><input name=\"acctinterim\" size=\"2\" value=\"".$tab['default_accounting_interval']."\"></td><td>minutes</td>
</tr><tr>
<td>Simultanous use : </td>
<td ><input name=\"simultanoususe\" size=\"2\" value=\"".$tab['default_simultanous_use']."\"></td><td></td>
</tr><tr>
<td >Logoff Url : </td>
<td ><input name=\"logoffurl\" size=\"30\" value=\"".$tab['logoff_url']."\"></td><td> 
</td>
</tr><tr>
<td >Redirection Url : </td>
<td ><input name=\"redirectionurl\" size=\"30\" value=\"".$tab['redirection_url']."\"></td><td>
</td>
</tr><tr>
<td >Reply message : </td>
<td ><input name=\"replymessage\" size=\"30\" value=\"".$tab['reply_message']."\"></td><td>
</td>
</tr><tr>
<td >Uam allowed : </td>
<td ><input name=\"uamallowed\" size=\"30\" value=\"".$tab['uam_allowed']."\"></td><td> 
</td>
</tr><tr>
<td >Mac allowed : </td>
<td ><input name=\"macallowed\" size=\"30\" value=\"".$tab['mac_allowed']."\"></td><td> 
</td>
</tr>
</table>
<hr>
<table>
<tr>
<td>
<input type=\"hidden\" name=\"buttonID\" value=\"saveconfigg\">
<input type=\"submit\" name=\"submit\" class=\"smallButton\" value=\"Save Configuration\" >
</form>
</td><td>
<form action=\"phpmyprepaid.php\" method=\"post\">
<input type=\"hidden\" name=\"buttonID\" value=\"general_config\">
<input type=\"hidden\" name=\"load_default\" value=\"general_config\">
<input name=\"submit\" type=\"submit\" class=\"smallButton\" value=\"Get default configuration\" >
</form>
</td></tr>
<tr><td><br><b><small>* : Only works with chillispot, you got to start chillispot with parameter : --coaport 3799 --coanoipcheck.</b></small> 
</td></tr>";
}
else echo $msg;
Return current item: phpMyPrepaid