[PHP] sessions problems :/

2001-08-31 Thread Rui Barreiros



i'm sorry if the solution to this problem was posted here before, but if it 
was i couldn't find it.

i have an app that it's basically like this:

index.php:

$app = new App;
$app->start();

in class app:

function start() {
()
session_start();

if($need_auth) {
global $auth; /* another class */
if(!isset($auth)) {
$auth = new auth;
session_register("auth");
}
$auth->start();
}
()
}

my question is, the auth class get's registered, and the auth array inside 
the auth class ($auth->auth[]) get his values recorded on the first attempt, 
but, if the user tries again, it doesn't refresh the session data, oh i'm 
using my session functions to write them on a mysql db, i've been debugging, 
and i can see all the queries that the session stores in the db through 
syslog, and for instance in $auth->start() if i change any variable like 
$this->auth["username"]=$username; the data field passed to my 
session_write() still has the first value not $username instead.

another question is, at what time of the script does php call my 
session_write function to update the registered session?!

thanks all
-- 
Rui Barreiros
   Software Developer

WEBSOLUT - Soluções Internet
Emailto: [EMAIL PROTECTED] 
Personal Info: http://websolut.net/people/rui.html

As informações contidas neste email são confidenciais
e destinam-se apenas à(s) pessoa(s) a quem foi enviado:
http://websolut.net/confidencialidade-responsabilidade.html

-- 
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] writing while reading

2001-08-01 Thread Rui Barreiros


hi all,

i'm writing a web chat, the frame that presents the text, has a very fast 
refresh (has to) it's about from 2 in 2 seconds, my problem is writing to the 
file (chat is file based), when the refresh read the file, it doesn't let php 
write. i made comething like this.

Function chat2file($filename, $str) {
  $fp = fopen("chats/$filename", "a");
  fputs($fp, $str);
  close($fp);
}

Function file2chat($filename) {
  if(file_exists("chats/$filename")) {
$fd = fopen("chats/$filename", "r");
flock($fd, LOCK_UN);
$content = fread($fd, filesize("chats/$filename"));
fclose($fd);
return $content;
  } else {
return "";
  }
}

i put the non blocking option in flock while reading but still blocks and 
doesn't write, my question is it possible to write to a file while reading?!, 
if so how?

thx.

-- 
Rui Barreiros
   Software Developer

WEBSOLUT - Soluções Internet
Emailto: [EMAIL PROTECTED] 
Personal Info: http://websolut.net/people/rui.html

As informações contidas neste email são confidenciais
e destinam-se apenas à(s) pessoa(s) a quem foi enviado:
http://websolut.net/confidencialidade-responsabilidade.html

-- 
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]