All pastes #2129664 Raw Edit

Unnamed

public php v1 · immutable
#2129664 ·published 2012-03-18 16:20 UTC
rendered paste body
<!--	Author: Michael Lavocat		Date: 03-06-2012		File:	InternetService.php		Purpose: --><html><head>	<title>Internet Service</title>	<link rel ="stylesheet" type="text/css" href="styles.css" /></head><body><?php	$custFirst = $_POST['custFirst'];	$custLast = $_POST['custLast'];	$packageType = $_POST['packageType'];	$hoursUsed = $_POST['hoursUsed'];	$nonProfit = $_POST['nonProfit'];	$addLogEntry = $_GET['doLog'];	if($doLog == "True"){// Checks that the user has input all the required data for the logif(!isset($packageType)OR !isset($custFirst) OR !isset($custLast) OR !isset($hoursUsed)){	print("You have made an improper selection, please go back and try again.");	}else		switch($packageType){			case "optionA":				$monthlyFee = 9.95;				$hourLimit = 10;				$overLimitFee = 2.00;				break;			case "optionB":				$monthlyFee = 14.95;				$hourLimit = 20;				$overLimitFee = 1.00;				break;			case "optionC":				$monthlyFee = 19.95;				break;			}							// 	Checks hours used against the hourly limit with the selected package, if its higher the overage fee is calculated		if($hoursUsed > $hourLimit){				$additionalHours = $hoursUsed - $hourLimit;				$overHourLimitFee = $additionalHours * $overLimitFee;		}				$finalCharge = $monthlyFee + $overHourLimitFee;			//Using $nonProfit as a flag, if it's set take 20% off the final charges.		if(isset($nonProfit)){		$finalCharge = ($finalCharge * .2) - $finalCharge;		//Round the final charges up		$finalCharge = ceil($finalCharge);	}//Writes the data to the log file, in append mode.$logFile = fopen("log.txt","a");fputs($logFile, $custFirst . ":" . $custLast . ":" . $packageType . ":" . number_format($finalCharge,2) . "\n");fclose($logFile);}else// display the log, do no calculations or writing to file$logFile = fopen("log.txt","a");$log = fgets($logFile, 1000);list($custFirst, $custLast, $packageType, $finalCharge) = explode(":",$log);print("<table>	<tr>");			print("<td>" . $custFirst . "</td>");		print("<td>" . $custLast . "</td>");		print("<td>" . $finalCharge . "</td></tr>");	print("</table>");?></body></html>