Location: PHPKode > projects > Web-Net-Admin > webnetadmin/serveurs/samba/samba_module.php
<?
session_start();

function	del_grp_in_smb($grp, $serv)
{
  $line="delgrp|".$grp."|".$serv."|\n";
  write_file_samba($line);
}

function	modif_name_grp_in_smb($new, $old, $serv)
{
  $line = "modifnamegrp|$new|$old|$serv|\n";
//   write_file_samba($line);  
}


function	modif_mdp_in_smb($usr, $pass)
{
  include "sortir_variable_obl.php";
  $line="modifmdp|".$usr."|".$pass."|".$ldap_samba."|\n";
  write_file_samba($line);
}


function	modif_pc_smb($new, $old)
{
  include "sortir_variable_obl.php";
  $line = "modif_pc|$new|$old|$ldap_pass_pc|$ldap_samba|\n";
  write_file_samba($line);
}

function	modif_smb($new, $old, $info, $ldap, $type)
{
  $grp = $info["grpprim"];
  $serveur = $info["serveur"];
  $old_ser = $info["old_serv"];
  $pass = $info["mdp"];
  $line = "modifuser|".$new."|".$old."|".$pass."|"
    .$serveur."|".$old_ser."|".$grp."|".$ldap."|\n";      
  write_file_samba($line);
}


function	del_smb($obj, $type)
{
  if ($type == "pc")
    $line = "delpc|$obj\n";
  else if ($type == "user")
    {
      $us = $obj;
      $info=recup_info_insql_usr($us);
      $serv = $info["serveur"];
      $grpprim = $info["grpprim"];
      $line = "delusr|$us|$grpprim|$serv|\n";
    }
  write_file_samba($line);
}

function	add_grp_in_smb($grp, $serveur)
{
  $line = "addgrp|".$grp."|".$serveur."|\n";
  write_file_samba($line);
}

function	modif_grpprim_in_smb($serveur, $new_serv, $usr, $prim, $old_prim)
{
 $line = "modifgrpprim|".$usr."|".$serveur."|".$prim."|".$old_prim."|".$new_serv."|\n";
 write_file_samba($line);
}

function	add_pc_in_smb($info, $ldap, $uid)
{
  $pc = $info["pc"];
  $serveur = $info["serveur"];
  $line = "addpc|".$pc."|".$uid."|".$ldap."|\n";
  write_file_samba($line);
}

function	add_user_in_smb($info, $ldap)
{
  $serveur = $info["serveur"];
  $user = $info["id"];
  $pass = $info["password"];
  $grp = $info["grpprim"];
  $uid = $info["uid"];
  $line = "adduser|".$user."|".$pass."|".$uid."|".$serveur
    ."|".$grp."|".$ldap."|\n";
  write_file_samba($line);
}

function	write_file_samba($line)
{
  $path_rep = "./TEMP";
  $path_file = "$path_rep/tmp_samba";
  if (file_exists($path_file))
    {
      $tmp = file($path_file);
      unlink($path_file);
    }
  $touch = touch($path_file);
  if ($touch)
    {
      $count = count($tmp);
      $file = fopen($path_file, "w");
      chmod($path_file, 0604);
      if ($count)
	for ($i = 0;  $i < $count; $i++)
	  fputs($file, $tmp[$i]);
      fputs($file, $line);
    }
  fclose($file);
}
Return current item: Web-Net-Admin