php-general Digest 20 Dec 2002 13:47:40 -0000 Issue 1774

Topics (messages 128931 through 128983):

Re: Another problem with conditional statements
        128931 by: Beauford.2002
        128934 by: Sean Malloy
        128936 by: Beauford.2002
        128958 by: Jason Wong
        128959 by: Jason Wong
        128966 by: Ford, Mike               [LSS]
        128969 by: Ford, Mike               [LSS]
        128971 by: Ford, Mike               [LSS]
        128972 by: Ford, Mike               [LSS]

Re: Training Courses in PHP & MySQL
        128932 by: Andrew Wilson
        128939 by: michael kimsal
        128940 by: Mike Hillyer
        128941 by: michael kimsal

Re: Problem with sessions.
        128933 by: Philip Olson
        128957 by: Jason Wong

Re: Fatal error: Call to undefined function: allerrors() in............
        128935 by: Beauford.2002
        128938 by: John W. Holmes

Code still showing up :(
        128937 by: Lic. Rodolfo Gonzalez Gonzalez

syntax to reference $_POST within function
        128942 by: Jamie
        128945 by: Philip Olson

Good program to indent large quantity of files?
        128943 by: Leif K-Brooks
        128944 by: Leif K-Brooks
        128949 by: Justin French
        128954 by: Leif K-Brooks
        128983 by: michael kimsal

URL path problems
        128946 by: ªüYam
        128947 by: Peter Houchin
        128948 by: Wee Keat
        128961 by: ªüYam

Alternating Links
        128950 by: conbud
        128951 by: Philip Olson
        128952 by: Justin French
        128953 by: conbud

Re: offline application
        128955 by: Philippe Saladin

PopUp Recall
        128956 by: beno

Problem with static call of method - class::method
        128960 by: Mirek Novak
        128962 by: Mirek Novak
        128963 by: Mirek Novak

Re: Error installing
        128964 by: Jason Wong

Re: PHP not working in html
        128965 by: Dries Verachtert

mkdir() makes dir, but with wrong owner
        128967 by: Mirza Muharemagic
        128981 by: John W. Holmes

Re: Some discoveries I've made. Anyone care to confirm/deny
        128968 by: Ford, Mike               [LSS]

Apache2 & PHP4
        128970 by: Chase Urich
        128979 by: Dries Verachtert

upload_max_filesize + ini_set
        128973 by: electroteque
        128976 by: Ford, Mike               [LSS]

Is there any method to filter the single quote from a string?
        128974 by: ªüYam
        128975 by: Justin French
        128982 by: ªüYam

Re: How to upload a file
        128977 by: Somesh

Re: PHP not working in html]
        128978 by: Dries Verachtert

XML fopen($url)
        128980 by: William Bradshaw

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message ---
I believe you are incorrect. Switch will look for the first case statement
that is true and execute that statement. The following works - case one is
incorrect so it doesn't get executed but the second case does. Paste this
into a test.php file and you will see it works.. Read the manual.

$a=2;
$b=4;

switch (true) {
    case ($a < $b) and ($b > 5):
        echo "Incorrect";
    case ($a == 2):
        echo "Correct";
 }

So my original question is still stands. The switch statement is correct,
but there is a problem with my conditional statements.

----- Original Message -----
From: "Rick Emery" <[EMAIL PROTECTED]>
To: "Beauford.2002" <[EMAIL PROTECTED]>; "PHP General"
<[EMAIL PROTECTED]>
Sent: Thursday, December 19, 2002 7:33 PM
Subject: Re: [PHP] Another problem with conditional statements


> switch() does not work that way.  Switch uses the value in the parentheses
and selects a
> CASE based upon that value.  Read the manual.
>
> You will have to use a series of if()-elseif()-else()
> ----- Original Message -----
> From: "Beauford.2002" <[EMAIL PROTECTED]>
> To: "PHP General" <[EMAIL PROTECTED]>
> Sent: Thursday, December 19, 2002 6:19 PM
> Subject: [PHP] Another problem with conditional statements
>
>
> Hi,
>
> This should be as simple as breathing, but not today. I have two variables
> $a and $b which I need to compare in a switch statement in several
different
> ways, but no matter what I do it's wrong.
>
> This is what I have tried, can someone tell me how it should be.
>
> TIA
>
> switch (true):
>
>     case ($a == $b):             This one seems simple enough.
>             do sum stuff;
>             break;
>
>     case ($a && $b == 124):   This appears not to work.
>             do sum stuff;
>             break;
>
>     case ($a == 124 && $b == 755):  If $a is equal to 124 and $b is equal
to
> 755 then it should be true..doesn't work.
>             do sum stuff;
>             break;
>
>     case ($a == 124 && $b != 124):   Nope, this doesn't appear to work
> either.
>             do sum stuff;
>             break;
>
> endswitch;
>
>
>
> --
> 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
>
>


--- End Message ---
--- Begin Message ---
Nowhere in the documentation does it specify switch should be used in the
context you are attempting.

The docs show a single variable and checking the case of that variable.

I'm not going to berate you on syntax. If you can get it working like that
then good for you. However, I would strongly advise you to use the
if/elseif/else statements instead.

an example of switch

$action = $_POST['action']
switch ($action)
{
    case 'help': showHelp(); break;
    default : showDefault();
}

not

$action = $_POST['action']
switch (true)
{
    case ($action == 'help'): showHelp(); break;
    default : showDefault();
}


> -----Original Message-----
> From: Beauford.2002 [mailto:[EMAIL PROTECTED]]
> Sent: Friday, 20 December 2002 12:46 PM
> To: Rick Emery
> Cc: PHP General
> Subject: Re: [PHP] Another problem with conditional statements
>
>
> I believe you are incorrect. Switch will look for the first case statement
> that is true and execute that statement. The following works - case one is
> incorrect so it doesn't get executed but the second case does. Paste this
> into a test.php file and you will see it works.. Read the manual.
>
> $a=2;
> $b=4;
>
> switch (true) {
>     case ($a < $b) and ($b > 5):
>         echo "Incorrect";
>     case ($a == 2):
>         echo "Correct";
>  }
>
> So my original question is still stands. The switch statement is correct,
> but there is a problem with my conditional statements.
>
> ----- Original Message -----
> From: "Rick Emery" <[EMAIL PROTECTED]>
> To: "Beauford.2002" <[EMAIL PROTECTED]>; "PHP General"
> <[EMAIL PROTECTED]>
> Sent: Thursday, December 19, 2002 7:33 PM
> Subject: Re: [PHP] Another problem with conditional statements
>
>
> > switch() does not work that way.  Switch uses the value in the
> parentheses
> and selects a
> > CASE based upon that value.  Read the manual.
> >
> > You will have to use a series of if()-elseif()-else()
> > ----- Original Message -----
> > From: "Beauford.2002" <[EMAIL PROTECTED]>
> > To: "PHP General" <[EMAIL PROTECTED]>
> > Sent: Thursday, December 19, 2002 6:19 PM
> > Subject: [PHP] Another problem with conditional statements
> >
> >
> > Hi,
> >
> > This should be as simple as breathing, but not today. I have
> two variables
> > $a and $b which I need to compare in a switch statement in several
> different
> > ways, but no matter what I do it's wrong.
> >
> > This is what I have tried, can someone tell me how it should be.
> >
> > TIA
> >
> > switch (true):
> >
> >     case ($a == $b):             This one seems simple enough.
> >             do sum stuff;
> >             break;
> >
> >     case ($a && $b == 124):   This appears not to work.
> >             do sum stuff;
> >             break;
> >
> >     case ($a == 124 && $b == 755):  If $a is equal to 124 and
> $b is equal
> to
> > 755 then it should be true..doesn't work.
> >             do sum stuff;
> >             break;
> >
> >     case ($a == 124 && $b != 124):   Nope, this doesn't appear to work
> > either.
> >             do sum stuff;
> >             break;
> >
> > endswitch;
> >
> >
> >
> > --
> > 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
>

--- End Message ---
--- Begin Message ---
>From the manual at www.php.net.  This is a lot more sophiticated than mine
and apparantly works. So as a recent user of PHP, I'm at a loss as to what
is and what isn't.

Using switch would be more efficiant as it would stop once a match is made
(if you use break), but with eleif statements each one is evaluated in
order.

$chr = substr($a,$i,1);
switch (TRUE) {

case $chr == "á" || $chr == "à" || $chr == "ã" || $chr == "â":
$a = str_replace(substr($a,$i,1),"a",$a);
break;

case $chr == "é" || $chr == "è" || $chr == "ê":
$a = str_replace(substr($a,$i,1),"e",$a);
break;

}

----- Original Message -----
From: "Sean Malloy" <[EMAIL PROTECTED]>
To: "PHP General" <[EMAIL PROTECTED]>
Sent: Thursday, December 19, 2002 9:36 PM
Subject: RE: [PHP] Another problem with conditional statements


> Nowhere in the documentation does it specify switch should be used in the
> context you are attempting.
>
> The docs show a single variable and checking the case of that variable.
>
> I'm not going to berate you on syntax. If you can get it working like that
> then good for you. However, I would strongly advise you to use the
> if/elseif/else statements instead.
>
> an example of switch
>
> $action = $_POST['action']
> switch ($action)
> {
>     case 'help': showHelp(); break;
>     default : showDefault();
> }
>
> not
>
> $action = $_POST['action']
> switch (true)
> {
>     case ($action == 'help'): showHelp(); break;
>     default : showDefault();
> }
>
>
> > -----Original Message-----
> > From: Beauford.2002 [mailto:[EMAIL PROTECTED]]
> > Sent: Friday, 20 December 2002 12:46 PM
> > To: Rick Emery
> > Cc: PHP General
> > Subject: Re: [PHP] Another problem with conditional statements
> >
> >
> > I believe you are incorrect. Switch will look for the first case
statement
> > that is true and execute that statement. The following works - case one
is
> > incorrect so it doesn't get executed but the second case does. Paste
this
> > into a test.php file and you will see it works.. Read the manual.
> >
> > $a=2;
> > $b=4;
> >
> > switch (true) {
> >     case ($a < $b) and ($b > 5):
> >         echo "Incorrect";
> >     case ($a == 2):
> >         echo "Correct";
> >  }
> >
> > So my original question is still stands. The switch statement is
correct,
> > but there is a problem with my conditional statements.
> >
> > ----- Original Message -----
> > From: "Rick Emery" <[EMAIL PROTECTED]>
> > To: "Beauford.2002" <[EMAIL PROTECTED]>; "PHP General"
> > <[EMAIL PROTECTED]>
> > Sent: Thursday, December 19, 2002 7:33 PM
> > Subject: Re: [PHP] Another problem with conditional statements
> >
> >
> > > switch() does not work that way.  Switch uses the value in the
> > parentheses
> > and selects a
> > > CASE based upon that value.  Read the manual.
> > >
> > > You will have to use a series of if()-elseif()-else()
> > > ----- Original Message -----
> > > From: "Beauford.2002" <[EMAIL PROTECTED]>
> > > To: "PHP General" <[EMAIL PROTECTED]>
> > > Sent: Thursday, December 19, 2002 6:19 PM
> > > Subject: [PHP] Another problem with conditional statements
> > >
> > >
> > > Hi,
> > >
> > > This should be as simple as breathing, but not today. I have
> > two variables
> > > $a and $b which I need to compare in a switch statement in several
> > different
> > > ways, but no matter what I do it's wrong.
> > >
> > > This is what I have tried, can someone tell me how it should be.
> > >
> > > TIA
> > >
> > > switch (true):
> > >
> > >     case ($a == $b):             This one seems simple enough.
> > >             do sum stuff;
> > >             break;
> > >
> > >     case ($a && $b == 124):   This appears not to work.
> > >             do sum stuff;
> > >             break;
> > >
> > >     case ($a == 124 && $b == 755):  If $a is equal to 124 and
> > $b is equal
> > to
> > > 755 then it should be true..doesn't work.
> > >             do sum stuff;
> > >             break;
> > >
> > >     case ($a == 124 && $b != 124):   Nope, this doesn't appear to work
> > > either.
> > >             do sum stuff;
> > >             break;
> > >
> > > endswitch;
> > >
> > >
> > >
> > > --
> > > 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
>
>


--- End Message ---
--- Begin Message ---
On Friday 20 December 2002 08:19, Beauford.2002 wrote:
> Hi,
>
> This should be as simple as breathing, but not today. I have two variables
> $a and $b which I need to compare in a switch statement in several
> different ways, but no matter what I do it's wrong.
>
> This is what I have tried, can someone tell me how it should be.
>
> TIA
>
> switch (true):
>
>     case ($a == $b):             This one seems simple enough.
>             do sum stuff;
>             break;
>
>     case ($a && $b == 124):   This appears not to work.
>             do sum stuff;
>             break;
>
>     case ($a == 124 && $b == 755):  If $a is equal to 124 and $b is equal
> to 755 then it should be true..doesn't work.
>             do sum stuff;
>             break;
>
>     case ($a == 124 && $b != 124):   Nope, this doesn't appear to work
> either.
>             do sum stuff;
>             break;
>
> endswitch;

AFAICS all of them should work. The 2nd case may not work the way you 
intended. It is testing for, if $a is TRUE, AND if $b equals 124.

Where are you getting $a and $b from?

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
You'll feel much better once you've given up hope.
*/

--- End Message ---
--- Begin Message ---
On Friday 20 December 2002 08:28, Sean Malloy wrote:
> Its all wrong. You shouldn't be using a switch statement anyway. A switch
> is for evaluating a single variable.

You can use the switch construct in the context that the OP was using it. In 
fact I prefer use that instead of a whole bunch of if-then-else statements. 
For one thing it looks (IMO) a lot neater.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
Beware of bugs in the above code; I have only proved it correct, not tried it.
                -- Donald Knuth
*/

--- End Message ---
--- Begin Message ---
> -----Original Message-----
> From: Beauford.2002 [mailto:[EMAIL PROTECTED]]
> Sent: 20 December 2002 00:19
> 
> This should be as simple as breathing, but not today. I have 
> two variables
> $a and $b which I need to compare in a switch statement in 
> several different
> ways, but no matter what I do it's wrong.
> 
> This is what I have tried, can someone tell me how it should be.
> 
> TIA
> 
> switch (true):
> 
>     case ($a == $b):             This one seems simple enough.
>             do sum stuff;
>             break;
> 
>     case ($a && $b == 124):   This appears not to work.
>             do sum stuff;
>             break;
> 
>     case ($a == 124 && $b == 755):  If $a is equal to 124 and 
> $b is equal to
> 755 then it should be true..doesn't work.
>             do sum stuff;
>             break;
> 
>     case ($a == 124 && $b != 124):   Nope, this doesn't appear to work
> either.
>             do sum stuff;
>             break;
> 
> endswitch;

Well, I've just cut-and-pasted this code and added a few echo statements
(and some other twiddles to get suitable values in), and it works perfectly
-- so I'd say your $a and $b aren't getting the values you think they are.
As a firtst step, I suggest you echo them out immediately before the switch
statement and see what you've got.

Cheers!

Mike

---------------------------------------------------------------------
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730      Fax:  +44 113 283 3211 
--- End Message ---
--- Begin Message ---
> -----Original Message-----
> From: Rick Emery [mailto:[EMAIL PROTECTED]]
> Sent: 20 December 2002 00:34
> 
> switch() does not work that way.  Switch uses the value in 
> the parentheses and selects a
> CASE based upon that value.  Read the manual.
> 
> You will have to use a series of if()-elseif()-else()

Not true.  Absolutely nothing wrong with using switch in this way -- it's a
very neat and useful device.

Cheers!

Mike

---------------------------------------------------------------------
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730      Fax:  +44 113 283 3211 
--- End Message ---
--- Begin Message ---
> -----Original Message-----
> From: Sean Malloy [mailto:[EMAIL PROTECTED]]
> Sent: 20 December 2002 02:36
> To: PHP General
> Subject: RE: [PHP] Another problem with conditional statements
> 
> 
> Nowhere in the documentation does it specify switch should be 
> used in the
> context you are attempting.

The docs say:

 "In many occasions, you may want to compare the same variable
  (or expression) with many different values, and execute a
  different piece of code depending on which value it equals
  to. This is exactly what the switch statement is for."

TRUE is an expression, and so can be the subject of a switch statement. 

> The docs show a single variable and checking the case of that 
> variable.

Admittedly all the examples in the manual use a single variable, but from the first 
sentence of the switch description:

 "The switch statement is similar to a series of IF statements
  on the same expression."

... I think it's reasonable to deduce that the parentheses after switch can contain 
any legitimate expression.

Admittedly, all the examples in the manual use a single variable -- perhaps you might 
want to submit a Documentation Problem bug report suggesting some more complex 
examples.  Actually, looking at the online manual again, I see several user notes with 
potential candidates for moving to the manual proper, including one which demonstrates 
the exact usage that the OP was having problems with.

Cheers!

Mike

---------------------------------------------------------------------
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730      Fax:  +44 113 283 3211 
--- End Message ---
--- Begin Message ---
> -----Original Message-----
> From: Beauford.2002 [mailto:[EMAIL PROTECTED]]
> Sent: 20 December 2002 03:15
> 
> 
> Using switch would be more efficiant as it would stop once a 
> match is made
> (if you use break), but with eleif statements each one is evaluated in
> order.

Not sure that's true -- a sequence of elseifs will also stop evaluating once one of 
the conditions has evaluated to true.  The essential difference is that a switch/case 
structure is a repeated test against a single value (possibly derived from an 
expression), whereas an if ... elseif sequence can test multiple completely disjoint 
conditions.

> $chr = substr($a,$i,1);
> switch (TRUE) {
> 
> case $chr == "á" || $chr == "à" || $chr == "ã" || $chr == "â":
> $a = str_replace(substr($a,$i,1),"a",$a);
> break;
> 
> case $chr == "é" || $chr == "è" || $chr == "ê":
> $a = str_replace(substr($a,$i,1),"e",$a);
> break;
> 
> }

Actually, I'm not sure that's a good example, either!  I'd have thought it was better 
written as:

  switch (substr($a,$i,1)) {

  case "á":
  case "à":
  case "ã":
  case "â":
    $a = str_replace(substr($a,$i,1),"a",$a);
    break;

  case "é":
  case "è":
  case "ê":
    $a = str_replace(substr($a,$i,1),"e",$a);
    break;
 
  }

Cheers!

Mike

---------------------------------------------------------------------
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730      Fax:  +44 113 283 3211 
--- End Message ---
--- Begin Message ---
TTT for the same info for sydney.
Thanks

-----Original Message-----
From: Ben C. [mailto:[EMAIL PROTECTED]]
Sent: Friday, December 20, 2002 12:31 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Training Courses in PHP & MySQL


Does anyone know where I can get a good training course in both PHP and
MySQL that would make me proficient?  Or does anyone know of a good tutor?
I would prefer it to be in California or on the west coast.  Please provide
your comments.


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


Netway Networks Pty Ltd 
(T) 8920 8877 
(F) 8920 8866 


--- End Message ---
--- Begin Message ---
Ben C . wrote:
Does anyone know where I can get a good training course in both PHP and MySQL that would make me proficient?  Or does anyone know of a good tutor?  I would prefer it to be in California or on the west coast.  Please provide your comments.

Hello Ben:

We offer PHP/MySQL training courses - currently in Detroit/Chicago, but we're planning others in Texas and later California. More
info can be found at http://www.tapinternet.com/php. We've
recently partnered with Zend and are looking to expand our
classes into various other markets.

If you're serious about learning PHP, give me a call or drop me an
email at [EMAIL PROTECTED] Our next class is in January
in Detroit, but we may still be able to convince you to come out
here anyway! :)

I can be reached at 734-480-9961, or 1-866-745-3660 (toll free).

I look forward to hearing from you.

Michael Kimsal
http://www.tapinternet.com
734-480-9961

--- End Message ---
--- Begin Message ---
I would reccomend going to the source and looking at the training courses
offered by MySQL AB, the developers of MySQL. Here is a link to the info
page for MySQL's training on PHP + MySQL:

http://www.mysql.com/training/courses/developing_dynamic_webapp.html

Looks like a course is coming up in San Francisco in February.

Mike Hillyer

-----Original Message-----
From: Ben C. [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 19, 2002 6:31 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Training Courses in PHP & MySQL


Does anyone know where I can get a good training course in both PHP and
MySQL that would make me proficient?  Or does anyone know of a good tutor?
I would prefer it to be in California or on the west coast.  Please provide
your comments.


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

--- End Message ---
--- Begin Message ---
Ben C . wrote:
Does anyone know where I can get a good training course in both PHP and MySQL that would make me proficient?  Or does anyone know of a good tutor?  I would prefer it to be in California or on the west coast.  Please provide your comments.

I'd neglected to mention that with our courses, students
get a free Zend Studio, and free snacks and lunch.  Little
things, true, but they mean a lot to some people.  :0

Michael Kimsal
http://www.tapinternet.com/php
734-480-9961

--- End Message ---
--- Begin Message ---
For the record, variables are case sensitive so it's
$_SESSION not $_session.

And if you're going to use $_SESSION (which you should),
do not use session_register().

Regards,
Philip


On Thu, 19 Dec 2002, Mike Hillyer wrote:

> I have recieved a private response, it appears my system had
> register_globals off and the other server would have had it turned on. The
> proper usage was actually $_session["name"] and I shall be using that.
> 
> This was my first use of the PHP mailing list and I am very impressed and
> pleased with all the quick and helpful responses. Thank you all.
> 
> Mike Hillyer
> 
> -----Original Message-----
> From: Quentin Bennett [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, December 19, 2002 5:24 PM
> To: PHP GENERAL LIST
> Subject: RE: [PHP] Problem with sessions.
> 
> 
> Hi,
> 
> Is your 'other server' identical (Web Server, PHP Version, register_globals
> setting)?
> 
> Quentin
> 
> -----Original Message-----
> From: Mike Hillyer [mailto:[EMAIL PROTECTED]]
> Sent: Friday, 20 December 2002 12:43 p.m.
> To: PHP GENERAL LIST
> Subject: [PHP] Problem with sessions.
> 
> 
> Hello All;
> 
> Please forgive me if I am repeating an often asked question, but I am having
> a problem with sessions. I simply cannot get them to work.
> 
> The sample code I provide works on another server perfectly, this is the
> first page:
> 
> <?PHP
> 
>  session_start();
>  session_register("name","pass");
>  $name = "hilde";
>  $pass = "mypassword";
>  echo "<h1>Session variables set!</h1>";
>  echo "<a href=\"page2.php\">go to next page</a>";
> 
> ?>
> 
> When called, the following file arrives in /tmp:
> 
> sess_f9c5e87b35ae66eac64a9a346321b269
> 
> name|s:5:"hilde";pass|s:10:"mypassword";
> 
> 
> 
> So obviously the session file is being created.
> However, when I go to page2.php?PHPSESSID=f9c5e87b35ae66eac64a9a346321b269
> Which has this code:
> 
> <?PHP
>  session_start();
>  echo "<h1>The password of $name is $pass </h1>";
> 
> ?>
> 
> I get "The Password of  is "
> 
> As a response. Both pages work perfectly on another server, so I am having
> trouble finding the problem, especially since the session file is actually
> created in /tmp
> 
> My PHP.ini file is standard to a RedHat RPM install, but I will include it
> as an attachment.
> 
> Any help would be greatly appreciated!
> 
> Mike Hillyer
> 
> The information contained in this email is privileged and confidential and
> intended for the addressee only. If you are not the intended recipient, you
> are asked to respect that confidentiality and not disclose, copy or make use
> of its contents. If received in error you are asked to destroy this email
> and contact the sender immediately. Your assistance is appreciated.
> 
> --
> 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
> 

--- End Message ---
--- Begin Message ---
On Friday 20 December 2002 07:43, Mike Hillyer wrote:
> Hello All;
>
> Please forgive me if I am repeating an often asked question, but I am
> having a problem with sessions. I simply cannot get them to work.
>
> The sample code I provide works on another server perfectly, this is the
> first page:

So what's the difference between the two servers?

> My PHP.ini file is standard to a RedHat RPM install, but I will include it
> as an attachment.

I don't think you can send attachments to the list. Examine the php.ini on 
both servers and play "spot the difference" :)

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
Nezvannyi gost'--khuzhe tatarina.
        [An uninvited guest is worse than the Mongol invasion]
                -- Russian proverb
*/

--- End Message ---
--- Begin Message ---
 At the beginning of my page I have some code which calls a function I have
created, at the bottom of the page is the function, but I keep getting the
error Fatal error: Call to undefined function: gotofunction() in ...... no
matter what I do.

 Any info on what's happening is appreciated.

 example:

 if ($a == $b) {
     gotofunction($a, $b);
 }

 function gotofunction($a, $b) {

 a bunch of code;

 }



--- End Message ---
--- Begin Message ---
Try defining the function before you call it. 

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/

> -----Original Message-----
> From: Beauford.2002 [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, December 19, 2002 10:07 PM
> To: PHP General
> Subject: [PHP] Fw: Fatal error: Call to undefined function:
allerrors()
> in............
> 
> 
>  At the beginning of my page I have some code which calls a function I
> have
> created, at the bottom of the page is the function, but I keep getting
the
> error Fatal error: Call to undefined function: gotofunction() in
...... no
> matter what I do.
> 
>  Any info on what's happening is appreciated.
> 
>  example:
> 
>  if ($a == $b) {
>      gotofunction($a, $b);
>  }
> 
>  function gotofunction($a, $b) {
> 
>  a bunch of code;
> 
>  }
> 
> 
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php



--- End Message ---
--- Begin Message ---
Hi,

I'm still having the same problem, the PHP code is sometimes not
interpreted, but passed as text/plain to the browser. The MIME type is
configured correctly, and once (in the master httpd.conf). I even
recompiled Apache. The system: RedHat 6.2 (ancient, I know) with Apache
1.3.27 and PHP 4.2.3. My MIME type defs:

AddType application/x-httpd-php .php .php4 .php3 .phtml .html
AddType application/x-httpd-php-source .phps

The module loads correctly, and no error is shown in the logs. The problem
happens mainly with Horde/IMP (I'm using Horde's PEAR, BTW). I guess that
everything started when Perl was upgraded from 5.6.0 to 5.8.0, but I can't
see any connection.

Any idea is appreciated.

Thanks.


--- End Message ---
--- Begin Message --- I am attempting to modify an old script to support the superglobal $_POST with register_globals=Off. These register globals are definately challenging when you are new to php and every example shown anywhere uses the old method but I guess what doesn't kill you only makes you stronger.

I am trying to convert this line, $email is coming from an html form so I would typically call it with $_POST['email'] but this doesn't work in this case and I thus far haven't been able to find anything that explains what I should be doing.

function check_banlist($banlist, $email) {

Any assistance is appreciated! Thanks,

Jamie

--- End Message ---
--- Begin Message ---
First, read this:

  http://www.php.net/variables.external

Second, assuming you have a PHP version equal to
or greater than 4.1.0 and the method of the form
is POST, you'd do something like this:

  $banlist = array('[EMAIL PROTECTED]');
  echo check_banlist($banlist, $_POST['email']);

Your question sounds like you're wondering if the
function definition should change, it doesn't.  You
leave it as $email and use $email within the function.
This is just how functions work, you pass in values.
So:

  function foo ($email) {
      print $email;
  }

  foo($_POST['email']);

  // Or as you used to do with register_globals
  foo($email);

Or you could always just do:

  function bar () {
      print $_POST['email'];
  }

  bar();

This is why they are SUPERglobals, because this is
what you would have done in the past (old school):

  function baz () {
      global $email, $HTTP_POST_VARS;

      print $email;

      print $HTTP_POST_VARS['email'];
  }

Also it's worth mentioning that $HTTP_POST_VARS has 
existed since PHP 3, so just in case that might be 
important to you too.  It is not super.

Now if you don't care if 'email' comes from GET, POST,
or COOKIE ... you could use $_REQUEST['email'].  Or,
import_request_variables() is another option.  For
example:

  import_request_variables('p', 'p_');

  print $p_email;

See the manual for details, and have fun!  It really
isn't that complicated and you'll be yelling out
Eureka! pretty soon now.

Regards,
Philip Olson

P.s. Superglobals work with register_globals on or off.


On Thu, 19 Dec 2002, Jamie wrote:

> I am attempting to modify an old script to support the superglobal 
> $_POST with register_globals=Off.  These register globals are definately 
> challenging when you are new to php and every example shown anywhere 
> uses the old method but I guess what doesn't kill you only makes you 
> stronger.
> 
> I am trying to convert this line, $email is coming from an html form so 
> I would typically call it with $_POST['email'] but this doesn't work in 
> this case and I thus far haven't been able to find anything that 
> explains what I should be doing.
> 
> function check_banlist($banlist, $email) {
> 
> Any assistance is appreciated!  Thanks,
> 
> Jamie
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

--- End Message ---
--- Begin Message --- I haven't been indenting any of my code, but I want to start indenting to make the code more readable. It would be near-impossible for me to manually indent what's already there, though. So, I'm looking for a program to indent an entire folder of PHP files at once. Any suggestions?

--
The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.


--- End Message ---
--- Begin Message --- Thanks, but that's not what I'm looking for. I already have a good php editor, what I'm looking for is something to indent exsiting files.

Mike Bowers wrote:

I use Ultra-Edit 32 .. It auto-indents when u set highlight mode to PHP
.. It also has a syntax higlight feature to show you when it recoginises
PHP4.2.3 code .. http://www.ultraedit.com

Mike Bowers
PlanetModz Gaming Network Webmaster
[EMAIL PROTECTED]
ViperWeb Hosting Server Manager
[EMAIL PROTECTED]
[EMAIL PROTECTED]
All outgoing messages scanned for viruses
using Norton AV 2002


-----Original Message-----
From: Leif K-Brooks [mailto:[EMAIL PROTECTED]] Sent: Thursday, December 19, 2002 9:53 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Good program to indent large quantity of files?


I haven't been indenting any of my code, but I want to start indenting to make the code more readable. It would be near-impossible for me to manually indent what's already there, though. So, I'm looking for a program to indent an entire folder of PHP files at once. Any
suggestions?


--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.



--- End Message ---
--- Begin Message ---
on 20/12/02 4:04 PM, Leif K-Brooks ([EMAIL PROTECTED]) wrote:

> Thanks, but that's not what I'm looking for.  I already have a good php
> editor, what I'm looking for is something to indent exsiting files.

... so open them up in the editor, indent them, save them, continue using
your old editor.

Justin


> Mike Bowers wrote:
> 
>> I use Ultra-Edit 32 .. It auto-indents when u set highlight mode to PHP
>> .. It also has a syntax higlight feature to show you when it recoginises
>> PHP4.2.3 code .. http://www.ultraedit.com
>> 
>> Mike Bowers
>> PlanetModz Gaming Network Webmaster
>> [EMAIL PROTECTED]
>> ViperWeb Hosting Server Manager
>> [EMAIL PROTECTED]
>> [EMAIL PROTECTED]
>> All outgoing messages scanned for viruses
>> using Norton AV 2002
>> 
>> 
>> -----Original Message-----
>> From: Leif K-Brooks [mailto:[EMAIL PROTECTED]]
>> Sent: Thursday, December 19, 2002 9:53 PM
>> To: [EMAIL PROTECTED]
>> Subject: [PHP] Good program to indent large quantity of files?
>> 
>> 
>> I haven't been indenting any of my code, but I want to start indenting
>> to make the code more readable.  It would be near-impossible for me to
>> manually indent what's already there, though.  So, I'm looking for a
>> program to indent an entire folder of PHP files at once.  Any
>> suggestions?
>> 
>> 
>> 

--- End Message ---
--- Begin Message --- But as far as I can tell, there's no "indent all" option. I'd have to do it by hand, or remove and recreate the line breaks in the text files.

Justin French wrote:

on 20/12/02 4:04 PM, Leif K-Brooks ([EMAIL PROTECTED]) wrote:


Thanks, but that's not what I'm looking for. I already have a good php
editor, what I'm looking for is something to indent exsiting files.

... so open them up in the editor, indent them, save them, continue using
your old editor.

Justin



Mike Bowers wrote:


I use Ultra-Edit 32 .. It auto-indents when u set highlight mode to PHP
.. It also has a syntax higlight feature to show you when it recoginises
PHP4.2.3 code .. http://www.ultraedit.com

Mike Bowers
PlanetModz Gaming Network Webmaster
[EMAIL PROTECTED]
ViperWeb Hosting Server Manager
[EMAIL PROTECTED]
[EMAIL PROTECTED]
All outgoing messages scanned for viruses
using Norton AV 2002


-----Original Message-----
From: Leif K-Brooks [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 19, 2002 9:53 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Good program to indent large quantity of files?


I haven't been indenting any of my code, but I want to start indenting
to make the code more readable. It would be near-impossible for me to
manually indent what's already there, though. So, I'm looking for a
program to indent an entire folder of PHP files at once. Any
suggestions?






--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.


--- End Message ---
--- Begin Message ---
Leif K-Brooks wrote:
I haven't been indenting any of my code, but I want to start indenting to make the code more readable. It would be near-impossible for me to manually indent what's already there, though. So, I'm looking for a program to indent an entire folder of PHP files at once. Any suggestions?

phpedit.com (I believe) has a 'code beautifier' program which will
take existing files and make them 'pretty' (indented, etc)

Not sure if it can do things in batches or not, but still faster
than doing things manually.

--- End Message ---
--- Begin Message ---
Suppose my web domain is http://abc.com
There is a administration directory in my wwwroot which is used to store the
administrative control pages.

However, from now on, everyone can access the administrative pages through
the addictive path to the domain such as:
http://abc.com/administration/xxx.php

Is there any solution to block or prevent the addictive path through my
server?
Just like only http://abc.com is allowed to browse.
thx a lot


--- End Message ---
--- Begin Message ---
if ur using apache using .htaccess in the directory .. and you can also set
it in the httpd.conf

> -----Original Message-----
> From: ªüYam [mailto:[EMAIL PROTECTED]]
> Sent: Friday, 20 December 2002 4:41 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] URL path problems
>
>
> Suppose my web domain is http://abc.com
> There is a administration directory in my wwwroot which is used
> to store the
> administrative control pages.
>
> However, from now on, everyone can access the administrative pages through
> the addictive path to the domain such as:
> http://abc.com/administration/xxx.php
>
> Is there any solution to block or prevent the addictive path through my
> server?
> Just like only http://abc.com is allowed to browse.
> thx a lot
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>

--- End Message ---
--- Begin Message ---
> Suppose my web domain is http://abc.com
> There is a administration directory in my wwwroot which is used to store
the
> administrative control pages.
>
> However, from now on, everyone can access the administrative pages through
> the addictive path to the domain such as:
> http://abc.com/administration/xxx.php
>
> Is there any solution to block or prevent the addictive path through my
> server?
> Just like only http://abc.com is allowed to browse.
> thx a lot

Why not try reading up on using htaccess?? But u need apache though...

Here's a link to get u started:

http://www.devarticles.com/art/1/15
http://www.devarticles.com/art/1/266



--- End Message ---
--- Begin Message ---
Thx for your help, but....is there any instructions that let me follow?
I'm not familiar with those settings,
thx a lot
"Peter Houchin" <[EMAIL PROTECTED]> ¼¶¼g©ó¶l¥ó·s»D
:[EMAIL PROTECTED]
> if ur using apache using .htaccess in the directory .. and you can also
set
> it in the httpd.conf
>
> > -----Original Message-----
> > From: ªüYam [mailto:[EMAIL PROTECTED]]
> > Sent: Friday, 20 December 2002 4:41 PM
> > To: [EMAIL PROTECTED]
> > Subject: [PHP] URL path problems
> >
> >
> > Suppose my web domain is http://abc.com
> > There is a administration directory in my wwwroot which is used
> > to store the
> > administrative control pages.
> >
> > However, from now on, everyone can access the administrative pages
through
> > the addictive path to the domain such as:
> > http://abc.com/administration/xxx.php
> >
> > Is there any solution to block or prevent the addictive path through my
> > server?
> > Just like only http://abc.com is allowed to browse.
> > thx a lot
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> >
>


--- End Message ---
--- Begin Message --- Hi.
Lets says I have 8 links stored in a database, extracting those links is no problem. Now lets says I have 2 columns, how do I get link 1 into column 1 then get link 2 into column 2 then link 3 into column 1 and link 4 into column 2 and so on...

<table>
<tr>
<td>This is column 1</td>
<td>This is column 2</td>
</tr>
</table>

--
Conbud
Graphic & Web Design Using Open Source Technology
--

--- End Message ---
--- Begin Message ---
This faqt answers your question:

  http://www.faqts.com/knowledge_base/view.phtml/aid/8583

Regards,
Philip Olson


On Fri, 20 Dec 2002, conbud wrote:

> Hi.
> Lets says I have 8 links stored in a database, extracting those links is 
> no problem. Now lets says I have 2 columns, how do I get link 1 into 
> column 1 then get link 2 into column 2  then link 3 into column 1 and 
> link 4 into column 2 and so on...
> 
> <table>
> <tr>
> <td>This is column 1</td>
> <td>This is column 2</td>
> </tr>
> </table>
> 
> --
> Conbud
> Graphic & Web Design Using Open Source Technology
> --
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

--- End Message ---
--- Begin Message ---
There was a post on a similar thing the other day, and about once a week for
the past few years :P

Quick (untested) example:

<table>
<?
$i = 0;
$sql = 'select link from tablename';
$result = mysql_query($sql);
while($myrow = mysql_fetch_array($result))
    {
    $i++;
    if($i == 1) { echo '<tr>'; }
    echo "<td>{$myrow['link']}</td>";
    if($i == 2) { echo '</tr>'; $i = 0; }
    }
?>
</table>

This is easily adaptable to three (or more) columns by changing the last
if() statement...

Justin
    


on 20/12/02 5:21 PM, conbud ([EMAIL PROTECTED]) wrote:

> Hi.
> Lets says I have 8 links stored in a database, extracting those links is
> no problem. Now lets says I have 2 columns, how do I get link 1 into
> column 1 then get link 2 into column 2  then link 3 into column 1 and
> link 4 into column 2 and so on...
> 
> <table>
> <tr>
> <td>This is column 1</td>
> <td>This is column 2</td>
> </tr>
> </table>
> 
> --
> Conbud
> Graphic & Web Design Using Open Source Technology
> --
> 

--- End Message ---
--- Begin Message --- Hey, thanks. I should have thought about it longer, since I made something the exact same to alternate <tr> bgcolors. Thanks for refreshing though.

Justin French wrote:
There was a post on a similar thing the other day, and about once a week for
the past few years :P

Quick (untested) example:

<table>
<?
$i = 0;
$sql = 'select link from tablename';
$result = mysql_query($sql);
while($myrow = mysql_fetch_array($result))
{
$i++;
if($i == 1) { echo '<tr>'; }
echo "<td>{$myrow['link']}</td>";
if($i == 2) { echo '</tr>'; $i = 0; }
}
?>
</table>

This is easily adaptable to three (or more) columns by changing the last
if() statement...

Justin


on 20/12/02 5:21 PM, conbud ([EMAIL PROTECTED]) wrote:


Hi.
Lets says I have 8 links stored in a database, extracting those links is
no problem. Now lets says I have 2 columns, how do I get link 1 into
column 1 then get link 2 into column 2  then link 3 into column 1 and
link 4 into column 2 and so on...

<table>
<tr>
<td>This is column 1</td>
<td>This is column 2</td>
</tr>
</table>

--
Conbud
Graphic & Web Design Using Open Source Technology
--



--- End Message ---
--- Begin Message ---
"Edward Peloke" <[EMAIL PROTECTED]> a écrit dans le message news:
[EMAIL PROTECTED]
> using php, can I extract data from an access file?
you can use odbc or com to connect to an access database.
(http://www.php.net/manual/en/faq.databases.php#faq.databases.access)

BTW, concerning your first question (burning a php application on a cd), you
would also look at
http://www.webmasterworld.com/forum13/1760.htm

Philippe


--- End Message ---
--- Begin Message --- Hi;
I have a PHP script that prints x number of products and related code to the generated HTML page. In that repeated code is a JavaScript that enables a pop-up window with an enlarged photo of a thumbnail image. The code printed to the JavaScript is dynamically generated in the loop and is correct. *However*, since the JavaScript has the same_name in all its renditions, when it's activated, it calls the last dynamically generated enlarged image, which is not necessarily the one the client cares to see. How do I keep my dynamic generation and get the correct photo to print? Is it possible to name functions differently via including an incremented variable? Here's my code:

<?php // display the products
$j=0;
while( $fcp->next_record() ){
$flag1=(int)$fcp->f('prodflag1');
?>

<tr><td align=left valign=top colspan=1>

<table width="100%" cellpadding=0 cellspacing=0 border=0>
<tr><td align=left valign=top colspan=3>

<?php
if($fcp->f("prodpic")){ // show the product picture (if defined)
/*
width="<?php echo $fcp->f("prodpicw")?>"
height="<?php echo $fcp->f("prodpich")?>"
*/
?>

<script language="javascript">
var photo = new String();
photo.src = "Jewelry.php?photo=<? echo ereg_replace('\.','%2E',htmlentities(urlencode($fcp->f("prodpic"))))?>&height=<? echo
$fcp->f("prodpich")?>";
function popUp(here) {
larimar = eval( here + ".src");
newWindow = window.open(larimar,"","toolbar=0,menubar=0,width=500,height=450, scrollbars=1 ,status=0,location=0,dire
ctories=0,left=100,top=0");
}
</script>
<table border=0><tr><td align=center>
<a href="#" onClick="popUp('photo')"><img src="<? echo $fcp->f("prodtpic")?>"
width="<?php echo $fcp->f("prodtpicw")?>"
height="<?php echo $fcp->f("prodtpich")?>"
border=0 align=left></a><br clear=all>
<i>Click image for enlargement.</i>
</td></tr></table>

So, how do I set an incrementor on popUp(here)?
TIA,
beno


--- End Message ---
--- Begin Message --- Hi everybody,
I've problem deciding whether is method call static or dynamic. How can I find it?

mirek

--- End Message ---
--- Begin Message ---
[re-sending]
Hi everybody,
   I've problem deciding whether is method call static or dynamic. How
can I find it?

mirek


--- End Message ---
--- Begin Message ---
[re-sending]
Hi everybody,
   I've problem deciding whether is method call static or dynamic. How
can I find it?

mirek


--- End Message ---
--- Begin Message ---
On Thursday 19 December 2002 23:48, Mako Shark wrote:
> Anybody have any bright ideas?
>
> Trying to install my own PHP on my own server. I'm
> getting the error "Redirection limit for this URL
> exceeded. Unable to load the requested page."

Not sure whether this is your problem, but one thing which can cause this is 
when your browser is set to reject cookies and the page tries to set a cookie 
and redirects to itself to read the cookie which it tried to set, it doesn't 
find it so it sets it again and redirects ... until you get the error 
message.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
Good day for overcoming obstacles.  Try a steeplechase.
*/

--- End Message ---
--- Begin Message ---
You can also change the apache config to use php for .html pages. 

example in apache 2.0.x:

<VirtualHost a.b.c.d:80>
  ... normal stuff like documentroot, servername, ..
  <Files *.html>
    SetOutputFilter PHP
    SetInputFilter PHP
  </Files>
</VirtualHost>
Or globally in the /etc/httpd/conf.d/php.conf, add a:
<Files *.html>
  SetOutputFilter PHP
  SetInputFilter PHP
</Files>

Example in apache 1.3.x:
Between the <IfModule mod_mime.c> and </IfModule> tags, add the
following:
AddType application/x-httpd-php .html

Kind regards,
Dries Verachtert



On Thu, 2002-11-07 at 22:27, 1LT John W. Holmes wrote:
> > PHP isn't working in my html docs - what changes do I need to make to get
> it
> > to do so?  Does it need to be recompiled?  Can I do it without
> re-compiling?
> 
> Give your file a .php extension, maybe?
> 
> ---John Holmes...
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php


--- End Message ---
--- Begin Message ---
Hi,

   i had a few problems with mkdir() ane uploading files using php.

   i have a simple script, which is making a dir. but everytime, it
   makes a dir with totally wrong user. chown wont work.

   any expirience with this?? i have found some older posts
   considering this, but no real answers. i think, the problem is
   probably in httpd.conf (apche config file), but i am not sure.

   any ideas?

   thanx.

   Mirza

--- End Message ---
--- Begin Message ---
>    i had a few problems with mkdir() ane uploading files using php.
> 
>    i have a simple script, which is making a dir. but everytime, it
>    makes a dir with totally wrong user. chown wont work.
> 
>    any expirience with this?? i have found some older posts
>    considering this, but no real answers. i think, the problem is
>    probably in httpd.conf (apche config file), but i am not sure.

That's normal. PHP runs as the Apache user, so anything it creates will
be owned by that user. Workaround is to use CGI mode or make the dir 777
so you can still access it. 

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/


--- End Message ---
--- Begin Message ---
> -----Original Message-----
> From: Sean Malloy [mailto:[EMAIL PROTECTED]]
> Sent: 19 December 2002 23:30
> 
> Firstly, something regarding accessing form/query string variables, on
> diffferent versions of PHP. Starts to become a nightmare, but 
> you also want
> to make sure you _aren't_ requiring register_globals to be on...
> 
> so what I do;
> 
> function Form($var = null)
> {
>     if (function_exists('version_compare')) // added in 4.1.0
>     {
>         return @$_POST[$var];
>     }
>     global $HTTP_POST_VARS;
>     return @$HTTP_POST_VARS[$var];
> }

This seems unnecessarily complex -- $HTTP_*_VARS did not go away when the new $_* 
superglobals were introduced, and are not likely to anytime soon, so the simple way to 
do this is just to continue referring to $HTTP_POST_VARS[$var].


Cheers!

Mike

---------------------------------------------------------------------
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730      Fax:  +44 113 283 3211 
--- End Message ---
--- Begin Message ---
OK, so I've spent the last 2 or 3 hours looking on the net for this.
Can anyone tell me the proper way (with Apache 2.0.40) to instruct
apache to process .htm and .html files?

I've tried:
In /etc/httpd/conf/httpd.conf ::
        AddType application/x-httpd-php .php
        AddType application/x-httpd-php .html
And also in /etc/httpd/conf.d/php.conf ::
        AddType application/x-httpd-php .php
        AddType application/x-httpd-php .html

Neither appears to work or affect anything at all. I have also tried:
<Files *.html>
    SetOutputFilter PHP
    SetInputFilter PHP
</Files>
... in the php.conf file, but my guess is that this wouldn't work unless
something like the AddType points to PHP to begin with.

Can anyone give me some ideas? I'm just fine with Apache 1.3, but RH8
ships with Apache2 and I thought I'd try it ...

Chase

--- End Message ---
--- Begin Message ---
Hello,

I use the following in my VirtualHost example:

<VirtualHost a.b.c.d:80>
  DocumentRoot /a/b/c/d/
  ServerName a.be
  <Files *.html>
    SetOutputFilter PHP
    SetInputFilter PHP
  </Files>
</VirtualHost>

I don't have AddType's for .html. 

I also still got the following:
<Directory "/a/b/c/d/">
  AllowOverride All
</Directory>

This was needed to make the AddType in .htaccess files work in apache
1.3 if i remember correctly.  It's possible you only need a
'AllowOverride FileInfo' to make it work.

This works without problems for me on RH8 with the apache/php from RH8.

Kind regards,
Dries Verachtert


On Fri, 2002-12-20 at 10:32, Chase Urich wrote:
> OK, so I've spent the last 2 or 3 hours looking on the net for this.
> Can anyone tell me the proper way (with Apache 2.0.40) to instruct
> apache to process .htm and .html files?
> 
> I've tried:
> In /etc/httpd/conf/httpd.conf ::
>       AddType application/x-httpd-php .php
>       AddType application/x-httpd-php .html
> And also in /etc/httpd/conf.d/php.conf ::
>       AddType application/x-httpd-php .php
>       AddType application/x-httpd-php .html
> 
> Neither appears to work or affect anything at all. I have also tried:
> <Files *.html>
>     SetOutputFilter PHP
>     SetInputFilter PHP
> </Files>
> ... in the php.conf file, but my guess is that this wouldn't work unless
> something like the AddType points to PHP to begin with.
> 
> Can anyone give me some ideas? I'm just fine with Apache 1.3, but RH8
> ships with Apache2 and I thought I'd try it ...
> 
> Chase
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php


--- End Message ---
--- Begin Message ---
is there a way to get this setting to work without hard setting in htaccess
? i'd like to be able to dynamically set the max filesize via a defines
setting and ini_set rather than statically in htaccess


--- End Message ---
--- Begin Message ---
> -----Original Message-----
> From: electroteque [mailto:[EMAIL PROTECTED]]
> Sent: 20 December 2002 11:35
> To: [EMAIL PROTECTED]
> Subject: [PHP] upload_max_filesize + ini_set
> 
> 
> is there a way to get this setting to work without hard 
> setting in htaccess
> ? i'd like to be able to dynamically set the max filesize via 
> a defines
> setting and ini_set rather than statically in htaccess

No can do -- as all file upload activity takes place before your script even
starts executing, you can't use ini_set on this.

In fact, upload_max_filesize is listed in
http://www.php.net/manual/en/function.ini-set.php as being a PHP_INI_SYSTEM
level directive, which means it can be set only in php.ini or httpd.conf (if
using Apache) -- it's not even settable in .htaccess files.

Cheers!

Mike

---------------------------------------------------------------------
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730      Fax:  +44 113 283 3211 
--- End Message ---
--- Begin Message ---
as title that I'm getting a trouble on filtering the single quote '  , since
there would be error when storing those string into MySQL, thus, i have to
find the appropriate method to solve it, anybody can help please?
thx a lot


--- End Message ---
--- Begin Message ---
don't filter the quotes... escape them with add_slashes()

justin

on 20/12/02 10:50 PM, ªüYam ([EMAIL PROTECTED]) wrote:

> as title that I'm getting a trouble on filtering the single quote '  , since
> there would be error when storing those string into MySQL, thus, i have to
> find the appropriate method to solve it, anybody can help please?
> thx a lot
> 
> 

--- End Message ---
--- Begin Message ---
thx
"Justin French" <[EMAIL PROTECTED]> ¼¶¼g©ó¶l¥ó·s»D
:[EMAIL PROTECTED]
don't filter the quotes... escape them with add_slashes()

justin

on 20/12/02 10:50 PM, ªüYam ([EMAIL PROTECTED]) wrote:

> as title that I'm getting a trouble on filtering the single quote '  ,
since
> there would be error when storing those string into MySQL, thus, i have to
> find the appropriate method to solve it, anybody can help please?
> thx a lot
>
>


--- End Message ---
--- Begin Message ---
post_max_size 8M
upload_tmp_dir <didn't set to any value>

It fails immediately after clicking the submit button.

[thanx for ur concern]


On Wed, 18 Dec 2002, Rich Gray wrote:

> What are these settings in your php.ini?
> 
> post_max_size
> upload_tmp_dir
> 
> Does the upload_tmp_dir have enough space? Are the permissions on the
> directory correct? When you start the upload - how long does it take to fail
> immeditaely you click submit or after a delay. If the latter then is there
> anything created in the upload directory after teh submit is clicked and
> before it fails...?
> 
> -----Original Message-----
> From: Somesh [mailto:[EMAIL PROTECTED]]
> Sent: 18 December 2002 15:52
> To: Rich Gray
> Cc: [EMAIL PROTECTED]
> Subject: RE: [PHP] How to upload a file
> 
> 
> 
> No difference
> 
> 
> On Wed, 18 Dec 2002, Rich Gray wrote:
> 
> > As others have suggested does it make any difference if you up the script
> > timeout limit with set_time_limit() or via the max_execution_time in
> > php.ini?
> >
> 
> 
> 
> 

-- 

--- End Message ---
--- Begin Message ---

You can also change the apache config to use php for .html pages. 

example in apache 2.0.x:

<VirtualHost a.b.c.d:80>
  ... normal stuff like documentroot, servername, ..
  <Files *.html>
    SetOutputFilter PHP
    SetInputFilter PHP
  </Files>
</VirtualHost>
Or globally in the /etc/httpd/conf.d/php.conf, add a:
<Files *.html>
  SetOutputFilter PHP
  SetInputFilter PHP
</Files>

Example in apache 1.3.x:
Between the <IfModule mod_mime.c> and </IfModule> tags, add the
following:
AddType application/x-httpd-php .html

Kind regards,
Dries Verachtert



On Thu, 2002-11-07 at 22:27, 1LT John W. Holmes wrote:
> > PHP isn't working in my html docs - what changes do I need to make to get
> it
> > to do so?  Does it need to be recompiled?  Can I do it without
> re-compiling?
> 
> Give your file a .php extension, maybe?
> 
> ---John Holmes...
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php



--- End Message ---
--- Begin Message --- Reading Remote Files With FOPEN:

This appears to be quite a common problem for installations that run a really tight ship. I am trying to do some XML and have a slight problem:

My hosting company does not allow for file sockets. I assume that this means that allow_url_fopen will not work.

Example
<?php
if (!($fp = fopen($url, "r"))) {
die("could not open XML input");
}
?>

NOTE: This works fine if the file is local.

The following is supposed to work by overriding the default php.ini but sadly, does not work on my installation.

Sample Newsfeed in XML format

Or setting the ini file:

<?php
$feed = 'http://slashdot.org/slashdot.rdf';

ini_set('allow_url_fopen', true);
$fp = fopen($feed, 'r');
$xml = '';
while (!feof($fp)) {
$xml .= fread($fp, 128);
}
fclose($fp);

The result is either getting a message stating that the file could not be opened or that the file does not exist in the directory. The file pointer does not seem to recognize the scheme (http) versus file protocol sometimes?

My question is, has anybody got a reasonable work around for reading remote files from an http server (must be port 80 not ftp port 21) that does not require using any commands from the file sockets set (fopen, fsock...)

OR...

What am I missing here to get the fopen to work when fsockets are NOT ALLOWED.

NOTE: Yahoo Web Hosting is my provider. They have not yet responded to my query regarding file sockets and their policies. I cannot change the PHP installation so I may be not be able to do XML at all.

Any thoughts or comments would be greatly appreciated.

Thanks,
Bill

http://www.zappersoftware.com

--- End Message ---

Reply via email to