File_SMBPasswd
[ class tree: File_SMBPasswd ] [ index: File_SMBPasswd ] [ all elements ]

Source for file smbpasswd.php

Documentation is available at smbpasswd.php

  1. <?php
  2.  
  3. require_once 'File/SMBPasswd.php';
  4.  
  5. $f = new File_SMBPasswd('./smbpasswd');
  6. $f->load();
  7. $ret $f->addAccount('sepp3'12'MyPw');
  8. if (PEAR::isError($ret)) {
  9.     echo $ret->getMessage();
  10.     exit;
  11. $ret $f->modAccount('sepp''''MyPw');
  12. if (PEAR::isError($ret)) {
  13.     echo $ret->getMessage();
  14.     exit;
  15. $ret $f->delAccount('karli');
  16. if (PEAR::isError($ret)) {
  17.     echo $ret->getMessage();
  18.     exit;
  19. $f->printAccounts();
  20. if (PEAR::isError($ret)) {
  21.     echo $ret->getMessage();
  22.     exit;
  23. }
  24.  
  25. echo "PASS 1 ------------\n";
  26.  
  27. $f = new File_SMBPasswd('./smbpasswdnew');
  28. $ret $f->addAccount('sepp1'12'MyPw');
  29. if (PEAR::isError($ret)) {
  30.     echo $ret->getMessage();
  31.     exit;
  32. $ret $f->addUser('sepp3'1000'MyPw');
  33. if (PEAR::isError($ret)) {
  34.     echo $ret->getMessage();
  35.     exit;
  36. $ret $f->addMachine('mypc'1000);
  37. if (PEAR::isError($ret)) {
  38.     echo $ret->getMessage();
  39.     exit;
  40.  
  41. $f->printAccounts();
  42. $ret $f->save();
  43. if (PEAR::isError($ret)) {
  44.     echo $ret->getMessage();
  45.     exit;
  46.  
  47. echo "PASS 2 ------------\n";
  48.  
  49. $f = new File_SMBPasswd('./smbpasswd');
  50. $f->load();
  51. if ($f->verifyAccount('sepp''MyPw')) {
  52.     echo "Account valid\n";
  53. else {
  54.     echo "Account invalid or disabled\n";
  55. }
  56.  
  57. echo "PASS 3 ------------\n";
  58. ?>

Documentation generated on Mon, 11 Mar 2019 15:28:55 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.