<?php
//////////////////////////////////////////////////////////
// INSERT PAYMENTS TAB //
// This opens the new tab within the list of users //
// where you can add payments to each user's account. //
// It resides within a table that is 15 columns //
// wide. ` //
// C. Carl Peterson 2005 //
// Modified to act as a popup when moved to v2 //
//////////////////////////////////////////////////////////
//
// Include styles for nested monthly payment table with tabs.
//
#session_name("phpmyprepaid");
include_once('../../config.inc.php');
if (!isset($_SESSION['oreon'])) Session::Start();
$oreon=$_SESSION['oreon'];
if (check_access($oreon,'1')) {
include_once ("../configuration/".$_SESSION['gatewayType'].".attr");
include_once('../../head.usertab.inc');
$dateFormat=$oreon->phpmyprepaid['display_date_format'];
$octet_type=$oreon->phpmyprepaid['octet_type'];
$crypt=$oreon->phpmyprepaid['crypt'];
$radius=$oreon->database->getradiusconfiguration($_SESSION['locID']);
$radius_server=$radius['radius_server'];
$radiussecret=$radius['radius_server_secret'];
$radius_server_port=$radius['radius_server_port'];
if ($debug) echo " DATE FORMAT ".$dateFormat;
if ($debug) echo " RADIUS SERVER ".$radius_server;
include('pullUser.php');
echo '<body><div>';
//////////////////////////////////////////////////////////
// Set a tab var //
//////////////////////////////////////////////////////////
if(isset($_POST['tab'])) {
if(($_POST['tab']) == "a") { $tb = "a"; }
if(($_POST['tab']) == "b") { $tb = "b"; }
if(($_POST['tab']) == "c") { $tb = "c"; }
if(($_POST['tab']) == "d") { $tb = "d"; }
if(($_POST['tab']) == "e") { $tb = "e"; }
if(($_POST['tab']) == "f") { $tb = "f"; }
}else{ $tb = "a"; }
//////////////////////////////////////////////////////////
// PASS THROUGH ID VAR //
//////////////////////////////////////////////////////////
if(isset($_GET['id2'])) { $id3 = ($_GET['id2']); } // if they clicked a date tab the second time.
if (isset($_POST['id']))
if(!isset($id3)) { $id3 = ($_POST['id']); } // if they clicked a tab the first time.
//////////////////////////////////////////////////////////
// echo($tb);
if (isset($_POST['buttonID']))
$buttonID = $_POST['buttonID'];
else
$buttonID = "";
if ($buttonID=="delete_user")
{
echo delete_user($pullUser);
echo '<script language="JavaScript">window.opener.location.reload();self.close();</script>';
}
if ($buttonID=="delete_user_acct")
{
echo delete_user_acct($pullUser);
echo '<script language="JavaScript">window.opener.location.reload();;alert("Successfull delete user accounting. !");</script>';
}
if ($buttonID=="modify_user")
{
$timeCount=$_POST['TimeCount'];
$pass = $_POST['pm'];
if ($Type=="Hourly" or $Type=="Subscription Time") {
$maxs = $_POST['maxas'];
$maxs=get_conversion($maxs,$timeCount,'Time');
$attr=$sessionTimeAttr;
$db=$sessionTimeAttrdb;
}
if ($Type=="Subscription Mac") {
$maxs = $_POST['maxas'];
$attr=$macAuthAttr;
$db=$macAuthAttrdb;
}
else if ($Type=="Octets" or $Type=="Subscription Octets")
{
$tab= get_octet_type_attr($octet_type);
$attr = $tab[0];
$db= $tab[1];
$maxs = $_POST['maxas'];
$maxs=get_conversion($maxs,$timeCount,'Octet');
}
else if ($Type=="Subscription Expiration" or $Type=="Expiration")
{
$attr=$expirationWisprAttr;
$db=$expirationWisprAttrdb;
$maxs = $_POST['maxas'];
if (!check_date(split(' ',$maxs)))
{
echo '<p class="error">Date format invalid !!!!!</p>';
unset($buttonID);
return;
}
}
$idBp=$_POST['BillingPlan'];
if (isset($_POST['edate']) and $_POST['edate']!='') {
updateExpirationDate($pullUser,date_to_attribute($_POST['edate'],"freeradius"));
$edate=date_to_attribute($_POST['edate'],"freeradius");
}
updateGroup($pullUser,$_POST['GroupName']);
$tab['WorkPhone']=$workphone=$_POST['workphone'];
$tab['HomePhone']=$homephone=$_POST['homephone'];
$tab['Mobile']=$mobile=$_POST['mobile'];
$tab['Mail']=$mail=$_POST['mail'];
$tab['cid']=$cid=$_POST['cid'];
$tab['Note']=$note=$_POST['note'];
$tab['LastName']=$lastname=$_POST['lastname'];
$tab['FirstName']=$firstname=$_POST['firstname'];
$tab['Department']=$department=$_POST['department'];
$tab['Country']=$country=$_POST['country'];
$tab['ZipCode']=$zipcode=$_POST['zipcode'];
$tab['Address']=$address=$_POST['address'];
$tab['City']=$city=$_POST['city'];
modify_user($pullUser,$pass,$maxs,$idBp,$attr,$Type,$_SESSION['gatewayType'],$db,$tab,$crypt);
echo '<script language="JavaScript">window.opener.location.reload();alert("Successfull modify user. !");</script>';
$password=$pass;
$Max=$maxs;
$BillingPlan=$idBp;
unset($_POST['buttonID']);
//echo "<script Language=\"JavaScript\"> window.parent.location.reload();</script>";
}
echo('<table class="tabTable" cellspacing="0">');
//echo('<form action="phpmyprepaid.php method="post">');
echo('<tr >');
//////////////////////////////////////////////
// USERNAME/ID TAB a //
//////////////////////////////////////////////
if (isset($_POST['id']))
{
if(!isset($id3)) { $id3 = ($_POST['id']); } // if they clicked a tab the first time.
}
else
if(!isset($id3)) { $id3 = "";}
if($tb == "a")
{
echo('<td class="Active" id="User">');
}else{
echo ('<td class="Inactive" id="User">');
}
echo '<form method="post">
<div><input type="hidden" name="tab" value="a"></div>
<div><input type="hidden" name="phpmyprepaid" value="'.session_id().'"></div>
<div><input type="hidden" name="ID" value="'.$pullUser.'"></div>
<table border="0" cellpadding="0" cellspacing="0">
<tr>';
if($tb == "a")
echo '<td class="bla">';
else
echo '<td class="bli">';
echo '<img class="image" src="../../images/modification.png" ALT="Modification">
</td>';
if($tb == "a")
echo '<td class="bla">';
else
echo '<td class="bli">';
echo '<input type="submit" class="tabButton" name="submit" value="'."$firstname $lastname".'">
</td></tr></table>
</form>';
echo("</td>");
// TAB a td2
if($tb == "a") { echo ('<td class="Active" id="UserID" > ');
}else{
echo('<td class="Inactive" id="UserID" > ');
}
echo("User Modification");
echo("</td>");
// if(isset($_GET['id2'])) { $id3 = ($_GET['id2']); } // if they clicked a date tab the second time.
// if(!isset($id3)) { $id3 = ($_POST['id']); } // if they clicked a tab the first time.
//////////////////////////////////////////////
// Layout the date tabs //
//////////////////////////////////////////////
if($tb == "b") { echo('<td bgcolor="#666699" class="Active">'); } // <-- date1 jan
else{ echo('<td bgcolor="#666699" class="Inactive">'); }
echo '<form action="../divers/sexyTabs.php" method="post">
<div><input type="hidden" name="tab" value="b"></div>
<div><input type="hidden" name="phpmyprepaid" value="'.session_id().'"></div>
<div><input type="hidden" name="ID" value="'.$pullUser.'"></div>
<table class="tabButton" border="0" cellpadding="0" cellspacing="0">
<tr >';
if($tb == "b")
echo '<td class="bla">';
else
echo '<td class="bli">';
echo '<img src="../../images/billing.png" ALT="Billing">
</td>';
if($tb == "b")
echo '<td class="bla">';
else
echo '<td class="bli">';
echo ' <input type="submit" class="tabButton" name="submit" value="Billing user">';
echo '</td></tr></table>
</form>';
echo("</td>");
// C TAB
if($tb == "c") { echo('<td bgcolor="#666699" class="Active">'); } // <-- date1 jan
else{
echo('<td bgcolor="#666699" class="Inactive">');
}
echo '<form action="../divers/sexyTabs.php" method="post">
<div><input type="hidden" name="tab" value="c"></div>
<div><input type="hidden" name="phpmyprepaid" value="'.session_id().'"></div>
<div><input type="hidden" name="ID" value="'.$pullUser.'"></div>
<table border="0" cellpadding="0" cellspacing="0">
<tr>';
if($tb == "c")
echo '<td class="bla">';
else
echo '<td class="bli">';
echo '<img src="../../images/information.png" ALT="Inforamtion" >
</td>';
if($tb == "c")
echo '<td class="bla">';
else
echo '<td class="bli">';
echo' <input type="submit" class="tabButton" name="submit" value="Information">
</td></tr></table>
</form>';
echo("</td>");
// D TAB
if($tb == "d") { echo('<td bgcolor="#666699" class="Active">'); } // <-- date1 jan
else{
echo('<td bgcolor="#666699" class="Inactive">');
}
echo '<form action="../divers/sexyTabs.php" method="post">
<div><input type="hidden" name="tab" value="d"></div>
<div><input type="hidden" name="phpmyprepaid" value="'.session_id().'"></div>
<div><input type="hidden" name="ID" value="'.$pullUser.'"></div>
<table border="0" cellpadding="0" cellspacing="0">
<tr>';
if($tb == "d")
echo '<td class="bla">';
else
echo '<td class="bli">';
echo '<img src="../../images/debug.png" ALT="Debug" >
</td>';
if($tb == "d")
echo '<td class="bla">';
else
echo '<td class="bli">';
echo '<input type="submit" class="tabButton" name="submit" value="Test and disconnect">
</td></tr></table>
</form>';
echo("</td>");
//////////////////////////////////////////////
//TAB E
/////////////////////////////////////////////
//
if($tb == "e") { echo('<td bgcolor="#666699" class="Active">'); } // <-- date1 jan
else{
echo('<td bgcolor="#666699" class="Inactive">');
}
echo '<form action="../divers/sexyTabs.php" method="post">
<div><input type="hidden" name="tab" value="e"></div>
<div><input type="hidden" name="phpmyprepaid" value="'.session_id().'"></div>
<div><input type="hidden" name="ID" value="'.$pullUser.'"></div>
<table border="0" cellpadding="0" cellspacing="0">
<tr>';
if($tb == "e")
echo '<td class="bla">';
else
echo '<td class="bli">';
echo '<img src="../../images/badusers.png" ALT="Badusers" >
</td>';
if($tb == "e")
echo '<td class="bla">';
else
echo '<td class="bli">';
echo '<input type="submit" class="tabButton" name="submit" value="Baduser">
</td></tr></table>
</form>';
echo("</td>");
echo("</tr>");
//////////////////////////////////////
// END of TABS //
//////////////////////////////////////
//////////////////////////////////////
// Start Content //
//////////////////////////////////////
echo('<tr bgcolor="#666699" >');
echo ('<td bgcolor="#666699" colspan="6" class="bl">');
if (file_exists("../tabs/".$tb.".php")) { include("../tabs/".$tb.".php");
}else {
echo("<b><center>Error 404<br><br>That link is not yet functional</center></b>");
}
echo('</td>');
echo("</tr>");
// printf('</form>');
echo("</table>");
echo("</td>");
include('../../footer.php');
}
?>