473,503 Members | 1,641 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How do I redirect to a new php file from the one I am in?

Basically I have a login.php script that takes the users login and password,
I then search in the database for the entry and discover if they have access
0 which is admin or access 1 which is normal user. Based on this I want to
redirect the user to a new php file. Either admin.php or user.php depending
on the access level.=l. Simple solution I am sure.

Thanks for the help.
Jul 17 '05 #1
12 1970
C-man wrote:
Basically I have a login.php script that takes the users login and
password, I then search in the database for the entry and discover if they
have access 0 which is admin or access 1 which is normal user. Based on
this I want to redirect the user to a new php file. Either admin.php or
user.php depending on the access level.=l. Simple solution I am sure.


if($access == 0) {
header("Location: admin.php");
}
else {
header("Location: user.php");
}

I'm pretty sure I once read somewhere that the filename specified is
supposed to be a full url containing the domain name etc as well but it's
always worked for me just specifying the filename.

Chris

--
Chris Hope
The Electric Toolbox Ltd
http://www.electrictoolbox.com/
Jul 17 '05 #2
Chris Hope wrote:
header("Location: user.php");


That's a relative URL. The authoritative source, RFC2616, says the
Location header "field value consists of a single absolute URI". For
practical purposes, in my opinion, we can take "URI" here to mean
"URI reference", i.e., the absolute URI could be accompanied by a
fragment identifier.

http://www.ietf.org/rfc/rfc2616.txt

--
Jock
Jul 17 '05 #3
John Dunlop wrote:
That's a relative URL. The authoritative source, RFC2616, says the
Location header "field value consists of a single absolute URI". For
practical purposes, in my opinion, we can take "URI" here to mean
"URI reference", i.e., the absolute URI could be accompanied by a
fragment identifier.


Thanks for that. As you will of course noted I did say that I thought this
was the case in my posting, but that a relative url has always worked for
me in the past (with a variety of browsers I might add).

BTW a URI is the full path including the http:// and domain name etc

Chris

--
Chris Hope
The Electric Toolbox Ltd
http://www.electrictoolbox.com/
Jul 17 '05 #4
Chris Hope wrote:
BTW a URI is the full path including the http:// and domain name etc


If you mean "an absolute HTTP URI", I largely agree -- the "full
path" is optional. The only mandatory components of an absolute HTTP
URL are the case-sensitive scheme name ("http"), the separating
colon, the two solidi ("//") and the host name. See RFC2616, sec.
3.2.2.

The value of the HTTP Location header field isn't restricted to an
absolute *HTTP* URL though. The only requirement is that it must
consist of an absolute URI (read "URI reference"), as defined in
RFC2396, sec. 3. Other URI schemes are implicitly allowed.

--
Jock
Jul 17 '05 #5
"John Dunlop" <us*********@john.dunlop.name> wrote in message
news:MP************************@News.Individual.NE T...
Chris Hope wrote:
header("Location: user.php");


That's a relative URL. The authoritative source, RFC2616, says the
Location header "field value consists of a single absolute URI". For
practical purposes, in my opinion, we can take "URI" here to mean
"URI reference", i.e., the absolute URI could be accompanied by a
fragment identifier.

http://www.ietf.org/rfc/rfc2616.txt


IE has no problems with relative URLs in the location field.

http://www.microsoft.com/
Jul 17 '05 #6
Chung Leong wrote:
"John Dunlop" <us*********@john.dunlop.name> wrote in message
news:MP************************@News.Individual.NE T...
The authoritative source, RFC2616, says the Location header "field
value consists of a single absolute URI". For practical purposes,
in my opinion, we can take "URI" here to mean "URI reference", i.e.,
the absolute URI could be accompanied by a fragment identifier.

It's not just my opinion. The errata discusses this. The correct
ABNF for the Location header is:

Location = "Location" ":" absoluteURI [ "#" fragment ]

The rule "absoluteURI", I presume, is defined in RFC2396, sec. 3, as
it was in RFC2616, sec. 14.30; I *guess* "fragment" is defined in
RFC2396, sec. 4.1, although the only mention in RFC2616 of fragment
identifiers has nothing to do with Location headers, and the errata
doesn't explicitly delegate "fragment"'s definition to anywhere.

http://skrb.org/ietf/http_errata.htm...tion-fragments
IE has no problems with relative URLs in the location field.


I would've accompanied that type of humour with a smiley.

--
Jock
Jul 17 '05 #7
"John Dunlop" <us*********@john.dunlop.name> wrote in message
news:MP************************@News.Individual.NE T...
The rule "absoluteURI", I presume, is defined in RFC2396, sec. 3, as
it was in RFC2616, sec. 14.30; I *guess* "fragment" is defined in
RFC2396, sec. 4.1, although the only mention in RFC2616 of fragment
identifiers has nothing to do with Location headers, and the errata
doesn't explicitly delegate "fragment"'s definition to anywhere.

http://skrb.org/ietf/http_errata.htm...tion-fragments
IE has no problems with relative URLs in the location field.


I would've accompanied that type of humour with a smiley.


As far as I'm concerned the behavior of the de facto standard browser is the
standard. Long live Redmond unilateralism! :-)
Jul 17 '05 #8
On Thu, 08 Apr 2004 19:26:25 -0400, Chung Leong wrote:
> IE has no problems with relative URLs in the location field.


I would've accompanied that type of humour with a smiley.


As far as I'm concerned the behavior of the de facto standard browser is the
standard. Long live Redmond unilateralism! :-)

ROFL!!

You owe me a new keyboard! lol this one's now covered in coffee =)

Regards,

Ian

--
Ian.H
digiServ Network
London, UK
http://digiserv.net/

Jul 17 '05 #9
On Fri, 09 Apr 2004 00:14:42 GMT, "Ian.H" <ia*@WINDOZEdigiserv.net> wrote:
On Thu, 08 Apr 2004 19:26:25 -0400, Chung Leong wrote:
> IE has no problems with relative URLs in the location field.

I would've accompanied that type of humour with a smiley.


As far as I'm concerned the behavior of the de facto standard browser is the
standard. Long live Redmond unilateralism! :-)


ROFL!!

You owe me a new keyboard! lol this one's now covered in coffee =)


The Redmond mob do a nice line in keyboards ;-)

Actually if Microsoft software was up to the standard of their mice and
keyboards I'd have much less to complain about! But back to the real world...

--
Andy Hassall <an**@andyh.co.uk> / Space: disk usage analysis tool
http://www.andyh.co.uk / http://www.andyhsoftware.co.uk/space
Jul 17 '05 #10
On Fri, 09 Apr 2004 01:26:35 +0100, Andy Hassall wrote:
On Fri, 09 Apr 2004 00:14:42 GMT, "Ian.H" <ia*@WINDOZEdigiserv.net> wrote:
On Thu, 08 Apr 2004 19:26:25 -0400, Chung Leong wrote:
> IE has no problems with relative URLs in the location field.

I would've accompanied that type of humour with a smiley.

As far as I'm concerned the behavior of the de facto standard browser is the
standard. Long live Redmond unilateralism! :-)
ROFL!!

You owe me a new keyboard! lol this one's now covered in coffee =)


The Redmond mob do a nice line in keyboards ;-)

LOL! Can't say I've actually tried any.. just bought this one.. was a
whole 12 quid (PCLine).. but I go through keyboards like I do coffee =)

Actually if Microsoft software was up to the standard of their mice and
keyboards I'd have much less to complain about! But back to the real world...

I've used a couple of their mice and they seemed "robust".. and as you
say, if they could get that sort of technology into their software, the
world would be a better place.

WinBSD anyone?

Regards,

Ian

--
Ian.H
digiServ Network
London, UK
http://digiserv.net/

Jul 17 '05 #11
On Fri, 09 Apr 2004 00:42:50 GMT, "Ian.H" <ia*@WINDOZEdigiserv.net> wrote:
On Fri, 09 Apr 2004 01:26:35 +0100, Andy Hassall wrote:
On Fri, 09 Apr 2004 00:14:42 GMT, "Ian.H" <ia*@WINDOZEdigiserv.net> wrote:

ROFL!!

You owe me a new keyboard! lol this one's now covered in coffee =)
The Redmond mob do a nice line in keyboards ;-)


LOL! Can't say I've actually tried any.. just bought this one.. was a
whole 12 quid (PCLine).. but I go through keyboards like I do coffee =)


I've had this Microsoft 'Natural Keyboard' for years, the sort that's split
down the middle, and there is no way I'd give it up - it's basically a perfect
keyboard IMHO. Noticably easier to type on than the plain keyboard at the
office.

And it's relatively easy to clean drinks out of it after the odd couple of
accidents ;-) Haven't tried spilling coffee into it yet though...
Actually if Microsoft software was up to the standard of their mice and
keyboards I'd have much less to complain about! But back to the real world...


I've used a couple of their mice and they seemed "robust".. and as you
say, if they could get that sort of technology into their software, the
world would be a better place.


As per the usual Microsoft practice, they changed the design of the 'Natural'
range of keyboards in annoying ways, e.g. the ins/home/pgup group of keys are
2x3 instead of the proper 3x2 layout, and the cursor keys are diamond instead
of an inverted T. And half-height Function keys. Bleh. So basically the new
ones are rubbish, last time I looked anyway.

Their new mouse looks nice - with a 2D wheel (left+right as well as up+down
and middle-button click). A bit pricy though.
WinBSD anyone?


Eek.

--
Andy Hassall <an**@andyh.co.uk> / Space: disk usage analysis tool
http://www.andyh.co.uk / http://www.andyhsoftware.co.uk/space
Jul 17 '05 #12
On Fri, 09 Apr 2004 02:09:29 +0100, Andy Hassall wrote:
On Fri, 09 Apr 2004 00:42:50 GMT, "Ian.H" <ia*@WINDOZEdigiserv.net>
wrote:
On Fri, 09 Apr 2004 01:26:35 +0100, Andy Hassall wrote:
On Fri, 09 Apr 2004 00:14:42 GMT, "Ian.H" <ia*@WINDOZEdigiserv.net>
wrote:

ROFL!!

You owe me a new keyboard! lol this one's now covered in coffee =)

The Redmond mob do a nice line in keyboards ;-)
LOL! Can't say I've actually tried any.. just bought this one.. was a
whole 12 quid (PCLine).. but I go through keyboards like I do coffee =)


I've had this Microsoft 'Natural Keyboard' for years, the sort that's
split
down the middle, and there is no way I'd give it up - it's basically a
perfect keyboard IMHO. Noticably easier to type on than the plain
keyboard at the office.

I've never tried one of these "natural keyboards".. I've always though
they looked awkward to type on. I use most fingers to type with.. but not
in the style a secretary would (I have no "home keys" as such). I might
have to try one just for the sakes of comparison.. never know, I might
like it too =)

And it's relatively easy to clean drinks out of it after the odd couple
of
accidents ;-) Haven't tried spilling coffee into it yet though...

lol.

Actually if Microsoft software was up to the standard of their mice
and
keyboards I'd have much less to complain about! But back to the real
world...


I've used a couple of their mice and they seemed "robust".. and as you
say, if they could get that sort of technology into their software, the
world would be a better place.


As per the usual Microsoft practice, they changed the design of the
'Natural'
range of keyboards in annoying ways, e.g. the ins/home/pgup group of
keys are 2x3 instead of the proper 3x2 layout, and the cursor keys are
diamond instead of an inverted T. And half-height Function keys. Bleh.
So basically the new ones are rubbish, last time I looked anyway.

I hate pretty much all "new keyboards".. this one I'm typing on now
included. The keyboard I've just ditched in replacement from this was from
my old 486 AST box.. none of these extra keys.. not even any "windoze
keys" 8)

This one has those stupid sleep, standby, blah blah buttons where print
screen, scroll lock etc used to be. Print screen etc have now been moved
down along with the 3x2 Insert, Home etc block. This becomes realy
annoying as I tend to hit scroll lock instad / aswell as Home etc. Some
are also coming with single-row height Return keys too and.......... argh!

I can handle the half-height F-keys as I don't use these _that_ often..
although I have some custom macros defined in UEdit / Anjuta that I use
them for.

Their new mouse looks nice - with a 2D wheel (left+right as well as
up+down
and middle-button click). A bit pricy though.

I saw this advertised somewhere the other day and was thinking the same...
would be great for coding to save you have to keep finding the scrollbar
on the odd occassion my lines are longer than the width of my editor.
Can't remember how much it was advertised for though.. might look into it
when I need my next mouse.

Regards,

Ian

--
Ian.H
digiServ Network
London, UK
http://digiserv.net/

Jul 17 '05 #13

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
7962
by: Damo | last post by:
Could someone please help me. I am a newbie at PHP. I downloaded formail.php Version 5.0 from Jacks scripts( http://www.dtheatre.com/scripts/ )and changed the required areas to my email address and...
3
6530
by: Sean Berry | last post by:
Hi there. I am relativly new to Python CGI and need a question answered. I have made custom 404 error pages and have them in various web directories. I have not been able to figure out a way...
6
4438
by: Tim Stokes | last post by:
Hi all, I want to do a similar action to response.redirect ("file.htm"). But the file.htm contains some sensitive data. I have placed file.htm in a folder in the InetPub...
5
2175
by: Steve Lutz | last post by:
Hello, I have a page that creates a class, and then on certain conditions, redirects user to another page. The class has a Class_Terminate() function that saves itself to a database. The class...
8
3268
by: Don Miller | last post by:
I have an ASP script that is called from a PDF form to process form data. On the last line of the script I have a Response.Redirect "webpage.asp" that leads to another target page with actual HTML....
6
4299
by: Sam | last post by:
I have some issues with HTTP Headers and I was hoping for some pointers or references to good articles. Here is the problem. I have 6 .aspx pages, each page contains a common .ascx. This ascx...
3
7934
by: Jed | last post by:
I have written an HttpHandler which I invoke through an ashx page. The HttpHandler does various things to process the request, then it is supposed to redirect to a confirmation page. Everything...
4
1311
by: news.microsoft.com | last post by:
Hello All, im am new to ASP.NET, so bare with me. i have an application that i am building in stages. stage1 user picks data required stage2 file is written to a virutal directory Stage3...
9
4330
by: RN1 | last post by:
When a server encounters the line Response.Redirect("abcd.asp") in a ASP script, the server tells the browser that it has to be redirected to another page (which is abcd.asp, in this case)....
18
2644
by: Paul Lautman | last post by:
JRough wrote: What do you mean by "redirect the output to Excel"??? Excel isn't a location, it's a spreadsheet program that some (but not all users) will have on their machine. BTW, Location:...
0
7194
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7070
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7267
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7316
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7449
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5566
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4666
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3160
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1495
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.