<?php
include($_SERVER['DOCUMENT_ROOT'] .'/script/HeaderInc.php');
//SiteLibs::GetVarDump($_SESSION);

if ((true === isset($_SESSION['SessionAuth']['SvtAdmin']['reg']) && 1 == $_SESSION['SessionAuth']['SvtAdmin']['reg']) ||
    (true === isset($_SESSION['SessionAuth']['SvtOperatorAdv']['reg']) && 1 == $_SESSION['SessionAuth']['SvtOperatorAdv']['reg']) ||
    (true === isset($_SESSION['SessionAuth']['SvtOperator']['reg']) && 1 == $_SESSION['SessionAuth']['SvtOperator']['reg'])
   ){
  $smarty->assign('VarMenuMain', $VarMenu);
  $ObjCryptMod = new CryptMod($MS_SP->Sp_DbConf['site']['SecretPassphrase']);
  $ObjPassMod = new PassMod($MS_SP);
  if (($handle = fopen("pass.csv", "r")) !== FALSE) {
    while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
        //$num = count($data);
        //echo "<p> $num fields in line $row: <br /></p>\n";
        //for ($c=0; $c < $num; $c++) {
          $ArrValue['users_id'] = 1;
          $ArrValue['pass_name'] = $data[0];
          $ArrValue['pass_login'] = $data[1];
          $ArrValue['pass_pass'] = $ObjCryptMod->encrypt($data[2]);
          $ArrValue['pass_note'] = $data[3];
          $ArrValue['pass_share'] = 0;
          
          $ObjPassMod->Add($ArrValue);
        //}
    }
    fclose($handle);
}
  
  
  
  
}
else{
  $smarty->assign('VarError', $MS_SP->Sp_LangMessage['error']['ErrAuthAccessDenied']);
  $VarPagesTxt .= $smarty->fetch('AccessDenied.tpl');
}

$smarty->assign('VarPagesTxt', @$VarPagesTxt);
if (true === isset($MS_SP->SP_CurrPage['template_file']) && '' != $MS_SP->SP_CurrPage['template_file']){
	$smarty->display($MS_SP->SP_CurrPage['template_file']);
}
else {
	$smarty->display('Page.tpl');
}
include($_SERVER['DOCUMENT_ROOT'] .'/script/FooterInc.php');
?>