321 users online (1 members and 320 guests)  

  Results 1 to 1 of 1


  1. Replies: 0
  2. simple dbase script    Forum: Databases
    Replies: 3
  3. Replies: 5
  1. #1
    PudgiPod's Avatar
    New User

    Join Date
    Mar 2007

    Adding a username to simple password script


    I have a simple password script that works quite well. It asks for a password when logging in and depending on the password, directs the user to a specific page. I would like it to also ask for a username, but I'm not sure how to make it do that since I don't know how to write perl scripts. The script allows multiple passwords and I hope that adding the username would still allow this. Here is the code:

    $correctpass = "sample";
      $correcturl = "http://www.mydomain.com/private/";
      $scriptlocation = "http://www.mydomain.com/cgi-bin/password.pl";
      $loginurl = "http://www.mydomain.com/login.html";
    # Read in form data
      $password =  $input{'password'};
      $function = $input{'function'};
      if ($function eq "login") {
           if ($password eq $correctpass) {
    sub badpassword {
        print "Location: $loginurl\n\n";
    sub goto_url {
        print "Location: $correcturl\n\n";
    sub parse_form {
       read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
       if (length($buffer) < 5) {
             $buffer = $ENV{QUERY_STRING};
       @pairs = split(/&/, $buffer);
       foreach $pair (@pairs) {
          ($name, $value) = split(/=/, $pair);
          $value =~ tr/+/ /;
          $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
          $input{$name} = $value;

    If anyone can help I would really appreciate it! Thank you.

    Last edited by DeadMeatGF; 03-19-2007 at 12:52 PM. Reason: Added Code tags

Tags for this Thread