Solved

Members area

Posted on 2004-03-25
7
153 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
  • 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
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction This tutorial will give you a fast look what you can do with WhizBase. I expect you already know how to work with HTML at least, and that you understand the basics of the internet and how the internet works. WhizBase is a server-s…
This article will show, step by step, how to integrate R code into a R Sweave document
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

757 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

21 Experts available now in Live!

Get 1:1 Help Now