[PHP] variable num of function args

2002-12-03 Thread christian haines
hi all,

is it possible to somehow have a function which takes a variable number 
of arguments (with some kind of key association) which can then be 
converted to variables?
i am sick of continually having to go back and add empty parameters to 
functions in use.

an example would be..

function test1()
{
   extract(func_arg_keys());
   print $this;
}
test1($test = 1, $this = 2);
// output
2

i know something similar can be done like this...

function test2()
{
   extract($arr);
   print $this;
}

test2($arr = array(
test = 1,
this = 2
));
// output
2

is there another ... better or cleaner way?

having something like this inbuilt into php would appear to be an 
excellent to allow functions to easily expand without having to go 
revisit already used instances of the function

many thanks
christian

ps sorry if this has been discussed before





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



[PHP] Re: variable num of function args

2002-12-03 Thread christian haines
ooops that should be...

function test2($arr)
{
  extract($arr);
  print $this;
}

test2($arr = array(
test = 1,
this = 2
));
// output
2


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




[PHP] Re: When hitting Refresh I still get old data ..

2002-11-25 Thread christian haines
is it that your response page and the page processing the data are the same
page? i have had issues with this previously and had to use a 3 step
process -
1. address book form
2. processing script page
3. response page

--


Christian Haines
Internet Developer

MITOUSA.
Branding Strategies for Visual  Interactive Design

102 Tynte Street
North Adelaide  SA  5006

e) [EMAIL PROTECTED]
t) 08 8361 9022
f) 08 8361 9977
w) www.mitousa.com
Krispi [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi!

 Here is my scenario. I'm doing a dynamic html with php for my address
book.
 When I enter all the data that is necesary and hit Submit, for saving the
 user( using POST), I get an error or success message, which is OK, but if
I
 press a Refresh  button now, it will try to save the user again, because
old
 data is still in the $_POST.Why??

 I already tried header directives:

 header(Expires: Mon, 26 Jul 1997 05:00:00 GMT);// Date in the past
 header(Last-Modified:  . gmdate(D, d M Y H:i:s) .  GMT);
 // always modified
 header(Cache-Control: no-store, no-cache, must-revalidate,false);  //
 HTTP/1.1
 header(Cache-Control: post-check=0, pre-check=0, false);
 header(Pragma: no-cache);


 Thx,
  Krispi







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




Re: [PHP] detecting POST variables

2002-10-07 Thread christian haines

maybe try...

print pre;
print_r($HTTP_POST_VARS);
print /pre;

this will dump the entire post var array to the browser.. similar to
functions before but faster.



Christian Haines
Internet Developer

MITOUSA.
Branding Strategies for Visual  Interactive Design

102 Tynte Street
North Adelaide  SA  5006

e) [EMAIL PROTECTED]
t) 08 8361 9022
f) 08 8361 9977
w) www.mitousa.com
Anup [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Here's the code
 ?php
  foreach ($HTTP_POST_VARS  as $Index=$Value) {
   echo DEBUG ::: POST Key: $Index; POST Value: $Valuebr\n;
  }
 ?
 ### Here's the function (this is how what I catually use).
 function PrintVars () {
 global $HTTP_POST_VARS;
 foreach ($HTTP_POST_VARS  as $Index=$Value) {
   echo DEBUG ::: POST Key: $Index; POST Value: $Valuebr\n;
 }
 }

 The first snippet seems to work fine by itself, but if call it as a
function
 (as the latter snippet) then it doesn't print the variables. I have the
POST
 array defined as global (in the function), could that be why it takes out
 the empty textbox variables?

 Justin French [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  on 08/10/02 9:13 AM, Anup ([EMAIL PROTECTED]) wrote:
 
   Hello, I have been dealing with different form proccessing PHP
scripts.
 When
   I start a new job I usually have a script that just takes the form
POST
   values and prints them to the screen, so I know what I'm working with.
 Now
   I have a question say the form has 1 field named FirstName. If the
 field
   is left blank, sometimes my script will print the key and NO value, or
 it
   will just print out nothing, ie NO key or value.
 
  Are you certain this is happening on text fields?  Typically text
fields,
  password fields and textareas allways set a key, and no value of blank.
 Ie:
 
  $_POST['FirstName'] = '';
 
  Select boxes should always have a value set.
 
  Check boxes are only set IF the box was ticked.
 
  What I'd advise is that you make a quick form and test this out --
perhaps
  it was only checkboxes that were sometimes not being set?
 
 
   any ideas.  Could it be the server (IIS or Unix/Linux) of the form and
 the
   server (IIS or Unix/Linux)  of the script.?
   Since I do jobs for different people and environments any combination
of
   servers are possible.
 
  I've never experienced this problem on any environment -- FreeBSD,
RedHat
 or
  Windows.
 
 
   The reason, for this post is that I don't know if I should always put
 code
   to check for validilty using isset all the time or should I put it in
 just
   in case the script gets moved. I want to pinpoint this so that I can
 write
   more effective code.
 
  You should be able to use isset() or empty() on text/password/textarea
 form
  elements reliably.
 
  Write a SMALL test script, test it, and if it ain't working, post the
code
  :)
 
 
  Justin
 





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




Re: [PHP] force download and file size issue

2002-10-04 Thread christian haines

this is what i have exactly in my code...

  header(Content-Type: application/force-download; name=\$file\);
  header(Content-Disposition: attachment; filename=\$file \);
  header(Content-Transfer-Encoding: binary);
  header(Content-Length: $content_length);
  readfile($file_fullpath);
  exit;

it works for files upto 10M (same as memory limit) but not above. the paths to
file and content length are correct as i have checked them and made comparisons to
other files which i can download.

is there a problem with this code? i have tried it with win ie 6 and mac ie 5.1.2
and ns 4.7.. same issue

cheers
christian

Rasmus Lerdorf wrote:

 readfile() reads 8k blocks at a time and dumps them out.  It does not read
 the entire thing into ram, so that wouldn't be what was causing you to hit
 a memory limit.  You must have done something else wrong then.

 -Rasmus

 On Fri, 4 Oct 2002, christian haines wrote:

  thanks rasmus,
 
  i have tried read file but it gave me the same issues as fpassthru.. both cap
  on the memory_limit directive withint the php.ini file
 
  any other suggestions maybe?
 
  cheers
  christian
 
  Rasmus Lerdorf wrote:
 
   readfile()
  
   On Fri, 4 Oct 2002, christian haines wrote:
  
hi all,
   
i have successfully created a download script to force a user to
download, however attempting to download large files causes an error
saying that the file cannot be found.
   
my code 
  header(Cache-control: private);
  header(Content-Type: application/force-download; name=\$file\);
  header(Content-Disposition: attachment; filename=\$file \);
  header(Content-Transfer-Encoding: binary);
  header(Content-Length: $content_length);
  $fp = fopen($file_fullpath,r);
  fpassthru($fp);
  fclose($fp);
 my code
   
this is a memory issue in the php.ini i.e. memory_limit = 8M then the
largest file i can download is 8M
   
is there anyway to force a download without having to use the system
hungry fpassthru function?
   
this is driving me nuts so any help would be greatly appreciated
   
cheers
christian
   
ps i read the following at php.net fpassthru man page but could not make
sense of it (it appears to be some kind of solution) 
   
fpassthru() works best for small files. In download manager scripts,
it's best to determine the URL of the file to download (you may generate
it locally in your session data if you need so), and then use HTTP
__temporary__ redirects (302 status code, with a Location: header
specifying the effective download URL).
This saves your web server from maintaining PHP scripts running for long
times during the file downloadn and instead the download will be managed
directly by the web server without scripting support (consequence: less
memory resources used by parallel downloads)...
   
 
 
  --
  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




[PHP] Re: Mime Types

2002-10-04 Thread christian haines

you could use the command file -bin your_filename and capture the output using popen 
or exec.

i have found this to work well..

seee below

 function mimetype($file)
 {
  // execute command
  $fp = popen(file -bin $file,r);

  // determine mimetype to output
  if(!$fp)
  {
   // default mimetype if no mimetype exists
   $mimetype=application/octet-stream;
  }
  else
  {
   // iterate through return value to determine mimetype
   while($string=fgets($fp, 1024))
   {
$mimetype .= $string;
   }
   pclose($fp);
  }

  // return output
  return $mimetype;
 }

Php List wrote:

 Hi,
 Is it possible to get a mime type of a file?
 I need to be able to attach files, but I won't always know the mime type of what is 
being attached.
 I could look at the extension of the file for a general Idea, but I wouldn't know if 
a .jpg file is an image/jpg or image/jpeg.(progressive) and there seems to be a 
difference between the two.

 Thanks for any help.
 Chris


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




Re: [PHP] force download and file size issue

2002-10-04 Thread christian haines

PHP Version 4.1.2
Red Hat Linux release 7.3 (Valhalla) (Kernel 2.4.18-3 on an i686)
Apache/1.3.23

Rasmus Lerdorf wrote:

 Which OS and which PHP version?

 On Fri, 4 Oct 2002, christian haines wrote:

  this is what i have exactly in my code...
 
header(Content-Type: application/force-download; name=\$file\);
header(Content-Disposition: attachment; filename=\$file \);
header(Content-Transfer-Encoding: binary);
header(Content-Length: $content_length);
readfile($file_fullpath);
exit;
 
  it works for files upto 10M (same as memory limit) but not above. the paths to
  file and content length are correct as i have checked them and made comparisons to
  other files which i can download.
 
  is there a problem with this code? i have tried it with win ie 6 and mac ie 5.1.2
  and ns 4.7.. same issue
 
  cheers
  christian
 
  Rasmus Lerdorf wrote:
 
   readfile() reads 8k blocks at a time and dumps them out.  It does not read
   the entire thing into ram, so that wouldn't be what was causing you to hit
   a memory limit.  You must have done something else wrong then.
  
   -Rasmus
  
   On Fri, 4 Oct 2002, christian haines wrote:
  
thanks rasmus,
   
i have tried read file but it gave me the same issues as fpassthru.. both cap
on the memory_limit directive withint the php.ini file
   
any other suggestions maybe?
   
cheers
christian
   
Rasmus Lerdorf wrote:
   
 readfile()

 On Fri, 4 Oct 2002, christian haines wrote:

  hi all,
 
  i have successfully created a download script to force a user to
  download, however attempting to download large files causes an error
  saying that the file cannot be found.
 
  my code 
header(Cache-control: private);
header(Content-Type: application/force-download; name=\$file\);
header(Content-Disposition: attachment; filename=\$file \);
header(Content-Transfer-Encoding: binary);
header(Content-Length: $content_length);
$fp = fopen($file_fullpath,r);
fpassthru($fp);
fclose($fp);
   my code
 
  this is a memory issue in the php.ini i.e. memory_limit = 8M then the
  largest file i can download is 8M
 
  is there anyway to force a download without having to use the system
  hungry fpassthru function?
 
  this is driving me nuts so any help would be greatly appreciated
 
  cheers
  christian
 
  ps i read the following at php.net fpassthru man page but could not make
  sense of it (it appears to be some kind of solution) 
 
  fpassthru() works best for small files. In download manager scripts,
  it's best to determine the URL of the file to download (you may generate
  it locally in your session data if you need so), and then use HTTP
  __temporary__ redirects (302 status code, with a Location: header
  specifying the effective download URL).
  This saves your web server from maintaining PHP scripts running for long
  times during the file downloadn and instead the download will be managed
  directly by the web server without scripting support (consequence: less
  memory resources used by parallel downloads)...
 
   
   
--
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
 


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




Re: [PHP] force download and file size issue

2002-10-04 Thread christian haines

thanks for all your help and that last suggestion. it helped me isolate the issue.
which i believe relates to a header previously sent.still debugging it but got a
simple vers running

cheers
christian

Rasmus Lerdorf wrote:

 Which OS and which PHP version?

 On Fri, 4 Oct 2002, christian haines wrote:

  this is what i have exactly in my code...
 
header(Content-Type: application/force-download; name=\$file\);
header(Content-Disposition: attachment; filename=\$file \);
header(Content-Transfer-Encoding: binary);
header(Content-Length: $content_length);
readfile($file_fullpath);
exit;
 
  it works for files upto 10M (same as memory limit) but not above. the paths to
  file and content length are correct as i have checked them and made comparisons to
  other files which i can download.
 
  is there a problem with this code? i have tried it with win ie 6 and mac ie 5.1.2
  and ns 4.7.. same issue
 
  cheers
  christian
 
  Rasmus Lerdorf wrote:
 
   readfile() reads 8k blocks at a time and dumps them out.  It does not read
   the entire thing into ram, so that wouldn't be what was causing you to hit
   a memory limit.  You must have done something else wrong then.
  
   -Rasmus
  
   On Fri, 4 Oct 2002, christian haines wrote:
  
thanks rasmus,
   
i have tried read file but it gave me the same issues as fpassthru.. both cap
on the memory_limit directive withint the php.ini file
   
any other suggestions maybe?
   
cheers
christian
   
Rasmus Lerdorf wrote:
   
 readfile()

 On Fri, 4 Oct 2002, christian haines wrote:

  hi all,
 
  i have successfully created a download script to force a user to
  download, however attempting to download large files causes an error
  saying that the file cannot be found.
 
  my code 
header(Cache-control: private);
header(Content-Type: application/force-download; name=\$file\);
header(Content-Disposition: attachment; filename=\$file \);
header(Content-Transfer-Encoding: binary);
header(Content-Length: $content_length);
$fp = fopen($file_fullpath,r);
fpassthru($fp);
fclose($fp);
   my code
 
  this is a memory issue in the php.ini i.e. memory_limit = 8M then the
  largest file i can download is 8M
 
  is there anyway to force a download without having to use the system
  hungry fpassthru function?
 
  this is driving me nuts so any help would be greatly appreciated
 
  cheers
  christian
 
  ps i read the following at php.net fpassthru man page but could not make
  sense of it (it appears to be some kind of solution) 
 
  fpassthru() works best for small files. In download manager scripts,
  it's best to determine the URL of the file to download (you may generate
  it locally in your session data if you need so), and then use HTTP
  __temporary__ redirects (302 status code, with a Location: header
  specifying the effective download URL).
  This saves your web server from maintaining PHP scripts running for long
  times during the file downloadn and instead the download will be managed
  directly by the web server without scripting support (consequence: less
  memory resources used by parallel downloads)...
 
   
   
--
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
 


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




[PHP] force download and file size issue

2002-10-03 Thread christian haines

hi all,

i have successfully created a download script to force a user to
download, however attempting to download large files causes an error
saying that the file cannot be found.

my code 
  header(Cache-control: private);
  header(Content-Type: application/force-download; name=\$file\);
  header(Content-Disposition: attachment; filename=\$file \);
  header(Content-Transfer-Encoding: binary);
  header(Content-Length: $content_length);
  $fp = fopen($file_fullpath,r);
  fpassthru($fp);
  fclose($fp);
 my code

this is a memory issue in the php.ini i.e. memory_limit = 8M then the
largest file i can download is 8M

is there anyway to force a download without having to use the system
hungry fpassthru function?

this is driving me nuts so any help would be greatly appreciated

cheers
christian

ps i read the following at php.net fpassthru man page but could not make
sense of it (it appears to be some kind of solution) 

fpassthru() works best for small files. In download manager scripts,
it's best to determine the URL of the file to download (you may generate
it locally in your session data if you need so), and then use HTTP
__temporary__ redirects (302 status code, with a Location: header
specifying the effective download URL).
This saves your web server from maintaining PHP scripts running for long
times during the file downloadn and instead the download will be managed
directly by the web server without scripting support (consequence: less
memory resources used by parallel downloads)...



Re: [PHP] force download and file size issue

2002-10-03 Thread christian haines

thanks rasmus,

i have tried read file but it gave me the same issues as fpassthru.. both cap
on the memory_limit directive withint the php.ini file

any other suggestions maybe?

cheers
christian

Rasmus Lerdorf wrote:

 readfile()

 On Fri, 4 Oct 2002, christian haines wrote:

  hi all,
 
  i have successfully created a download script to force a user to
  download, however attempting to download large files causes an error
  saying that the file cannot be found.
 
  my code 
header(Cache-control: private);
header(Content-Type: application/force-download; name=\$file\);
header(Content-Disposition: attachment; filename=\$file \);
header(Content-Transfer-Encoding: binary);
header(Content-Length: $content_length);
$fp = fopen($file_fullpath,r);
fpassthru($fp);
fclose($fp);
   my code
 
  this is a memory issue in the php.ini i.e. memory_limit = 8M then the
  largest file i can download is 8M
 
  is there anyway to force a download without having to use the system
  hungry fpassthru function?
 
  this is driving me nuts so any help would be greatly appreciated
 
  cheers
  christian
 
  ps i read the following at php.net fpassthru man page but could not make
  sense of it (it appears to be some kind of solution) 
 
  fpassthru() works best for small files. In download manager scripts,
  it's best to determine the URL of the file to download (you may generate
  it locally in your session data if you need so), and then use HTTP
  __temporary__ redirects (302 status code, with a Location: header
  specifying the effective download URL).
  This saves your web server from maintaining PHP scripts running for long
  times during the file downloadn and instead the download will be managed
  directly by the web server without scripting support (consequence: less
  memory resources used by parallel downloads)...
 


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




[PHP] mime type list

2002-09-30 Thread christian haines

hi all,

i have been looking around on the net for a relatively complete
mime-type listing (possibly showing extensions) but have not come across
anything.
does anyone know of such a list or where i could obtain one?

who looks after such a list might be a better question.

many thanks
christian


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




Re: [PHP] mime type list

2002-09-30 Thread christian haines

cheers for that...

that listing should do the trick

it was right under my nose as usual

also thanks for your reply  in my other post

christian


Marek Kilimajer wrote:

 I know about /etc/mime.types, does that help?

 christian haines wrote:

 hi all,
 
 i have been looking around on the net for a relatively complete
 mime-type listing (possibly showing extensions) but have not come across
 anything.
 does anyone know of such a list or where i could obtain one?
 
 who looks after such a list might be a better question.
 
 many thanks
 christian
 
 
 
 


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




[PHP] exec issue - return value 127

2002-09-27 Thread christian haines

hi all,

i am having a problem with exec. every command i try to run returns 127
(seg fault i think) but no array with info.
what could be causing this problem?

i have tried running the complete path to the command e.g. usr/bin/ls -l
etc but with no luck.

could this be something to do with my php.ini settings?

any help would be greatly appreciated!

many thanks in advance,

christian


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




[PHP] Re: exec issue - return value 127 (more)

2002-09-27 Thread christian haines

ok.. i found that i need to check the httpd error_log and it tells me that
it can't find the file or directory for the command.

how do i fix this?

i tried a full pathname to the command but it still says it cannot find dir
or file etc

c.



Christian Haines wrote:

 hi all,

 i am having a problem with exec. every command i try to run returns 127
 (seg fault i think) but no array with info.
 what could be causing this problem?

 i have tried running the complete path to the command e.g. usr/bin/ls -l
 etc but with no luck.

 could this be something to do with my php.ini settings?

 any help would be greatly appreciated!

 many thanks in advance,

 christian


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




[PHP] Re: exec issue - return value 127 (more and more)

2002-09-27 Thread christian haines

here is some more info

i figured out the exec fails because php is running in safe mode. that is ok
when i am at home developing (i can turn it off) however when i go to upload
my app to my server which runs in safe mode.. what do i do then?
is there a way around this?

i tried using the ini_set function to turn safe mode off but this appears not
to work

suggestions would be great as this is driving me nuts!

cheers
c.



Christian Haines wrote:

 ok.. i found that i need to check the httpd error_log and it tells me that
 it can't find the file or directory for the command.

 how do i fix this?

 i tried a full pathname to the command but it still says it cannot find dir
 or file etc

 c.

 Christian Haines wrote:

  hi all,
 
  i am having a problem with exec. every command i try to run returns 127
  (seg fault i think) but no array with info.
  what could be causing this problem?
 
  i have tried running the complete path to the command e.g. usr/bin/ls -l
  etc but with no luck.
 
  could this be something to do with my php.ini settings?
 
  any help would be greatly appreciated!
 
  many thanks in advance,
 
  christian


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




[PHP] session and expiration function

2002-09-23 Thread christian haines

hi,

is it possible to have a function execute when a session expires using php4
sessions?
i know how to execute a function if i control the timeout (as mentioned
elsewhere in this group) but what about if the session times out itself
using the inbuilt garbage collection routine.
if so, any ideas how?

many thanks in advance!
christian




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




Re: [PHP] session and expiration function

2002-09-23 Thread christian haines

thanks john,

hmmm... i suspected as much...

i guess the way to do it would be to set a highly improbable garbage
collection and long timeout via ini_set. then use a timeout function
attached to the session which launches on expiration

cheers
christian

John Holmes [EMAIL PROTECTED] wrote in message
002501c26374$e136db20$b402a8c0@mango">news:002501c26374$e136db20$b402a8c0@mango...
  is it possible to have a function execute when a session expires using
  php4
  sessions?
  i know how to execute a function if i control the timeout (as
 mentioned
  elsewhere in this group) but what about if the session times out
 itself
  using the inbuilt garbage collection routine.
  if so, any ideas how?

 I don't think there's a way to do it besides hacking the source code. If
 you really have to do this, I'd set your own session.save_path() in your
 scripts and then write a script to do the cleanup and function calling
 for you.

 ---John Holmes...




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




Re: [PHP] session and expiration function

2002-09-23 Thread christian haines

thanks.. i will check it out


John Holmes [EMAIL PROTECTED] wrote in message
002601c26378$b4189350$b402a8c0@mango">news:002601c26378$b4189350$b402a8c0@mango...
 Just use ini_set() to set a different session.save_path() than what's in
 your PHP.ini. then the garbage collector won't touch it. Write your own
 script to do the deleting and call whatever functions you need. Add that
 to your cron script to run every hour or day, and you're good to go. You
 made your own garbage collector.

 I'm going to have to do this for a sourceforge site I have. I started a
 thread about this on the PHP board at Devshed and someone posted a
 sample function to handle the cleanup.

 ---John Holmes...

  -Original Message-
  From: christian haines [mailto:[EMAIL PROTECTED]]
  Sent: Monday, September 23, 2002 11:06 PM
  To: [EMAIL PROTECTED]
  Subject: Re: [PHP] session and expiration function
 
  thanks john,
 
  hmmm... i suspected as much...
 
  i guess the way to do it would be to set a highly improbable garbage
  collection and long timeout via ini_set. then use a timeout function
  attached to the session which launches on expiration
 
  cheers
  christian
 
  John Holmes [EMAIL PROTECTED] wrote in message
  002501c26374$e136db20$b402a8c0@mango">news:002501c26374$e136db20$b402a8c0@mango...
is it possible to have a function execute when a session expires
 using
php4
sessions?
i know how to execute a function if i control the timeout (as
   mentioned
elsewhere in this group) but what about if the session times out
   itself
using the inbuilt garbage collection routine.
if so, any ideas how?
  
   I don't think there's a way to do it besides hacking the source
 code. If
   you really have to do this, I'd set your own session.save_path() in
 your
   scripts and then write a script to do the cleanup and function
 calling
   for you.
  
   ---John Holmes...
  
 
 
 
  --
  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




[PHP] session class

2001-12-21 Thread Christian Haines

(sorry if this has been posted a thousand times..i am having problems
posting)

hi all,

how does one access and manipulate session variables from within a class?
i have hunted the net high and low but received no relief.

i have tried (where error is a session variable)

class test
{
var $global['error'];
}

class test
{
var $HTTP_SESSION_VARS['error'];
}

class test
{
session_register(error);
var $error;
}

all to no avail.

please help!

many thanks in advance,
christian


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

2001-09-20 Thread Christian Haines

hi all,

i have tried everything not to get a page to cache..

server-side:

  header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
  header('Last-Modified: '. gmdate('D, d M Y H:i:s') .' GMT');
  header('Cache-Control: no-cache, must-revalidate');
  header('Pragma: no-cache')

client-side:

meta http-equiv = Expires content = Tue, 20 Aug 1996 14:25:27 GMT


does anyone have any idea how to make sure pages do not cache?


many thanks in advance,
christian


-- 
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] internet explorer and form submission

2001-09-13 Thread Christian Haines

hi all,

i have just discovered a bug with internet explorer form submission.

suppose i have a form with 2 submit buttons to do different things eg-

form name=form method=post action=something.php

input type=submit name=update value=update
input type=submit name=delete value=delete

/form

one to update content and one to delete content then in my processing file i
have

if(isset($update))
{
// do update
}

if(isset($delete))
{
// do delete
}

so if a particular form button is clicked a different process will occcur.

well what happens if i press return to enter my form submission?
nothing is set!

so the processing file does nothing

any thoughts?

christian


-- 
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] Re: internet explorer and form submission

2001-09-13 Thread Christian Haines

sorry i just figured it out...just panicked...must be the time of year

if(!isset($delete))
{
 // do update
}
 
if(isset($delete))
{
// do delete
}


that should fix the problem

 From: [EMAIL PROTECTED] (Christian Haines)
 Newsgroups: php.general
 Date: Thu, 13 Sep 2001 23:44:30 +1030
 To: [EMAIL PROTECTED]
 Subject: internet explorer and form submission
 
 hi all,
 
 i have just discovered a bug with internet explorer form submission.
 
 suppose i have a form with 2 submit buttons to do different things eg-
 
 form name=form method=post action=something.php
 
 input type=submit name=update value=update
 input type=submit name=delete value=delete
 
 /form
 
 one to update content and one to delete content then in my processing file i
 have
 
 if(isset($update))
 {
 // do update
 }
 
 if(isset($delete))
 {
 // do delete
 }
 
 so if a particular form button is clicked a different process will occcur.
 
 well what happens if i press return to enter my form submission?
 nothing is set!
 
 so the processing file does nothing
 
 any thoughts?
 
 christian
 


-- 
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] stripslashes strips too much

2001-09-11 Thread Christian Haines

hi all,

i am experiencing a bit of a problem with stripslashes stripping too much
data.

For example:

it will strip abc's - abc

has anyone else experienced this? is there a solution?

many thanks in advance,
christian


-- 
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] session_name causes break

2001-09-08 Thread Christian Haines

hi all,

has anyone else had problems with specifying session_name causing data not
being input into session variables?

For example:

session_name(test);
session_start();
session_register(count);
count++;

causes count not to increment whereas

session_start();
session_register(count);
count++;

with the default PHPSESSID works 



many thanks in advance
christian


-- 
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] SESSIONS! - please help

2001-09-06 Thread Christian Haines

hi all,

PHP-4.03pl
LINUX 7.0

i am still having problems with sessions. the following does nothing but
should appear to do something! it is just a simple experiment to test that
sessions work. session_test.php calls session_proc.php to perform one of
three functions.

i would really appreciate any help as this is driving me nuts. i have also
tested this on other systems to no avail.

many thanks in advance,
christian


- session_test.php --
html

body
?
if(is_array($count))
{
reset ($count);
while (list($key, $value) = each ($count)) {
echo Key: $key; Value: $value
Count:.count($value).br\n;

if(is_array($value))
{
reset ($value);
while (list($key2, $value2) = each ($value)) {
echo --- Key: $key2; Value: $value2 br\n;
}
}
}
}

print brnbsp;br.count($count).
---.session_is_registered(count);

?
form name=test method=post action=session_proc.php
input name=increment type=submit value=incrementinput name=reset
type=submit value=resetinput name=decrement type=submit value=decrement
/form

/body
/html

- session_proc.php --
?
session_start();

session_register(count);
$count = array();

if(isset($increment))
{
$count[0] = 9;
$count[1] = 11;
$count[2] = 12;
}

if(isset($reset))
{
unset($count);
}

if(isset($decrement))
{
$count[0] = 4;
$count[1] = 6;
$count[2] = 1;
}

header(location: session_test.php);
exit;
?


-- 
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] session - why does this not work?

2001-09-05 Thread Christian Haines

hi all,

any ideas why this does not work? its just a simple script to test
multi-dimensional arrays. the count value should increment...should it not?

many thanks in advance!

?
session_start();
session_register(count[0]);

$count[0]++;
echo $count[0].brnbsp;br;

reset ($HTTP_SESSION_VARS);
while (list($key, $value) = each ($HTTP_SESSION_VARS)) {
echo Key: $key; Value: $valuebr\n;
}
?
html

body

form name=test method=post action=session_test.php
input name=submit type=submit
/form

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