[PHP] Re: fread problem

2006-01-03 Thread Mario de Frutos Dieguez
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Yes, sorry i forget send some example code. Here is:


$xml_parser = xml_parser_create();
// usa case-folding para que estemos seguros de encontrar la etiqueta
// en $map_array
xml_parser_set_option($xml_parser, XML_OPTION_CASE_FOLDING, true);
xml_set_element_handler($xml_parser, startElement, endElement);
xml_set_character_data_handler($xml_parser, characterData);
if (!($fp = fopen($file, rb))) {
   die(could not open XML input);
}

while ($data = fread($fp, 12288)) {
   if (!xml_parse($xml_parser, $data, feof($fp))) {
   die(sprintf(XML error: %s at line %d,
   xml_error_string(xml_get_error_code($xml_parser)),
   xml_get_current_line_number($xml_parser)));
   }
}   

If i put fread($fp, 8192) i obtain the same text and if a put 4096 it
cut before.
- --
**
FUNDACIÓN CARTIF

  MARIO DE FRUTOS DIEGUEZ - Email: [EMAIL PROTECTED]
 División de Ingeniería del Software y Comunicaciones

   Parque Tecnológico de Boecillo, Parcela 205
   47151 - Boecillo (Valladolid) España
  Tel.   (34) 983.54.88.21 Fax(34) 983.54.65.21
**
Este mensaje se dirige exclusivamente a su destinatario y puede contener
información CONFIDENCIAL sometida a secreto profesional o cuya
divulgación esté prohibida en virtud de la legislación vigente. Si ha
recibido este mensaje por error, le rogamos que nos lo comunique
inmediatamente por esta misma vía y proceda a su destrucción.

Nótese que el correo electrónico via Internet no permite asegurar ni la
confidencialidad de los mensajes que se transmiten ni la correcta
recepción de los mismos. En el caso de que el destinatario de este
mensaje no consintiera la utilización del correo electrónico vía
Internet, rogamos lo ponga en nuestro conocimiento de manera inmediata.
***
This message is intended exclusively for its addressee and may contain
information that is CONFIDENTIAL and protected by a professional
privilege or whose disclosure is prohibited by law. If this message has
been received in error, please immediately notify us via e-mail and
delete it.

Please note that Internet e-mail neither guarantees the confidentiality
nor the proper receipt of the messages sent. If the addressee of this
message does not consent to the use of Internet e-mail, please
communicate it to us immediately.

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFDunbvbPPtxT8v/3wRAjBwAJ4kHE0cdyrvruFE3LlSGXMKFri5fwCfU7ii
machwamViid/Hr8lXPrv8e8=
=xyJI
-END PGP SIGNATURE-

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] fread problem

2006-01-02 Thread Mario de Frutos Dieguez
Hi!

I have a problem using fread with a XML document. When i read some nodes
with a great amount of text it cuts in the same place of the text. There
are any limitation of text or something? I have in the php.ini the amount
of memory in 256M.

Thanks in advance

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Dates problem

2005-04-27 Thread Mario de Frutos Dieguez
Hi!
I have a problem with dates. I have a function that sum a duration in 
laboral days to an initial date. The problem come when the function 
reaches the last sunday of October, the data remains in the last sunday 
of October and make an infinite loop. The functions works fine i have 
test in all the cases and only fails in the last sunday of October.

Can anyone help me?
Thanks in advance.
PD: Jochem home english is bad english :P
--
Mario de Frutos Dieguez
División de Ingeniería del Software
y Comunicaciones  

CARTIF -Parque Tecnológico Boecillo
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Dates problem

2005-04-27 Thread Mario de Frutos Dieguez
Petar Nedyalkov escribió:
On Wednesday 27 April 2005 09:17, Mario de Frutos Dieguez wrote:
 

Hi!
I have a problem with dates. I have a function that sum a duration in
laboral days to an initial date. The problem come when the function
reaches the last sunday of October, the data remains in the last sunday
of October and make an infinite loop. The functions works fine i have
test in all the cases and only fails in the last sunday of October.
   

So, let's see the function.
 

Can anyone help me?
Thanks in advance.
PD: Jochem home english is bad english :P
--
Mario de Frutos Dieguez
División de Ingeniería del Software
y Comunicaciones
CARTIF -Parque Tecnológico Boecillo
   

 

function aCalculaFechas($oSqlBDGestion,$fecFechaIniProyecto,$iDuracion)
   {
   $iCont=0;
  
   //Descomponemos los argumentos y pasamos las fechas a 
formato Y/m/d
   $aFecIniTemp=split(/,$fecFechaIniProyecto);
   
$fecFechaInicio=date(Y/m/d,mktime(0,0,0,$aFecIniTemp[1],$aFecIniTemp[0],$aFecIniTemp[2]));
  
   if ($iDuracion0)
   {
   //Generamos una fecha temporal sobre la que haremos los 
cálculos
   $fecFechaFinTemp=$fecFechaInicio;
  
   //Sumamos uno a la fecha para iniciar la cuenta de la 
duración un día despues de la fecha de inicio
   $fecFechaFinTemp=$this-SumarFechas($fecFechaFinTemp,1);
  
   //Ejecutamos un bucle que irá calculando la duración 
total (incluyendo sabados y domingos) a partir de la duración
   //laboral
   while ($iCont($iDuracion))
   {
   //Obtenemos el día de la semana del día que estamos 
mirando  
   $aFecTempCalculo=split('/',$fecFechaFinTemp);
   
$iDiaSemanaTemp=date(w,mktime(0,0,0,$aFecTempCalculo[1],$aFecTempCalculo[2],$aFecTempCalculo[0]));
   //Si el día es distinto de domingo o sabado 
aumentamos el contador de duración laboral
   if ($iDiaSemanaTemp!=6  $iDiaSemanaTemp!=0)
   {
   $iCont++;
   }
   //Se añade uno más a la fecha
   $fecFechaFinTemp=$this-SumarFechas($fecFechaFinTemp,1);
   //Siempre se añade uno al número de días totales.
   $iNumDiasTotales++;
   //echo $iNumDiasTotales.'br';
   }
  
   //Sumamos al a fecha temporal el número de dias totales 
(solo incluidos sabados y domingos)
   
$fecFechaFinTemp=$this-SumarFechas($fecFechaInicio,$iNumDiasTotales);
  
   //Hacemos un bucle obteniendo los días festivos usando 
la fecha final temporal y hasta que no se obtengan dias
   //festivos sigue sumandolos.
   do
   {
   //echo SELECT * FROM festivos WHERE dia_festivo 
BETWEEN '.$fecFechaInicio.' AND '.$fecFechaFinTemp.';
   //Obtenemos los dias festivos entre el rango de fechas
   
$iObtenDiasFest=$oSqlBDGestion-iEjecutarConsulta(SELECT * FROM 
festivos WHERE dia_festivo BETWEEN '.$fecFechaInicio.' AND 
'.$fecFechaFinTemp.');
  
   
$iNumDiasFestivos=$oSqlBDGestion-iNumeroFilasResultadoConsulta($iObtenDiasFest);
  
   $fecFechaInicio=$this-SumarFechas($fecFechaFinTemp,1);
   
$fecFechaFinTemp=$this-SumarFechas($fecFechaFinTemp,$iNumDiasFestivos);
  
   }while ($iNumDiasFestivos0);
  
   $aFecTempCalculo=split('/',$fecFechaFinTemp);
   
$iDiaSemanaTemp=date(w,mktime(0,0,0,$aFecTempCalculo[1],$aFecTempCalculo[2],$aFecTempCalculo[0]));
   if ($iDiaSemanaTemp==6)
   $fecFechaFin=$this-SumarFechas($fecFechaFinTemp,3);
   else if ($iDiaSemanaTemp==0)
   $fecFechaFin=$this-SumarFechas($fecFechaFinTemp,2);
   else
   $fecFechaFin=$fecFechaFinTemp;
   $aFecFin=split(/,$fecFechaFin);
   
$fecFechaFin=date(d/m/Y,mktime(0,0,0,$aFecFin[1],$aFecFin[2],$aFecFin[0]));
   }
   else
   $fecFechaFin=$fecFechaIniProyecto;

  
   return $fecFechaFin;
   }

--
Mario de Frutos Dieguez
División de Ingeniería del Software
y Comunicaciones  

CARTIF -Parque Tecnológico Boecillo
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Line feed in a echo

2005-04-26 Thread Mario de Frutos Dieguez
How can i make a line feed in a echo instruction? like printf(foo\n);
--
Mario de Frutos Dieguez
División de Ingeniería del Software
y Comunicaciones  

CARTIF -Parque Tecnológico Boecillo
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Line feed in a echo

2005-04-26 Thread Mario de Frutos Dieguez
Andri Heryandi escribió:
Use echo something br;
is that what you mean?
Mario de Frutos Dieguez wrote:
How can i make a line feed in a echo instruction? like printf(foo\n);

yes that's it thx
--
Mario de Frutos Dieguez
División de Ingeniería del Software
y Comunicaciones  

CARTIF -Parque Tecnológico Boecillo
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] strtotime() lost precision?

2005-04-26 Thread Mario de Frutos Dieguez
Hi!
I'm back hahaha :D
I'm making functions to calculate the duration (only laboral days) 
between 2 dates and the initial and final date between a duration give 
me in laboral days.

I use the following function to make the diference between 2 dates:
function fecDiferenciaFechas($fecFechaInicio,$fecFechaFin)
   {
   $fecFechaInicio=strtotime($fecFechaInicio);
   $fecFechaFin=strtotime($fecFechaFin);
  
   if ($fecFechaFin == -1 || $fecFechaInicio == -1)
   {
   return false;
   }
  
   $iDiferencia = $fecFechaFin - $fecFechaInicio;
  
   //Inicializamos la variable
   $iDias = 0;
  
   //Devolvemos la diferencia en dias
   return ($iDiferencia/86400);
   }

The problem is that with a duration of 220 the return is 219.958333, 
where im losing precision?

(Sorry for my home english :P)
--
Mario de Frutos Dieguez
División de Ingeniería del Software
y Comunicaciones  

CARTIF -Parque Tecnológico Boecillo
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] .htaccess

2005-04-19 Thread Mario de Frutos Dieguez
pete M escribió:
I'm trying to figure out out to put a directive in .htaccess to make 
the session timeout in 4 hours ..

tried
php_flag session.cookie_lifetime 240
and a few others
can someone help !
tia
Try ini_set(session.gc_maxlifetime,2400);
--
Mario de Frutos Dieguez
División de Ingeniería del Software
y Comunicaciones  

CARTIF -Parque Tecnológico Boecillo
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] How to unset a post variable (SOLVED)

2005-04-18 Thread Mario de Frutos Dieguez
Richard Lynch escribió:
On Mon, April 18, 2005 9:42 pm, Chris Kay said:
 

unset($_POST['buttonNew']);
wont work?
   

Sure it works
It's just not useful in the context of this thread :-)
How do you know to unset it the second time when they hit refresh (aka
reload) though?
I should have said won't solved that specific problem
You can change $_POST all you want, but it doesn't change that fact that
that's what the browser *sent* to you.
To reliable detect a reload of a page, you need to somehow change
something in between load and reload and you have to tie it to that
user, filling in that form, at that time.
There's no easy way to do that unless *YOU* somehow notate each FORM you
send out, and then mark it as used when it comes back.
 

On Mon, Apr 18, 2005 at 08:25:04PM -0700, Richard Lynch wrote:
   

On Fri, April 15, 2005 5:08 am, Mario de Frutos Dieguez said:
 

I have another little question hehe :D, i have a page with a form
   

where
 

the user insert data and can click in a new,edit or delete button.
   

I've
 

make that when a button is clicked the page refresh and in the head of
the page i have conditions like this: if ($_POSt[buttonNew]!=) {
insert commands.. } , etc
My question is, how can i unset $_POST[buttonNew] or leave it empty
because when the user refresh the page make insert commans again
   

because
 

the $_POST[buttonNew] arent empty.
   

The POST data is sent by the browser, so you can't really alter that...
But you can bury an http://php.net/md5 or other random token in the
FORM,
and put that token in a table in your database, and then on the first
POST, you mark that token as used
On the second POST, a re-load, you can detect that the token was used
and do whatever you want.  Re-direct the user, ignore them completely,
give them an error message, blow up their computer.  Well, okay, you can
do almost whatever you want.
--
Like Music?
http://l-i-e.com/artists.htm
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
 

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
   


 

Thx for all, i do it and works perfectly :D
--
Mario de Frutos Dieguez
División de Ingeniería del Software
y Comunicaciones  

CARTIF -Parque Tecnológico Boecillo
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] How to unset a post variable

2005-04-15 Thread Mario de Frutos Dieguez
Hi!
I have another little question hehe :D, i have a page with a form where 
the user insert data and can click in a new,edit or delete button. I've 
make that when a button is clicked the page refresh and in the head of 
the page i have conditions like this: if ($_POSt[buttonNew]!=) { 
insert commands.. } , etc

My question is, how can i unset $_POST[buttonNew] or leave it empty 
because when the user refresh the page make insert commans again because 
the $_POST[buttonNew] arent empty.

Thx in advance for all *^_^*
--
Mario de Frutos Dieguez
División de Ingeniería del Software
y Comunicaciones  

CARTIF -Parque Tecnológico Boecillo
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Image and PHP

2005-04-14 Thread Mario de Frutos Dieguez
I have a page where i place an image but i want when i show the image 
delete it. How can i do this?

--
Mario de Frutos Dieguez
División de Ingeniería del Software
y Comunicaciones  

CARTIF -Parque Tecnológico Boecillo
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Image and PHP

2005-04-14 Thread Mario de Frutos Dieguez
Petar Nedyalkov escribió:
On Thursday 14 April 2005 10:06, Mario de Frutos Dieguez wrote:
 

I have a page where i place an image but i want when i show the image
delete it. How can i do this?
   

You want to delete it from the clients machine or what? 

 

--
Mario de Frutos Dieguez
División de Ingeniería del Software
y Comunicaciones
CARTIF -Parque Tecnológico Boecillo
   

 

Sorry, i want delete it from the server side. I put the images in a 
directory in the server.

--
Mario de Frutos Dieguez
División de Ingeniería del Software
y Comunicaciones  

CARTIF -Parque Tecnológico Boecillo
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php