RE: [PHP] Am i crazy?

2001-11-04 Thread Jack Dempsey

you're assigning, not checking for equality...use two ='s
-Original Message-
From: Martin [mailto:[EMAIL PROTECTED]]
Sent: Sunday, November 04, 2001 12:49 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Am i crazy?


Did I forget everything in a few months?
if ($name='admin') {
header("Location: $MYPATH/admin.php");
}

Doesn't. That is it doesn't redirect to whatever $MYPATH/admin.php
translates to. Doing an echo $MYPATH directly after the line shows that the
path is interpreted correctly - and the file exists (I checked). And the
$name is correct - echo $name gives admin. And neither does the php.net
example work ...

if ($name='admin') {
header("Location: http://www.php.net/";);
}

doesn't redirect to php.net.

*sigh*

Martin

--
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] Am i crazy?

2001-11-04 Thread Martin

Jack Dempsey wrote:

> you're assigning, not checking for equality...use two ='s

Still not redirecting ...

Martin S

-- 
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] Am i crazy?

2001-11-04 Thread Jack Dempsey

what happens? are you sure $name really equal's admin?
if you change header to echo $MYPATH does that work?

-Original Message-
From: Martin [mailto:[EMAIL PROTECTED]]
Sent: Sunday, November 04, 2001 12:54 PM
To: [EMAIL PROTECTED]
Subject: RE: [PHP] Am i crazy?


Jack Dempsey wrote:

> you're assigning, not checking for equality...use two ='s

Still not redirecting ...

Martin S

-- 
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] Am i crazy?

2001-11-04 Thread Richard Baskett

It has to do with the $name variable, if you've fixed the code to check for
equality instead of setting the variable:

if ($name=='admin') {

Echo $name and make sure that it is actually getting set..

Also make sure your header information is before html.. let's see.. yeah
that's about all I can think of.. if $name is echoing something then I have
no clue why it's not working :(

Rick

> Did I forget everything in a few months?
> if ($name='admin') {
>   header("Location: $MYPATH/admin.php");
>   }
> 
> Doesn't. That is it doesn't redirect to whatever $MYPATH/admin.php
> translates to. Doing an echo $MYPATH directly after the line shows that the
> path is interpreted correctly - and the file exists (I checked). And the
> $name is correct - echo $name gives admin. And neither does the php.net
> example work ...
> 
> if ($name='admin') {
>   header("Location: http://www.php.net/";);
> }
> 
> doesn't redirect to php.net.
> 
> *sigh*
> 
> Martin
> 
> -- 
> 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] Am i crazy?

2001-11-04 Thread Martin

Jack Dempsey wrote:

> what happens? 

if ($name == "admin") {
echo $name;
header("Location: $MYPATH/admin.php");
}

Displays admin on the page where the redirect is from (switch.php).
Without the echo statement I just get a blank switch.php.
I'm simply not redirected anywhere. (Nothing else is supposed to happen).

> are you sure $name really equal's admin?

Ohh yes.

> if you change header to echo $MYPATH does that work?

No.


Martin S


-- 
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] Am i crazy?

2001-11-04 Thread Martin

Richard Baskett wrote:

> It has to do with the $name variable, if you've fixed the code to check
> for equality instead of setting the variable:
> 
> if ($name=='admin') {
> 
> Echo $name and make sure that it is actually getting set..

Yes.

> Also make sure your header information is before html.. 

There isn't any html in the page at all. It's intended as a switchboard for 
people logging in to be redirected according to user name.

>let's see.. yeah
> that's about all I can think of.. if $name is echoing something then I
> have no clue why it's not working :(

Martin S

-- 
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] Am i crazy?

2001-11-04 Thread Tom Carter

well when you were using echo $name to test then you were outputting html,
hence no redirect... if your php is set up in such a way as to suppress
errors then you wouldn't have been warned about it..check that nothing else
is being outputted, eg a space before the first 
To: <[EMAIL PROTECTED]>
Sent: Sunday, November 04, 2001 8:24 PM
Subject: Re: [PHP] Am i crazy?


> Richard Baskett wrote:
>
> > It has to do with the $name variable, if you've fixed the code to check
> > for equality instead of setting the variable:
> >
> > if ($name=='admin') {
> >
> > Echo $name and make sure that it is actually getting set..
>
> Yes.
>
> > Also make sure your header information is before html..
>
> There isn't any html in the page at all. It's intended as a switchboard
for
> people logging in to be redirected according to user name.
>
> >let's see.. yeah
> > that's about all I can think of.. if $name is echoing something then I
> > have no clue why it's not working :(
>
> Martin S
>
> --
> 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] Am i crazy?

2001-11-04 Thread Jason G.

Try putting exit; right after the header() function...

-JAson Garber
IonZoft.com

At 06:54 PM 11/4/2001 +0100, Martin wrote:
>Jack Dempsey wrote:
>
> > you're assigning, not checking for equality...use two ='s
>
>Still not redirecting ...
>
>Martin S
>
>--
>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] Am i crazy? - Solved.

2001-11-04 Thread Martin

Tom Carter wrote:

> well when you were using echo $name to test then you were outputting html,
> hence no redirect... 

I've tried both w/ and w/o the echo. No difference.

>if your php is set up in such a way as to suppress
> errors then you wouldn't have been warned about it..

No, nothing is being output the page starts with check that nothing
> else is being outputted, eg a space before the first  fix it turn error reporting down to its lowest level.

But ...
error_reporting(E_ALL) ... that did it. Apparently what the problem was is 
that in an included file there were two trailing spaces after the ?>. 
Making that page end with ?> fixed the redirect.

Thanks to everyone.

Martin S

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