1

Looking to redirect to my university's login page in order to authenticate users with $_SERVER['REMOTE_USER']. Conventionally, I would use an htaccess file to redirect to the login page, but I would like my solution to be completely in PHP. I imagine the start would be...

header('Location:http://login.university.edu');

But I would need to specify the return url, correct? I don't know. I may be completely wrong about this. Any help appreciated.

2 Answers 2

2

This is not possible in PHP or any other language. It would have to be implemented on your university's system. Most university login systems (especially for WiFi login) allow you to add a return url, but you'll need to ask what the name of this parameter is. My guess would be:

header('Location: http://login.university.edu?return='+urlencode('http://www.mysite.com/page.php'));
Sign up to request clarification or add additional context in comments.

2 Comments

Well shucks. What is it that an htaccess file do that PHP can't?
Nothing. Other than .htaccess having access to Apache modules. But they won't help you. You'll need to talk to your university about a URL parameter for the return url on their login page.
2

Careful:

header('Location: http://login.university.edu');
                 ^ space

iirc Header("Location ...") can't specify a query string.

You can use a meta refresh tag of 1 second.

What authentication system does your university use?

4 Comments

A query string? Is that what I'm doing? Sorry, I don't understand what refreshing the page would accomplish for me. My university uses Novell.
en.wikipedia.org/wiki/Query_string Meta refresh: If user is not logged in: print <meta http-equiv="refresh" content="0; url=login.myuniversity.com/?return_url=mysite.org/secret">
Ah, yes, that's kindof helpful.
Some universities have a central authentication server, and most will provide documentation. So won't hurt to check that out :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.