Вы находитесь на странице: 1из 4

autentica.

php
<html>
<head>
<title>Control Dieta Batallon</title>
</head>
<body>
<center><h1>Broker's intranet</h1></center>
<form action="control.php" method="post">
<table align="center" width="225" cellspacing="2" cellpadding="2" border="0">
<tr>
<td colspan="2" align="center" bgcolor=#cccccc>Introduce nombre de usuario</td>
</tr>
<tr><td> </td></tr>
<tr>
<td align="right">USER: </td>
<td><input type="Text" name="user" size="14" maxlength="50"></td>
</tr>
<tr>
<td align="right">PASSWORD: </td>
<td><input type="password" name="password" size="14" maxlength="50"></td>
</tr>
<tr>
<BR>
<td colspan="2" align="center"><input type="Submit" value="Submit"></td>
</tr>
</table>
</form>
</body>
</html>

control.php
<html>
<head>
<title>Brokers OnLine</title>
</head>
<body>
<br>
<?php
$conexio = pg_connect("host=localhost port=5432 dbname=postgres password=marlon1
973
user=postgres") or die("<BR>ERROR accedint a la BD!<BR>");
$sql = "SELECT COUNT(*) FROM client WHERE nick = '".$_POST['user']."' AND
password = '".$_POST['password']."'";
$resultat_set = pg_Exec ($conexio, $sql);
$TotalRegistres = pg_result($resultat_set, 0);
pg_close($conexio);
if ($TotalRegistres == 0) {
echo "Autentication Error: ";
?> <a href="autentica.php">Back to home</a>
<?php
}
else {
header("location: captura.php");
}
?>

</body>
</html>
captura.php
<html>
<head>
<title>Control Dieta Ejercito</title>
</head>
<body>
<center><h1>Introduccion Datos</h1></center>
<form action="dietas.php" method="post">
<table align="center" width="250" cellspacing="2" cellpadding="2" border="0">
<tr>
<td colspan="2" align="center" bgcolor=#cccccc>Operation details</td>
</tr>
<tr>
<td align="right">Numero de Regimiento: </td>
<td><input type="Text" name="id" size="14" maxlength="50"></td>
</tr>
<tr>
<td align="right">Numero de Batallon: </td>
<td><input type="Text" name="id_reg" size="14" maxlength="50"></td>
</tr>
<tr>
<td align="right">Fecha: </td>
<td><input type="Text" name="fechapedido" size="14" maxlength="50"></td>
</tr>
<tr>
<td align="right">Id. Tipo de Comida: </td>
<td><input type="Text" name="tipocomida" size="14" maxlength="50"></td>
</tr>
<tr>
<td align="right">Id. Momento Comida: </td>
<td><input type="Text" name="nombremomento" size="14" maxlength="50"></td>
</tr>
<tr>
<td align="right">Numero de Soldados: </td>
<td><input type="Text" name="integrantes" size="14" maxlength="50"></td>
</tr>
</table>
</form>
</body>
</html>
dietas.php
<html>
<head>
<title>Control Dieta</title>
</head>
<body>
<br>
<?php
$conexio = pg_connect("host=localhost port=5432 dbname=postgres password=marlon1
973
user=postgres") or die("<BR>ERROR open BD!<BR>");
// Retrieve ticket id from short nom

$sql_1 = "SELECT ticket, intraDayDay, intraDayHour FROM IntraDay WHERE ticket =


(SELECT ticket FROM
valor WHERE shortName = '".$_POST['valor']."') ORDER BY intraDayDay DESC, intraD
ayHour
DESC LIMIT 1;";
$result_set_1 = pg_Exec ($conexio, $sql_1);
$numRows_1 = pg_num_rows ($result_set_1);
if ($numRows_1 == 0){
echo "Not found";
}
else {
$ticket=pg_result($result_set_1,0,0);
$data=pg_result($result_set_1,0,1);
$hora=pg_result($result_set_1,0,2);
$sql_2 = "INSERT INTO BuySell (ticket, intraDayDay, intraDayHour, idEmployee,
idBrokerCompany, idClient, phoneNumber, quantityStock, price)
VALUES ('".$ticket."', '".$data."', '".$hora."', 2, 1, ".$_POST['idcli'].",
'".$_POST['numtel']."', ".$_POST['accions'].", ".$_POST['price'].");";
$result_set_2 = pg_Exec ($conexio, $sql_2);

// Se fa la consulta de las accions comprades


$sql_3 = "SELECT intraDayDay, intraDayHour, quantityStock, price FROM BuySell WH
ERE
idClient = ".$_POST['idcli']." AND ticket = '".$ticket."';";
$result_set_3 = pg_Exec ($conexio, $sql_3);
$numRows_3 = pg_num_rows ($result_set_3);
if ($numRows_3 == 0){
echo "Client haven t share!";
}
else {
?><BR><BR>
<CENTER>
<H3>Operation history<?php ECHO $_POST['valor']; ?></H3>
<TABLE width="700" cellpadding="1" cellspacing="1" border="1"
bordercolor="#000000"><TR>
<TD><CENTER>Date</CENTER></TD>
<TD><CENTER>Hour</CENTER></TD>
<TD><CENTER>Share</CENTER></TD>
<TD><CENTER>Quantity/CENTER></TD>
<TD><CENTER>Buy price</CENTER></TD>
<TD><CENTER>Total</CENTER></TD>
<?php
// Loop to retrieve data
$import_total = 0;
$total_accions = 0;
for ($comptador=0; $comptador < $numRows_3; $comptador++) {
?><TR><?php
$quantityStock = pg_result($result_set_3, $comptador, 2);
$price = pg_result($result_set_3, $comptador, 3);
$total_linia = $quantityStock * $price;
$import_total = $import_total + $total_linia;
$total_accions = $total_accions + $quantityStock;
?>
<TD><?php ECHO pg_result($result_set_3, $comptador, 0); ?></TD>
<TD><?php ECHO pg_result($result_set_3, $comptador, 1); ?></TD>
<TD><?php ECHO $_POST['valor']; ?></TD>
<TD><?php ECHO $quantityStock; ?></TD>

<TD><?php ECHO $price; ?></TD>


<TD><?php ECHO $total_linia; ?></TD>
</TR>
<?php
}
?></TABLE>
<BR><H3>Quantity Share:</H3>
<?php echo $total_accions; ?>
<BR><H3>Total value:</H3>
<?php echo $import_total." Euros";
}
}
pg_close($conexio);
?>
<br><br>
<a href="captura.php">Back to home</a>
</body>
</html>
Las

Вам также может понравиться