[Ovillo] Closing a file (PHP)

2011-12-02 Por tema Fabricio Holguin





Saludos,



Por este medio quisiera extender un saludo a todos y desear si me pueden
 ayudar con un ejemplo que he trabajado por algunas semanas y no me da 
el resultado deseado.  Talves alguien tenga un poco mas de conocimiento.
 La compañia es un taller de autos.  Gracias por antemano.



El código es el siguiente:





html



head



titleRoberto's Auto Parts - Order Results/title



/head



body



h1Roberto's Auto Parts/h1



h2Order Results/h2



?php 



echo pOrder processed at .date('H:i, jS F Y')./p; 



echo pYour order is as follows: /p;



$totalqty = 0;

$totalqty = $tireqty + $oilqty + $sparkqty; 



echo Items ordered: .$totalqty.br /; 



if ($totalqty == 0) {



   echo You did not order anything on the previous page!br /;



} else {



if ($tireqty  0) {

   echo $tireqty. tiresbr /;

}



if ($oilqty  0) {

   echo $oilqty. bottles of oilbr /;

}



if ($sparkqty  0) {

   echo $sparkqty. spark plugsbr /;

}



}





$totalamount = 0.00;  



define('TIREPRICE', 100);

define('OILPRICE', 10);

define('SPARKPRICE', 4);



$totalamount = $tireqty * TIREPRICE 

 + $oilqty * OILPRICE 

 + $sparkqty * SPARKPRICE;  



$totalamount=number_format($totalamount, 2, '.', '');



echo pTotal of order is $.$totalamount./p;

echo pAddress to ship to is .$address./p;



$outputstring = $date.\t.$tireqty. tires \t.$oilqty. oil\t

.$sparkqty. spark plugs\t\$.$totalamount

.\t. $address.\n; (posible error talves!)



//open file for appending

@ $fp = fopen($DOCUMENT_ROOT/../orders/orders.txt, 'ab');



flock($fp, LOCK_EX);



if (!$fp) {

echo pstrong Your order could not be processed at this time.

 Please try again later./strong/p/body/html;

exit;

}



fwrite($fp, $outputstring, strlen($outputstring));

flock($fp, LOCK_UN);

fclose($fp);



echo pOrder written./p;  



?

/body



/html


Thanks, 
Fabricio
http://hlgns.net/
http://hlgn.net/
 
Remote Support
http://hlgn.showmypc.com/ 
 




  
___
Lista de distribución Ovillo
Para escribir a la lista, envia un correo a Ovillo@lists.ovillo.org
Puedes modificar tus datos o desuscribirte en la siguiente dirección: 
http://lists.ovillo.org/mailman/listinfo/ovillo


Re: [Ovillo] Closing a file (PHP)

2011-12-02 Por tema MIguel Flores Franco
Hola!
y ¿que es lo que deseas, una crítica o qué?
no indicas que ayuda requieres, especifica mejor-

Miguel

Miguel Flores Franco
Graphic Design  Standard based Web Design
http://pe.linkedin.com/in/mikersson
http://www.pixelperu.net
Phone +51 991 592 446 (Perú) • +48 28141587 (Denmark)


-Mensaje original-
De: ovillo-boun...@lists.ovillo.org [mailto:ovillo-boun...@lists.ovillo.org]
En nombre de Fabricio Holguin
Enviado el: viernes, 02 de diciembre de 2011 06:29 p.m.
Para: ovillo@lists.ovillo.org
Asunto: [Ovillo] Closing a file (PHP)






Saludos,



Por este medio quisiera extender un saludo a todos y desear si me pueden
ayudar con un ejemplo que he trabajado por algunas semanas y no me da el
resultado deseado.  Talves alguien tenga un poco mas de conocimiento.
 La compañia es un taller de autos.  Gracias por antemano.



El código es el siguiente:





html



head



titleRoberto's Auto Parts - Order Results/title



/head



body



h1Roberto's Auto Parts/h1



h2Order Results/h2



?php 



echo pOrder processed at .date('H:i, jS F Y')./p; 



echo pYour order is as follows: /p;



$totalqty = 0;

$totalqty = $tireqty + $oilqty + $sparkqty; 



echo Items ordered: .$totalqty.br /; 



if ($totalqty == 0) {



   echo You did not order anything on the previous page!br /;



} else {



if ($tireqty  0) {

   echo $tireqty. tiresbr /;

}



if ($oilqty  0) {

   echo $oilqty. bottles of oilbr /;

}



if ($sparkqty  0) {

   echo $sparkqty. spark plugsbr /;

}



}





$totalamount = 0.00;  



define('TIREPRICE', 100);

define('OILPRICE', 10);

define('SPARKPRICE', 4);



$totalamount = $tireqty * TIREPRICE 

 + $oilqty * OILPRICE 

 + $sparkqty * SPARKPRICE;  



$totalamount=number_format($totalamount, 2, '.', '');



echo pTotal of order is $.$totalamount./p;

echo pAddress to ship to is .$address./p;



$outputstring = $date.\t.$tireqty. tires \t.$oilqty. oil\t

.$sparkqty. spark plugs\t\$.$totalamount

.\t. $address.\n; (posible error talves!)



//open file for appending

@ $fp = fopen($DOCUMENT_ROOT/../orders/orders.txt, 'ab');



flock($fp, LOCK_EX);



if (!$fp) {

echo pstrong Your order could not be processed at this time.

 Please try again later./strong/p BRBR__ Information
from ESET Smart Security, version of virus signature database 6679
(20111202) __BRBRThe message was checked by ESET Smart
Security.BRBRA HREF=http://www.eset.com;http://www.eset.com/ABR
BRBR__ Information from ESET Smart Security, version of virus
signature database 6679 (20111202) __BRBRThe message was checked
by ESET Smart Security.BRBRA
HREF=http://www.eset.com;http://www.eset.com/ABR /body/html;

exit;

}



fwrite($fp, $outputstring, strlen($outputstring));

flock($fp, LOCK_UN);

fclose($fp);



echo pOrder written./p;  



?

/body



/html


Thanks, 
Fabricio
http://hlgns.net/
http://hlgn.net/
 
Remote Support
http://hlgn.showmypc.com/ 
 




  
___
Lista de distribución Ovillo
Para escribir a la lista, envia un correo a Ovillo@lists.ovillo.org
Puedes modificar tus datos o desuscribirte en la siguiente dirección:
http://lists.ovillo.org/mailman/listinfo/ovillo

___
Lista de distribución Ovillo
Para escribir a la lista, envia un correo a Ovillo@lists.ovillo.org
Puedes modificar tus datos o desuscribirte en la siguiente dirección: 
http://lists.ovillo.org/mailman/listinfo/ovillo