#!/usr/bin/perl BEGIN { use lib '/usr/home/cfg' ; require push_inc ; } require cfg ; #--------------------------------------------------------------------------------------------------------------------------------------------------------------------- use CGI::Carp qw(fatalsToBrowser); use CGI; use Crypt::PasswdMD5; &today; #--------------------------------------------------------------------------------------------------------------------------------------------------------------------- @ARGV = split(/\\*\&/, $ENV{'QUERY_STRING'}); $action = $ARGV[0] ; our ($q) = CGI -> new() ; our $iaction = $q -> param('iaction') || $action ; our $isaved = $q -> param('isaved') || '' ; # our $debug = 1 ; #-------- page opts -------------------------------------------------------------------------------------------------------------------------------------------------- &page_opts ; #--------------------------------------------------------------------------------------------------------------------------------------------------------------------- print "Content-type: text/html\n\n"; &common_min_action; exit; #------------------------------------------------------------------------------------------ sub validate { my $exists = '' ; $i{username} = lc $i{username} ; $i{username} =~ s/ //gi ; &db_min_ro($table,'*',"username = '$i{username}'",'username','') ; foreach my $id (keys %{$db{$table}}) { if ($db{$table}{$id}{username} eq $i{username}) { $exists = 1 ; } } if ($exists) { $alert = &common_min_alert('warning',"USERNAME ALREADY EXISTS!",'ok') ; %col_name = (); &common_min_add_screen; &common_min_screen1; } } #------------------------------------------------------------------------------------------ sub insert { &add_db_fields ; my $crypted_password = apache_md5_crypt($i{password},$useropts{salt}) ; $i{password} = $crypted_password ; $i{lastupdate} = "$now_ccyy_mm_dd $now_hour:$now_min:$now_sec" ; $i{email} = lc $i{email} ; &db_min_insert($table) ; } #------------------------------------------------------------------------------------------ sub update { unless ($i{id}) { $error = qq(NO ID) ; return ; } &edit_db_fields ; unless ($i{block}) { $i{block} = '0' ; } if ($i{new_password}) { my $crypted_password = apache_md5_crypt($i{new_password},$useropts{salt}) ; $i{password} = $crypted_password ; $ignore{password} = 0 ; $hidden{password} = 2 ; } $i{lastupdate} = "$now_ccyy_mm_dd $now_hour:$now_min:$now_sec" ; &db_min_upd($table,"id='$i{id}'") ; } #------------------------------------------------------------------------------------------ sub list_screen { &db_min_ro($table,'*',"user_type like 'casual%'",'username','') ; foreach my $id (keys %{$db{$table}}) { my $disp_blocked = qq(); if ($db{$table}{$id}{block}) { $disp_blocked = qq(); } if ($useropts{it}{$db{$table}{$id}{username}} and $username ne 'rory') { next ; } $opts{$lcpage} .= qq() ; $print_tbody .= qq(