[slbackup-commit] CVS update: slbackup-php index.php

finnarne-guest at alioth.debian.org finnarne-guest at alioth.debian.org
Wed Apr 11 12:52:17 UTC 2007


  User: finnarne-guest
  Date: 07/04/11 12:52:17

  Modified:    .        index.php
  Log:
  Some cleanup
  
  Revision  Changes    Path
  1.3       +22 -16    slbackup-php/index.php
  
  Index: index.php
  ===================================================================
  RCS file: /cvsroot/slbackup/slbackup-php/index.php,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- index.php	11 Apr 2007 12:37:55 -0000	1.2
  +++ index.php	11 Apr 2007 12:52:17 -0000	1.3
  @@ -6,17 +6,21 @@
   $backupconf="/etc/slbackup/slbackup.conf" ; 
   $ssh_options="-o StrictHostKeyChecking=no" ; 
   
  +# Fetch arguments passed as the script is executed
  +$action = $_POST["Action"] ; 
  +$passwd = $_POST["Passwd"] ; 
  +$client = $_POST["client"] ; 
  +
  +# fetch script to use whith passing the ssh-password
  +$ssh_askpass = sprintf ("%s/mypass.sh", dirname ($_SERVER["SCRIPT_FILENAME"])); 
  +
   printf ("<html>\n") ; 
   printf ("<head>\n") ; 
   printf ("<title>%s</title>\n", _("SLBackup Configuration")) ; 
   printf ("</head>\n") ; 
   printf ("<body>\n") ; 
  -$action = $_POST["Action"] ; 
  -$passwd = $_POST["Passwd"] ; 
  -$client = $_POST["client"] ; 
   
   printf ("<pre>") ; 
  -print_r ($_SERVER) ; 
   printf ("</pre>") ; 
   
   switch ($action) {
  @@ -27,26 +31,28 @@
   	                     $backuphost, $backupconf) ; 
   	    break ; 
           }
  -    default:
  -        printf ("<form name=login method=POST>\n") ; 
  -        printf ("<input type=hidden name=Action value=read>\n") ; 
  -        printf (_("To read the configuration, you must log in as root on the backup-server.<BR>")) ; 
  -        printf (_("Please enter the password for the root account at the backup server:<BR>")) ; 
  -        printf ("<INPUT type=password name=Passwd><BR>\n") ; 
  -        printf ("<INPUT type=submit name=Submit value='%s'>\n", _("Login")) ; 
  -        printf ("<INPUT type=reset name=Reset value='%s'>\n", _("Reset")) ; 
  -        printf ("</form>") ; 
  -        break ; 
   }
   
  -if (empty ($cmd))
  +# if no cmd is provided, show loginform
  +if (empty ($cmd)) {
  +    printf ("<form name=login method=POST>\n") ; 
  +    printf ("<input type=hidden name=Action value=read>\n") ; 
  +    printf (_("To read the configuration, you must log in as %s on %s.<BR>"),
  +	    $backupuser, $backuphost) ; 
  +    printf (_("Please enter the password for the %s account on %s:<BR>"),
  +	    $backupuser, $backuphost) ; 
  +    printf ("<INPUT type=password name=Passwd><BR>\n") ; 
  +    printf ("<INPUT type=submit name=Submit value='%s'>\n", _("Login")) ; 
  +    printf ("<INPUT type=reset name=Reset value='%s'>\n", _("Reset")) ; 
  +    printf ("</form>") ; 
       return ; 
  +}
   
   $desc[0] = array ("pipe", "r") ; 
   $desc[1] = array ("pipe", "w") ; 
   $desc[2] = array ("file", "/tmp/error.log", "a") ; 
   
  -$env = array ('SSH_ASKPASS' => '/home/finnarne/MYCVS/slbackup/slbackup-php/mypass.sh',
  +$env = array ('SSH_ASKPASS' => $ssh_askpass, 
                 'DISPLAY' => ':nowhere') ; 
   $proc = proc_open ($cmd, $desc, $pipes, '/tmp', $env) ; 
   if (is_resource ($proc)) {
  
  
  



More information about the slbackup-commit mailing list