<?php
	include("../session.php");
	include("../connect.php");
	$user=$_SESSION['company'];
	$pQuery=mysql_query("select * from price order by id desc");
	$displayP=mysql_fetch_array($pQuery);
	$price=$displayP['price'];
	
$checkurl = 'www.finance.yahoo.com';

if(@fsockopen($checkurl,80)){	
$from = 'MYR';
$to = 'SGD';
$url = 'http://finance.yahoo.com/d/quotes.csv?f=l1d1t1&s='.$from.$to.'=X';

$handle = fopen($url, 'r');

 
if ($handle) {
    $result = fgetcsv($handle);
    fclose($handle);
}



	
	$priceA = $price * 1 *$result[0];
		$priceB = $price * 2 *$result[0];
			$priceC = $price * 3*$result[0];
	$priceA1 = round($priceA, 2);
	$priceB1 = round($priceB, 2);
	$priceC1 = round($priceC, 2);	


	
?>
<html>
<head>
<title>User Page(Company profile)</title>
<link href="header.css" rel="stylesheet" type="text/css"/>
<link rel="stylesheet" type="text/css" href="facebox/facebox.css" />
<script language="javascript" src="jquery.js"></script>
<script language="javascript" src="facebox/facebox.js"></script>


</head>
<body>
<div id="content2">
<!-----------------Outer table--------------->
<table width=1000 border=0 cellspacing=10 cellpadding=3 >
<tr>
	<td colspan=2 >
	<?php include("../head.php");?>
	</td>
	</tr>
<tr>
	<td colspan=2>
	<div class=main>&nbsp;&nbsp;>>
			<a href="<?php echo"company.php";?>">&nbsp;Home&nbsp;</a>>>
			&nbsp;Update License&nbsp;
			</div></td>
	</tr>
<tr>
	<td valign=top colspan=2>
	<!--------------------Inner table 2----------------------->
<font color="red">
<?php echo '1 '.$from.' is worth '.$result[0].' '.$to.' Based on data on '.$result[1].' '.$result[2]. ' EDT';?>
</font>
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
<input type='hidden' name='custom' value='<?php echo"$user"?>'>
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="wai_1330158011_biz@gmail.com">
<input type="hidden" name="lc" value="US">
<input type="hidden" name="item_name" value="License">
<input type="hidden" name="button_subtype" value="services">
<input type="hidden" name="no_note" value="0">
<input type="hidden" name="currency_code" value="SGD">
<input type="hidden" name="return" value="http://www.wauhaha.com/smart/company/company.php">
<input type="hidden" name="cancel_return" value="http://www.wauhaha.com/smart/company/company.php">
<input name='notify_url' value='http://www.wauhaha.com/smart/company/updatepaypal.php' type='hidden'>
<input type="hidden" name="bn" value="PP-BuyNowBF:btn_buynowCC_LG.gif:NonHostedGuest">
<table>
<tr><td><input type="hidden" name="on0" value="Update License List">Update License List</td></tr><tr><td><select name="os0">
	<option value="Update License(1 YRS)">Update License(1 YRS) $<?php echo $priceA1?> SGD</option>
	<option value="Update License(2 YRS)">Update License(2 YRS) $<?php echo $priceB1?> SGD</option>
	<option value="Update License(3 YRS)">Update License(3 YRS) $<?php echo $priceC1?> SGD</option>
</select> </td></tr>
</table>
<input type="hidden" name="currency_code" value="SGD">
<input type="hidden" name="option_select0" value="Update License(1 YRS)">
<input type="hidden" name="option_amount0" value="<?php echo $priceA1?>">
<input type="hidden" name="option_select1" value="Update License(2 YRS)">
<input type="hidden" name="option_amount1" value="<?php echo $priceB1?>">
<input type="hidden" name="option_select2" value="Update License(3 YRS)">
<input type="hidden" name="option_amount2" value="<?php echo $priceC1?>">
<input type="hidden" name="option_index" value="0">
<input type="image" src="image/btn_buynow.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.sandbox.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>

	<!----------------------End inner table 2-------------------->
	
	</td>
	</tr>
</table>
<!-----------------------End outer table-------------------------->
</div>

<?php 
}
else{
echo "<script language=javascript>alert('Internet Connection Error, Please Try Again');window.location='company.php';</script>";
die();
}
?>
<?php 
include("../closeconnection.php");
?>

</body>
</html>