Location: PHPKode > projects > phpMyPrepaid > phpmyprepaid/www/include/account/process.php
<?php
if (!isset($oreon))
                exit();
if( isset($_POST['UserName']) and $_POST['UserName']=='') {
	$_SESSION['error']='<p class="error" >You can\'t have a blank user name.</p>';
    echo $_SESSION['error'];
    $error=-$_SESSION['error'];
    include('unset.php');
}
if ($debug) echo ' USERNAME '.$_POST['UserName'];

if( isset($_POST['UserName']) and existUser($_POST['UserName'])) {
	$_SESSION['error']='<p class="error" >You can\'t have two user with same name.</p>';
    echo $_SESSION['error'];
    $error=-$_SESSION['error'];
    include('unset.php');
}

if( isset($_POST['MacAddress'])) {
	if ($_POST['MacAddress']=='') $_SESSION['error']='<p class="error" >You can\'t have a blank mac address.</p>';
    echo $_SESSION['error'];
    $error=-$_SESSION['error'];
    include('unset.php');
}


if( isset($_POST['RadiusProfile'])) {
	$radiusprofile=$_POST['RadiusProfile'];
}

if( isset($_POST['GroupBp'])) {
	$group=$_POST['GroupBp'];
}
$_SESSION['error']=$error;
if ($error=='') {
if(isset($_POST['UserName']) and $_POST['UserName']=='' and ($buttonID == "CR_subscription_octets" or  $buttonID == "CR_subscription_time" or  $buttonID == "CR_subscription_expiration")){

 $_SESSION['error']=" You have to enter a User name to create account !";
    include('unset.php');
 echo "<script Language=\"JavaScript\"> window.location.href='".$_SERVER['HTTP_REFERER']."';</script>";
 return;
 if($buttonID == "CR_subscription_octets" )
 	$buttonID = "subscription_octets";
 if ( $buttonID == "CR_subscription_time" ) 
  	$buttonID = "subscription_time";	
 if ($buttonID == "CR_subscription_expiration")
      	$buttonID = "subscription_expiration";
 if ($buttonID == "CR_subscription_mac")
      	$buttonID = "subscription_mac";

 
}
else
{
	// if they didn't use the form, they want one card
if($buttonID=="CR_Quick" or $buttonID == "CR_subscription_octets" or  $buttonID == "CR_subscription_time" or $buttonID == "CR_subscription_expiration" or  $buttonID == "CR_subscription_mac" ){
	$number=1;
}else{
	$number=$_POST['AnzahlSeiten']; // get the number of tickets they wanted
	if(!is_numeric($number)) {include('unset.php');  die('<p class=information >Please enter a number like 6</p>'); }
	if($number > $max) {
		$num = $number;
		$number = $max;
        echo("<p class=information >You asked for $num cards but the maximum is set to $max.</p>");
        include('unset.php');
        return;
	}
}
}


if($buttonID=="CR_Timed"){
 $idBp=$_POST['zeit'];
 $min = get_plan_value($idBp);

  if($min=="") { include('unset.php'); die('<p class=information >Did you select or create a Billing Plan?</p>'); }
  if($min < $mintime) {include('unset.php'); die("<p class=information >The shortest ticket is $mintime minutes.</p>"); }
  if($min > $maxtime) {include('unset.php'); die("<p class=information >The shortest ticket is $maxtime minutes.</p>"); }
  $display=time2str($min);
}

if($buttonID=="CR_Quick"){
  $idBp=$_POST['Bp'];
  $min = get_plan_value($idBp);
  $type = get_plan_type($idBp);

  if($min=="") {include('unset.php'); die('<p class=information >Did you select or create a Billing Plan?</p>'); }
  //FIXME
  $display=time2str($min);
  
}

if($buttonID=="CR_Octets")
{
  $idBp=$_POST['zeit'];
  $moctets = get_plan_value($idBp);
  if($moctets=="") { die('<p class=information >Did you select a Mega octets limit?</p>'); }
  if($moctets < $minmoctets) { include('unset.php'); die("<p class=information >The shortest ticket is $minmoctets minutes.</p>"); }
  if($moctets > $maxmoctets) {include('unset.php'); die("<p class=information >The longest ticket is $maxmoctets minutes.</p>"); }
  $display=octets2str($moctets);
  
}

if($buttonID=="CR_subscription_time")
{
  $SessionTime=$_POST['SessionTime'];
  $idBp=$_POST['BillingPlan'];
  $min=get_conversion($SessionTime,$timeCountRes,'Time');
  if ($min=='')
    $min=get_conversion($mintime,$timeCountRes,'Time');
   $display=time2str($min);
}

if($buttonID=="CR_subscription_octets") {

  $MaxDownload=$_POST['MaxDownload'];
  $idBp=$_POST['BillingPlan'];
  $moctets=$MaxDownload; 
  print " <br>ON Y VAS OCTET COUNT ".$octetCountRes."<br>";
  $moctets=get_conversion($moctets,$octetCountRes,'Octet');
  if ($moctets=='')
    $moctets=get_conversion($moctets,$octetCountRes,'Octet');;
   $display=octets2str($moctets);
}

if($buttonID=="CR_Expiration"){
	$idBp=$_POST['zeit'];
	$exp = get_plan_value($idBp);
	$val=$exp;
 //	$display=date($dateFormat,strtotime($exp));
	$display=$exp;
if ($debug)	print ' EXPIRATION VALUE '.$exp;
}

if($buttonID=="CR_subscription_expiration")
{
 $exp=$_POST['ExpirationDate'];
 $idBp=$_POST['BillingPlan'];
 $val=$exp;
 $display=$exp;
if ($debug)	print ' EXPIRATION VALUE '.$exp;
}

if($buttonID=="CR_subscription_mac")
{
 $idBp=$_POST['BillingPlan'];
 $ID=($_POST['MacAddress']);
 $PASS=($_POST['MacAddress']);
 $val=$_POST['MacAddress'];
}
}
?>
Return current item: phpMyPrepaid