Location: PHPKode > projects > phpMyPrepaid > phpmyprepaid/www/include/billingplan/CreateBillingPlan.php
<?php 
if (!isset ($msg))
{
    $namedest = "Destination";

    $structure =array (array("name" =>"Name", "align" =>"left", "name_input" =>"UserName", "width" =>"180px"), array ("name" =>"Description","name_input" =>"Description","align" =>"left", "width" =>"140px"));

    $structure2 =array (array("name" =>"Name", "align" =>"left", "name_input" =>"UserNameSrc", "width" =>"180px"), array ("name" =>"Description","name_input" =>"DescriptionSrc","align" =>"left", "width" =>"140px"));
    echo '<script type="text/javascript">';

    // création du tableau JS ici
    echo php2js ($structure, 'structure');
    echo php2js ($structure2, 'structure2');
    echo '</script>';

    if ($buttonID == "saveaddbp")
    {

	//GENERAL

	$id = $_POST['applyaddtp'];
	$NameBp = $_POST['NameBp'];
	$timeCount=$_POST['TimeCount'];
	$TypeBp = $_POST['TypeBp'];
	if ($TypeBp=='Octets')
		$TimeBp = get_conversion($_POST['TimeBp'],$timeCount,'Octet');
	else if ($TypeBp=='Time')
		$TimeBp = get_conversion($_POST['TimeBp'],$timeCount,'Time');
	else
		$TimeBp = $_POST['TimeBp'];
	$PriceBp = $_POST['PriceBp'];
	$GroupBp = $_POST['GroupBp'];
	$PublishBp = $_POST['PublishBp'];
	$TimetofinishBp = $_POST['TimetofinishBp'];
	$SimultanousBp = $_POST['SimultanoususeBp'];
	$RedirectionurlBp = $_POST['RedirectionurlBp'];
	if (isset ($_POST['MaxtimeBp']))
	  $MaxtimeBp = $_POST['MaxtimeBp'];
	else
	  $MaxtimeBp = '';
	$CatBp = $_POST['CatBp'];
	$CurrencyBp = $_POST['CurrencyBp'];
	if (isset ($_POST['MaxoctetsBp']))
	  $MaxoctetsBp = $_POST['MaxoctetsBp'];
	else
	  $MaxoctetsBp = '';
	if (isset ($_POST['ExpirationdateBp']))
	  $ExpirationdateBp = $_POST['ExpirationdateBp'];
	else
	  $ExpirationdateBp = '';
	$BandwidthuploadBp = $_POST['BandwidthuploadBp'];
	$BandwidthdownloadBp = $_POST['BandwidthdownloadBp'];
	$LocationID = $_SESSION['locID'];

	       $q0= "INSERT INTO BillingPlan(NameBp, TimeBp,PriceBp,TypeBp,PublishBp,TimetofinishBp,SimultanousBp,RedirectionurlBp,MaximumtimeBp,MaximumoctetBp,ExpirationdateBp ,BandwidthuploadBp,BandwidthdownloadBp,CatBp,CurrencyBp,LocationID) " .
			"VALUES" .
			"('$NameBp', '$TimeBp', '$PriceBp','$TypeBp','$PublishBp','$TimetofinishBp','$SimultanousBp ','$RedirectionurlBp','$MaxtimeBp','$MaxoctetsBp','$ExpirationdateBp','$BandwidthuploadBp ','$BandwidthdownloadBp','$CatBp','$CurrencyBp','$LocationID')";
		$insert0 = $oreon->database->database->query($q0) or die("Query database error !");
	if ($debug)
	  echo $q0;

	// WE SAVE NOW THE LISTCHECKBOX
	$opt->location_id = $LocationID;
	$opt->bpradname = $NameBp;
	$opt->rp_name = $_POST['UserName'];

      $err=$oreon->database->saveUserRadiusProfile($opt,$structure);

	if ($err == '')
	  {
	    echo
	      " <p class=\"information\">Sucessfully created Billing Plan  !!</p>";
	  }
	else
	  echo "<p class=\"error\">".$err."</p>";

	unset ($_POST['saveaddbp']);
	exit ();
 }
   else
    {
	    $lid=$_SESSION['locID'];
	    if (isset($_GET['NameBp'])) $nbp=$_GET['NameBp'];
	    if (isset($_GET['ValueBp'])) $vbp=$_GET['ValueBp'];
	    if (isset($_GET['PriceBp'])) $pbp=$_GET['PriceBp'];
	    if (isset($_GET['PublishBp'])) $pbp=$_GET['PublishBp'];
	    if (isset($_GET['IdBp'])) $id=$_GET['IdBp'];
	    if (isset($_GET["typeacct"]))   $selectedaccttype=$_GET["typeacct"];
	    else $selectedaccttype='Time';
	    $timetofinish=$oreon->phpmyprepaid['default_timetofinish'];
	    $simultanous=$oreon->phpmyprepaid['default_simultanous_use'];
	    $redirectionurl=$oreon->phpmyprepaid['redirection_url'];
	    $default_currencyBp=$oreon->phpmyprepaid['default_currency'];

echo "<form action=\"phpmyprepaid.php\" id=\"selectform\" name=\"form_select\" method=\"post\" >";


	echo "<table >";

	    echo
	      '<hr><big><p class="information" >Create billing plan </p><hr></big>';

	    echo '<big style="font-family: Aircut"><span
				style="font-weight: bold; text-decoration: italic;">
				Required field :<br></span></big>
				
				
				<table  border="2">
				
				<tbody>
				
				<tr>
			
				<td class="fieldcell"><b>Name</b></td>
				
				<td class="bpcell"><input name="NameBp" id="NameBp" type="text" value="'.$nbp.'"></td>
				
				</tr>
				
				
				
				<tr>
				
				<td class="fieldcell"> <b> Default value</span></td><td class="bpcell">';
	    if ($selectedaccttype == "Expiration")
	      {
		$now = time ();
		$nextd =
		  mktime (0, 0, 0, date ("m", $now) + $maxmonth,
			  date ("d", $now), date ("Y", $now));

		echo '<input type="text"  width="180" name="TimeBp" id="TimeBp" value="'.date ($dateFormat, $nextd).'"/><button type="reset" id="f_trigger_b1">...</button>
					<script type="text/javascript">
Calendar.setup({
	inputField     :    "TimeBp",      // id of the input field
		ifFormat       :    "'.cdateformat_calendar ($dateFormat).
		  '",       // format of the input field
		showsTime      :    true,            // will display a time selector
		button         :    "f_trigger_b1",   // trigger for the calendar (button ID)
		singleClick    :    true,           // double-click mode
		step           :    1                // show all years in drop-down boxes (instead of every other year as default)
			});
</script>';
	      }
	    else  if ($selectedaccttype == "Time") {
	echo ("<table><tr><td><input type=text id='TimeBp' size=10 class=text name=\"TimeBp\" value=\"$vbp\"></td><td>");
	echo '<select name="TimeCount">';

		$tabv=split(";",$timeCount);
	   for ($i=0;$i<sizeof($tabv);$i++) {
	       if ($defaultTimeCount == $tabv[$i])
		echo ("<option selected=\"selected\" value=\"".$tabv[$i]."\">".$tabv[$i]);
	      else
		echo ("<option value=\"".$tabv[$i]."\">".$tabv[$i]);
	      echo ("</option>'");
	    }
	    echo '</select> 
			</td>';
			
	    echo '</tr></table>';
	    }
	    else  if ($selectedaccttype == "Octets") {
	            echo ("<table><tr><td><input type=text id='TimeBp' size=10 class=text name=\"TimeBp\" value=\"$vbp\"></td><td>");
	            echo '<select name="TimeCount">';

                   $tabv=split(";",$octetCount);
               for ($i=0;$i<sizeof($tabv);$i++) {
                 if ($defaultOctetCount == $tabv[$i])
                    echo ("<option selected=\"selected\" value=\"".$tabv[$i]."\">".$tabv[$i]);
                  else
                    echo ("<option value=\"".$tabv[$i]."\">".$tabv[$i]);
                  echo ("</option>'");
                }
	         echo '</select> 
		 </td>';

                echo '</tr></table>';
           }

    echo '   </td></tr>
				
				<tr>
				<td class="fieldcell"> <b> Price </span></td>
				<td class="bpcell"><input name="PriceBp" id="PriceBp" type="text" width="48"  value="'.$pbp.'">';

			echo '<select name="CurrencyBp">';

	    $tab = split (',', $currency);
	    foreach ($tab as $val)
	    {
	      if ($val == $CurrencyBp or $default_currencyBp==$CurrencyBp)
		echo ("<option selected=\"selected\" value=\"$val\">$val");
	      else
		echo ("<option  value=\"$val\">$val");
	      echo ("</option>'");
	    }
	    echo '<end select> 
			</td>';
				
				echo '</tr>';
	    echo '<script type="text/javascript">  
				function reloadbp(formulaire) {
					document.getElementById(\'TimeBp\').value="";
					document.location.href="phpmyprepaid.php?buttonID=add_tp&&typeacct="+document.getElementById(\'TypeBp\').value+"&&NameBp="+document.getElementById(\'NameBp\').value+"&&PriceBp="+document.getElementById(\'PriceBp\').value+"&&ValueBp="+document.getElementById(\'TimeBp\').value +"&&IdBp="+document.getElementById(\'applyaddtp\').value;
		}  
 </script>';

	    echo '
			<tr>
			
			<td class="fieldcell"><b> Default
			Type</td>
			
			<td class="bpcell" style="text-align: left">
			<select name="TypeBp" id="TypeBp" onChange="reloadbp(this.form)">';

	    $tab = split (',', $differentaccttype);
	    foreach ($tab as $val)
	    {
	      if ($val == $selectedaccttype)
		echo ("<option selected=\"selected\" value=\"$val\">$val");
	      else
		echo ("<option  value=\"$val\">$val");
	      echo ("</option>'");
	    }
	    echo '<end select> 
			</td>
			
			</tr>';

	    //GROUP BP

	    echo '
		<tr>
		<td class="fieldcell"><b> Group </td>
		<td class="bpcell" style="text-align: left">
		<select name="GroupBp">';

	    $result2=$oreon->database->database->query("SELECT ID,gp_name FROM group_template WHERE location_id='".$lid."'");
	    echo ("<option value='-1'>None");

	    while ($row2 =  $oreon->database->database->fetch_object($result2)) {
	       if ($row2->ID == $GroupBp)
		echo ("<option selected=\"selected\" value=\"".$row2->ID."\">".$row2->gp_name);
	      else
		echo ("<option value=\"".$row2->ID."\">".$row2->gp_name);
	      echo ("</option>'");
	    }
	    echo '<end select> 
			</td></tr>';
			

	    if ($selectedaccttype == "Time")
	      {

		echo '
				<tr>
				<td class="fieldcell"><b> Category</td>
				<td class="bpcell" style="text-align: left">
				<select name="CatBp">';
		if ($CatBp == "None")
		  echo
		    '<option selected="selected" value="None">None</option>';
		else
		  echo '<option value="None">None</option>';
		if ($CatBp == "Daily")
		  echo
		    '<option selected="selected" value="Daily">Daily</option>';
		else
		  echo '<option value="Daily">Daily</option>';
		if ($CatBp == "Weekly")
		  echo
		    '<option selected="selected" value="Weekly">Weekly</option>';
		else
		  echo '<option value="Weekly">Weekly</option>';

		if ($CatBp == "Monthly")
		  echo
		    '<option selected="selected" value="Monthly">Monthly</option>';
		else
		  echo '<option value="Monthly">Monthly</option>';
		if ($CatBp == "Yearly")
		  echo
		    '<option selected="selected" value="Yearly">Yearly</option>';
		else
		  echo '<option value="Yearly">Yearly</option>';

		echo '<end select>  
				
				</td>
				</tr>';
	      }
	    echo '<tr>
			<td class="fieldcell"><b> Publish :</td>';
	    if ($PublishBp == '1')
	      echo
		'<td class="bpcell"><input name="PublishBp" type="checkbox" value="1" checked="checked"></td>';
	    else
	      echo
		'<td class="bpcell"><input name="PublishBp" value="1" type="checkbox"></td>';
	    echo '
			</tr><tr>
			<td class="fieldcell"><b>Use time to finish</td>
			<td class="bpcell" style="text-align: left">
			<select name="TimetofinishBp">';
	    if ($timetofinish == '1')
	      echo '	<option selected="selected" value="1">Yes</option>';
	    else
	      echo '	<option  value="1">Yes</option>';
	    if ($timetofinish == '0')
	      echo '	<option selected="selected" value="0">No</option>';
	    else
	      echo '	<option  value="0">No</option>';

	    echo '
			<end select>  
			
			</td></tr>
			</tbody>
			</table>';





	    echo
	      "<br><hr><big  style=\"font-family: Aircut\"><span style=\"font-weight: bold;\"><b>Radius account profile  ".
	      $Name."</span></b></big><br>
	";


	    echo "<script type='text/javascript'>
		
function addLigneToDestination(nom,nu,bpu,rep) {
var i=0;
var str='';
var test='';
test='tr_'+nom+0;
if (rep==false) 
for( i=0; document.getElementById(test)!=null ;i++)
{
	test='tr_'+nom+i;
}

if (i>0)
	var j=i-1;
else
	var j=0;
str=document.getElementById('main_table_'+nom).innerHTML;
	 var strfinal='<tbody id=\"tr_div_'+nom+j+'\"><tr id=\"tr_'+nom+j+'\" class=\"select_even\" onMouseOver=\'javascript:setEvenement(\"'+nom+'\",\"'+j+'\",\"over\",\"select_even\",\"td\");\' onMouseOut=\'javascript:setEvenement(\"'+nom+'\",\"'+j+'\",\"out\",\"select_even\",\"td\");\'  onClick=\'javascript:setEvenement(\"'+nom+'\",\"'+j+'\",\"click\", \"select_even\",\"td\");\' ><td width=\"7\" ><input type=\"checkbox\" id=\"'+nom+j+'\" name=\"Check'+nom+'[]\" value=\"'+nu+'\" onClick=\'javascript:setEvenement(\"'+nom+'\",\"'+j+'\",\"click\",\"select_even\",\"ck\");\'  />';
 
 
	 strfinal=strfinal+'<td width=\"'+structure2[0]['width']+'\" align=\"'+structure2[0]['align']+'\"><input name=\"'+structure2[0]['name_input']+'[]\" style=\"width: 100%;\"  disabled=\"disabled\" value=\"'+nu+'\"></td><td width=\"'+structure2[1]['width']+'\" align=\"'+structure2[1]['align']+'\"><input name=\"'+structure2[1]['name_input']+'[]\" style=\"width: 100%;\" disabled=\"disabled\" value=\"'+bpu+'\"></td></tr></tbody>';
if (rep==true)	
	document.getElementById('main_table_'+nom).innerHTML=strfinal;
else
	document.getElementById('main_table_'+nom).innerHTML=str+strfinal;

}

function enableAll(form)
{
	var i=0;
	var tab=document.getElementsByName('".$structure[0]['name_input']."[]');
	for (i=0;i<tab.length;i++) {
		tab[i].disabled=false;
        }
}

function userFind(nom)
{
	var i=0;
	var tab=document.getElementsByName('".$structure[0]['name_input']."[]');
	for (i=0;i<tab.length;i++) {
		if (tab[i].value==nom) return true;
}
return false;
}

function addFromListSource(namesource,namedest) 
{
var i=0;
var j=0;
var str='';
var strdest='';
var test='';
var val_td;
test='tr_'+namedest+0;

for( i=0; document.getElementById(test)!=null ;i++)
{
	test='tr_'+namedest+i;
}

if (i>0)
	var j=i-1;
else
	var j=0;

var x=0;

strdest=document.getElementById('main_table_'+namedest).innerHTML;
for (i=0; document.getElementById(namesource + i)!=null; i++) {
	val_td=document.getElementById('tr_div_'+namesource+i).innerHTML;
		if (document.getElementById(namesource + i).checked==false)
		{
                       
			var reg=new RegExp(namesource+i, \"g\");
			var res=val_td.replace(reg,namesource+x);
			var reg2=new RegExp(',\"'+i+'\",', \"g\");
			var resf=res.replace(reg2,',\"'+x+'\",');
			str=str+'<tbody id=\"tr_div_'+namesource+x+'\">'+resf+'<tbody>';
			x=x+1;
                  }
               else
	        {
		       if (document.getElementsByName('".$structure2[0]['name_input']."'+'[]') && document.getElementsByName('".$structure2[0]['name_input']."'+'[]')[i]) 	
			       var nu=document.getElementsByName('".$structure2[0]['name_input']."'+'[]')[i].value;
		       if (userFind(nu)==true) 
			       alert('User '+nu+' already exist not added.');
		       else {
			      var reg=new RegExp(namesource, \"g\");
			      var res=val_td.replace(reg,namedest);
			      var regtmp;
			      var restmp=res;
			      for (v=0; v<structure2.length; v++) {
			        regtmp=new RegExp(structure2[v]['name_input'], \"g\");
			        restmp=restmp.replace(regtmp,structure[v]['name_input']);
                               }
			      var reg2=new RegExp(namedest+i, \"g\");
			      var res2=restmp.replace(reg2,namedest+j);
			      var reg3=new RegExp(',\"'+i+'\",', \"g\");
			      var resf=res2.replace(reg3,',\"'+j+'\",');
			      strdest=strdest+'<tbody id=\"tr_div_'+namedest+j+'\">'+resf+'<tbody>';
			      j=j+1;
                           } 

               } 
}
document.getElementById('main_table_'+namesource).innerHTML=str;
var reg2=new RegExp('<tbody></tbody>', \"g\");
var resf=document.getElementById('main_table_'+namesource).innerHTML.replace(reg2,'');
document.getElementById('main_table_'+namesource).innerHTML=resf;

document.getElementById('main_table_'+namedest).innerHTML=strdest;
var reg2=new RegExp('<tbody></tbody>', \"g\");
var resf=document.getElementById('main_table_'+namedest).innerHTML.replace(reg2,'');
document.getElementById('main_table_'+namedest).innerHTML=resf;
}
	

function findAccountGroup(nom)
{
   var text=fileXml('include/divers/findAccountRadiusProfile.php?radiusprofile='+document.getElementById('usernamegroup').value+'&&loc='+$lid);
   var root = text.getElementsByTagName('acctprofiles')[0];
   var users = root.getElementsByTagName('acctprofile');
   
   if (users.length==1) alert('Sorry, try again no result found.');
   else {
	   ul=users.length-1;
         for (var iNode = 0; iNode < ul; iNode++) {
             var item = users[iNode];
             nu=item.getElementsByTagName(\"name\")[0].firstChild.nodeValue;
	     bpu=item.getElementsByTagName(\"description\")[0].firstChild.nodeValue;
	     if (iNode==0) 
	           addLigneToDestination(nom,nu,bpu,true);
	      else
	           addLigneToDestination(nom,nu,bpu,false);

	  }
      alert(\"Successfull find radius profile(s) !\");
       }
}

function deleteFromListGroup(nom)
{
	var i=0;
	var j=0;
	var str='';
	var test='';
	var val_td;
	for (i=0; document.getElementById(nom + i)!=null; i++) {
		val_td=document.getElementById('tr_div_'+nom+i).innerHTML;
		if (document.getElementById(nom + i).checked==false)
		{
			var reg=new RegExp(nom+i, \"g\");
			var res=val_td.replace(reg,nom+j);

			var reg2=new RegExp(',\"'+i+'\",', \"g\");
			var resf=res.replace(reg2,',\"'+j+'\",');
			str=str+'<tbody id=\"tr_div_'+nom+j+'\">'+resf+'<tbody>';
			j=j+1;
                 }
}

document.getElementById('main_table_'+nom).innerHTML=str;
var reg2=new RegExp('<tbody></tbody>', \"g\");
var resf=document.getElementById('main_table_'+nom).innerHTML.replace(reg2,'');
document.getElementById('main_table_'+nom).innerHTML=resf;
}

</script>";
	    echo "<table><tr><td colspan=\"5\" rowspan=\"1\" >";

	    $result =
		    $oreon->database->database->query("SELECT rp_name,rp_description FROM radiusprofile_template,bpradiusprofile WHERE bpradiusprofile.RadiusProfileName=radiusprofile_template.rp_name AND BpName='$Name' AND radiusprofile_template.location_id='$lid' GROUP BY rp_name");
	    $i = 0;
	    while ($row = $oreon->database->database->fetch_array_result($result, MYSQL_NUM))
	      {
		$contenu[$i] =
		  array ($row[0], $row[1]);
		$i++;
	      }

	    echo '<div align="left" >';
	    echo checkedSelect ($namedest, $structure, $contenu, "disabled","_bp");
	    echo '<br />';
	    echo '</div></td><td>';
	    print
	      "<a href=\"JavaScript:deleteFromListGroup('$namedest')\"><img  src=\"images/delete.png\" title=\"Del radius profile from billing plan\"></a>";
	    echo '</td></tr></table>';

	    $nom = "Source";
	    echo ('<br><table>');
	    echo ('<tr>');
	    echo ('<td class="fieldcell" style="text-align: left">');
	    echo
	      "<input type=\"text\" width=\"17\" id=\"usernamegroup\" class=\"text\" value=\"$username\" name=\"findAccountName\">";
	    echo ('</td>');
	    echo (' <td style="height: 33px; width: 33px;">');
	    print
	      "<a href=\"JavaScript:findAccountGroup('$nom')\"><img  src=\"images/search.png\" title=\"Find account\"></a>";
	    echo "</table>";
	    echo '<br>';

	    echo "<table><tr><td colspan=\"5\" rowspan=\"1\" >";

	    $contenu2 = array ();
	    echo '<div align="left" >';
	    echo checkedSelect ($nom, $structure2, $contenu2, true, "_bp");
	    echo '<br />';
	    echo '</div></td><td>';
	    print
	      "<a href=\"JavaScript:addFromListSource('$nom','$namedest')\"><img  src=\"images/insert.png\" title=\"Add radius profile to bp\"></a>";
	    echo '</td></tr></table>';

	    echo ('<table>');

	    echo '<big style="font-family: Aircut"><span
			style="font-weight: bold; text-decoration: italic;">
			<hr>Other parameters :</span></big>';

	    echo '<table  border="2">
			
			<tbody>

			<tr>
			
			<td class="fieldcell">Simultanous use</span></td>
			<td class="bpcell"><input name="SimultanoususeBp" type="text" width="180" value="'.$simultanous.'"></td>
			
			</tr>
			
			<tr>
			<td class="fieldcell"> Redirection url </span></td>
			<td class="bpcell"><input name="RedirectionurlBp" type="text" width="180" value="'.$redirurl.'"></td>
			
			</tr>
			
			</tbody>
			</table>
			<br>
			
			
			
			<table  border="2">
			
			<tbody>
			';
	    if ($selectedaccttype != "Time")
	      echo '
				<tr>
				
				<td class="fieldcell">Maximun time</span></td>
				<td class="bpcell"><input name="MaxtimeBp" type="text" width="180" value="'.$maxtime.'"></td>
				
				</tr>';

	    if ($selectedaccttype != "Octets")
	      echo '
				
				<tr>
				<td class="fieldcell"> Maximun Mo '.$octet_type.' </span></td>
				<td class="bpcell"><input name="MaxoctetsBp" type="text" width="180" value="'.$maxoctets.'"></td>
				
				</tr>';

	    if ($selectedaccttype != "Expiration")
	      {
		$now = time ();
		$nextd =
		  mktime (0, 0, 0, date ("m", $now) + $maxmonth,
			  date ("d", $now), date ("Y", $now));
		if ($dateexp != "")
		  $dateexp2 = $dateexp;
		echo '
				
				<tr>
				<td class="fieldcell"> Expiration date </span></td>
				<td class="bpcell">';
		echo '
				<input type="text"  width="180" name="ExpirationdateBp" id="f_date_b" value="'.$dateexp2.'"/><button type="reset" id="f_trigger_b">...</button>
				';
		echo '<script type="text/javascript">
				Calendar.setup({
					inputField     :    "f_date_b",      // id of the input field
						ifFormat       :    "'.cdateformat_calendar ($dateFormat).'",       // format of the input field
						showsTime      :    true,            // will display a time selector
						button         :    "f_trigger_b",   // trigger for the calendar (button ID)
						singleClick    :    true,           // double-click mode
				step           :    1                // show all years in drop-down boxes (instead of every other year as default)
		});
</script>';


		echo '</td>';

	      }
	    echo '  </tr>';

	    echo '
			<tr>
			<td class="fieldcell" >
			Bandwidth Download Limit:
			</td>
			<td class="fieldcell">
			<select name="BandwidthdownloadBp">
			<option value="">';

	    $tab = split (',', $updownload);
	    foreach ($tab as $val)
	    {
	      if ($BandwidthdownloadBp == "$val")
		echo ("<option selected=\"selected\" value=\"$val\">$val");
	      else
		echo ("<option value=\"$val\">$val");
	    }

	    echo '
    </select>
    </td>
    
    </tr>
    <tr>
    <td class="fieldcell" >
    Bandwidth Upload Limit:
    </td>
    <td class="fieldcell" >
    <select name="BandwidthuploadBp">
    <option value="">';

	    $tab = split (',', $updownload);
	    foreach ($tab as $val)
	    {
	      if ($BandwidthuploadBp == "$val")
		echo ("<option selected=\"selected\" value=\"$val\">$val");
	      else
		echo ("<option value=\"$val\">$val");
	    }
	    echo '
		</select>
</td>

    </tr>

  </tbody>
</table>';

	    echo
	      "<br><br><input type=\"hidden\" name=\"buttonID\" value=\"saveaddbp\">";
	    echo "<input type=\"hidden\" name=\"gp_id\" value=\"$gp_id\">";
	     echo("<input type=\"hidden\" name=\"applyaddtp\" id=\"applyaddtp\" value=\"$id\">");
	    echo "<input type=\"hidden\" name=\"locationID\" value=\"$lid\">
	<input name=\"bpsave\" type=\"submit\"  class=\"smallButton\" value=\"Create billing plan\" onClick=\"enableAll(this.form);\" >

	<tr>
</form>
</table>

";
    }
	  }
	echo $msg;
?>
Return current item: phpMyPrepaid