[PHP] init_set(): auto_append_file doesn't work?

2002-04-27 Thread Matt Wong

hello,

init_set doesn't seem to work for setting auto_append_file, in php 4.1.2. 
the master setting is NULL, and the local setting is properly set when I do 
a phpinfo(), but the file never gets appended. Any ideas?

thanks
-Matt


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




[PHP] sending content-type header after session_start()

2001-04-27 Thread matt . wong

Hello,

please correct me if I'm wrong, but it seems that in PHP 4, after calling
session_start(), you are stuck with serving an HTML page.

What if you want to call session_start(), but you want to send headers
after the session has started? for example, I'd like to deliver a 
downloadable file, but before I deliver that file, I'd like to check the 
user's session and make sure that the user is logged in and that the user 
has proper authorization to access the file.

I've got a workaround for this problem (see below). However, I would prefer
to handle the problem with the built-in session handling functions. Does
anyone know if this can be done?
Thanks
-Matt
?php
/
this page serves a request to download a file. The file should
not be served unless the user has authorization to view this file. To
check that authorization, the user must be logged in
/
function my_session_start() {
// decode session data, if any
if($GLOBALS[PHPSESSID]) {
$fname = /tmp/sess_.$GLOBALS[PHPSESSID]; // file path hardcoded
for this example
$fcontents = @file($fname);
if($fcontents) {
$fcontents = implode(, $fcontents);
include(User.phpc); // defines the User object stored in the session
session_decode ($fcontents);
}
}
}
/ start processing the page
get session data, and still allow content type headers to be sent.
why doesn't the built-in session_start() allow this?
/
my_session_start();
$s_user = $HTTP_SESSION_VARS[s_user];
if(!$s_user) {
$err = user not logged in;
} else {
// pseudo code from here on
if(!$s_user-has_authorization_to_download_requested_file()) {
$err = user not logged in, or has no authorization to download this
file;
} else {
header(content-type: .requested_file_mime_type());
output_requested_file_data();
}
}
}
if($err) echo Error: $err;
?



-- 
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] where are the mailing lists listed?

2001-04-26 Thread Matt Wong

Hello,

The page http://www.php.net/support.php talks about many mailing lists, but 
I really can't find the specific email address of any of those lists. It 
would be really helpful if the list addresses were on that page as well. 
Does anyone know who this suggestion should be forwarded to?

Thanks
-Matt


-- 
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] sending content-type header after session_start()

2001-04-26 Thread matt . wong

Hello,

please correct me if I'm wrong, but it seems that in PHP 4, after calling
session_start(), you are stuck with serving an HTML page.

What if you want to call session_start(), but you want to send headers
after the session has started? for example, I'd like to deliver a 
downloadable file, but before I deliver that file, I'd like to check the 
user's session and make sure that the user is logged in and that the user 
has proper authorization to access the file.

I've got a workaround for this problem (see below). However, I would prefer
to handle the problem with the built-in session handling functions. Does
anyone know if this can be done?
Thanks
-Matt
?php
/
this page serves a request to download a file. The file should
not be served unless the user has authorization to view this file. To
check that authorization, the user must be logged in
/
function my_session_start() {
// decode session data, if any
if($GLOBALS[PHPSESSID]) {
$fname = /tmp/sess_.$GLOBALS[PHPSESSID]; // file path hardcoded
for this example
$fcontents = @file($fname);
if($fcontents) {
$fcontents = implode(, $fcontents);
include(User.phpc); // defines the User object stored in the session
session_decode ($fcontents);
}
}
}
/ start processing the page
get session data, and still allow content type headers to be sent.
why doesn't the built-in session_start() allow this?
/
my_session_start();
$s_user = $HTTP_SESSION_VARS[s_user];
if(!$s_user) {
$err = user not logged in;
} else {
// pseudo code from here on
if(!$s_user-has_authorization_to_download_requested_file()) {
$err = user not logged in, or has no authorization to download this
file;
} else {
header(content-type: .requested_file_mime_type());
output_requested_file_data();
}
}
}
if($err) echo Error: $err;
?



-- 
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] PHP oop in C

2001-01-29 Thread matt . wong

Hello,

Does anyone know how to take a PHP class and move it directly into PHP's C 
code, OR (even better) to move it into C code that compiles in a separate 
binary object (e.g. myobj.o), and is then linked to the php executable (or 
httpd executable)?

For example, how can I move this code into C?
?
class myObject {
  function myObject {
$this-data = "hello!";
  }
  function hello () {
echo $this-data;
  }
}
?

Thanks!
   -Matt



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