OSSP CVS Repository

ossp - Check-in [2124]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 2124
Date: 2002-May-08 17:59:21 (local)
2002-May-08 15:59:21 (UTC)
User:ps
Branch:
Comment: Corrected one error in password checking. Created the first construction of second "window"
Tickets:
Inspections:
Files:
ossp-pkg/tabea/tabea.cgi      1.8 -> 1.9     144 inserted, 64 deleted

ossp-pkg/tabea/tabea.cgi 1.8 -> 1.9

--- tabea.cgi    2002/05/08 07:38:18     1.8
+++ tabea.cgi    2002/05/08 15:59:21     1.9
@@ -36,6 +36,8 @@
 $|++;
 
 my $pwdfile = "./tabea.pw";
+my $configsdir = "./tabea.d";
+my $tabeauser = "tabea";
 
 # establish my configuration
 my $MY = {};
@@ -84,35 +86,6 @@
     }
 }
 
-########################################################################################
-sub validpassword {
-########################################################################################
-    my ($username, $password) = @_;
-
-    my $returnvalue = 0;
-    my $uname;
-    my $pwd;
-    my $pwdin;
- 
-    $pwdin = IO::File->new("<$pwdfile");
-    if(defined $pwdin) {
-        while(<$pwdin>) {
-            $_ =~ s|^(\w+):(\w+)$|{$uname=$1; $pwd=$2}|eg;
-            ( $uname =~ $username ) && do {     # check the password
-                if (crypt($password, $pwd) eq $pwd){
-                    $returnvalue = 1;
-                }
-            }
-        }
-    }
-
-    $pwdin->close();
-
-    return $returnvalue;
-}
-########################################################################################
-
-
 my $page = '';
 
 if ($form eq '') {
@@ -152,46 +125,98 @@
 }
 elsif ($form eq 'login') {
     #   enter Select form
+
     
     &validpassword($username, $password, $pwdfile) || print STDOUT $cgi->redirect(-uri => $cgi->url(-full => 1), -type => "text/html");
+    my $templatesfiles = &readdir($configsdir."/".$tabeauser);
+    my $configsfiles = &readdir($configsdir."/".$username);
+
+
+    my @templateshash = split(/ /,$templatesfiles);
+    my $templateslist = "";
+    foreach (@templateshash) {
+        $templateslist .= "'$_', ";
+    }
+  #  $templateslist .= "]";
+     
 #
      $page .= $cgi->startform( -method => "POST", -action => $cgi->url(-full => 1)) .
         $cgi->hidden(-name => 'form', -default => ['']) .
-         
-#        "<table cellspacing=0 cellpadding=0>" .
-#        "  <tr>" . 
-#        "    <td>Username:</td>" .
-#        "    <td>" . 
-#        $cgi->textfield(
-#            -name => 'username',
-#            -default => $username,
-#            -size => 20,
-#            -maxlength => 8
-#        ) .
-#        "    </td>" .
-#        "  </tr>" .
-#        "  <tr>" . 
-#        "    <td>Password:</td>" .
-#        "    <td>" . 
-#        $cgi->password_field(
-#            -name => 'password',
-#            -value => $password,
-#            -size => 20,
-#            -maxlength => 80
-#        ) .
-#        "    </td>" .
-#        "  </tr>" .
-#        "  <tr>" . 
-#        "    <td colspan=2 align=right>" .
-#        $cgi->reset() .
-#        $cgi->submit(-name => 'dialog', -value => 'Login') .
-#        "    </td>" .
-#        "  </tr>" .
-#        "</table>" .
-#        $cgi->endform;        print "$pwd\n";
-#    $page .= "Dialog:   ".$cgi->param("dialog") ."<br>\n";
-#    $page .= "Username: ".$cgi->param("username") ."<br>\n";
-#    $page .= "Password: ".$cgi->param("password") ."<br>\n";
+# Begin with templates part         
+        $page .= "Templates:   <br><br>\n" . 
+        "<table width=70%>" .
+        "  <td>" . 
+        "    <td>" .
+        $cgi->scrolling_list(
+            -name => 'templatelist',
+            -value => ['default', 'sample'],
+            -size => 2
+        ) .
+        "   </td>" .
+        "  <td>" .
+        "    <table>" .
+        "   <td>" .
+        "   <tr>" .
+        $cgi->submit(-name => 'copy', -value => 'Copy') .
+        "   </tr>" .
+        "   <tr>" .
+        $cgi->submit(-name => 'view', -value => 'View') .
+        "   </tr>" .
+        "   </td>" .
+        "   </table>" .
+        "   </td>" .
+        "   </table>" .
+        " </td>" .
+        "</table>" .
+
+# Now the configuration part         
+        $page .= "Configuration:   <br><br>\n". 
+        "<table width=70%>" .
+        "  <td>" . 
+        "    <td>" .
+        $cgi->scrolling_list(
+            -name => 'configlist',
+            -value => ['xdefault', 'xsample'],
+            -size => 5
+        ) .
+        "   </td>" .
+        "    <td>" .
+        "     <table>" .
+        "      <td>" .
+
+        "      <tr>" .
+        $cgi->submit(-name => 'new', -value => 'New') .
+        "      </tr>" .
+
+        "      <tr>" .
+        $cgi->submit(-name => 'copy', -value => 'Copy') .
+        "      </tr>" .
+
+        "      <tr>" .
+        $cgi->submit(-name => 'edit', -value => 'Edit') .
+        "      </tr>" .
+
+        "      <tr>" .
+        $cgi->submit(-name => 'del', -value => 'Del') .
+        "      </tr>" .
+
+        "      <tr>" .
+        $cgi->submit(-name => 'run', -value => 'Run') .
+        "      </tr>" .
+
+        "      <tr>" .
+        $cgi->submit(-name => 'conf_rights', -value => 'Config_rights') .
+        "      </tr>" .
+
+        "     </td>" .
+        "    </table>" .
+        "   </td>" .
+
+        " </td>" .
+        "</table>" .
+
+
+        $cgi->endform;   
 }
 elsif ($form eq 'select') {
     #   enter Edit form
@@ -208,3 +233,58 @@
 print $cgi->header(-cookie => $cookies, -expires => '+1s') . $out;
 
 exit (0);
+
+
+
+
+########################################################################################
+sub validpassword {
+########################################################################################
+    my ($username, $password) = @_;
+
+    my $returnvalue = 0;
+    my $uname;
+    my $pwd;
+    my $pwdin;
+ 
+    $pwdin = IO::File->new("<$pwdfile");
+    if(defined $pwdin) {
+        while(<$pwdin>) {
+            $_ =~ s|^(\w+):(.+)$|{$uname=$1; $pwd=$2}|eg;
+            ( $uname =~ $username ) && do {     # check the password
+                if (crypt($password, $pwd) eq $pwd){
+                    $returnvalue = 1;
+                }
+            }
+        }
+    }
+
+    $pwdin->close();
+
+    return $returnvalue;
+}
+########################################################################################
+
+
+########################################################################################
+sub readdir {
+########################################################################################
+    my ( $dir ) = @_;
+    my $filestring = "";
+    my $direntry = "";
+
+    opendir(DIR, "$dir");       # Open dir for scanning
+    
+    foreach $direntry (readdir(DIR)) {
+        next if $direntry eq ".";
+        next if $direntry eq "..";
+        if (-f "$dir/$direntry") {
+            $filestring .= $direntry. " ";
+        }
+    }
+    closedir(DIR);
+    return $filestring;
+}
+########################################################################################
+
+

CVSTrac 2.0.1