Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 179
  • Last Modified:

Remote user login

How to write a cgi scripts with perl that is able to add remote user to a certain homepage?
Eg: A user need to register himself before can surf into certain homepage. How the cgi work to receive user's input and keep it at a place, then, when second time the user come again, he is able to login by entering the password that he gave when he first register.
0
sping
Asked:
sping
1 Solution
 
evilgregCommented:
Are you using .htaccess, or is it all cgi based? In other
words, is this page that is supposed to be restricted a
known URL, or is it only accessed after they have gone through
a username/password form page?

Also, what system is this on? Unix?
0
 
John P JohnAdvisor ICTCommented:
This should do the needful and sort ur problem
TRY IT OUT
********************************************
# Three variables to keep track of the user inputs

$login=Variable1
$email=Variable2
$pagename=Variable3


# Write the login name and email address to a separate file for confirmation
# when they want to edit their page

open (FILE, ">>$data") || die "I can't open $data\n";
print FILE "$login&&$email&&$pagename\n";
close(FILE);

# Here we check the details of the user

sub checkuser {
open(FILE, "$data") || die "I can't open $data\n";      

      while(<FILE>) {
      chop;            
      @all = split(/\n/);

      foreach $line (@all) {
      ($loginname, $loginemail, $loginpagename) = split(/&&/, $line);

      if($loginname eq "$login" && $loginemail eq "$email" && $loginpagename eq "$pagename") {
            $match = 1;
            &edit($loginpagename);
                     }
            }
      
      }

#  Please add ur subroutine to open

0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now