Solved

Need help passing login information to a system .. and then going directly to a specific URL

Posted on 2004-10-12
13
167 Views
Last Modified: 2013-12-25
I need help .. and am hoping that someone could help me with this.

Situation - that needs to exist.  (Let me know if this makes sense and if you need any additional information to assist me.)

I have a Portal system that students can log into in order to access their financial and all other information at a Unviersity.  Typically they go to a home page and then enter a username and password.  Once they log in, they can then proceed and navigate through the portal.  This is fine, but tends to take students many steps in order to get to certain areas (deep within the portal).

I want to be able to provide direct links to specific URLs within the portal .. so a user can click on a link .. and then go directly to that page (section within the portal).

The problem (as you can imagine is) ... that if a student isn't logged into the portal (prior to clicking on the link to the URL within the portal) they get a message that says "You are not authorized to access this area."

What I am hoping to do .. and would like to know if a cgi script can be put together to do this is ....

1)  The user clicks on a link (to a particular page .. that exisits deep within the portal) - from another webpage on the University website.  The reason is to allow different departments on campus .. to provide direct access to specific information contained within the portal.

2)  If the user was not already logged into the Portal (which would most likely be the case, but not always .. but mostly) ... when the user clicks on the link .. the CGI script would first need to see if they were logged into the Portal .. and if not ... the CGI script would take the user to a page where the student could log in.  Then once the student logs in ... and their login is accepted .. the CGI script would re-direct the student to the webpage (URL) that they originally clicked on (in the link) that they tried to access.  

If the student was already logged in .. prior to clicking on the link .. the CGI script would simply redirect the user to the page they are trying to access.

Is this possible to accomplish using a CGI script?  I am expecting that when the user clicks on a link .. the link is passed into the CGI script ... and then the script determines if the user is logged in .. and if not .. allows the user to log in.  Then, once logged in .. the script would redirect the user to the appropriate URL (which was passed via the link).

I need help with someone to possibly show me exactly how to write this script.

Is this possible? If so, ... please help.

Thanks,
Gary
0
Comment
Question by:garymgordon
  • 8
  • 3
13 Comments
 
LVL 3

Expert Comment

by:alskdj80
ID: 12288361
to do this, you need to use sessions... im gonna use perl to show you

on any page that you need the user to login, you must check the session:

session_start();
session_name('MyPortalName');
header("Cache-control: private"); // Fix for IE -> this is to prevent a problem with caching in IE

if ($_SESSION['login'] != TRUE) {
      myheader("Login Required!");
      include $_SERVER['DOCUMENT_ROOT'].'/login_form.html'; //this is your login page
      footer();
      exit();
}

//insert body of your page
0
 
LVL 3

Expert Comment

by:alskdj80
ID: 12288466
for your login page, you will need a form for the user to enter their username and password

i wont write out that part... but i will write out how to handle it...

lets suppose that your form names were: username and password, sent through POST

first you'd have to check your database if they exist already, otherwise, they'll have to sign up

when you have determined that the user is ok, and the username and password are correct, set the session variables:
if (//everything is correct) {
    $_SESSION['login'] = true;
    //as well as any other session variable you may need... the user's first name, last name, etc.
}
0
 
LVL 3

Accepted Solution

by:
alskdj80 earned 100 total points
ID: 12288503
for more indepth info... try looking at this tutorial: http://www.phpfreaks.com/tutorials/41/0.php
0
 

Author Comment

by:garymgordon
ID: 12288505
alskdj80,

I am very confused.  I apologize.

but in order to help you so that you can answer this question, maybe it would help if we chatted on Instant Messenger .. so you could bring me up to speed with various aspects of this.  Then, you can hopefully answer the question, etc.

Is that okay?  My IM on AOL and Yahoo is  garymgordon.  My IM on MSN is garymgordon@hotmail.com .

Please let me know how we can best discuss things prior to your answering the question.  I apologize, but I am a little lost as to the process of what will be needed, etc.

I hope you don't mind my asking to chat on IM.

Gary
0
 
LVL 3

Expert Comment

by:alskdj80
ID: 12288677
well, im actually at work right now... and we cant use msn... but i'd be happy to answer any questions you might have right here... and that way someone else might be of some help too
0
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 

Author Comment

by:garymgordon
ID: 12290142
alskdj80,

Well ..

What I was really hoping for was .. someone to outline exactly what I needed, including writing the script(s), etc., that would be needed to accomplish this.  (If it needed more points, that would have been fine.)

But .. being that I am not very familiar with Perl/CGI .. I have numerous questions and .. I'm affraid that going back and forth here .. with all the questions .. would probably not work as well as I need.

I apologize, but don't know what to do.

Should I not have posted this here?

I would like to give you some points .. just for your trying to get started helping me.

Is there a way I can reduce the points .. and give some to you .. just for initially trying to help me (because I appreciate your willingness).

I just don't know what to do.

Can you tell me?

Thanks,
Gary

0
 
LVL 3

Expert Comment

by:alskdj80
ID: 12290216
well, i dun think you can take away points...

im not sure if you're able to do this, but... are you able to delete this question?  then just ask a new question with the desired amount of points, and i'll reply something, then you can accept that answer... (kinda a round-about way)
0
 
LVL 3

Expert Comment

by:alskdj80
ID: 12290302
hmm, i think the only way you can delete a question is by posting in the Support Forum http://www.experts-exchange.com/Community_Support/

dunno if you can ask for refund of some points but not close the question
0
 
LVL 3

Expert Comment

by:alskdj80
ID: 12290321
but it is alot of work... so its ok if you dont too...
0
 

Author Comment

by:garymgordon
ID: 12290558
Well... I posted the request to delete this.
Then, when it's done, I'll repost one for you with 100 points (just for you).

I appreciate your help.
Hopefully you can help me in the future.

Thanks,
Gary
0
 
LVL 3

Expert Comment

by:alskdj80
ID: 12291025
thanks, =)
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Batch, VBS, and scripts in general are incredibly useful for repetitive tasks.  Some tasks can take a while to complete and it can be annoying to check back only to discover that your script finished 5 minutes ago.  Some scripts may complete nearly …
This article will show, step by step, how to integrate R code into a R Sweave document
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now