RE: [PHP] Parse Error - Help? (AGAIN)

2002-04-25 Thread John Holmes

I don't think performance should be as much of a concern as security.
When you get warnings about undefined variables, it should make you
think about where this variable's value is coming from. If
register_globals is off, then this isn't as much of an issue. If I use
$id, at least I know it's not coming from user input. 

Either way, you should develop with E_ALL so that you can make sure that
variables are set and checked correctly and to spot all the
mistakes/holes that you can. Once you go live, you set it so that NO
errors are reported (default in PHP 4.2) so that viewers can't glean any
info from failed scripts like path directories and file names...

---John Holmes...

> -Original Message-
> From: Maxim Maletsky (PHPBeginner.com)
> [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, April 25, 2002 11:19 AM
> To: 'Nathan'; 'PHP'
> Subject: RE: [PHP] Parse Error - Help? (AGAIN)
> 
> You know, I once said the same: better fix the notices and keep the
code
> "clean". But as I've done several performance tests I came to a
> conclusion that there's no much difference debugging the code yourself
> or let PHP doing it. Often predefining manually a variable resulted to
> me being even more 'expensive' then when PHP debugs it. I think it is
> wise using this feature of PHP. The only reason not to is for having
the
> full control of your code.
> 
> Just my 2 Eurocents
> 
> Sincerely,
> 
> Maxim Maletsky
> Founder, Chief Developer
> 
> www.PHPBeginner.com   // where PHP Begins
> 
> 
> 
> > -----Original Message-
> > From: Nathan [mailto:[EMAIL PROTECTED]]
> > Sent: Thursday, April 25, 2002 7:15 PM
> > To: PHP
> > Subject: Re: [PHP] Parse Error - Help? (AGAIN)
> >
> > I'll second that one... always better to code with register_globals
=
> Off and E_ALL
> > reporting level
> > IMHO.
> >
> > # Nathan
> >
> > - Original Message -
> > From: "Philip Olson" <[EMAIL PROTECTED]>
> > To: "Maxim Maletsky (PHPBeginner.com)"
<[EMAIL PROTECTED]>
> >
> > > To stop receiving the messages from undefined variables add this
at
> top
> > > of your files:
> > >
> > > error_reporting(55);
> >
> > Or better yet, keep as you're doing and develop with E_ALL
> > and fix those E_NOTICE errors correctly! ;)
> >
> > Regards,
> > Philip Olson
> >
> >
> > --
> > 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] Parse Error - Help? (AGAIN)

2002-04-25 Thread Nathan

Fair enough, I suppose at that point it is simply a matter of preference, though I 
must maintain my
debug commentary... I really like knowing that the reason my $variable isn't 
displaying anything is
because I speeled it $varaible. :-)

Cheers,

# Nathan


- Original Message -
From: "Maxim Maletsky (PHPBeginner.com)" <[EMAIL PROTECTED]>
To: "'Nathan'" <[EMAIL PROTECTED]>; "'PHP'" <[EMAIL PROTECTED]>
Sent: Thursday, April 25, 2002 12:58 PM
Subject: RE: [PHP] Parse Error - Help? (AGAIN)


> I would agree that performance-wise, there may be little difference in
how fast a
> script runs. And
> for pre-defining variables, sure you can get away without doing that
and php will
> happily help you
> out. However, I find it easier to debug my code knowing whether or not
I
> remembered to assign a
> value to my variable and where the heck it got assigned from. :-)


This is true. Whatever I write I always have variable *I* created, all
the rest are $_*[] and good old $HTTP_*_VARS[]. I always had register
globals off. So, in this way, since I know that every variable is mine,
why do I have to leave error_reporting E_ALL?


> I would also like to point out that the combo of not registering
globals and having all
> errors
> reported will ensure you get the right data type when using the same
variable names
> for _POST,
> _SESSION, et cetera data. I had a few scripts that behaved differently
than I though
> because I was
> looking for the value of $foo and not realizing that my $foo was
grabbing my session
> data instead of
> what I thought I was assigning it to. I changed my php.ini and now I
tear out far less
> hair this way
> ;-)


Once again, use $_SEESION and this is resolved.
Good point about variable types. Setting them before solves this
problem.

Sincerely,

Maxim Maletsky
Founder, Chief Developer

www.PHPBeginner.com   // where PHP Begins


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




RE: [PHP] Parse Error - Help? (AGAIN)

2002-04-25 Thread Maxim Maletsky \(PHPBeginner.com\)

> I would agree that performance-wise, there may be little difference in
how fast a
> script runs. And
> for pre-defining variables, sure you can get away without doing that
and php will
> happily help you
> out. However, I find it easier to debug my code knowing whether or not
I
> remembered to assign a
> value to my variable and where the heck it got assigned from. :-)


This is true. Whatever I write I always have variable *I* created, all
the rest are $_*[] and good old $HTTP_*_VARS[]. I always had register
globals off. So, in this way, since I know that every variable is mine,
why do I have to leave error_reporting E_ALL?

 
> I would also like to point out that the combo of not registering
globals and having all
> errors
> reported will ensure you get the right data type when using the same
variable names
> for _POST,
> _SESSION, et cetera data. I had a few scripts that behaved differently
than I though
> because I was
> looking for the value of $foo and not realizing that my $foo was
grabbing my session
> data instead of
> what I thought I was assigning it to. I changed my php.ini and now I
tear out far less
> hair this way
> ;-)


Once again, use $_SEESION and this is resolved.
Good point about variable types. Setting them before solves this
problem.

Sincerely,

Maxim Maletsky
Founder, Chief Developer

www.PHPBeginner.com   // where PHP Begins

> 
> # Nathan
> 
> 
> - Original Message -
> From: "Maxim Maletsky (PHPBeginner.com)"
<[EMAIL PROTECTED]>
> To: "'Nathan'" <[EMAIL PROTECTED]>; "'PHP'"
<[EMAIL PROTECTED]>
> Sent: Thursday, April 25, 2002 12:18 PM
> Subject: RE: [PHP] Parse Error - Help? (AGAIN)
> 
> 
> You know, I once said the same: better fix the notices and keep the
code
> "clean". But as I've done several performance tests I came to a
> conclusion that there's no much difference debugging the code yourself
> or let PHP doing it. Often predefining manually a variable resulted to
> me being even more 'expensive' then when PHP debugs it. I think it is
> wise using this feature of PHP. The only reason not to is for having
the
> full control of your code.
> 
> Just my 2 Eurocents
> 
> Sincerely,
> 
> Maxim Maletsky
> Founder, Chief Developer
> 
> www.PHPBeginner.com   // where PHP Begins
> 
> 
> 
> > -Original Message-
> > From: Nathan [mailto:[EMAIL PROTECTED]]
> > Sent: Thursday, April 25, 2002 7:15 PM
> > To: PHP
> > Subject: Re: [PHP] Parse Error - Help? (AGAIN)
> >
> > I'll second that one... always better to code with register_globals
=
> Off and E_ALL
> > reporting level
> > IMHO.
> >
> > # Nathan
> 



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




Re: [PHP] Parse Error - Help? (AGAIN)

2002-04-25 Thread Nathan

I would agree that performance-wise, there may be little difference in how fast a 
script runs. And
for pre-defining variables, sure you can get away without doing that and php will 
happily help you
out. However, I find it easier to debug my code knowing whether or not I remembered to 
assign a
value to my variable and where the heck it got assigned from. :-)

I would also like to point out that the combo of not registering globals and having 
all errors
reported will ensure you get the right data type when using the same variable names 
for _POST,
_SESSION, et cetera data. I had a few scripts that behaved differently than I though 
because I was
looking for the value of $foo and not realizing that my $foo was grabbing my session 
data instead of
what I thought I was assigning it to. I changed my php.ini and now I tear out far less 
hair this way
;-)

# Nathan


- Original Message -
From: "Maxim Maletsky (PHPBeginner.com)" <[EMAIL PROTECTED]>
To: "'Nathan'" <[EMAIL PROTECTED]>; "'PHP'" <[EMAIL PROTECTED]>
Sent: Thursday, April 25, 2002 12:18 PM
Subject: RE: [PHP] Parse Error - Help? (AGAIN)


You know, I once said the same: better fix the notices and keep the code
"clean". But as I've done several performance tests I came to a
conclusion that there's no much difference debugging the code yourself
or let PHP doing it. Often predefining manually a variable resulted to
me being even more 'expensive' then when PHP debugs it. I think it is
wise using this feature of PHP. The only reason not to is for having the
full control of your code.

Just my 2 Eurocents

Sincerely,

Maxim Maletsky
Founder, Chief Developer

www.PHPBeginner.com   // where PHP Begins



> -Original Message-
> From: Nathan [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, April 25, 2002 7:15 PM
> To: PHP
> Subject: Re: [PHP] Parse Error - Help? (AGAIN)
>
> I'll second that one... always better to code with register_globals =
Off and E_ALL
> reporting level
> IMHO.
>
> # Nathan



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




RE: [PHP] Parse Error - Help? (AGAIN)

2002-04-25 Thread Maxim Maletsky \(PHPBeginner.com\)

You know, I once said the same: better fix the notices and keep the code
"clean". But as I've done several performance tests I came to a
conclusion that there's no much difference debugging the code yourself
or let PHP doing it. Often predefining manually a variable resulted to
me being even more 'expensive' then when PHP debugs it. I think it is
wise using this feature of PHP. The only reason not to is for having the
full control of your code.

Just my 2 Eurocents

Sincerely,

Maxim Maletsky
Founder, Chief Developer

www.PHPBeginner.com   // where PHP Begins



> -Original Message-
> From: Nathan [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, April 25, 2002 7:15 PM
> To: PHP
> Subject: Re: [PHP] Parse Error - Help? (AGAIN)
> 
> I'll second that one... always better to code with register_globals =
Off and E_ALL
> reporting level
> IMHO.
> 
> # Nathan
> 
> - Original Message -
> From: "Philip Olson" <[EMAIL PROTECTED]>
> To: "Maxim Maletsky (PHPBeginner.com)" <[EMAIL PROTECTED]>
> 
> > To stop receiving the messages from undefined variables add this at
top
> > of your files:
> >
> > error_reporting(55);
> 
> Or better yet, keep as you're doing and develop with E_ALL
> and fix those E_NOTICE errors correctly! ;)
> 
> Regards,
> Philip Olson
> 
> 
> --
> 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] Parse Error - Help? (AGAIN)

2002-04-25 Thread 1LT John W. Holmes

> > To stop receiving the messages from undefined variables add this at top
> > of your files:
> > 
> > error_reporting(55);
> 
> Or better yet, keep as you're doing and develop with E_ALL 
> and fix those E_NOTICE errors correctly! ;)

Well said...don't hide and ignore the warnings...fix them.

---John Holmes...


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




Re: [PHP] Parse Error - Help? (AGAIN)

2002-04-25 Thread 1LT John W. Holmes

I guess I missed the "last line" part, my bad.

Yes, you've got the idea for isset(). ! means NOT. So isset($id) will check
to see if $id is set, it doesn't care what the value is. !isset($id) will
see if $id is NOT set. A variable can be set and have an empty value, or be
false, null, etc.

The idea behind "undefined variable" is that you must assign a default value
to to the variable before you print it out or use it in a comparison. You
can adjust your error_reporting() so you don't get these errors, but it's
better to leave it on and make your code work. You can see they are just
warnings, and your code will still work. It's an easy way to find typo'd
variable names. Also, when register_globals is ON, you might use $id and
expect the value to be passed through the URL. By getting this warning when
you check $id, you should realize that the variable needs to be validated,
because it can be anything coming through the URL.

Hope that helps.

---John Holmes...

- Original Message -
From: "Jason Soza" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, April 25, 2002 12:33 PM
Subject: Re: [PHP] Parse Error - Help? (AGAIN)


> Sorry for the length of the code, but I felt I described the problem,
> (parse error, last line) and if I hadn't posted the entire code I
> probably would've been asked to. This list can be a little confusing
> for a newbie: just a couple days ago I read someone saying "too much
> information is better than not enough" and now I'm getting that I
> posted too much. I'm still learning! :)
>
> What does the ! in if(!isset($id)) { $id = 0; } do? I think I get what
> this bit does in general: checks if $id has been assigned anything, if
> it's empty it gets assigned 0. Correct? Then I can use if($id)
> statements later on without having PHP return "Undefined Variable"
> errors. Right?
>
> Thanks for your help, I'll work on my PHP listetiquette.
>
> Jason Soza
>
> - Original Message -
> From: "1LT John W. Holmes" <[EMAIL PROTECTED]>
> Date: Thursday, April 25, 2002 5:35 am
> Subject: Re: [PHP] Parse Error - Help? (AGAIN)
>
> > I don't have your original code (which, btw, you shoudn't ever
> > post that
> > much code without explicitly saying what the error was, what line
> > it was
> > one, highlighting that line, and saying what you've done so far),
> > but these
> > errors are caused by not giving a default value to a variable,
> > basically.
> > If you have something like this:
> >
> > if($id = 5)
> > {
> >  //whatever
> > }
> >
> > and $id hasn't been assigned a value, then you'll get that
> > warning. In
> > previous versions of PHP, you wouldn't get the warning, you'd just get
> > FALSE.
> >
> > So, before you test the value of a variable, or echo the value
> > out, make
> > sure you've assigned it something.
> >
> > if(!isset($id)) { $id = 0; }
> >
> > Hopefully that's not too confusingit's hard to explain.
> >
> > ---John Holmes...
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


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




Re: [PHP] Parse Error - Help? (AGAIN)

2002-04-25 Thread Jason Soza

Yeah, I think I'd rather fix the errors rather than just not see them. 
I'd still know they were there and it'd bug me!

Thanks everyone for your help!

Jason Soza

- Original Message -
From: "Nathan" <[EMAIL PROTECTED]>
Date: Thursday, April 25, 2002 9:14 am
Subject: Re: [PHP] Parse Error - Help? (AGAIN)

> I'll second that one... always better to code with 
> register_globals = Off and E_ALL reporting level
> IMHO.
> 
> # Nathan
> 
> - Original Message -
> From: "Philip Olson" <[EMAIL PROTECTED]>
> To: "Maxim Maletsky (PHPBeginner.com)" <[EMAIL PROTECTED]>
> 
> > To stop receiving the messages from undefined variables add this 
> at top
> > of your files:
> >
> > error_reporting(55);
> 
> Or better yet, keep as you're doing and develop with E_ALL
> and fix those E_NOTICE errors correctly! ;)
> 
> Regards,
> Philip Olson


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




Re: [PHP] Parse Error - Help? (AGAIN)

2002-04-25 Thread Nathan

I'll second that one... always better to code with register_globals = Off and E_ALL 
reporting level
IMHO.

# Nathan

- Original Message -
From: "Philip Olson" <[EMAIL PROTECTED]>
To: "Maxim Maletsky (PHPBeginner.com)" <[EMAIL PROTECTED]>

> To stop receiving the messages from undefined variables add this at top
> of your files:
>
> error_reporting(55);

Or better yet, keep as you're doing and develop with E_ALL
and fix those E_NOTICE errors correctly! ;)

Regards,
Philip Olson


--
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] Parse Error - Help? (AGAIN)

2002-04-25 Thread Philip Olson

> To stop receiving the messages from undefined variables add this at top
> of your files:
> 
> error_reporting(55);

Or better yet, keep as you're doing and develop with E_ALL 
and fix those E_NOTICE errors correctly! ;)

Regards,
Philip Olson


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




RE: [PHP] Parse Error - Help? (AGAIN)

2002-04-25 Thread Maxim Maletsky \(PHPBeginner.com\)

> What does the ! in if(!isset($id)) { $id = 0; } do? 


It checks for the false return. If isset($id) returns false then the
'if' statement with (!) returns you true, and, as you just guessed, it
will assign a (0) to $id.



> this bit does in general: checks if $id has been assigned anything, if
> it's empty it gets assigned 0. Correct? Then I can use if($id)
> statements later on without having PHP return "Undefined Variable"
> errors. Right?


To stop receiving the messages from undefined variables add this at top
of your files:

error_reporting(55);

 
> Thanks for your help, I'll work on my PHP listetiquette.
> 
> Jason Soza




Sincerely,

Maxim Maletsky
Founder, Chief Developer

www.PHPBeginner.com   // where PHP Begins









> 
> - Original Message -
> From: "1LT John W. Holmes" <[EMAIL PROTECTED]>
> Date: Thursday, April 25, 2002 5:35 am
> Subject: Re: [PHP] Parse Error - Help? (AGAIN)
> 
> > I don't have your original code (which, btw, you shoudn't ever
> > post that
> > much code without explicitly saying what the error was, what line
> > it was
> > one, highlighting that line, and saying what you've done so far),
> > but these
> > errors are caused by not giving a default value to a variable,
> > basically.
> > If you have something like this:
> >
> > if($id = 5)
> > {
> >  //whatever
> > }
> >
> > and $id hasn't been assigned a value, then you'll get that
> > warning. In
> > previous versions of PHP, you wouldn't get the warning, you'd just
get
> > FALSE.
> >
> > So, before you test the value of a variable, or echo the value
> > out, make
> > sure you've assigned it something.
> >
> > if(!isset($id)) { $id = 0; }
> >
> > Hopefully that's not too confusingit's hard to explain.
> >
> > ---John Holmes...
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php



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




Re: [PHP] Parse Error - Help? (AGAIN)

2002-04-25 Thread Jason Soza

Sorry for the length of the code, but I felt I described the problem, 
(parse error, last line) and if I hadn't posted the entire code I 
probably would've been asked to. This list can be a little confusing 
for a newbie: just a couple days ago I read someone saying "too much 
information is better than not enough" and now I'm getting that I 
posted too much. I'm still learning! :)

What does the ! in if(!isset($id)) { $id = 0; } do? I think I get what 
this bit does in general: checks if $id has been assigned anything, if 
it's empty it gets assigned 0. Correct? Then I can use if($id) 
statements later on without having PHP return "Undefined Variable" 
errors. Right?

Thanks for your help, I'll work on my PHP listetiquette.

Jason Soza

- Original Message -
From: "1LT John W. Holmes" <[EMAIL PROTECTED]>
Date: Thursday, April 25, 2002 5:35 am
Subject: Re: [PHP] Parse Error - Help? (AGAIN)

> I don't have your original code (which, btw, you shoudn't ever 
> post that
> much code without explicitly saying what the error was, what line 
> it was
> one, highlighting that line, and saying what you've done so far), 
> but these
> errors are caused by not giving a default value to a variable, 
> basically.
> If you have something like this:
> 
> if($id = 5)
> {
>  //whatever
> }
> 
> and $id hasn't been assigned a value, then you'll get that 
> warning. In
> previous versions of PHP, you wouldn't get the warning, you'd just get
> FALSE.
> 
> So, before you test the value of a variable, or echo the value 
> out, make
> sure you've assigned it something.
> 
> if(!isset($id)) { $id = 0; }
> 
> Hopefully that's not too confusingit's hard to explain.
> 
> ---John Holmes...


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




Re: [PHP] Parse Error - Help? (AGAIN)

2002-04-25 Thread 1LT John W. Holmes

I don't have your original code (which, btw, you shoudn't ever post that
much code without explicitly saying what the error was, what line it was
one, highlighting that line, and saying what you've done so far), but these
errors are caused by not giving a default value to a variable, basically.

If you have something like this:

if($id = 5)
{
  //whatever
}

and $id hasn't been assigned a value, then you'll get that warning. In
previous versions of PHP, you wouldn't get the warning, you'd just get
FALSE.

So, before you test the value of a variable, or echo the value out, make
sure you've assigned it something.

if(!isset($id)) { $id = 0; }

Hopefully that's not too confusingit's hard to explain.

---John Holmes...


- Original Message -
From: "Jason Soza" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, April 25, 2002 12:06 AM
Subject: RE: [PHP] Parse Error - Help? (AGAIN)


> Yike, now I wish I hadn't found it:
>
> [Wed Apr 24 19:42:18 2002] [error] PHP Warning:  Wrong datatype for second
> argument in call to in_array in beta_up.asp on line 61
> [Wed Apr 24 19:42:18 2002] [error] PHP Warning:  Undefined variable:
> upload_path in beta_up.php on line 73
> [Wed Apr 24 19:42:18 2002] [error] PHP Warning:  Undefined variable:
> timestamp in beta_up.php on line 73
> [Wed Apr 24 19:42:18 2002] [error] PHP Warning:  Undefined variable:  id
in
> beta_up.php on line 73
> [Wed Apr 24 19:42:18 2002] [error] PHP Warning:  Undefined variable:
> HTTP_POST_FILES in beta_up.php on line 78
> [Wed Apr 24 19:42:18 2002] [error] PHP Warning:  Undefined variable:
> upload_path in beta_up.php on line 79
> [Wed Apr 24 19:42:18 2002] [error] PHP Warning:  Undefined variable:
> timestamp in beta_up.php on line 79
> [Wed Apr 24 19:42:18 2002] [error] PHP Warning:  Undefined variable:  id
in
> beta_up.php on line 79
> [Wed Apr 24 19:42:18 2002] [error] PHP Warning:  Undefined variable:
> message in beta_up.php on line 83
> [Wed Apr 24 19:42:18 2002] [error] PHP Warning:  Undefined variable:
> filename3 in beta_up.php on line 177
> [Wed Apr 24 19:42:18 2002] [error] PHP Warning:  Undefined variable:
> filename4 in beta_up.php on line 178
>
> What more do I have to do to define variables? I name what each variable
is
> with normal conventions - what would cause the above error messages? I
think
> the one that's most disturbing is the in_array() warning, need that to
work!
>
> Again, any help would be greatly appreciated!
>
> Jason
>
> -Original Message-
> From: Jason Soza [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, April 24, 2002 7:56 PM
> To: [EMAIL PROTECTED]
> Subject: RE: [PHP] Parse Error - Help?
>
>
> Found it - just added another curly brace to the end of the code and it
> worked, so I searched up from there and found:
>
> function ext_valid ($filename) {
>
>  $extget = substr( strrchr($filename, "."), 1);
>
>  $found = in_array($extget, $extval);
>
>  if ( $found ) {
> echo ""
>. $message["invext"]."";
>
> $rc = 2;
> }
>
> This function should have another curly brace at the end. Aha! Thanks for
> your help!
>
> Jason
>
> -Original Message-
> From: Tyler Longren [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, April 24, 2002 7:22 PM
> To: Jason Soza; [EMAIL PROTECTED]
> Subject: Re: [PHP] Parse Error - Help?
>
>
> Copy and paste the parse error into your e-mail.  Also, try placing
another
> "}" at the end of the code.  If you're missing a closing bracket
somewhere,
> that will take care of it.
>
> Tyler Longren
> Captain Jack Communications
> www.captainjack.com
> [EMAIL PROTECTED]
>
>
> --
> 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] Parse Error - Help? (AGAIN)

2002-04-25 Thread Ford, Mike [LSS]

> -Original Message-
> From: Jason Soza [mailto:[EMAIL PROTECTED]]
> Sent: 25 April 2002 05:06
> 
> Yike, now I wish I hadn't found it:
> 
> [Wed Apr 24 19:42:18 2002] [error] PHP Warning:  Wrong 
> datatype for second
> argument in call to in_array in beta_up.asp on line 61

57 function ext_valid ($filename) {
58
59 $extget = substr( strrchr($filename, "."), 1);
60
61 $found = in_array($extget, $extval);
62
63 if ( $found ) {
64echo ""
65   . $message["invext"]."";
66
67$rc = 2;
68 }
69 }

$extval is undefined on line 61 -- it's neither a parameter to the function nor a 
variable defined in the function.  If you are intending to refer to the $extval 
defined in the global scope, you need to global it in the function:

57 function ext_valid ($filename) {
58
59 global $extval;

etc.

> [Wed Apr 24 19:42:18 2002] [error] PHP Warning:  Undefined variable:
> upload_path in beta_up.php on line 73

Same.

> [Wed Apr 24 19:42:18 2002] [error] PHP Warning:  Undefined variable:
> timestamp in beta_up.php on line 73

Same.

... and, I'd guess, same for most of the others.  Try globalling all the global 
variables you're using in functions, or passing them as parameters, and then try again.

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 



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




RE: [PHP] Parse Error - Help? (AGAIN)

2002-04-24 Thread Jason Soza

Yike, now I wish I hadn't found it:

[Wed Apr 24 19:42:18 2002] [error] PHP Warning:  Wrong datatype for second
argument in call to in_array in beta_up.asp on line 61
[Wed Apr 24 19:42:18 2002] [error] PHP Warning:  Undefined variable:
upload_path in beta_up.php on line 73
[Wed Apr 24 19:42:18 2002] [error] PHP Warning:  Undefined variable:
timestamp in beta_up.php on line 73
[Wed Apr 24 19:42:18 2002] [error] PHP Warning:  Undefined variable:  id in
beta_up.php on line 73
[Wed Apr 24 19:42:18 2002] [error] PHP Warning:  Undefined variable:
HTTP_POST_FILES in beta_up.php on line 78
[Wed Apr 24 19:42:18 2002] [error] PHP Warning:  Undefined variable:
upload_path in beta_up.php on line 79
[Wed Apr 24 19:42:18 2002] [error] PHP Warning:  Undefined variable:
timestamp in beta_up.php on line 79
[Wed Apr 24 19:42:18 2002] [error] PHP Warning:  Undefined variable:  id in
beta_up.php on line 79
[Wed Apr 24 19:42:18 2002] [error] PHP Warning:  Undefined variable:
message in beta_up.php on line 83
[Wed Apr 24 19:42:18 2002] [error] PHP Warning:  Undefined variable:
filename3 in beta_up.php on line 177
[Wed Apr 24 19:42:18 2002] [error] PHP Warning:  Undefined variable:
filename4 in beta_up.php on line 178

What more do I have to do to define variables? I name what each variable is
with normal conventions - what would cause the above error messages? I think
the one that's most disturbing is the in_array() warning, need that to work!

Again, any help would be greatly appreciated!

Jason

-Original Message-
From: Jason Soza [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 24, 2002 7:56 PM
To: [EMAIL PROTECTED]
Subject: RE: [PHP] Parse Error - Help?


Found it - just added another curly brace to the end of the code and it
worked, so I searched up from there and found:

function ext_valid ($filename) {

 $extget = substr( strrchr($filename, "."), 1);

 $found = in_array($extget, $extval);

 if ( $found ) {
echo ""
   . $message["invext"]."";

$rc = 2;
}

This function should have another curly brace at the end. Aha! Thanks for
your help!

Jason

-Original Message-
From: Tyler Longren [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 24, 2002 7:22 PM
To: Jason Soza; [EMAIL PROTECTED]
Subject: Re: [PHP] Parse Error - Help?


Copy and paste the parse error into your e-mail.  Also, try placing another
"}" at the end of the code.  If you're missing a closing bracket somewhere,
that will take care of it.

Tyler Longren
Captain Jack Communications
www.captainjack.com
[EMAIL PROTECTED]


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