Pues me han pasado una pagina en php que hay que traducir a jsp, entiendo la asignación de variables , los if , y las variables de servidor (aunque estas últimas necesito encontrar correspondecia en jsp para algunas )
Os agradecería que aunque no podais traducir todo aporteis lo que sepais. ya sea traduciendo o con explicaciones
Os pongo el código:
<?
/*************************************
***** Transaction Script Example *****
*************************************/
//Init Products
$products = Array("product1" => 29.90,"product2" => 39.90);
//Init Header
$fg_linknr = $_SERVER["HTTP_X_CONTENTID"]; //Premium Link Number
$fg_price = $_SERVER["HTTP_X_PRICE"]; //Millicents !
$fg_uid = $_SERVER["HTTP_X_USERID"]; //Empresa Customer Reference Number
$fg_transaction_id = $_SERVER["HTTP_X_TRANSACTION"]; //Transaction ID is a unique id vom Empresa
$fg_ip = $_SERVER["REMOTE_ADDR"];
$fg_uid = $_SERVER["HTTP_X_USERID"]; //Empresa Customer Reference Number
// Init Get
$my_productid = $_GET["productid"]; //Your own GET Parameter
$my_price = $_GET["price"]; //Your own GET Parameter
$my_uid = $_GET["uid"]; //Your own GET Parameter
//Check UserID
if(empty($fg_uid) || is_nan($fg_uid))
{
$result = false;
}
//Check SERVER IP
if(substr($fg_ip,0,11) != "212.22.128.")
{
$result = false;
}
//Check Firstgate Price
if(empty($fg_price) || is_nan($fg_price))
{
$result = false;
}
//Check My Price
if(($fg_price / 1000) != $my_price)
{
$result = false;
}
//Check Product-Price Matching
if($products[$my_productid] != $my_price)
{
$result = false;
}
// Reservation check, if transaction_id=0 then is it a Test purchase or the user is member in the servicearea
if($fg_transaction_id != 0){
//Create new Record in Database
$sql = "INSERT INTO transactions (uid,fg_uid,date_time,product_id,link_nr,transacti on_id) ";
$sql .= "VALUES ";
$sql .= "('$my_uid','$fg_uid','".date("Y-m-d H:i:s")."','$my_productid','$fg_linknr',$fg_transa ction_id)";
if(!$query = @mysql_query($sql,$connection))
{
//Check double reservation, by doubbel Click
$sql_d_reservation = "SELECT transaction_id FROM transactions Where transaction_id=";
$sql_d_reservation .= $fg_transaction_id ;
$count_transaktion = mysql_query(mysql_fetch_row($sql_d_reservation));
//Is the reservation booked then is result=true
//Is the reservation not booked is the result=false
if($count_transaktion != 1){
$result = false;
}
}
}
//redirect success or error
if($result)
{
header("Location: http://www.somewhere.com/directorio/thanks.php?result=success¶meters=");
}
else header("Location: http://www.somewhere.com/directorio/sorry.php?result=error¶meters=");
}
?>
Gracias