Re: [PHP] location= Construct Doc
--- Lee Stewart [EMAIL PROTECTED] wrote: It's version 4.0.3 Lee In v4.3.2, it throws a Parse error: parse error, unexpected '=' in /path/to/file/test.php on line 23. Chris Shiflett wrote: --- Lee Stewart [EMAIL PROTECTED] wrote: Here's a *working* section of code... Note the location = browse.php; on line 23 How does that not generate a parse error? I must be missing something. It seems to me that either a dollar sign is missing, or the line is intended to define a constant (although I prefer my constants to be uppercase), in which case the wrong syntax is being used. What version of PHP are you using that does not generate a parse error? Chris = My Blog http://shiflett.org/ HTTP Developer's Handbook http://httphandbook.org/ RAMP Training Courses http://www.nyphp.org/ramp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php = Mark Weinstock [EMAIL PROTECTED] *** You can't demand something as a right unless you are willing to fight to death to defend everyone else's right to the same thing. *** __ Do you Yahoo!? Protect your identity with Yahoo! Mail AddressGuard http://antispam.yahoo.com/whatsnewfree -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] location= Construct Doc
On Tue, Nov 11, 2003 at 01:46:33PM -0800, Mark wrote: : : --- Lee Stewart [EMAIL PROTECTED] wrote: : : Here's a *working* section of code... Note the :location = browse.php; : on line 23 : : In v4.3.2, it throws a Parse error: parse error, unexpected '=' in : /path/to/file/test.php on line 23. It'd be helpful to see the rest of the code snippet. But it kinda looks as if it should be: $location = browse.php; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] location= Construct Doc
Hi... I'm looking at an existing application that uses a number of statements like: location = page2.php; I thought I'd seen it somewhere in the PHP doc, but can't find it now.. Can anyone point me to where it's written up? Thanks, Lee -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] location= Construct Doc
[snip] I'm looking at an existing application that uses a number of statements like: location = page2.php; I thought I'd seen it somewhere in the PHP doc, but can't find it now.. Can anyone point me to where it's written up? [/snip] http://www.php.net/header -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] location= Construct Doc
I see the Location: of the Header function there, but what I see in the code is just a location = and a page name... No header function... Is it the same thing? Lee Jay Blanchard wrote: [snip] I'm looking at an existing application that uses a number of statements like: location = page2.php; I thought I'd seen it somewhere in the PHP doc, but can't find it now.. Can anyone point me to where it's written up? [/snip] http://www.php.net/header -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] location= Construct Doc
--- Lee Stewart [EMAIL PROTECTED] wrote: I'm looking at an existing application that uses a number of statements like: location = page2.php; I thought I'd seen it somewhere in the PHP doc, but can't find it now.. Can anyone point me to where it's written up? The HTTP header itself is defined in RFC 2616 in section 14.30: -- 14.30 Location The Location response-header field is used to redirect the recipient to a location other than the Request-URI for completion of the request or identification of a new resource. For 201 (Created) responses, the Location is that of the new resource which was created by the request. For 3xx responses, the location SHOULD indicate the server's preferred URI for automatic redirection to the resource. The field value consists of a single absolute URI. Location = Location : absoluteURI An example is: Location: http://www.w3.org/pub/WWW/People.html Note: The Content-Location header field (section 14.14) differs from Location in that the Content-Location identifies the original location of the entity enclosed in the request. It is therefore possible for a response to contain header fields for both Location and Content-Location. Also see section 13.10 for cache requirements of some methods. -- PHP can send HTTP headers using the header() function: http://www.php.net/header Hope that helps. Chris = My Blog http://shiflett.org/ HTTP Developer's Handbook http://httphandbook.org/ RAMP Training Courses http://www.nyphp.org/ramp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] location= Construct Doc
Lee Stewart mailto:[EMAIL PROTECTED] on Monday, November 10, 2003 12:18 PM said: I see the Location: of the Header function there, but what I see in the code is just a location = and a page name... No header function... Is it the same thing? $location = page.php; is nothing more than a value being assigned to a variable. that variable needs to be used somewhere (or else it'd just be a waste of resources). the most likely situation is what people have suggested so far. that is, the $location variable is being used in a redirect, i.e. header(Location: $location); but in answer to your question, no they are not the same thing. HTH, Chris. -- Don't like reformatting your Outlook replies? Now there's relief! http://home.in.tum.de/~jain/software/outlook-quotefix/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] location= Construct Doc
It's not $location = xxx, just location = page.php; And it seems to work as a redirect... But not part of the header fuction, and not just setting a variable... Lee Chris W. Parker wrote: Lee Stewart mailto:[EMAIL PROTECTED] on Monday, November 10, 2003 12:18 PM said: I see the Location: of the Header function there, but what I see in the code is just a location = and a page name... No header function... Is it the same thing? $location = page.php; is nothing more than a value being assigned to a variable. that variable needs to be used somewhere (or else it'd just be a waste of resources). the most likely situation is what people have suggested so far. that is, the $location variable is being used in a redirect, i.e. header(Location: $location); but in answer to your question, no they are not the same thing. HTH, Chris. -- Don't like reformatting your Outlook replies? Now there's relief! http://home.in.tum.de/~jain/software/outlook-quotefix/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] location= Construct Doc
--- Lee Stewart [EMAIL PROTECTED] wrote: It's not $location = xxx, just location = page.php; So the dollar sign is missing? Can you show us all of the code in question? (Or did I miss it?) And it seems to work as a redirect... But not part of the header fuction, and not just setting a variable... Location is an HTTP header. If that name is being used in any code for some other reason, then the name may be purely coincidental. However, if it is the header you are speaking of, then it is specified using: header('Location: http://example.org/path/to/script.php'); Of particular note is that the URL is an absolute URL, not a relative one. This is in the snippet of the specification that I quoted earlier. Hope that helps. Chris = My Blog http://shiflett.org/ HTTP Developer's Handbook http://httphandbook.org/ RAMP Training Courses http://www.nyphp.org/ramp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] location= Construct Doc
Lee Stewart mailto:[EMAIL PROTECTED] on Monday, November 10, 2003 12:42 PM said: It's not $location = xxx, just location = page.php; And it seems to work as a redirect... But not part of the header fuction, and not just setting a variable... Hmm.. Never seen that before and the only time I've seen variables without a $ is for a constant, but then again I don't think you can set a constant dynamically, i.e. constant = value; (hence the name constant). If you're not already doing it, posting the code would be good. Chris. -- Don't like reformatting your Outlook replies? Now there's relief! http://home.in.tum.de/~jain/software/outlook-quotefix/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] location= Construct Doc
Here's a *working* section of code... Note the location = browse.php; on line 23 ? $errmsg = ''; if( isset($username) ) { require_once('Connections/mySql.php'); mysql_select_db($database_mySql, $mySql); $rs = mysql_query(select * from employee where initials = ' . strtoupper($username) . ', $mySql) or die(mysql_error($mySql)); if( !(mysql_num_rows($rs)) ) { // not a valid username mysql_free_result($rs); $errmsg = Invalid Userid; unset($username); } else { // valid user, now validate password and status $row = mysql_fetch_assoc($rs); mysql_free_result($rs); if( $row['pw'] == $password ) { // if correct password if( $row['status'] == 'a' || $row['status'] == 'm' ) { // if active user $username = strtoupper($username); session_register(username); $authlevel = $row['status']=='a'?1:2; session_register(authlevel); mysql_query(update employee set lastlogin = . (time()-10800) . where initials = '$username', $mySql) or die(mysql_error($mySql)); session_write_close(); location = browse.php; exit; } else { // not active user $errmsg = Invalid Userid; unset($username); } } else { // incorrect password $errmsg = Invalid Password; unset($password); } } } session_write_close(); ? Chris Shiflett wrote: --- Lee Stewart [EMAIL PROTECTED] wrote: It's not $location = xxx, just location = page.php; So the dollar sign is missing? Can you show us all of the code in question? (Or did I miss it?) And it seems to work as a redirect... But not part of the header fuction, and not just setting a variable... Location is an HTTP header. If that name is being used in any code for some other reason, then the name may be purely coincidental. However, if it is the header you are speaking of, then it is specified using: header('Location: http://example.org/path/to/script.php'); Of particular note is that the URL is an absolute URL, not a relative one. This is in the snippet of the specification that I quoted earlier. Hope that helps. Chris = My Blog http://shiflett.org/ HTTP Developer's Handbook http://httphandbook.org/ RAMP Training Courses http://www.nyphp.org/ramp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] location= Construct Doc
--- Lee Stewart [EMAIL PROTECTED] wrote: Here's a *working* section of code... Note the location = browse.php; on line 23 How does that not generate a parse error? I must be missing something. It seems to me that either a dollar sign is missing, or the line is intended to define a constant (although I prefer my constants to be uppercase), in which case the wrong syntax is being used. What version of PHP are you using that does not generate a parse error? Chris = My Blog http://shiflett.org/ HTTP Developer's Handbook http://httphandbook.org/ RAMP Training Courses http://www.nyphp.org/ramp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] location= Construct Doc
It's version 4.0.3 Lee Chris Shiflett wrote: --- Lee Stewart [EMAIL PROTECTED] wrote: Here's a *working* section of code... Note the location = browse.php; on line 23 How does that not generate a parse error? I must be missing something. It seems to me that either a dollar sign is missing, or the line is intended to define a constant (although I prefer my constants to be uppercase), in which case the wrong syntax is being used. What version of PHP are you using that does not generate a parse error? Chris = My Blog http://shiflett.org/ HTTP Developer's Handbook http://httphandbook.org/ RAMP Training Courses http://www.nyphp.org/ramp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] location= Construct Doc
Lee Stewart wrote: Hi... I'm looking at an existing application that uses a number of statements like: location = page2.php; I thought I'd seen it somewhere in the PHP doc, but can't find it now.. Can anyone point me to where it's written up? This would generate parse error in php, but I guess it is javascript. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php