yapcom-cvs Mailing List for Yet Another Perl Conference Manager
Status: Planning
Brought to you by:
szabgab
You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(3) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
---|
From: <sz...@us...> - 2003-07-12 20:27:11
|
Update of /cvsroot/yapcom/yapcom/yapcom/cgi In directory sc8-pr-cvs1:/tmp/cvs-serv31726/cgi Modified Files: yapcom.pl Log Message: registration form works, id counter works, rejects duplicate registrations with the same e-mail address but does not say anything about it. List registered users Index: yapcom.pl =================================================================== RCS file: /cvsroot/yapcom/yapcom/yapcom/cgi/yapcom.pl,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** yapcom.pl 10 Jul 2003 18:36:07 -0000 1.5 --- yapcom.pl 12 Jul 2003 20:27:07 -0000 1.6 *************** *** 1,11 **** ! #!/usr/bin/perl -T use strict; use warnings; use CGI::Application; package YAPC::WebApp; use base 'CGI::Application'; sub setup { my $self = shift; --- 1,33 ---- ! #!/usr/bin/perl use strict; use warnings; + + # it seems we cannot use FindBin with taint checking + # so we untaint it in a very unsecure way. + use FindBin qw($Bin); + BEGIN { + $Bin =~ /.*/; + $Bin = $&; + } + use lib "$Bin/../lib"; use CGI::Application; + use DBI; + + # configuration that should be in a separate file + my $username = 'gabor'; + my $password = 'gabor'; + my $db_dir = '../ydb'; + chdir $db_dir; + + my $dbh = DBI->connect("DBI:Sprite:ydb", $username, $password, + { RaiseError => 1}); + #die "Cannot connect to: " . $DBI::errstr; + $dbh->{FetchHashKeyName} = 'NAME_lc'; package YAPC::WebApp; use base 'CGI::Application'; + use Data::Dumper; # for playing with debugging sub setup { my $self = shift; *************** *** 15,19 **** 'main' => 'main', 'registration_form' => 'do_pre_registration', ! 'mode3' => 'do_something_else' ); } --- 37,42 ---- 'main' => 'main', 'registration_form' => 'do_pre_registration', ! 'mode3' => 'do_something_else', ! 'list_users' => 'do_list_users', ); } *************** *** 28,31 **** --- 51,68 ---- } + sub do_list_users { + my $self = shift; + + my $sth = $dbh->prepare("SELECT fname, lname FROM users"); + $sth->execute; + my $ar = $sth->fetchall_arrayref({}); + my $t = $self->load_tmpl('../templates/list_users.tmpl'); + #print STDERR Dumper $ar; + $t->param(USERS => $ar); + return $t->output; + + } + + sub do_pre_registration { my $self = shift; *************** *** 37,41 **** $q->param('pw1') and $q->param('pw2') and ! $q->param('pw2') eq $q->param('pw2') { my @str = ('a'..'z'); --- 74,78 ---- $q->param('pw1') and $q->param('pw2') and ! $q->param('pw1') eq $q->param('pw2')) { my @str = ('a'..'z'); *************** *** 53,58 **** } ! sub save_user { ! } --- 90,119 ---- } ! sub save_new_user { ! my $q = shift; ! my $authcode = shift; ! ! # this code should be in transaction and/or the e-mail field should ! # be unique ! my $sth = $dbh->prepare("SELECT count(*) FROM users WHERE email = ?"); ! $sth->execute($q->param('email')); ! my ($count) = $sth->fetchrow_array; ! if ($count) { ! print STDERR "email exists\n"; ! return 0; ! } ! $sth = $dbh->prepare("INSERT INTO users ! (id, email, fname, lname, password) ! VALUES(user_id.NEXTVAL, ?,?,?,?)"); ! $sth->execute($q->param('email'), $q->param('fname'), ! $q->param('lname'), $q->param('pw1')); ! ! # what about error checking ? ! return 1; ! } ! ! sub do_thank_registration { ! my $self = shift; ! $self->main; # temporary solution } |
From: <sz...@us...> - 2003-07-12 20:27:10
|
Update of /cvsroot/yapcom/yapcom/yapcom/templates In directory sc8-pr-cvs1:/tmp/cvs-serv31726/templates Modified Files: main.tmpl preregister.tmpl Added Files: list_users.tmpl Log Message: registration form works, id counter works, rejects duplicate registrations with the same e-mail address but does not say anything about it. List registered users --- NEW FILE: list_users.tmpl --- <html><head><title>List of registered users</title></head> <body> <table> <TMPL_LOOP NAME="users"> <tr> <td><TMPL_VAR NAME="fname"></td> <td><TMPL_VAR NAME="lname"></td> <td><a href="yapcom.pl?run=user_info&id=<TMPL_VAR NAME="uid">">details</td> </tr> </TMPL_LOOP> </table> <a href="yapcom.pl">main</a> </body> </html> Index: main.tmpl =================================================================== RCS file: /cvsroot/yapcom/yapcom/yapcom/templates/main.tmpl,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** main.tmpl 9 Jul 2003 21:00:22 -0000 1.1 --- main.tmpl 12 Jul 2003 20:27:07 -0000 1.2 *************** *** 1,5 **** <html><head><title>YAPCoM main site</title></head> <body> ! <a href="yapcom.pl?run=registration_form">Pre Register here</a> </body> </html> --- 1,14 ---- <html><head><title>YAPCoM main site</title></head> <body> ! Welcome to the main page of our Conference.<br> ! Here you will be able to do all kind of things:<p> ! <a href="yapcom.pl?run=registration_form">Pre Register here</a><br> ! ! <hr> ! <a href="yapcom.pl?run=list_users">list of registered people</a><br> ! Login<br> ! Admin - interface for the administrators<br> ! <hr> ! <a href="http://sourceforge.net/projects/yapcom/">YAPCoM</a> - the software running on this site is </body> </html> Index: preregister.tmpl =================================================================== RCS file: /cvsroot/yapcom/yapcom/yapcom/templates/preregister.tmpl,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** preregister.tmpl 10 Jul 2003 18:36:08 -0000 1.2 --- preregister.tmpl 12 Jul 2003 20:27:07 -0000 1.3 *************** *** 6,11 **** First Name: <input name="fname" value="<TMPL_VAR NAME=fname>" /><br /> Last Name: <input name="lname" value="<TMPL_VAR NAME=lname>" /><br /> ! Password: <input name="pw1" /><br /> ! Retype Password: <input name="pw2" /><br /> <input type="submit" value="Register"> </form> --- 6,11 ---- First Name: <input name="fname" value="<TMPL_VAR NAME=fname>" /><br /> Last Name: <input name="lname" value="<TMPL_VAR NAME=lname>" /><br /> ! Password: <input name="pw1" type="password" /><br /> ! Retype Password: <input name="pw2" type="password" /><br /> <input type="submit" value="Register"> </form> |
From: <sz...@us...> - 2003-07-12 13:24:41
|
Update of /cvsroot/yapcom/CVSROOT In directory sc8-pr-cvs1:/tmp/cvs-serv4847 Modified Files: loginfo Log Message: tetsing the mailing list 1 Index: loginfo =================================================================== RCS file: /cvsroot/yapcom/CVSROOT/loginfo,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** loginfo 12 Jul 2003 13:24:02 -0000 1.2 --- loginfo 12 Jul 2003 13:24:36 -0000 1.3 *************** *** 26,29 **** --- 26,30 ---- #DEFAULT (echo ""; id; echo %{sVv}; date; cat) >> $CVSROOT/CVSROOT/commitlog + #CVSROOT /cvsroot/sitedocs/CVSROOT/cvstools/syncmail %{sVv} use...@us... |