We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now


Members area

Rusty20009 asked
Medium Priority
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?

Watch Question

Unlock this solution and get a sample of our free trial.
(No credit card required)
use CGI;
my $q = new CGI;
# for details see man CGI


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);

Unlock this solution and get a sample of our free trial.
(No credit card required)


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";
      <title>Members Welcome Page</title>
      <link rel='stylesheet' rev='stylesheet' href='stylesheet.css' type='text/css'>
      <body bgcolor=#E9E7DA>
      <table width=650 border=0><tr><td>
if (!isset(\$_COOKIE['rusteaselogin'])) :
     echo "<br>". session_id();
     echo "there is no cookie";


HTML file
close CGI;

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

> 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 );


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.
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.