Re: How to verify a usnername and password?



nightcats@xxxxxxxxx wrote:
....
I hold an old version of discussion board writen in Perl.
Recently, a guy from Chins violently spams my discussion board to
cause it even malfunctioned.

The only thing I can do is setup a Username/Password verifying
procedure to stop this Chinese from spamming. I am an ordinary girl
who know's nothing about this.

My intention is to add two columns,"username"and"password". When
Vistior post a message, the perl script verify the combination first.
Only the one with the right combination can succesfully post it. And I
intent to get every friends of mine different set of combination.

One place to start is:

perldoc -f crypt

which will provide the capability to store encrypted passwords so that
if your system is compromised to the point where someone gets the
password file, they still won't be able to determine the passwords of
your users. You would start by defining a password for your friends and
storing the crypt'ed version of it in a file. Then let your friends
know the password, and arrange the software so they have to change the
password the first time through. You should arrange a couple of simple
checks so your friends can't use easily-cracked passwords like '' or 'a'
or 'abcde', etc -- if their passwords are easily cracked, you are no
better off than you were before.

Depending upon your software, you may need to lock access to the
password file so multiple instances of your program can't access it
simultaneously, at least not when one or more instances need to write to
it. See:

perldoc -q lock

Regarding the type of file to use: If you have only a few users, you
can probably get away with a plain text file of a form such as:

userID encodedpassword

If you have lots of users, you should consider a DBM-type file tied to a
Perl hash. See:

perldoc DB_File

(you might need to download the DB_File module first).

Note that userID and password administration can be a chore -- users
will forget their userID's and/or passwords, etc.

Question: Is your discussion board web-based, or something else?


I roughly know that the process could be first define a password file:
$passwd_file = "path/to/my_password_file";

Then get the variable,
&check_passwd;

Then define the variable. but I just don't know how to make it happen.
Can anybody PLEASE help me so that I can stop this guy from paralizing
my discussion board. T_T

By the way, there is a short script in my Perl file to keep track of
every aticle:
$tolog = "Post $num|";
$tolog .= "$ENV{'REMOTE_ADDR'}|"; ### IP
$tolog .= "$date";
$tolog .= "\n";
open(LOG,">>$testfile");
print LOG $tolog;
close(LOG);

After I put on the password verifying process, how to also record the
"username" information of evrey article?

Looks to me like a simple addition of:

$tolog .= "$userID|";

at an appropriate place should do it, assuming variable $userID hold the
user's userID.
--
Bob Walton
Email: http://bwalton.com/cgi-bin/emailbob.pl
.



Relevant Pages

  • Re: Annoying HASH(0x...) in Output
    ... Perl will tell you if you forget a 'my'. ... A reference to an empty hash? ... same @friends that we saw earlier, the package variable also known as ... If that doesn't sell you on 'use strict', ...
    (perl.beginners)
  • Re: Perl And Apache.
    ... > After UserID/Password authentication on a web page, does Apache store the ... > UserID in an environment variable that a Perl script could use? ... if you are using the CGI module, you have access to any html form ...
    (comp.lang.perl.misc)
  • Re: Perl And Apache.
    ... >> After UserID/Password authentication on a web page, does Apache store the ... >> UserID in an environment variable that a Perl script could use? ... > use CGI; ...
    (comp.lang.perl.misc)
  • Re: Foreach Code Issue
    ... > Windows Environment for a windows environment and I'm running ActivePerl ... As someone else pointed out you could just open the file directly in perl. ... You are overwriting the file for each $USERID ... close REPORT1; ...
    (perl.beginners)
  • Re: Need a shell or perl script
    ... } having kept all these different mailboxes in one directory. ... } addresses have become invalid over the years and some friends' addresses ... } done with shell scripting and better with perl but I know neither. ... I'm assuming your mailboxes are in some reasonable format where email ...
    (Debian-User)