All pastes #911698 Raw Edit

Stuff

public text v1 · immutable
·published 2008-02-20 21:30 UTC
rendered paste body
#!/usr/bin/php -q
<?php
require('phpagi.php');

function connect_db() { 
$db_connection = mysql_connect ('localhost', '', '') or die (mysql_error()); 
$db_select = mysql_select_db('billing') or die (mysql_error()); 
} 
$agi = new AGI();
$agi->answer();
 

                $answeredtime = $agi->get_variable("ANSWEREDTIME");

                $g  = $answeredtime;
                $h  = $agi->get_variable("clientfirst");
                $i  = $agi->get_variable("clientsecond");
                $j  = $agi->get_variable("clientrate");
		$k  = $agi->get_variable("credit");
 
                   $seconds = $g['data'];
		   $first   = $h['data'];
		   $second  = $i['data'];
		   $credit  = $k['data'];
		   $cost    = $j['data'];


		        $A = bcsub( $seconds, $first );
                        $B = bcdiv($A, $second, 4);
                        $C = ceil( $B );
                        $D = bcmul( $C, $second, 4 );
                        $E = bcadd( $D, $first );
                        $F = bcdiv( $cost, 60, 10);
                        $total = bcmul( $F, $E, 4 );

	                $deduct = bcsub($credit, $total, 4);
$agi->verbose($cost);
connect_db();
$query1 = "update cardcustomer set credit='$deduct' where phone='$incoming_number' ";
$query_result1 = @mysql_query($query1);

 ?>