[PHP] Problems of conversion with strftime()

2001-03-28 Thread Evelio Martinez

?
setlocale("LC_ALL","es_ES");
$fecha = date("d-m-Y");
print $fecha ."
br";-
28-03-2001   ok
$fecha = "2001-03-28 18:22:00";
print (date("d m Y H:i:s",$fecha)) ."br";-01 01 1970
01:33:21wrong
print (date("Y m d H:i:s",$fecha)) ."br";-1970 01 01
01:33:21wrong
print (strftime("%d-%m-%Y %T")) ."br"; -28-03-2001
18:22:24   ok
print (strftime("%d-%m-%Y %T",$fecha)) ."br";  - 01-01-1970 01:33:21
wrong

?


Who should I convert between date values?

I am using postgresql date fields and the only way to format de date is
using  the SQL functions
instead of formating with PHP functions.

select to_char(date(pg_user.valuntil),'DD-MM- HH24:MI:SS')  ...

Any idea?

Thanks in advance

--
Evelio Martnez





[PHP] Sessions question

2001-02-26 Thread Evelio Martinez


How can I have an new session id without closing the browser?

session.inc contains  basically the postgresql session functions (user
handler) in  http://www.php.net/manual/en/ref.session.php
I have change  pg_pconnect for pg_connect and I have added
pg_destroy_session.

1. There is a login/password page
2. Afterwards all pages that access the DB have the following include
file:

?
include('sesion.inc');

if (!isset($g_login)) {// flag that indicates that validation was
succesful

  echo "script language='javascript'
 !--
  var lugar = window.location.href;
  if ( lugar != \"http://www.my_web.com/login.php\" ) {
 window.location.assign('http://www.my_web.com/login.php');
  }
  //--
 /script";
}

if (isset($g_hora)) {

  $timeout = 3600 ;
  $lapso = time() - $g_hora;
  if ( $lapso = $timeout )  {

session_destroy();// delete session  from  database
session_unset();  // suppose to delete session
variable from memory
$sesion = md5(uniqid("prueba"));
session_id($sesion);  // new session

echo "script language='javascript'
   !--
var lugar = window.location.href;
var lugars;

window.alert('La sesin ha expirado');
var lugar = window.location.href;
if ( lugar != \"http://www.my_web.com/login.php\" ) {

window.location.assign('http://www.my_web.com/login.php');
  }
//--
   /script";
  }
}
?


3. How am I supposed to create a new session identificator ?
session_unset is suppose to "free" (delete?)  all session variables
currently registered, isn't it?
After timeout, it goes to login page but I have still the old
session id instead of the new one.

What am I missing?

TIA

--
Evelio Martnez





[PHP] How to issue a new session without closing the browser?

2001-02-21 Thread Evelio Martinez


Hi!

I have used your postgresql session functions in
http://www.php.net/manual/en/ref.session.php   with few changes.

I have a login.php page that register 3 things
  - the pg_connect string,
  - a login flag to indicate that we already have done the login
  - actual time

In a second php page  I test
 - if login variable is set, if not I redirect to the login page.
 - if time has expired, if affirmative redirect to login page

I  have added a "pg_session_destroy" in your "user functions" to delete
the actual session but when
I reenter in the login page the session_start() re-creates the data I
have just deleted with the same session_id.

I would like to know how to issue a new session without closing the
browser?
What did I missed?

- Working with  php 4.0.4

- php.ini contains
session.auto_start Off
session.cache_expire 180
session.cache_limiter nocache
session.cookie_domain no value
session.cookie_lifetime 0
session.cookie_path /
session.cookie_secure Off
session.entropy_file no value
session.entropy_length 0
session.gc_maxlifetime 60
session.gc_probability 1
session.name PHPSESSID
session.referer_check no value
session.save_handler user
session.save_path /tmp
session.serialize_handler php
session.use_cookies On

- track_vars and gpc_globals are not enabled

TIA


--
Evelio Martnez





[PHP] sessions and data missing browser message

2001-02-19 Thread Evelio Martinez


Hi!

is there any relation between use of sessions (php 4.0.4) and  the
following browser message ?

Data Missing

This document resulted from a POST operation and has expired from the
cache. If you wish you can repost the form
data to recreate the document by pressing the reload button.

I am having this message since I include session handling in the code.

Is there any way to avoid this?

Thanks in advance

--
Evelio Martnez





[PHP] HOWTO handle sessions ?

2001-02-09 Thread Evelio Martinez


Hi!
Does anyone know of some good examples of sessions?


--
Evelio Martnez


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Possible bug in pg_connect (4.0.3.pl1) ?

2001-02-05 Thread Evelio Martinez


Hi!

under 4.0.3pl1

Why this sentence works ?

 $conexion2 = pg_Connect("host=$servidor user=$usuario password=$pass
dbname=$bd port=$puerto");

and this one does not ?

 $conexion2 = pg_Connect("host=$servidor port=$puerto user=$usuario
password=$pass dbname=$bd");


It issues the following message
  Warning: 1 is not a valid PostgreSQL link resource



--
Evelio Martnez
Testanet. Dept. desarrollo software.
Av. Reino de Valencia, 15 - 5
46005 Valencia (Spain)
Tel: +34 96 395 90 00
Fax: +34 96 316 23 19





[PHP] pg_Exec: Warning: 1 is not a valid PostgreSQL link resource.

2001-02-02 Thread Evelio Martinez

Hi!

We have a host (host A) with PostgreSQL 7.0.3. and PHP 4.0.4 under Red Hat

We have another host (host B) with PHP 4.0.3pl1  under Debian

We are having an incomprehensible error with this code when the content of $sql is

and "update"

...

$resultado=pg_Exec($conexion,$sql);

...

1) The php code from host A works ok.

2) The same php code from host B accessing postgresql database on host A

   does not work with "update", but it works with "select", "insert", and "delete".

3) If I try from host B:   psql -h hostA -d database -u

update fam set nom='xx' where id='23'

   it works ok.

4) So, where is the problem?  php4 libraries under Debian distribution?

Any ideas?

--
Evelio Martnez
Testanet. Dept. desarrollo software.
Av. Reino de Valencia, 15 - 5
46005 Valencia (Spain)
Tel: +34 96 395 90 00
Fax: +34 96 316 23 19





[PHP] is it possible to communicate javascript and php?

2001-01-19 Thread Evelio Martinez

I would like to know if it possible to pass in any way some values

from javascript functions to php variables ?

Any FAQ?

Thanks

--
Evelio Martnez
Testanet. Dept. desarrollo software.
Av. Reino de Valencia, 15 - 5
46005 Valencia (Spain)
Tel: +34 96 395 90 00
Fax: +34 96 316 23 19