Solved

Members area

Posted on 2004-03-25
7
167 Views
Last Modified: 2013-12-25
I have mostly completed the databases in MySQL that store users infomration including "userid" and "password" - I can query this info from the database to make sure that an individual actually logs in on the log in page, but how do I carry over this information into all subsequent html pages? i.e. hold the log in over several pages, does this have anything to do with temporary cache and if so how do I use it?

0
Comment
Question by:Rusty20009
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
7 Comments
 
LVL 12

Assisted Solution

by:venkateshwarr
venkateshwarr earned 50 total points
ID: 10681941

You may consider the option of using sessions

http://jan.netcomp.monash.edu.au/ecommerce/perl_session.html
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 10687218
use CGI;
my $q = new CGI;
$q->save();
# for details see man CGI
0
 

Author Comment

by:Rusty20009
ID: 10688431
Currently, I am attempting to set a cookie - which will, I gather, be used to authenticate the user from page to page and will expire when the user closes his/her browswer, but I do not know what is happening currently with my script- no error messages but I cannot find the cookie the gets created... does this script save a cookie to the user's browser and if so how do I gather that info on a separate php page?


$mycookie = cookie(-name => 'rusteaselogin',
               -value => $rowdata[0]);
print header(-cookie => $cookie);

0
How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

 
LVL 51

Accepted Solution

by:
ahoffmann earned 100 total points
ID: 10689666
yes the cookie is sent to the browser and stored there
you may get it back with
my $q = new CGI;
my $c = $q->->cookie('rusteaselogin');
0
 

Author Comment

by:Rusty20009
ID: 10714323
Sessions, cookies, variables and arrays, oh my!

I still have not been able to get my scripts to work.

a - create cookie with PERL
b - store cookie in browswer with PERL
c - redirect to new PHP webpage embedded within a CGI PERL script
d - use PHP to ascertain the contents of the cookie stored in "b" so as to act as a indication that user is logged in properly.

The Code:

if (($useridcheck =~ $rowdata[2]) && ($passwordcheck =~ $rowdata[3]))
{
$mycookie = cookie(-name => 'rusteaselogin',
-value => $rowdata[0]);
print header(-cookie => $cookie);

print "Content-type: text/html\n\n";
open (CGI, ">readcookie.php") || die ("File not created");
rename ("readcookie.php", "../readcookie.php");
print CGI << "HTML file";
      <html>
      <head>
      <title>Members Welcome Page</title>
      <link rel='stylesheet' rev='stylesheet' href='stylesheet.css' type='text/css'>
      </head>
            
      <body bgcolor=#E9E7DA>
      <center><br><br><br><br>
      <table width=650 border=0><tr><td>
      <\?
if (!isset(\$_COOKIE['rusteaselogin'])) :
SESSION_START();      
     echo "<br>". session_id();
else:
     echo "there is no cookie";
endif;
?>

      </td></tr></table><br><br>
      </center>
      </body>
      </html>

HTML file
close CGI;

print <<"CGI code";
      
      <html>
      <head>
      <title>Loading Results</title>
      <META HTTP-EQUIV="refresh" CONTENT="0; URL=http://www.my.net/readcookie.php">
      </head>
      <body>
      </body>
      </html>
      
CGI code
}

0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 10714401
> rename ("readcookie.php", "../readcookie.php");

why this?
simply do instead:

open (CGI, ">../readcookie.php") || die ("File not created");

also add at end:

close( CGI );
exit( 0 );
0
 

Author Comment

by:Rusty20009
ID: 10963618
It seems that my web hosting service does not have the CGI.pm module installed on their UNIX boxes... has caused much frustration, not to mention confusion.
0

Featured Post

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It is becoming increasingly popular to have a front-page slider on a web site. Nearly every TV website,  magazine or online news has one on their site, and even some e-commerce sites have one. Today you can use sliders with Joomla, WordPress or …
In this tutorial I will show you how to make a simple HTML bar chart with the usage of WhizBase, If you want more information about WhizBase please read my previous articles at http://www.experts-exchange.com/ARTH_5123186.html (http://www.experts-ex…
The viewer will learn how to count occurrences of each item in an array.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

732 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