RE: [PHP] session_start() times and resets?

2002-04-25 Thread Johnson, Kirk

See session.gc_maxlifetime in php.ini. The session timer is based on the
session file access (or modified?) timestamp. It gets reset every time the
session data is accessed, which is every time a page using that session is
requested.

Kirk

 -Original Message-
 From: Smileyq [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, April 24, 2002 11:35 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] session_start() times and resets?
 
 
 I have one question that I've been working about. When you setup a 
 session to last a particular time say 1 week. If the user 
 comes back to 
 that page because the week is over to reset the session does the user 
 then at that time reset the timer to yet another week. I'm trying to 
 figure out a way to set something like this up so that if they choose 
 not to come back for a period of time the session will delete but if 
 they do come back it will just reset for another week .

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




RE: [PHP] Won't save session ids?

2002-04-25 Thread Johnson, Kirk

The coding style needs to match the register_globals setting in php.ini.

register_globals on:

$accountsession = $session;
$accountemail = $email;
session_register(accountsession);
session_register(accountemail);

register_globals off: 

Do just like you have it below, except remove the calls to session
_register().

Kirk

 -Original Message-
 From: Johan Holst Nielsen [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, April 25, 2002 6:14 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Won't save session ids?
 
 
 Hi people,
 
 I have a problem with my PHP scripts. I hope someone can help me?
 I run PHP 4.0.6, Redhat 7.1
 
 When i tries to set a session and then redirect to the next page, the
 sessions is empty? Someone know how to solve this problem?
 
 The script looks like this:
 
 session_start();
 session_register(accountsession);
 session_register(accountemail);
 $HTTP_SESSION_VARS[accountsession] = $session;
 $HTTP_SESSION_VARS[accountemail] = $email;
 header(Location: ./main.php);
 
  //The session and email variabel is from a output from a 
 mysql query!!
 And this works fine!
 
 The mainpage tries to get the sessions.
 
 session_start();
 echo
 Email:.$HTTP_SESSION_VARS[accountemail].br.$HTTP_SESSI
 ON_VARS[accountsession];
 
 But i just get a Email: without any content?
 
 Please help me? Someone know whats wrong?

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




RE: [PHP] in_array problems (another pair of eyes?)

2002-05-22 Thread Johnson, Kirk

Unless you are using PHP version 4.2 or higher, the first argument can't be
an array.

Kirk

 -Original Message-
 From: Jas [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, May 21, 2002 11:46 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] in_array problems (another pair of eyes?)
 
 
 I don't think I am using the syntax correctly, I have been 
 looking at this
 function on php.net and everything I have seen says my code should be
 working.
 A form allows the user to upload a file:
 form name=img1 method=post action=upload_done.php
 enctype=multipart/form-data
  input type=file name=img1 size=25
  input type=submit name=Submit value=save
  input type=reset name=reset value=reset
  /form
 Resulting file (upload_done.php):
 ?php
 $types = array(.gif,
   .jpg,
   .jpeg,
   .htm,
   .pdf); //place file type into array
 if (in_array(array ('.jpg', '.jpeg'), $types)) { //this is 
 the error line
 (line 7)
  print jpg file; }
 ?
 And here is my error:
 Warning: Wrong datatype for first argument in call to in_array in
 upload_done.php on line 7

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




RE: [PHP] comment followed by ? fails to parse

2002-05-28 Thread Johnson, Kirk

I have wondered for some time if this is a bug or just an interesting design
choice ;) I agree with you, I was surprised when I first encountered this.
But it is what it is, so code accordingly.

Kirk

 -Original Message-
 From: Thalis A. Kalfigopoulos [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, May 28, 2002 1:21 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] comment followed by ? fails to parse
 
 
 If I write a comment line with // and I include in it ? then 
 it fails to parse the rest of the page because (i'm guessing) 
 the parser gets confused and goes off PHP mode. 
 Is this normal? Shouldn't I be able to write literally 
 ANYTHING on a comment line?
 
 Sample Code:
 
 ?
 //bla bla ?
 $var=1;
 ?
 
 Output:
 
 $var=1; ?
 
 
 cheers,
 thalis

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




RE: [PHP] comment followed by ? fails to parse

2002-05-28 Thread Johnson, Kirk

Which begs the question, why does PHP see a '?' in a '//' comment line, but
not in a multi-line comment, e.g., /* ? */ ?

 -Original Message-
 From: Ed Gorski [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, May 28, 2002 2:46 PM
 To: Leotta Natalie (NCI/IMS); 'Jonathan Rosenberg'; Johnson, Kirk;
 [EMAIL PROTECTED]
 Subject: RE: [PHP] comment followed by ? fails to parse
 
 
 No the parser sees the ? after a // because it needs to see 
 when to quit 
 out (unlike traditional, compiled languages) but it won't 
 have this same 
 effect in a string literal.
 
 ed

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




RE: [PHP] comment followed by ? fails to parse

2002-05-28 Thread Johnson, Kirk

Well, one thing I know for sure is that there are members of the PHP
develpment team that monitor this list. Maybe one of them will clear this up
for us ;)

Kirk

 -Original Message-
 From: Ed Gorski [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, May 28, 2002 3:04 PM
 To: Kevin Stone; [EMAIL PROTECTED]
 Subject: Re: [PHP] comment followed by ? fails to parse
 
 
  From my experience the PHP parser acts much like the HTML 
 parser in the 
 fact that it doesn't give a damn about carriage returns
 
 ed
 
 At 03:01 PM 5/28/2002 -0600, Kevin Stone wrote:
 Exactly.. it doesn't seem to make any sense.  Esspecially 
 since it's such as
 absolutely incredibly undeniably easy thing to check for.  
 :)  If the code
 doesn't end with an uncommented ? then just parse the code 
 as text.  That's
 what it does anyway so why catch commented code at all?
 
 - Original Message -
 From: Johnson, Kirk [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Tuesday, May 28, 2002 2:55 PM
 Subject: RE: [PHP] comment followed by ? fails to parse
 
 
   Which begs the question, why does PHP see a '?' in a 
 '//' comment line,
 but
   not in a multi-line comment, e.g., /* ? */ ?
  
-Original Message-
From: Ed Gorski [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 28, 2002 2:46 PM
To: Leotta Natalie (NCI/IMS); 'Jonathan Rosenberg'; 
 Johnson, Kirk;
[EMAIL PROTECTED]
Subject: RE: [PHP] comment followed by ? fails to parse
   
   
No the parser sees the ? after a // because it needs to see
when to quit
out (unlike traditional, compiled languages) but it won't
have this same
effect in a string literal.
   
ed
  
   --
   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 General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] Re: Dynamically check radio buttons

2002-08-01 Thread Johnson, Kirk

If you made an array for your buttons, then you could use PHP's looping
constructs to process the array. Write the input tag like this:

INPUT NAME=Game[1] VALUE=1Chicago

The processing code will then have access to the array $Game indexed by the
game number, e.g., $Game[1].

Good luck!

Kirk


 -Original Message-
 From: Shew [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, August 01, 2002 9:19 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Re: Dynamically check radio buttons
 
 
 OK, changed the subject to what I think it should be about.
 
 Anybody?
 
 Shew [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  Hi - I'm a TOTAL php NEWBIE - my 1st bit of code!!!.
 
  Basically the input form page has 17 sets of radio buttons, each
  representing one game with 2 options - team 1 and team 2. 
 What I want to
 do
  is a better way of checking each radio button value instead 
 of using an if
  statement for each. This code doesn't really work - it 
 finds that vars
  ALWAYS exist.
 
  IE:
 
  INPUT NAME=Game1 VALUE=1Chicago
  INPUT NAME=Game1 VALUE=2whatever
 
  INPUT NAME=Game2 VALUE=3Minny
  INPUT NAME=Game2 VALUE=1Nobody
 
  Code above is processed by the following code:
 
  for ($GameIdx = 1; $GameIdx = 17; $GameIdx++) {
   /* instead hardcoding each radio button name - just do it
 programmatically
  by concatenating / creating the name */
   $frmGame = Game + $GameIdx;
   if ($frmGame) {
/* U want to check if the length is 5 or 6 bytes because 
 it could be
  game1 or game14 */
$Length = strlen($frmGame);
if ($Length == 5) {
 $GetNumber = 1;
}
else {
 $GetNumber = 2;
}
 
$GameID = intval(substr($frmGame, $Length - $GetNumber, 
 $GetNumber));
print Game --- $GameIdx - $frmGame - $GetNumber - $GameID BR;
  if ($GameID == $GameIdx) {
 print Yeah Match - $GameID = $GameIdx BR;
 /* OK, here is where U want to do the actual insert */
}
   } /* $frmGame endif */
  }
 
  ?
 
 
  Thanks
 
 
 
 
 
 
 -- 
 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] Re: Sessions...

2002-08-15 Thread Johnson, Kirk

 Kondwani Spike Mkandawire wrote:
  Am I mistaken to assume that a Session is automatically
  destroyed if a Window Browser is closed?

*Eventually* it is destroyed, but not at the instant the browser is closed.
See the session.gc_maxlifetime and session.gc_probability settings in
php.ini. If the session file is not accessed for a specified period of time,
then it is deleted.

Kirk

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




RE: [PHP] Project Suggestions

2002-09-04 Thread Johnson, Kirk

 Things I want to do:
 
 - convert this site into a dynamic one, where I can very easily
   change the layout of things whenever it comes time to revamp
   the site into a new design.

I have not worked with any of the templating systems, but here is a
home-grown one. Separate the page HTML into 3 pieces. Two of the pieces form
the shell, which is the HTML that is constant across groups of pages. The
third piece is the HTML that varies with each page. Build the two shell
files so that they form an empty td, into which the dynamic piece goes:

?
include(htmlShellHead.inc);
buildCurrentPage(); // or another include()
include(htmlShellFoot.inc);
?

Then, if you need to add a right-hand sidebar, for example, you just edit
the shell files, and all the pages using that shell get updated at once.
Simple way to update the look and feel across the whole site.

 - insert all the products, their prices and related data into
   a database (which would tie in with the above item, maybe by
   means of functions, say, 'function 
 show_product('inkjet_prints')'

Sounds good.

 - make it so that those responsible for price changes can make
   their own changes to the database, so I don't have to deal with
   it every time.

Making your own forms is probably best. We have done this with Java applets,
which may be overkill for you. The main thing to think about here is
authentication: making sure people can access only their own data and nobody
else's. Also, make sure everyone involved shares a clear idea of who bears
responsibility for update mistakes. If the user has the ability to change
their data, they have the ability to screw it up. Make a clear oversight
plan: how much reviewing of their changes you will do before the changes go
live, etc.

Good luck!

Kirk

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




RE: [PHP] Re: unless something...

2002-09-12 Thread Johnson, Kirk

There is no 'unless' in PHP, so you just have to grind it out. If you are
searching for known strings, rather than string *patterns*, use the strstr()
function here: http://www.php.net/manual/en/function.strstr.php.

So, something like:

if(!strstr($c,$a)  !strstr($c,$b)) {
  bla;
  exit;
}

Completely untested ;) If you are looking for patterns, see preg_match(),
linked to from the link above.

Kirk

 Magnus Solvang [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  I'm used to the unless-statement in perl... How do I do this:
 
if string A or B are NOT in string C, then do something and quit.
 
  In perl, I would do this:
 
  unless ($c =~ /$a|$b/) {
blabla
exit 0
  }

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




RE: [PHP] Re: unless something...

2002-09-12 Thread Johnson, Kirk

Indeed, it is a negated something or other.

 -Original Message-
 From: David Buerer [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, September 12, 2002 11:23 AM
 To: '[EMAIL PROTECTED]'
 Subject: RE: [PHP] Re: unless something...
 
 
 True, but isn't unless just a negated while?

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




RE: [PHP] Getting my head around nulls.

2001-09-24 Thread Johnson, Kirk

 And remember 0 as a number is as important as any other number.

I wish the rest of the world saw it that way! But not so...

You may want to look at MySQL's IS_NULL function for retrieving data. Other
than that, I don't have any good advice. It seems that if you retrieve a
NULL from the database and try to assign it to a PHP variable, that variable
gets destroyed. AFAIK, yes, you need a bunch of data checks, both putting
data in and pulling it back out.

Kirk

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
 Sent: Monday, September 24, 2001 8:59 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Getting my head around nulls.
 
 
 First recap (been doing RDBMS stuff for over 10 years so 
 reckon this is
 correct).  Nulls and blank are NOT the same in RDBMS (in fact 
 there are
 actually several types of nulls).  MySQL implements this 
 correctly (Unlike
 Oracle which treats null and blank the same).  Up to now I am 
 OK but when
 it comes to codeing in PHP I am not to sure about best practice.
 
 The app I am working on for number datatypes inserts 0 if no data is
 entered in form.  I can see why, I am inserting a blank into 
 the database
 and MySQL goes (Hang on this is a number fields and as you are not
 inserting NULL you obviously mean zero).  So I guess I need to do some
 conditional stuff so the blanks are not actually inserted or 
 put null into
 the PHP variable and insert this (Can PHP vars be null but 
 exist?).  Or is
 their another option?
 
 The second half of the issue is getting data from the 
 database.  I added a
 couple of columns to database but then I tried to retrieve them as
 $row[index]. I got a variable x douse not exist error.  This 
 really through
 me until I realised it was because the value in the database 
 was null and
 it kind of makes sense not to create the var for nulls 
 (although it makes
 coding a pig).  So again, it seems I need to do a lot of isset() stuff
 which is going to be a pain.  Any other insight.
 
 Nulls with varchar/char types are not so much of a problem as 
 long as you
 don't mind all fields in the database being blank rather than 
 null after
 you first insert data into them.
 
 It would be good to get peoples advice on this.
 
 And remember 0 as a number is as important as any other number.

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




RE: [PHP] Sessions just don't work on my machine. (Trying this again)

2001-09-24 Thread Johnson, Kirk

Perhaps you could post the [Session] section of your php.ini file. It
appears that session.cookie_lifetime is not set to 0, which is what you want
for a session cookie. Perhaps we can find another setting that needs a
change.

Kirk

 Sessions just don't work on my machine...

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




RE: [PHP] Sessions just don't work on my machine. (Trying this again)

2001-09-24 Thread Johnson, Kirk

 After reloading IE on the PC now the SID constant doesn't 
 echo anything at
 all.

SID is always defined on the first page request. It is only defined on later
page requests if cookies are disabled in the browser. 

Kirk

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




RE: [PHP] Sessions just don't work on my machine. (Trying this ag ain)

2001-09-24 Thread Johnson, Kirk

Try these changes:

session.cookie_lifetime   = 0
session.use_trans_sid = 1

Also, what version of PHP are you using?


 My php.ini:
 
 [Session]
 session.save_handler  = files
 session.save_path = /tmp
 
 session.use_cookies   = 1
 session.name  = PHPSESSID
 
 session.auto_start= 0
 session.cookie_lifetime   = 3600
 
 session.cookie_path   = /
 session.cookie_domain =
 session.serialize_handler = php
 
 session.gc_probability= 1
 
 session.gc_maxlifetime= 1440
 
 session.referer_check = 0
 
 session.entropy_length= 0
 session.entropy_file  =
 ; session.entropy_length= 16
 ; session.entropy_file  = /dev/urandom
 session.cache_limiter = nocache
 
 session.cache_expire  = 180
 

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




RE: [PHP] Sessions just don't work on my machine. (Trying this ag ain)

2001-09-24 Thread Johnson, Kirk

OK, do you have access to your /tmp directory? If so, close your browser,
then open it and request your index page. Now sort the files in /tmp by
creation time, to find the newly created session file. Look at its contents,
and see if the 2 variables have values assigned to them in the file. Do this
before you click submit on index.

BTW, I don't think $PHPSESSID is ever defined on the first request. Instead,
you can do this to see the new session ID on the first page. That will also
help you find the correct session file to inspect.

echo session id is  . session_id() . br\n;

Kirk

 -Original Message-
 From: Thomas Deliduka [mailto:[EMAIL PROTECTED]]
 Sent: Monday, September 24, 2001 11:19 AM
 To: PHP List
 Subject: Re: [PHP] Sessions just don't work on my machine. 
 (Trying this
 ag ain)
 
 
 On 9/24/2001 1:18 PM this was written:
 
  OK, now the session ID is getting passed like it should. 
 Now for the two
  missing variables. Try moving the two assignment 
 statements ahead of the two
  session_register() calls - assign, then register. I have 
 never seen this
  make a difference, but the pros on this list say that is 
 the way it needs to
  be done.
  
  Done, I switched the four lines around.
 
 Same result.
 -- 
 
 Thomas Deliduka
 IT Manager
  -
 New Eve Media
 The Solution To Your Internet Angst
 http://www.neweve.com/
 
 
 
 -- 
 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 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]




RE: [PHP] Getting my head around nulls.

2001-09-25 Thread Johnson, Kirk

 SELECT * from some_table WHERE some_field IS NULL;
 
 
 Andrey Hristov
 -- 
 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]

Thanks for correcting my misspelling, Andrey, IS NULL not IS_NULL.
Another thing to look at, Ben, is IFNULL(). I would give you an example, but
I never got it to work like I thought it should ;) I think it is supposed to
return an alternate value for NULLs.

Kirk

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




RE: [PHP] Can I rely on session.gc_maxlifetime?

2001-09-25 Thread Johnson, Kirk

 So, no matter if the user is still working, the session will be 
 destroyed. I mean session.gc_maxlifetime isn't 
 session.gc_maxIDLEtime? 

Every time the user requests a page in an application using sessions, the
session file's access time gets updated. The garbage collection routine
looks at that access time. If the file hasn't been accessed less than
gc_maxlifetime seconds ago, the gc routine deletes the session file. Another
factor comes into play, tho, that is session.gc_probability. This sets how
often the gc routine is launched. The default value is 1%, which means that
on 1 of every 100 page requests the gc routine launches. So, if the server
is not getting many hits, it can be a long time before the gc routine
launches, so the session file can hang around longer than gc_maxlifetime.

Kirk

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




RE: [PHP] Can I rely on session.gc_maxlifetime?

2001-09-25 Thread Johnson, Kirk

 I thought that php works as you wrote. But sometimes I find that much 
 older session are still alive. I have 1440secs for maxlifetime, and 
 if I bookmark a page with the session id I can use it till days or 
 even weeks (I haven't tested longer time period :)) 

Are old files being re-used, or instead, is the session ID in the bookmark
causing PHP to create a new session file with that old ID? That has been my
experience: if a bookmark contains the session ID, PHP will re-use the old
session file if it still exists, but if the old file has been cleaned up,
then PHP will create a new session using the old ID in the bookmark.

Do you have access to the /tmp directory? If so, try to track this.

Kirk

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




RE: [PHP] Globals and HTTP_SESSION_VARS variables.

2001-09-26 Thread Johnson, Kirk

 Is here anyway to make a variable like $var not the same than
 $HTTP_SESSION_VARS[var], when register_globals=1?. (where 
 $var is in the
 script scope).
 
 I read in a changelog that this is relatively recent (make 
 $var the same
 than $HTTP_SESSION_VARS[var]).

I'm not sure what was changed. As far as I can see, the global version of
$test and $HTTP_SESSION_VARS[test] still reference different memory
locations, and they are not the same variable, *while on the current page*.
However, if register_globals is on, then the global version gets saved to
the session file, and will be in the $HTTP_SESSION_VARS array on the next
page.

?
session_start();
$test=globalversion;
session_register(test);
$HTTP_SESSION_VARS[test] = arrayversion;
echo global version of test = $testbr;
echo sess array version of test = .$HTTP_SESSION_VARS[test].br;
?

Kirk

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




RE: [PHP] account for missing/optional arguments in functions?

2001-10-25 Thread Johnson, Kirk

Two php functions may help, func_num_args() and func_get_args(). For
example,

  $numargs = func_num_args();
  $arg_list = func_get_args();

Kirk

 -Original Message-
 From: Kurt Lieber [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, October 25, 2001 4:58 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] account for missing/optional arguments in functions?
 
 
 Is it possible to account/trap missing arguments in functions?

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




RE: [PHP] checkboxes

2001-10-26 Thread Johnson, Kirk

onClick

Kirk

 -Original Message-
 From: Boaz Yahav [mailto:[EMAIL PROTECTED]]
 Sent: Friday, October 26, 2001 3:03 PM
 To: PHP General (E-mail)
 Subject: [PHP] checkboxes
 
 
 does anyone know the HTML event that knows when a checkbox has been
 checked and unchecked?
 

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




RE: [PHP] User Authentication against remote authentication server [ LDAP ]

2001-10-29 Thread Johnson, Kirk

Thanks for the link, Kurt. Can you also point to any authentication code
examples, or further discussion? The user comments in the manual suggest
there are at least a couple ways to code stuff, ldap_compare vs ldap_bind.
Any additional help appreciated.

TIA

Kirk

 -Original Message-
 From: Kurt Lieber [mailto:[EMAIL PROTECTED]]
 Sent: Monday, October 29, 2001 3:58 PM
 To: PHP General List
 Subject: Re: [PHP] User Authentication against remote authentication
 server [ LDAP ]
 
 
  However, if the authentication server is not the web 
 server, instead,
  it is a remote independent server. How can we manage the user
  authentications at the web server side?
 
 Use LDAP.  
 
 http://www.php.net/manual/en/ref.ldap.php

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




RE: [PHP] User Authentication against remote authentication serve r [ LDAP ]

2001-10-31 Thread Johnson, Kirk

Thanks very much, Stig, very helpful! We are just scouting the technology
right now, so my more precise questions will come later ;) We will be using
SSL. Given that, it looks to me like decision maker mode is the way to go?

Kirk

 -Original Message-
 From: Stig Venaas [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, October 31, 2001 3:06 AM
 To: Johnson, Kirk
 Cc: PHP General List
 Subject: Re: [PHP] User Authentication against remote authentication
 serve r [ LDAP ]
 
 
 On Mon, Oct 29, 2001 at 04:54:37PM -0700, Johnson, Kirk wrote:
  Thanks for the link, Kurt. Can you also point to any 
 authentication code
  examples, or further discussion? The user comments in the 
 manual suggest
  there are at least a couple ways to code stuff, 
 ldap_compare vs ldap_bind.
  Any additional help appreciated.
 
 I might be able to help if you have some more precise questions, but
 basically there are two ways LDAP can be used. You can either use it
 as a data store or you can have LDAP make the authentication decision
 for you. If you want the user to supply username and password, the
 authentication can be done as follows:
 
 As data store:
 
 Hopefully the passwords are stored encrypted. Then there are two ways.
 If the password is stored encrypted with some unknown salt where the
 salt is stored together with the password (like the traditional UNIX
 way), your PHP script retrieves the encrypted password from LDAP,
 checks the salt, encrypts the user supplied password using the salt,
 and compare the two. If you don't use a salt you can encrypt the
 password from the user and just do an ldap_compare to check that it's
 the same as in the LDAP server. You get better security by 
 not allowing
 people to read the encrypted passwords from LDAP. To store passwords
 encrypted in LDAP, SHA1 might be a good choice, PHP has this.
 
 As decision maker:
 
 You can simply bind to the server on behalf of the user, you use the
 user supplied username and password as arguments to ldap_bind(). If
 the bind succeeds, you let the user access your stuff. In this case
 you should consider using SSL/TLS for talking to the server.
 
 There are other ways to authenticate with LDAP, RFC 2829 gives a good
 overview. You can find it at for instance
 http://www.ietf.org/rfc/rfc2829.txt
 
 I could go into more detail, but to write a complete general overview
 would be a lot of work. You might also have a look at a really short
 presentation I've made at
 http://www.uninett.no/info/seminar/gnomis/ldapauth.pdf
 
 Stig
 

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




RE: [PHP] Re: Where are lists of PHP's predefined constants and keywords?

2001-11-01 Thread Johnson, Kirk

Thank you Jim, Mike, CC and Philip.

Geez! I thought I did a search, but maybe I imagined that...

LOL

Kirk

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




RE: [PHP] Destroying Ssessions

2001-11-01 Thread Johnson, Kirk

session_destroy() works fine for me - it deletes the session file after the
script finishes. I have never used the session_name() function. I am
wondering if it is possible that the server is confused about what session
needs to be destroyed because of the way session_name() is being used
here

I am also curious about the session_write_close() call. What is left to
write after the session_unset() call?

Sorry I can't give you anything more specific.

Kirk

 -Original Message-
 From: Richard Baskett [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, November 01, 2001 4:03 PM
 To: PHP General
 Subject: [PHP] Destroying Ssessions
 
 
 Unusual that I didnt even get one response, so I shall try again! :)
 
 Ok why does this not work?
 
 session_name(adminid);
 session_start();
 unset($sess);
 session_unset();
 session_destroy();
 session_write_close();
 $sess = 0;
 
 etc etc etc etc etc etc..
 
 After all that is executed I take a look at the session file 
 and what do I
 see?  All the session variables still there... and the file 
 still there
 also!  How can I get rid of them?
 
 Rick

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




RE: [PHP] PHP Highlighting Text Editors

2001-11-02 Thread Johnson, Kirk

Here's a link http://www.itworks.demon.co.uk/phpeditors.htm 

Got this link at http://www.php.net/links.php#TOP.

Kirk

 -Original Message-
 From: Chris Bailey [mailto:[EMAIL PROTECTED]]
 Sent: Friday, November 02, 2001 8:56 AM
 To: TD - Sales International Holland B.V.; [EMAIL PROTECTED]
 Subject: RE: [PHP] PHP Highlighting Text Editors
 
 
 Also, Visual SlickEdit works on Windows (in addition to Linux 
 as mentioned),
 and FreeBSD, OS/390, and a slew of others.
 
 There is a list of editors out there somewhere, I know 
 someone has posted a
 link before.  There are many editors that do this.
 
 -Original Message-
 From: TD - Sales International Holland B.V. [mailto:[EMAIL PROTECTED]]
 Sent: Friday, November 02, 2001 10:32 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] PHP Highlighting Text Editors
 
 
 Hey there,
 
 these are the editors given by you guys, thanks for the 
 replies. If somebody
 could put this online on php.net it would be great. If you 
 have anything to
 add please feel free to email me.
 
 Windows
 
 UltraEdit
 ActiveState Komodo
 EditPlus
 HTML-Kit
 Homesite
 
 
 
 
 Linux/Unix
 
 Nedit
 (x)emacs
 Visual SlickEdit
 vim/gvim
 ActiveState Komodo
 Beaver
 Cooledit
 KWrite (included with KDE, PHP highlighting since KDE 2.2.1 
 maybe 2.2.0 also
 haven't used that version 2.1.2 doesn't support PHP)

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




RE: [PHP] Cookies won't stick

2001-11-02 Thread Johnson, Kirk

If the cookie lifetime is set to 0, then it is a session cookie, and it
persists until the browser is closed.

Kirk

 -Original Message-
 From: jennyw [mailto:[EMAIL PROTECTED]]
 Sent: Friday, November 02, 2001 12:48 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Cookies won't stick
 
 
 For some reason, when I tried using setcookie(), cookies 
 wouldn't stick
 around. When I added an expiration time, cookies started 
 sticking around,
 but ... I thought that if you didn't provide an expiration they were
 supposed to stick around indefinitely?
 
 Thanks!
 
 Jen 

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




RE: [PHP] HTTP_SESSION_VARS

2001-11-08 Thread Johnson, Kirk

 Regarding the same topic of session management, I am using 
 PHP 3.09 and when
 I call session_start() or $HTTP_SESSION_VARS['someVariable]
 I get :
 
 Fatal error: Call to unsupported or undefined function session_start()
 
 
 So, my question is that: Is there any session management in 
 PHP3.09? If the
 answer is no, what weould be an alternative?

Native session management arrived with PHP 4.0. If you are stuck with 3.x,
you might look at PHPLIB, which has a session management class. The best
bet, IMHO, is to upgrade to 4.x, tho.

Kirk

-- 
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] Security question: getenv()

2001-11-09 Thread Johnson, Kirk

Happy Friday!

I don't know anything about the innards of the PHP/Apache relationship. I am
wondering if there is a security advantage to using the getenv() function to
access an environment variable, instead of using the $HTTP_SERVER_VARS
array, or, if register_globals is on, the global version of the variable.
Using $SERVER_NAME as an example, and assuming register_globals is on, if

$foo = gentenv(SERVER_NAME);
$bar = $HTTP_SERVER_VARS[SERVER_NAME];

are $foo, $bar and $SERVER_NAME guaranteed to have the same value? Can a
cracker poison one of these but not the other? Does getenv() get the value
from Apache or PHP's namespace?

You know what I'm getting at, right? ;)

TIA

Happy Friday!

Kirk

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




RE: [PHP] variable issue

2001-11-09 Thread Johnson, Kirk

The else clause can be removed, since it is not doing anything. What is the
error message?

Kirk

 Hey everyone, I need some help with a variable issue. How can 
 I delcare a variable and then if a url variable of the same 
 name is present use that value instead?
 
 this is what I have:
 if(!$dte)
 {
 $dte=date(j, time()+$ctime);
 }
 else
 {
 $dte=$dte;
 }
 and this causing an error in the 'if' expression.

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




RE: [PHP] Eval()??? A variables contents?

2001-11-09 Thread Johnson, Kirk

http://www.php.net/manual/en/function.eval.php

Kirk


 -Original Message-
 From: Christopher Raymond [mailto:[EMAIL PROTECTED]]
 Sent: Friday, November 09, 2001 1:11 PM
 To: PHP List
 Subject: Re: [PHP] Eval()??? A variables contents?
 
 
 on 11/9/01 2:01 PM, Kurt Lieber at [EMAIL PROTECTED] wrote:
 
  What you're doing doesn't make any sense.  If it were to 
 work, it would look
  like the following:
  
  ?PHP ?PHP Query_Database( $category );? ; ?,
  
  or something similar.  I think what you want to do is:
  ?php
  $content = query_database($category);
  echo $content;
  ?
  
  that's using psuedo-code, of course.  You'll want to 
 substitute correct php
  syntax for returning database results.
 
 
 
 
 Kurt:
 
 I understand where you are coming from, and I appreciate your answer.
 However, I'm trying to get PHP to parse commands that are stored in a
 variable because I'm passing those commands to a function. Inside the
 function, it needs to evaluate the commands stored in the variable.
 
 Does you solution solve that or does my description clarify my problem
 better?

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




RE: [PHP] Re: is_null misses spaces... another solution?

2001-11-13 Thread Johnson, Kirk

A space is a valid string. Are you sure there is a space?

?
$a = ' ';
if($a == '') {
  echo a is blankbr;
} else {
  echo a is not blankbr;   // this is printed
}

if(is_null($a)) {
  echo a is nullbr;
} else {
  echo a is not nullbr;   // this is printed
}
?

Kirk

  I need to check variables for blank values but it appears 
 that is_null and
  == return true if there is a space.
 
  Any other suggestions?

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




RE: [PHP] What version did $PHP_SELF still work?

2001-11-15 Thread Johnson, Kirk

Have you looked at what is in $HTTP_SERVER_VARS['PHP_SELF']? Does this array
element even exist? I am wondering if there is an Apache setting that
affects this, but I sure don't know.

Kirk

 -Original Message-
 From: John Steele [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, November 15, 2001 6:36 AM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP] What version did $PHP_SELF still work?
 
 
 Hi Mike and Jim,
 
   From my earlier message [Re: PHP 4.0.6 $PHP_SELF empty?]:
 
   No, I updated my php.ini manually (just to change the zend 
 optimizer and
 add the DBG debugger.  These two lines from php.ini haven't 
 changed for sure:
 
 variables_order = EGPCS;
 register_globals = On;
 
   According to phpinfo, $PHP_SELF is set, but simply empty!
 
   I'm fully aware of the scope issues, and $GLOBALS[PHP_SELF] 
 returns the same thing as $PHP_SELF (= ''), and these aren't 
 withing classes, functions or anything like that.  It's as 
 simple as this not working in somefile.php:
 
 form action=?php echo $PHP_SELF ? method=POST
   input ...
 /form
 
   I've looked over every single line in my php.ini, the only 
 thing changed (checked with diff) is adding the debugger info 
 for DBG.  That doesn't do it either, I replaced it with my 
 original from PHP4.0.2, no go either.
 
 Help!
   John
 
 $PHP_SELF still works fine, just make sure that 
 register_globals is on.
 
 Also, don't forget that you must define global $PHP_SELF if 
 you need to 
 use it within a function, like so:
 
 function foo() {
 global $PHP_SELF;
 }
 
 Mike
 
 John Steele wrote:
 
 Hello,
 
   I'm trying this again with a different header.  After 
 installing PHP4.0.6 
 $PHP_SELF is set (empty), and this is breaking many scripts 
 of mine (and 
 others).  I can't seem to find any mention of this in the 
 commented manual, 
 or anywhere else for that matter.
 
   I can try and install an earlier version, but I'm not 
 sure which one (I'd 
 like to use DBG though).  I'd hate to have to go back to 4.0.2!
 
 Any advice welcome!
   John

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




RE: [PHP] parse error when requiring

2001-12-06 Thread Johnson, Kirk

There is a semi-colon missing on the session_start() line. PHP can't pin
down the exact line number of an error where the error is a missing
terminator.

Kirk

 -Original Message-
 From: Oosten, Sjoerd van [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, December 06, 2001 8:44 AM
 To: 'Andrew Forgue'
 Cc: '[EMAIL PROTECTED]'
 Subject: RE: [PHP] parse error when requiring
 
 
 Parse error: parse error in 
 /home/sites/site139/web/EIA/sessionstart.php on
 line 10
 
 It's strange that line number 10 doesn't exist!

 On Thu, 2001-12-06 at 06:51, Oosten, Sjoerd van wrote:
  I have a question about require...
  
  I have a session_start() on top of every page and an 
 if-else construction.
  ?
  session_start()
  if ($SessieEIA-Login == 1) 
  {  
  ?
 

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




RE: [PHP] Cookie Retrieval

2001-12-11 Thread Johnson, Kirk

I think this approach should work as long as register_globals is set to 'on'
in php.ini. If it isn't, then reference the cookie as
$HTTP_COOKIE_VARS['poccd_session'].

Kirk

 Can someone tell me if there is a bit of code I need to put 
 on pages so I
 can retrieve a cookie.
 The cookie was set with the following code:
 
 //(D) Set Cookie
$encoded_login = encode_string($login);
if ( $remember == yes ){
 // set login to expire in 1000 days
 $time = (time() + ( 24 * 3600 * 365 ));
 SetCookie ( poccd_session, $encoded_login, $time);
}else{
 SetCookie ( poccd_session, $encoded_login );
}
 
 I am trying to retrieve it with the following code (for 
 testing purposes
 only, right now):
 
 if($poccd_session)
 {
  header(location: index.php);
 }else{
  print(The cookie plan didn't work.);
 }
 
 Any suggestions would be appreciated.
 
 Steve Osborne
 Database Programmer
 Chinook Multimedia Inc.
 [EMAIL PROTECTED]

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




RE: [PHP] flushing contents to the browser

2001-12-12 Thread Johnson, Kirk

If you redirect into the query page using a META refresh, you can display
the message:

  echo(HTMLHEADMETA HTTP-EQUIV=\refresh\
CONTENT=\0;url=your_url_here.php\/HEADBODYprocessing... please
wait/BODY/HTML);

The message will display until the query page finishes.

Kirk

 -Original Message-
 From: DigitalKoala [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, December 12, 2001 2:17 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] flushing contents to the browser
 
 
 hi folks,
 
 i'm trying to display something like processing... please 
 wait on a web
 page whilst a rather hefty database query is being run.
 
 i don't want to refresh the page so i've been attempting to 
 use flush and
 ob_start, together with some css stuff to try and do this.. 
 but no luck so
 far - as once the buffer has been flushed, i can't retrieve 
 the content..
 
 does anyone have any nifty ideas?
 
 many thanks
 dk
 
 
 
 -- 
 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 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]




RE: [PHP] flushing contents to the browser

2001-12-12 Thread Johnson, Kirk

 I tried this... it just continually refreshes ... and doesn't 
 ever re-direct
 to my page..  am i missing something?

If the URL is correct, it should work.

The *first* page should have this code. The variable $query_page contains
the URL to the *next* page, which contains the database query code:

echo(HTMLHEADMETA HTTP-EQUIV=\refresh\
CONTENT=\0;url=$query_page\/HEADBODYprocessing...please
wait/BODY/HTML);

   -Original Message-
   From: DigitalKoala [mailto:[EMAIL PROTECTED]]
   Sent: Wednesday, December 12, 2001 2:17 PM
   To: [EMAIL PROTECTED]
   Subject: [PHP] flushing contents to the browser
  
  
   hi folks,
  
   i'm trying to display something like processing... please
   wait on a web
   page whilst a rather hefty database query is being run.
  
   i don't want to refresh the page so i've been attempting to
   use flush and
   ob_start, together with some css stuff to try and do this..
   but no luck so
   far - as once the buffer has been flushed, i can't retrieve
   the content..

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




RE: [PHP] PHP_SELF

2001-07-30 Thread Johnson, Kirk

Ideal scenario, a blank form is presented to the 
 user, and when 
 the form is submitted, do the logic check and act accordingly.  Is it 
 possible using $PHP_SELF as the target, or do I have to use 2 
 files: a 
 form 'front end' with the php logic in the 'backend'??

Yes, this is possible, and commonly done. Just add some logic to determine
if the page is being displayed for the first time, or, if it is being posted
to. An easy way to check this is to see if $HTTP_POST_VARS[] has any
elements. If it does, the form has been posted, so process the form data.

Kirk 

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




RE: [PHP] Attitude of B van Ouwerkerk

2001-07-31 Thread Johnson, Kirk

Not for this list specifically, and not as well used as it might be ;)

http://www.php.net/manual/en/faq.php

Kirk


 what is up with a faq for this list? is there one?

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




RE: [PHP] Re: FAQ

2001-08-01 Thread Johnson, Kirk

 I know of 3 php faqs (I know there are tons), maybe we should 
 make a faq on how to
 find faqs? :)
 
 http://alt-php-faq.org/
 http://www.php.net/manual/en/faq.php
 http://php.faqts.com

Rasmus, do you think there would be any value in adding these 3 links to the
PHP General Mailing List trailer that is added to each post?

Just a thought.

Kirk

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




RE: [PHP] Re: FAQ

2001-08-01 Thread Johnson, Kirk

 Does anyone know what PHP stands for?

PHP = People Hate Perl.

No, that's just a joke, no flames please :)

PHP Hypertext Preprocessor.

Kirk

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




RE: [PHP] HTTP_SESSION_VARS

2001-08-01 Thread Johnson, Kirk

 while (list ($key, $val) = each ($HTTP_session_VARS)) {
 echo $key = $valbr;
 }
 
 i get the error -
 
 Warning: Variable passed to each() is not an array or object 
 in /var/www/html/adult/func.php on line 5

Change HTTP_session_VARS to HTTP_SESSION_VARS, since variable names are
case-sensitive.

Kirk

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




RE: [PHP] How to Compare dates?

2001-08-03 Thread Johnson, Kirk

 Can someone tell me how to properly compare the value 
 returned from the
 db to see if it is blank ?

 if ( (  
 mysql_result($db_result,$db_record,'order_date')=00)
 ) ) {


Two things, Jack. Enclose 00 in quotes, since it is a string,
but more importantly, use '==' instead of '=' for comparison. I hate it when
I do that :)

Kirk 

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




RE: [PHP] Include

2001-08-07 Thread Johnson, Kirk

 I try to use include() and require() an that what i get:
 The path is 100% good.
 
 Warning: Failed opening '../inc/menu.inc' for inclusion 
 (include_path='') in

Make sure that file permissions allow 'nobody' to view the file.

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




RE: [PHP] 3rd include

2001-08-08 Thread Johnson, Kirk

 Has the 3rd include bug (where variable definitions ar 
 lost at the 3rd
 include), been fixed yet?
 
 --Drew Vogel

Drew, I hadn't heard about this one. If you find anything, would you please
post back your results to the list?

TIA

Kirk

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




RE: [PHP] include, chmod, password files

2001-08-08 Thread Johnson, Kirk

 If I have a file called db.inc with, for example, this:
 
 However, any user on the system can read db.inc cause its 
 chmod'd 0644.
 If I chmod db.inc 0600 or even 0640, index.php can not include it.
 
 How do I go about protecting my files from being read by 
 users on the system?

Below is how Rasmus recommends this be handled.

Kirk

The right way to fix this is to add a rule to your Apache configuration
that looks like this:

Files ~ \.inc$
Order allow,deny
Deny from all
/Files

That will simply prevent any direct access at all to your .inc files.
Making the .inc files simply be parsed by PHP could still be a problem as
they could be called out of context.

-Rasmus

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




RE: [PHP] Session problem

2001-08-08 Thread Johnson, Kirk

   ?php
   session_start();
   global $count;
   session_register (count);
   $count++;
   ?
  
   Hello visitor, you have seen this page ?php echo
   $HTTP_SESSION_VARS[count]; ? times.p

There was a bug in PHP in versions prior to 4.0.6: $count and
$HTTP_SESSION_VARS[count] did not reference the same value while on the
*current* page. Try this:

?php
session_start();
$count++;
session_register (count);
?
Hello visitor, you have seen this page ?php echo $count; ? times.

Kirk

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




RE: [PHP] Session problem

2001-08-08 Thread Johnson, Kirk

 What it looks like it is doing to me, if you hit the script 
 and reload it a
 bunch, is it creates a session, sticks with it for a while, 
 then dumps it ..
 it then creates another session, starts over at 1, and begins 
 counting up..
 then sometimes it will see the old session, and go back to it ..

Sorry, I'm stuck. I did a cut and paste of the code I sent and it works
perfectly:

Hello visitor, you have seen this page 100 times.

I am using IE 5.5. There have been similar reports of session weirdness from
time to time when using Netscape 4.x. It is hard to see how the browser
could be doing this, but maybe there is a sporadic bug in its cookie
handling.

Try changing browsers and see if you still see the problem. I really don't
have any suggestions for fixing it, tho. Sorry.

Kirk

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




RE: [PHP] Session problem

2001-08-08 Thread Johnson, Kirk

 What it looks like it is doing to me, if you hit the script 
 and reload it a
 bunch, is it creates a session, sticks with it for a while, 
 then dumps it ..
 it then creates another session, starts over at 1, and begins 
 counting up..
 then sometimes it will see the old session, and go back to it ..

One final long shot: are you running the application on a load-balanced
server farm? That can cause problems unless things are set up correctly.

Kirk

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




RE: [PHP] register_globals odd behaviour?

2001-08-21 Thread Johnson, Kirk

 I just come across and odd behaviour with the register_globals and
 session handling. The problem is that when I set the register 
 globals to
 on I cannot access the session_variables through the associative array
 HTTP_SESSION_VARS. The manual says explicitly that with track_vars and
 register_globals both on the array and the vars will point to 
 the same. 

I believe this was a bug in all versions prior to 4.0.6, globals and
$HTTP_SESSION_VARS did *not* reference the same value while on the current
page, in spite of what the manual says. So, either upgrade to 4.0.6, or use
the global version of session variables rather than the $HTTP_SESSION_VARS
array.

Kirk

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




RE: [PHP] sessions

2001-08-21 Thread Johnson, Kirk

 session_start();
 session_unregister(val_1);
 session_register(val_1);
 
 I am doing this to clear the contents of val_1 before I use it again.
 Needless to say its not working. val_1 always contains the 
 same value until

session_registering()'ing a variable just puts it in a list of names of the
session variables. session_unregister() just removes the name from the list.
Neither function affects the variable's value.

To clear the variable's value, just assign it to blank, or call unset() on
it, e.g.,

$val_1 = ;
unset($val_1);

There is no need, or use, in unregistering it, then registering it again.

Kirk

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




RE: [PHP] Sessions, Is this behavior by design?

2001-08-21 Thread Johnson, Kirk

 apparently, session_is_registered and isset return null if 
 they evaluate to
 false.  I was expecting boolean true and false return values, 

What you were expecting is correct, boolean true/false. However, it appears
that PHP converts these values to strings during the echo. true converts to
the string 1, while a false string is the empty (null) string.

?
$a = true;
echo a is $a br;
$a = false;
echo a is $a br;
?

Kirk

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




RE: [PHP] Session Headaches

2001-08-21 Thread Johnson, Kirk

Start with this correction on page1.php:

   if (session_is_registered != 1) {

should be

   if (session_is_registered(FailedLogins) != 1) {

We'll go from there :)

Kirk
 

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




RE: [PHP] Session Headaches

2001-08-21 Thread Johnson, Kirk

OK, the session_is_registered() thing is correct.

 It seems like the gist of the problems is that different 
 pages can't seem to
 modify the same session variables.

This is definitely not the case. Two things to try:

1. In page2, put some logic around the session_register(FailedLogins);,
otherwise you re-register on every visit. I don't think this affects the
variable's value, but it is definitely wasted cycles.

2. If register_globals is set to on in php.ini, and you are using a PHP
version earlier than 4.0.6, then the code below probably won't work. If this
is the case, just use the global variable, $FailedLogins, instead of
$HTTP_SESSION_VARS[FailedLogins] everywhere.

Kirk

 -Original Message-
 From: Johnny Nguyen [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, August 21, 2001 1:58 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Session Headaches
 
 
 I have two pages page1.php and page2.php
 
 here is the code for page1.php:
 
 ?
   session_start();
   if (session_is_registered != 1) {
   session_register(FailedLogins);
   $HTTP_SESSION_VARS[FailedLogins] = 0;
   }
 
   if ($HTTP_SESSION_VARS[FailedLogins]  3) {
   echo you have made  . 
 $HTTP_SESSION_VARS[FailedLogins] .  login
 attempts;
   }
 ?
 a href=page2.phpSimulate a failed login/a
 
 
 
 here is the code for page2.php:
 ?
   session_start();
   session_register(FailedLogins);
   $HTTP_SESSION_VARS[FailedLogins]++;
   Header(Location: page1.php);
 ?
 
 Ok. so after i click on my link to simulate failed logins 3 
 times, I should
 see the number of failed logins.
 It seems like the gist of the problems is that different 
 pages can't seem to
 modify the same session variables.

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




RE: [PHP] chicken and egg problem with SID

2001-08-21 Thread Johnson, Kirk

One way around this is to make the first page just a dummy that starts a
session then redirects to the real first page, with the session id passed on
the redirect URL.

Kirk

 -Original Message-
 From: Egan [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, August 21, 2001 10:56 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] chicken and egg problem with SID
 
 
 I have a multi page sequence of input forms tied to a session.  It
 works perfectly with cookies.  But I also want to make it work without
 cookies, using:
 
 php_value session.use_cookies 0
 php_value session.use_trans_sid 1
 
 in my .htaccess file, to use the SID support provided by PHP.
 
 When testing this, I see that the SID works with all pages except the
 first.  But because the first page has no SID passed to it in the URL,
 the first instance of:
 
 session_start();
 
 creates a new session every time you refresh the first page with the
 browser.  And that is the problem.  I only want one session to be
 created, no matter how many times the user hits refresh on the first
 page.
 
 So then I tried setting the session id myself, hard coding it to some
 arbitrary value like:
 
 ?
 session_id('625d282694214b0459cebe28');
 session_start();
 ?
 
 and that solves the multiple session problem; only one session is
 created, no matter how many times you hit refresh on the first page. 
 
 Yay!
 
 But that still leaves a chicken and egg problem to solve:
 
 I can generate some random value to be used for the session_id, but I
 can't think of a good way to store it for use on the first page.
 
 Since the first page does not get the SID in the URL, I need to set
 the session_id before calling session_start.  But that means I don't
 have any session where I can store my random value, for recalling it
 later, on the next page refresh.
 
 Ack!  I only need some simple way to store the SID value I generate,
 before the page is loaded a second time.
 
 I thought of using a CGI to dynamically generate all the PHP and HTML
 for page 1, and also have the CGI put a random session_id value right
 into the page source itself, just like I did when testing.  I suppose
 that would work, but it seems like there should be an easier way.
 
 Maybe there is some obvious solution, but it is not obvious to me at
 the moment.
 
 Has anyone else solved this problem, with a better method?  

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




RE: [PHP] Session Headaches

2001-08-21 Thread Johnson, Kirk

 I am using php 4.0.6 and i would rather not use global variables.

I hear ya.

After playing around with this, your approach works if register_globals is
set to off (I did this with an .htaccess file). I'm surprised by this. It
appears that the global version of a variable still overwrites the
HTTP_SESSION_VARS version when the script ends and the data is stored to the
session file, in spite of the change in this area in 4.0.6. This is not the
behavior I expected with this bug fix, but it appears to be the case. Since
your code never sets the global version of $FailedLogins, nothing gets
stored in the session.

Unless I'm missing something, it looks like register_globals needs to be off
to use session variables the way your code does. In case you haven't done
this before, create .htaccess with this line:

php_flag register_globals off

All for me on this day. Good luck!

Kirk

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




RE: [PHP] Script timeout

2001-08-23 Thread Johnson, Kirk

Why timeout at 300s instead of the 30s or the 12000s which
  are the only two values reported?
 
 Looks like some HTTP timeout, i.e. either Apache or the browser is 
 getting bored. Try outputting something from time to time.

Can anybody point me to information on all the possible HTTP timeouts there
are (Apache, browser, ???), or care to discuss it here? We occasionally see
timeouts that are not due to PHP, and I'm wondering where they are coming
from.

TIA

Kirk

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




RE: [PHP] GET / POST strange error

2001-08-24 Thread Johnson, Kirk

I have seen this behavior when the user had a bookmark to the page with a
session ID in the bookmark URL. Just a thought.

Kirk

 -Original Message-
 From: Mike [mailto:[EMAIL PROTECTED]]
 Sent: Friday, August 24, 2001 8:17 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] GET / POST strange error
 
 
 i have written a login page for a members area on my site - 
 the code is as
 follows...
 
 ?
 require_once(backend.php);
 
 if (!$userid || !$password) {
 
  include(loginform.php);
  exit;
 }
 else {
 $login = $authlib-login($userid, $password);
 
 if ($login != 2) {
  $error = $login;
  include(loginform.php);
  exit;
 }
 else {
  include(index.php);
 }
 }
 ?
 
 it uses authlib to authorise the user and then include a 
 different pasge if
 they are logged in...fairly simple so far..
 
 approx 50% of the time the user cannot log in straight 
 away... the page just
 reloads and you get the blank entry fields again.
 
 The logs show the page being posted and then get
 
 213.165.1.171 - - [24/Aug/2001:15:05:36 +0100] POST 
 /cand/members/login.php
 HTTP/1.1 302 1792
 213.165.1.171 - - [24/Aug/2001:15:05:36 +0100] GET 
 /cand/members/login.php
 HTTP/1.1 200 1094
 
 i am using apache 1.3.19 and php 4.0.4 on redhat 7
 
 I have had this problem reported on another form page as well...

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




RE: [PHP] Fwd: functions returning arrays

2001-08-24 Thread Johnson, Kirk

Try echo $r[$i] instead of echo $r[i].

Kirk

 -Original Message-
 From: Frank Loewenthal [mailto:[EMAIL PROTECTED]]
 Sent: Friday, August 24, 2001 9:33 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Fwd: functions returning arrays
 
 
 Hi
 
 Perhaps I am confused, but is it not possible to return arrays in PHP?
 
 Example:
 
 function getArray() {
   $ret = array('hallo','you');
   return $ret;
 }
 
 $r = getArray();
 
 for( $i=0;$i  count($r); $i++)
   echo $r[i];
 
 Does not work! The array shows 2 Elements, but they are emty
 
 Hm... Where is do mistake?

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




RE: [PHP] Session not timing outafter 180 minutes

2001-08-27 Thread Johnson, Kirk

 Everything is pretty much set to default vaules. I can
 leave the browser open and come back 12+ hours later
 and the session is still active. Why??

There is another setting which affects this, gc_probability. This setting
determines how often the garbage collection routine runs (that kills off old
sessions). The default is 1, which means the gc runs on one out of every 100
hundred requests. So, if the server is not getting alot of requests, the gc
routine doesn't run very often, and sessions last longer than the timeout
value.

Kirk

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




RE: [PHP] parse error AFTER end of included file??

2001-08-28 Thread Johnson, Kirk

You need to close off this bit of code with a brace '}':

if (!isset($page_id))
{

Kirk

 -Original Message-
 From: Jaxon [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, August 28, 2001 9:34 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] parse error AFTER end of included file??
 
 
 Hi,
 
 Can anyone tell me why I have a parse error here?
 
 I'm including this file, which is 16 lines, but the error 
 being thrown by
 the including page reports a parse error in this file on line 17 ???:
 ?php
 if (!isset($page_type))
 {
 $page_type = foo;
 }
 
 if (!isset($page_id))
 {
 $sql=select page_id from table where fieldname = $value;
 $link_id = mysql_connect($host, $usr, $pass) or die 
 (mysql_error());
 mysql_select_db($database, $link_id); //select 
 database catalog
 $result = mysql_query ($sql, $link_id) or die (mysql_error());
 //return result set to php
 if (!$result) echo wait - no result set!;
 
 $page_id = mysql_result($result, 0, fieldname);
 ?
 
 cheers,
 jaxon

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




RE: [PHP] Add Slashes - Server Adds Them Automatically - Advice Requested!

2001-08-29 Thread Johnson, Kirk

See the magic_quotes_gpc setting in the php.ini file. This can be set to on
or off, and is responsible for escaping GET/POST/COOKIE data automatically.

Kirk

 -Original Message-
 From: Mike Gifford [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, August 29, 2001 9:58 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Add Slashes - Server Adds Them Automatically - Advice
 Requested!
 
 
 Hello,
 
 I've created a little opensource script:
   http://openconcept.ca/guide-petition.phtml
 
 Which uses addslashes() to help clean up data inserted from a 
 web form.
 
 This is fine, except that it appears that you can set up php, 
 so that addslashes are automatically 
 added:
 
 one small thing i noticed was the addSlashes issue. it 
 seems like php is
 sometimes installed (such as on my machine) in such a way 
 that addSlashes
 AUTOMATICALLY happens and therefore MANUAL addSlashes adds a SECOND,
 superfluous forward slash.
 
 eg
 Patrick the skier kuharic
 comes out in invitea friend emails by your system as
 Patrick \the skier\  kuharic
 
 Has anyone else experienced this?  Any suggestions for work arounds?
 
 Mike

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




RE: [PHP] Posting to oneself

2001-08-29 Thread Johnson, Kirk

Check if register_globals is off in php.ini. If it is, you will need to
access it through the $HTTP_SERVER_VARS array, e.g.,
$HTTP_SERVER_VARS['PHP_SELF'].

Kirk

 -Original Message-
 From: John Meyer [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, August 29, 2001 5:43 PM
 To: Jason Bell; [EMAIL PROTECTED]
 Subject: Re: [PHP] Posting to oneself
 
 
 At 03:18 PM 8/29/01 -0700, you wrote:
 if you are within a function, try doing this first:
 
 global $PHP_SELF;

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




RE: [PHP] RE: multiple submit buttons

2001-08-31 Thread Johnson, Kirk

Tim Ward wrote:
 
Be careful using values of submit buttons ... if the user hits return
instead of clicking one of the buttons you won't get anything. If you want a
default value try a hidden field before the submits with same name.
 

Tim, thanks for the tip. I had heard of this behavior before, but never
witnessed it. Today I wrote a test form with 1 text field and 1 submit, and
it did do this: when I submitted via return, the submit field was not
posted. However, when I added a second text field to the form, the submit
did get posted. I was careful that the focus was still in the text field,
and not on the button, when I hit return.

Any ideas on why this inconsistency? Just curious. Since it is inconsistent,
your point is important and well-taken.

My code is below if anyone wants to play.

Kirk

submit.php
--
HTMLHEAD/HEADBODY
FORM ACTION=submitRun.php METHOD=POST

INPUT TYPE=text name=testbr
!--input type=text name=test2br--

!--INPUT TYPE=hidden name=submit value=Yes--
INPUT TYPE=SUBMIT name=submit value=Yes
INPUT TYPE=SUBMIT name=submit value=No

/FORM/BODY/HTML

submitRun.php
-
?
while(list($key,$val)=each($HTTP_POST_VARS)) {
  echo key $key = $val br;
}
?

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




RE: [PHP] http get vars missing?? track vars enabled - HELP

2001-09-04 Thread Johnson, Kirk

 I'm about ready to go insane over this one. I have the following link.
 
 http://www.wayneswoodworks.net/test/samples.php3?key=1
 
 When I get into samples.php3 I do:
 
 $record = $HTTP_GET_VARS[key];
 
 echo record=$recordbr;
 
 And the record variable is blank/missing.

Did you get this figured out? There may be a typo in the link, there
shouldn't be both a '?' and an '' before 'key', altho I don't know if this
would cause a problem.

Kirk

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




RE: [PHP] Reprise of dissapearing session variables

2001-09-10 Thread Johnson, Kirk

 The session  variables will remain set, but will it looks 
 like my session gets lost every now and then  if you want 
 to see an example, go to http://northpointless.org/test.php  
 and hit refresh several times. I cannot figure out what is happening.

Did you get this figured out? It looks like you are running on a
load-balanced web farm. If so, and you are saving session data in files,
there's your problem. The session file is saved on the server that handles
the first request. When later requests go to a different machine, the
session file can't be found, since it is on the first server.

Kirk

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




RE: [PHP] Reprise of dissapearing session variables

2001-09-10 Thread Johnson, Kirk

 session files get saved in /tmp by default, correct?  Is 
 there a way to have
 them saved somewhere that would propogate to all the servers 
 in the cluster?

Warning! The following is from me, a non-gearhead.

1. We use a load balancer which is able to set a cookie on the first page
request. The cookie contains the ID of the server that handles that first
request. On all subsequent requests, the cookie is used to route the request
to the original server.

2. Haven't done this, but you could also put the session data in a database.
See the php.ini file for the session handler setting.

3. I believe I read that there is a way to save the session files to a drive
that is mountable by all the cluster servers. End of my knowledge on this
one!

Kirk

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




RE: [PHP] Reprise of dissapearing session variables

2001-09-10 Thread Johnson, Kirk

We use a Big-IP controller from F5:
http://www.f5.com/f5products/bigip/index.html

Kirk

 -Original Message-
 From: Jason Bell [mailto:[EMAIL PROTECTED]]
 Sent: Monday, September 10, 2001 1:33 PM
 To: PHP Users
 Subject: Re: [PHP] Reprise of dissapearing session variables
 
 
 Thanks for the input Kirk!
 
 Unfortunately, I don't have the ability modify my php.ini 
 (virtual hosting).
 Also, if I saved the session data in the database, I'd have 
 to perform a
 database query to get it at the beginning of each page.  
 That's probably not
 good for performance.  :/
 
 option #1 interests me  what do you use to achieve this?  
 I might be
 able to suggest it to my host...  they are extremely accommodating.
 
 I think option #3 is the best solution, if it's possible. 
 (I'm not sure if
 it is or not without modifying the php.ini file) I've been 
 trying to to
 figure it out.  My host is also looking into a fix, so when I 
 find something
 out, I'll let you all know.  :)

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




RE: [PHP] internet explorer and form submission

2001-09-13 Thread Johnson, Kirk

 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

This has been pointed out from time to time on this list. It is a fact: if
the user submits a form with the return key, a submit button value may, or
may not, get posted. So don't rely on the submit button.

3 possibilities:

1. If one of the buttons can be considered the default action, then write
your logic as:

  if(non-default button)
do non-default stuff
  else
do default stuff

If no button value gets passed, the default stuff gets done.

2. Again, if one button is default, put a HIDDEN field with the same name
and value as the default submit button just *before* the non-default submit
button. The HIDDEN will always get posted, but will get overwritten if the
user clicks the non-default button.

3. Write your logic as:

  if(non-default button)
do non-default stuff
  elseif(default button)
do default stuff
  else
meta refresh redirect back to original page

In the redirect, put a message asking the user to click a button, with a
pause of 5 seconds or so.

Kirk

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




RE: [PHP] minus in [] groups in ereg

2001-09-13 Thread Johnson, Kirk

Feature. By placing a dash next to the bracket, there is no confusion that
the dash is being used to specify a range.

Kirk

 -Original Message-
 From: Andrew Perevodchik [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, September 13, 2001 9:32 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] minus in [] groups in ereg
 
 
 Is this a bug or feature? The only way to include
 a minus characher in [] groups in regex is to put
 \- right gefore ]
 
 [[A-Za-z0-9\_\-\=\%\.]] won't work with - as it is supposed to
 [[A-Za-z0-9\_\=\%\.\-]] is ok
 
 Uh?

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




RE: Re[2]: [PHP] minus in [] groups in ereg

2001-09-13 Thread Johnson, Kirk

 JK Feature. By placing a dash next to the
 JK bracket, there is no confusion that the dash
 JK is being used to specify a range.
 
 Doesn't slash before dash mean that???

Could be, I don't know. I always put a dash next to the bracket, instead of
escaping it with a backslash. As is often the case, there is more than one
way to do it.

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




RE: [PHP] session_unset session_destroy being called outside of logic.

2001-09-13 Thread Johnson, Kirk

Several comments, Jason.

 session_destroy() terminates the session, which cannot be 
 started up again
 until the browser is restarted...


Yes, session_destroy removes the session file that stores the values of
session variables between pages. Once gone, it cannot be accessed again
under any circumstances.

 
 sooo... I just removed session_destroy, and settled for using 
 sess_unset()
 to log out of a session.
 
 using this method the session is still open, and the session 
 variables are
 still registered. since they are still registered, they can 
 still be used on
 the chance that I log in again, correct?


session_unset clears the values of all session variables in memory while on
the current page. If the variables are not re-assigned before the page ends,
all the variables in the session file get blanked out when the page ends.


 case logout:
session_unset();
session_destroy();
$AuthErr = FONT SIZE=-1 COLOR=redSession Terminated/FONT;
break;
 
 
 What is happening, is after the user authenticates and logs 
 in, everything
 looks good, but whenever the user follows any link, the 
 session gets unset
 and destroyed.


Have you verified that the session file actually disappears? This sounds
more like the session ID is not getting passed along to the next page, so
that PHP is not aware that a session already exists (and so starts a new
one). The session ID is usually passed between pages using a cookie. The ID
is what allows PHP to find the correct session file and restore the session
variable values.

Kirk

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




RE: [PHP] How to set the time for session??

2001-09-19 Thread Johnson, Kirk

 Then how can i set the time for session??

See the php.ini file, for session.gc_maxlifetime setting:

session.gc_maxlifetime= 1440; after this number of seconds, stored
; data will be seen as 'garbage' and
; cleaned up by the gc process

Kirk

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




RE: [PHP] include() problem...

2001-09-20 Thread Johnson, Kirk

Check the permissions on both the directory and the file, so that they are
accessible to 'nobody' (or whomever PHP is running as). I'm not sure what to
make of the empty include path in the error message.

Kirk


 I've tried including just a file that was in the /usr/lib/php 
 directory.
 No luck. I get exactly the same error (with the correct file name,
 obviously). Also, note in the error that include() is seeing
 include_path=''. What's up with that?

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




RE: [PHP] Codes in PHP

2001-09-20 Thread Johnson, Kirk

I only know of two ways to do page redirects with PHP: the header() function
and a META refresh tag. I suppose you could also use PHP to dynamically
generate the javascript code you included in your email. Good luck!

Kirk
 
 - Original Message -
 From: Wee Chua [EMAIL PROTECTED]
 To: PHP (E-mail) [EMAIL PROTECTED]
 Sent: Thursday, September 20, 2001 12:49 PM
 Subject: [PHP] Codes in PHP
 
 
  Hi all,
  I know how to forward a page with PHP, but what if the page 
 I want to
  forward is the previous page or last page. In javascript, 
 the code is like
  javascript:historygo(-1). The reason why I want to go back 
 to previous
 page
  is because I don't want to lose any information on previous 
 page.

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




RE: [PHP] Getting the value from a not posted form edit Vield.

2001-09-21 Thread Johnson, Kirk

I'm not sure what question you are asking, but try changing this line 

$aFinfOn = Getenv($aFindOnInput);

to 
$aFinfOn = $HTTP_POST_VARS[aFindOnInput];

The function getenv() gets environment variables, not post variables.

Kirk

 -Original Message-
 From: hvm [mailto:[EMAIL PROTECTED]]
 Sent: Friday, September 21, 2001 6:09 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Getting the value from a not posted form edit Vield.
 
 
 Hi All,
 
 Has some one a solution for a non posted field to get the 
 entered information out in to the session variables.
 My code:
 
 1e The script adv_search_dis.php4 is to build the input field.
 
 ?php
  echo INPUT type='text' name=aFindOnInput 
 value='$aFindOn' size=15 maxlength=15 style='font-family:
  Arial, Helvetica, sans-serif; color: black; background: 
 #DD'/td;
 
  // Find the diseases via Link
  echo a href='../PhPScrips/0DiseaseFind.php4' 
 target='mainFrame' name='disease'Search/a/FONT;
  ?
 
 2e The script 0DiseaseFind.php4 is to get the variable 
 $aFindOnInput from the adv_search_dis.php4 script in to the 
 session variable and start a new script to build the result 
 found in to the database. 
 
 ?php
  $aFinfOn = Getenv($aFindOnInput);
  $aLetter = $aFinfOn;
  echo FRAMESET rows='50, *' FRAMEBORDER='NO' BORDER='0' 
 FRAMESPACING='0';
  echo FRAME NAME='topFrame' SRC='../PhPScrips/a.php4' 
 FRAMEBORDER='NO' SCROLLING='NO' NORESIZE  MARGINHEIGHT='22';
  echo FRAME NAME='abc results' 
 SRC='../PhPScrips/GetLSDNs.php4' FRAMEBORDER='NO' 
 SCROLLING='AUTO' NORESIZE;
 ?
 
 Any help?
 
 Yours Hans.
 

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




RE: [PHP] money print out with two digits after , e.g. 49,00

2001-05-08 Thread Johnson, Kirk

Try number_format() http://www.php.net/manual/en/function.number-format.php

Kirk

 -Original Message-
 From: Ramiro Radjiman [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, May 08, 2001 8:35 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] money print out with two digits after , e.g. 49,00
 
 
 I want to changes 49.4  ---   49,4
 49,4  49,40
 
 the first rule is done with the code
 
 $totaal=49.4;
 $totaal=str_replace(.,,,$totaal);
 
 how can i do the second row??

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




RE: [PHP] HELP, problems with sessions.....

2001-05-09 Thread Johnson, Kirk

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
 Subject: [PHP] HELP, problems with sessions.

 so what aren'T i understanding here? shouldn't all the vars and values
 be in the encoded string??? and what could cause the loss of 
 the session
 vars on my server, what can i do to debug this?

You should not have to call session_encode() to get sessions to work. Make
session_start(); the first line on each page where you want to use session
variables. Use session_register() on each variable you want to be a session
variable. If you still have problems, please post your code so we can look
for bugs. Good luck!

Kirk

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




RE: [PHP] HELP, problems with sessions.....

2001-05-09 Thread Johnson, Kirk

My guess is one server has register_globals on, the other has
register_globals off. Try this change in your code: instead of assigning a
value to $HTTP_SESSION_VARS[toto], instead assign a value to $toto. You
will then see a value for $toto in the echo session_encode().
$HTTP_SESSION_VARS[toto] and $toto are *not* the same variables while on
the current page. 

The other way to approach it is to use an .htaccess file to turn
register_globals off but leave your code as it is below. Again, you will
then see a value for $toto in the echo session_encode().

Kirk

 -Original Message-

 but here that's whats not going:
 ?
  session_start();
  if(!isset($HTTP_SESSION_VARS[toto]))
  {
   echo  hell no toto defined;
  session_register(toto);
  $HTTP_SESSION_VARS[toto] = hello;
  }//if(!isset($HTTP_SESSION_VARS[toto]))
  else echo  toto was set to:'.$HTTP_SESSION_VARS[toto].'BR;
 
  ... rest of the page that has nothing to do with this session ...
   echo HR\nsession:;
   echo session_encode();
 echo Pdebug, after the run: num of sess
 vars:.count($HTTP_SESSION_VARS).BR\n;
 reset ($HTTP_SESSION_VARS);
 while (list ($key, $val) = each ($HTTP_SESSION_VARS ))
 {
   echo Sesvar '$key' = '$val'BR\n;
 }//while (list ($key, $val) = each ($HTTP_SESSION_VARS )
 ? 
 
 this is basicly what i have, and that is working on one 
 machine and not on
 another
 

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




RE: [PHP] Environment Variables

2001-05-09 Thread Johnson, Kirk

http://www.php.net/manual/en/language.variables.predefined.php#language.vari
ables.predefined.php

Kirk

 -Original Message-
 From: Karl J. Stubsjoen [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, May 09, 2001 10:08 AM
 To: PHP Mailing List
 Subject: [PHP] Environment Variables
 
 
 BlankHello,
 
 I need to look up in the PHP online reference other variables 
 similar to
 $DOCUMENT_ROOT.  I can't find them.  Anyone know where to 
 find them at?
 
 Thank you,
 
 
 Karl J. Stubsjoen
 www.excelir.com/worldshop
 

-- 
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] Question on php.ini.max_execution_time

2001-05-10 Thread Johnson, Kirk

I have a PHP script that opens a socket to another (non-PHP) process. This
process has been having problems of late, and can take 10 minutes or more to
execute. I have max_execution_time set to 300 seconds in php.ini. However,
users report to me that the PHP script does not always time-out after 300
seconds, it can be much longer than that. So, my question at last: will PHP
wait to display the time-out message until after the other process
completes? Or should the time-out be hard at 300 seconds, regardless of
what the PHP script is doing (waiting for a reply from another process,
doing a database query, etc.)?

Anyone familiar with the low-level view of max_execution_time?

Kirk

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




RE: [PHP] Please help

2001-05-10 Thread Johnson, Kirk

I think this question was answered by Stewart Taylor earlier today. Here is
his response:


This error occurrs when you start a session that recreates an object
variable but does not know the class definition for it.
You need to make sure you include the class source before you start the
session.


Kirk

 -Original Message-
 From: Rodrigo Reis da Rocha [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, May 10, 2001 11:44 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Please help
 
 
 Hi,
 I have a problem with the session variables.
 
 ?
 
 
 class Autorizacao
 {
  
 //Atributos---
 
  var $nome_usuario;
  var $webmaster_mail;
  var $acao;
  var $url_sistema;
 
  
 //Métodos-
 
  function Autorizacao(){
   $this-nome_usuario = vazio;
   $this-webmaster_mail = [EMAIL PROTECTED];
   $this-acao = inicio;
   $this-url_sistema = http://localhost/web/ ;
  }
 
  function autorizaSistema($param_usuario, $param_passwd){
   //Verificar no banco se o usuario existe
   $this-nome_usuario = $param_usuario;
  }
 }
 
 
 session_start();
 
 if (!session_is_registered(SISTEMA)){
 
  //Registra a sessao
  session_register(SISTEMA);
  $GLOBALS[SISTEMA] = new Autorizacao();
  echo Seta sistema;
 
 }
 
 echo $GLOBALS[SISTEMA]-url_sistema;
 
 echo teste;
 
 echo A href='in2.php'reload/A;
 ?
 
 at the secons time that this code is executed generate this error.
 
 Fatal error: The script tried to execute a method or access a 
 property of an incomplete object. Please ensure that the 
 class definition autorizacao of the object you are trying to 
 operate on was loaded _before_ the session was started in 
 C:/XITAMI/webpages/WEB/in2.php on line 38
 
 Please help
 
 Tkx.
 R3.

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




RE: [PHP] verify phone number

2001-05-11 Thread Johnson, Kirk

One way:

$phone = ereg_replace([^0-9], , $phone);
if(!ereg(^[0-9]{10}$,$phoneHome)) {
  echo error;
}

You could also check the string length after removing all non-numbers.

Kirk

 -Original Message-
 From: Claudia Smith [mailto:[EMAIL PROTECTED]]
 Sent: Friday, May 11, 2001 4:52 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] verify phone number
 
 
 I am looking for code to verify a phone number has been 
 entered correctly on
 a form field.  Requirements would include the area code:  
 xxx-xxx-.

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




RE: [PHP] [Win32,PHP/4.0.5] Problem with session

2001-05-14 Thread Johnson, Kirk

With register_globals off, ordinary GLOBAL variables can't be registered, so
the line session_register(language); isn't doing anything. Access all
registered variables through $HTTP_SESSION_VARS only.

Kirk

 -Original Message-
 From: Christian Ribeaud [mailto:[EMAIL PROTECTED]]
 Sent: Monday, May 14, 2001 1:38 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] [Win32,PHP/4.0.5] Problem with session
 
 
 Hi,
 
 I would like to know what is wrong with the code below.
 The following code will be included on every page with the include
 command.
 The variable $language does not seem to be registered at all. 
 it should
 be registered
 again on every page. Why this? On the php.ini 
 register_globals is off
 and session.auto_start is 0.
 Any help would be gratefully appreciated. Thanks and have a nice day,
 
 christian
 
  code 
 session_name(Apache);
 if (apache_note(Cookie)) {
 session_id(apache_note(Cookie));
 }
 session_start();
 if (session_is_registered(language)) {
 $language = ($HTTP_GET_VARS[language])?
 $HTTP_GET_VARS[language]:
 $HTTP_SESSION_VARS[language];
 } else {
 session_register(language);
 $language = $HTTP_GET_VARS[language]?
 $HTTP_GET_VARS[language]:
 d;
 }
 $HTTP_SESSION_VARS[language] = $language;
  code 

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




RE: [PHP] Easily Making Post Vars Session Vars

2001-05-14 Thread Johnson, Kirk

This isn't quite what you are asking, but maybe it will be of help. Use the
loop below to create and assign GLOBAL versions of the $HTTP_POST_VARS:;

reset($HTTP_POST_VARS);
while(list($key, $val) = each($HTTP_POST_VARS)) {
  $GLOBALS[$key] = $val;
}

Kirk

 -Original Message-
 From: Jason [mailto:[EMAIL PROTECTED]]
 Sent: Monday, May 14, 2001 1:32 PM
 To: Php-General
 Subject: [PHP] Easily Making Post Vars Session Vars
 
 
 Hi,
 
 So, is there anyway to assign $HTTP_POST_VARS to a session 
 array holding the
 same values without assign each variable one by one (there 
 are a ton of
 variables).
 [snip]
 I tried doing something like this and it didn't seem to work:
 session_start();
 if(!isset($custinfo)) {
   session_register(custinfo);
   $custinfo = array();
 }
 $custinfo = $HTTP_POST_VARS;
 
 
 So, it doesn't appear it will be that easy. Anybody have any 
 hints on doing
 this?
 
 Thanks!

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




RE: [PHP] Easily Making Post Vars Session Vars

2001-05-14 Thread Johnson, Kirk

Before we get too carried away here :), what didn't work with your original
solution? I would have guessed that it would work. What was the error?

But, here's some more with the loop, definitely not tested:

reset($HTTP_POST_VARS);
while(list($key, $val) = each($HTTP_POST_VARS)) {
if(is_array($val)) {
if(count($val)  0) {
reset($val);
while(list($key2,$val2)=each($val)) {
  $GLOBALS[$key][$key2] = $val2;
}
}
}
}

 -Original Message-
 From: Jason [mailto:[EMAIL PROTECTED]]
 Sent: Monday, May 14, 2001 2:40 PM
 To: Johnson, Kirk; Php-General
 Subject: RE: [PHP] Easily Making Post Vars Session Vars
 
 
 Ok, I see where that's going.
 
 I actually was a bit off in my first posting.
 
 The form field names are a multi-dimesional array. The goal it to make
 writing all of the info to the db a breeze.
 
 ie- name=cust[personal][phone]
 
 and name=cust[history][interests]
 
 etc etc
 
 lets also say
 $cust[history][interests] = tv;
 
 The reasoning behind it is the data does not need to be stored in a
 consistent or usable (just readable) manner. so... say 
 history is a table,
 and has a column name details.
 
 I would cycle through the array two levels deep on the first 
 associative
 history, i suppose with nested while(list = each).
 
 The two values I want to return from that array would be the 
 2nd associative
 key name and the value, in this case interests and tv.
 
 SO... back on track... how would i utilize that loop below to get my
 multi-dimesion form variables into a session. Once I get it 
 into a session I
 think I can break it up no problem.
 
 Thanks.
 
  -Original Message-
  From: Johnson, Kirk [mailto:[EMAIL PROTECTED]]
  Sent: Monday, May 14, 2001 1:07 PM
  To: Php-General
  Subject: RE: [PHP] Easily Making Post Vars Session Vars
 
 
  This isn't quite what you are asking, but maybe it will be of
  help. Use the
  loop below to create and assign GLOBAL versions of the 
 $HTTP_POST_VARS:;
 
  reset($HTTP_POST_VARS);
  while(list($key, $val) = each($HTTP_POST_VARS)) {
$GLOBALS[$key] = $val;
  }
 
  Kirk
 
   -Original Message-
   From: Jason [mailto:[EMAIL PROTECTED]]
   Sent: Monday, May 14, 2001 1:32 PM
   To: Php-General
   Subject: [PHP] Easily Making Post Vars Session Vars
  
  
   Hi,
  
   So, is there anyway to assign $HTTP_POST_VARS to a session
   array holding the
   same values without assign each variable one by one (there
   are a ton of
   variables).
   [snip]
   I tried doing something like this and it didn't seem to work:
   session_start();
   if(!isset($custinfo)) {
 session_register(custinfo);
 $custinfo = array();
   }
   $custinfo = $HTTP_POST_VARS;
  
  
   So, it doesn't appear it will be that easy. Anybody have any
   hints on doing
   this?
  
   Thanks!
 
  --
  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 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]




RE: [PHP] load balancing...

2001-05-15 Thread Johnson, Kirk

We are doing it here, although I am not involved in the server setup so I
can't give you much help. I guess the main thing is setting up the session
storage mechanism. If you use session files, then the load balancer needs to
add a cookie so that requests in multi-page applications always go to the
same server (so that the session file can be found). The alternative is to
use a database for session storage. Other than that, it is working well for
us. We are using an F5 load balancer with Apache/1.3.14, Linux, and
PHP/4.0.4pl1.

Kirk

 -Original Message-
 From: Juan Claudio Santana Saldaña [mailto:[EMAIL PROTECTED]]
 Sent: Monday, May 14, 2001 8:19 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] load balancing...
 
 
 Does anybody know how to do load balancing with php and 
 apache ? can
 you recomend me any tutorial document or how to? Thank you.
 
 
 Claudio.

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




RE: [PHP] easy one

2001-05-15 Thread Johnson, Kirk

Just to add a couple details. On the first page request, PHP sets the
constant SID as well as the cookie. If the user has cookies disabled, then
SID is also set on all following page requests. If cookies are enabled, then
the cookie PHPSESSID (if you stick with the default name) exists on all
following page requests.

Kirk

 -Original Message-
 From: Adaran (Marc E. Brinkmann) [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, May 15, 2001 7:52 AM
 To: Php-General
 Cc: Php-General
 Subject: Re: [PHP] easy one
 
 
 Hi Romulo,
 
 Romulo Hello!
 Romulo How do I check if a session exist before I call 
 session_start()?
 
 check if the Cookie PHPSESSID has been set!
 
 ---
 EnjoY,
  Adaran ([EMAIL PROTECTED])
check http://www.adaran.net

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




RE: [PHP] coding for 'no match found'

2001-05-15 Thread Johnson, Kirk

See http://www.php.net/manual/en/function.mysql-num-rows.php

Kirk

 -Original Message-
 From: midget2000x [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, May 15, 2001 3:00 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] coding for 'no match found'
 
 
 This is a simple yet fundamental programming question I am 
 hoping somebody will
 have the patience to explain...
 
 I have a mysql database with the email field as the key.  
 Before inserting an
 new record to it I want to check if there is already a record 
 with that e-mail.
  This I can do fine.  But this script needs to also handle 
 delete requests,
 which I can also do fine, but I need to code for the instance 
 that there is a
 delete request for an e-mail record that does not exist.  How 
 can I figure out
 if after my 'while' loop is finished checking the database it 
 has not found a
 match (so i can inform the requester as such)?
 
 Here's the code I have so far...
 
   $email_check_query = SELECT email FROM 
 $tablename WHERE email = '$email';
   $email_check_result = mysql_query($email_check_query);
   while($email_query_data = 
 mysql_fetch_array($email_check_result)) { 
   $db_email = $email_query_data[email];
   //if match, it's an update or delete
   if ($email==$db_email) {
   if ($op==delete) {
   $action=del;
   echo delete 
 requestbr;
   } 
   else {
   $action = upd;
   echo update 
 requestbr;
   }
   } 
   } //end while loop
 
  ---
 providing the finest in midget technology
 
 -- 
 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 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]




RE: [PHP] again with the regex

2001-05-15 Thread Johnson, Kirk

Jerry, try sprintf(). Here's an example:

sprintf((%s) %s-%s, substr($GLOBALS[appPhoneHome], 0,
3),substr($GLOBALS[appPhoneHome], 3, 3),substr($GLOBALS[appPhoneHome],
6, 4))

Kirk

 -Original Message-
 From: Jerry Lake [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, May 15, 2001 4:48 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] again with the regex
 
 
 I hate to keep asking regex stuff,
 but it is really evasive for me..
 I'm pulling phone numbers out of a DB
 in the format of 1234567890, I would
 like to format them like (123) 456-7890
 or something else that at least breaks them 
 up a bit.
 
 any help is appreciated,
 Thanks,
 
 Jerry Lake
 Interface Engineering Technician
 Europa Communications - http://www.europa.com
 Pacifier Online   - http://www.pacifier.com
 
 
 -- 
 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 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]




RE: [PHP] Custom Session Func?

2001-05-16 Thread Johnson, Kirk

Chris, is this requirement spelled out in the manual anywhere? I have never
seen any effect of the order of calling session_register() and assigning a
value in my own code.  In fact, I almost always register a variable before
assigning a value.

Just curious.

Kirk

 -Original Message-
 From: Chris Lee [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, May 16, 2001 6:58 AM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP] Custom Session Func?
 
 
 common mistake, your session_register() is before you assign 
 the variable, you must have it after. Ive done this myself. oi.
 
   session_start();  
   if ( ! session_is_registered(user_key) ) {
 $user_key = dummy;
 session_register(user_key);
   }  

[major snippage] 

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




RE: [PHP] need help

2001-05-16 Thread Johnson, Kirk

__FILE__ is a constant predefined by PHP. See
http://www.php.net/manual/en/language.constants.php

For help on the basename() function, see
http://www.php.net/manual/en/function.basename.php

Kirk

 -Original Message-
 From: Fai [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, May 16, 2001 11:19 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] need help
 
 
 Can anybody tell me what does the following mean?
 
 $path=substr(__FILE__, 0, strlen(__FILE__) - 
 strlen(basename(__FILE__)) -
 1);
 
 Thanks!

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




RE: [PHP] EREGI -- Help

2001-05-16 Thread Johnson, Kirk

Give this a try:

if(!ereg(^([0-9]{5}([-]{1}[0-9]{4})?)$,$data)) {

Kirk

 -Original Message-
 From: Jason Caldwell [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, May 15, 2001 8:16 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] EREGI -- Help
 
 
 I'm just trying to create a eregi expression that will evaluate a zip
 code... and I cannot get it to work... can anyone assist me 
 with this?  --
 also, is there a site that shows regular expression examples 
 for checking
 fields like, zip codes, phone numbers, etc...
 
 if(!(eregi((^[0-9]{5})(\\-([0-9]{4}$))?, $data)))
  $err[] = $desc .  - Invalid Zip Code  . $req;
 
 Thanks
 Jason

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




RE: [PHP] deleting a file

2001-05-16 Thread Johnson, Kirk

http://www.php.net/manual/en/function.unlink.php

Kirk

 -Original Message-
 From: Joseph Bannon [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, May 16, 2001 1:53 PM
 To: PHP (E-mail)
 Subject: [PHP] deleting a file
 
 
 What is the file function to remove/delete a file from a server?
 
 Joseph

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




RE: [PHP] help with header/cookies ..

2001-05-17 Thread Johnson, Kirk

Add an exit(); immediately following all the header() calls. Hitting a
header() does not end execution of the script, so without the exit() the
last header() that gets called is the one that actually occurs.

Kirk

 -Original Message-
 From: Chad Day [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, May 17, 2001 9:13 AM
 To: Php-General@Lists. Php. Net
 Subject: [PHP] help with header/cookies ..
 
 
 I'm submitting a form to a search page that performs 
 different searches
 based on what engine was selected.  One of these searches is 
 restricted, and
 runs a function that checks for a cookie.  If the user has no 
 cookie, they
 are redirected to a login page.
 
 I've used echo tests to make sure the function is being run 
 correctly, that
 I don't have a cookie, etc, and it all checks out.  I 
 *SHOULD* be redirected
 to a login page, but I am not.
 
 
   if ($fromwhere == ARCHIVES) {
   check_cookie($cookiename);
   Header(Location: gotosearch);
   }
 
   switch ($fromwhere) {
   case SITE:
   Header(Location: gotosearch2);
   break;
   case ARCHIVES:
   check_cookie($cookiename);
   Header(Location: gotosearch3);
   break;
   }
 
 
 I tried putting the check_cookie statement in and outside of 
 the switch
 statement, but both places perform the cookie check, fail it, 
 but don't
 redirect me, and continue to allow me to search?  What is 
 wrong with my
 code?  Is there something I'm missing about how I'm handling my
 headers/cookies?  I have the check_cookie function working on 
 several other
 parts of the site, but for some reason I can't get this to work .. :(
 
 Thanks,
 Chad
 
 
 -- 
 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 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]




RE: Re: [PHP] preprocessing

2001-05-17 Thread Johnson, Kirk

I don't know of any way to make a script self-submitting for POST data,
wish I did. Alternatives: 

1. Do the processing with JavaScript on the original input page.
2. Get the other company to modify C to look for GET variables, and build a
query string as suggested earlier.
3. Add a simple FORM to B with just a Submit button, with a message Please
click the Submit button to continue.

Kirk

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, May 17, 2001 11:51 AM
 To: [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Subject: RE: Re: [PHP] preprocessing
 
 

 - Original Message -
 From: [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Thursday, May 17, 2001 11:18 AM
 Subject: [PHP] preprocessing
 
  I have what I feel to be a strange problem (I'm most 
 likely wrong here).
  I have page A, which is an internal page, which posts to 
 page C which is
 external (belongs to another company). What I would like is 
 to insert a
 preprocessing script (let's call it page b). So, the end 
 result would be, users
 input data to page a, page a then posts to page b, page b 
 processes all
 variables etc and then posts to page c. I don't want the 
 customer, to ever
 really have to interact with page b. Is that possible?
  If there is a command to do this, which I must've missed, 
 that would really be
 all I need ;)

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




RE: [PHP] preprocessing

2001-05-17 Thread Johnson, Kirk

Louis, if you track this down, please post back to the list what you find.

TIA

Kirk

 -Original Message-
 From: infoz [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, May 17, 2001 12:21 PM
 To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Subject: Re: [PHP] preprocessing
 
 
 There's a public domain function kicking around called 
 post_to_host or
 something like that which will do exactly what you wish.  If 
 you search the
 list archives I'm sure there will be several pointers to 
 where you can find
 it.
 
 - Tim

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




RE: [PHP] preprocessing

2001-05-17 Thread Johnson, Kirk

Thanks, Tim!

http://marc.theaimsgroup.com/?l=php-generalm=98582357009336w=2

Kirk

 -Original Message-
 From: infoz [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, May 17, 2001 12:21 PM
 To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Subject: Re: [PHP] preprocessing
 
 
 There's a public domain function kicking around called 
 post_to_host or
 something like that which will do exactly what you wish.  If 
 you search the
 list archives I'm sure there will be several pointers to 
 where you can find
 it.
 
 - Tim
 
 
 -- 
 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 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]




RE: [PHP] Netscape 6, What a piece of s$#@ , anyone else had problems with php and Netscape 6?

2001-05-17 Thread Johnson, Kirk

Always a good idea to do a View Source, capture that to a file, then run it
through a tag checker program.

Kirk

 -Original Message-
 From: Brandon Orther [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, May 17, 2001 5:21 PM
 To: PHP User Group
 Subject: RE: [PHP] Netscape 6, What a piece of s$#@ , anyone else had
 problems with php and Netscape 6?
 
 
 This is the HTML that is returned by PHP.  Does anyone know 
 why Netscape
 Would have problems viewing it?
 

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




<    1   2   3   4   >