コード例 #1
0
ファイル: mod_entry.php プロジェクト: rhertzog/lcs
	    </tr>
	  </tbody>
        </table>
      </form>
      <?php
      if ( (!verifPseudo($pseudo))&&($mod_entry) ) {
        echo "<div class=\"error_msg\">Un pseudo ne peut contenir ni espace, ni virgule, ni anti-slash (\), ni symbole pipe (|).</div><BR>\n";
      }
    } else {
      // Modification pseudo
      $ds = @ldap_connect ( $ldap_server, $ldap_port );
      if ( $ds ) {
        $r = @ldap_bind ( $ds, $adminDn, $adminPw ); // Bind en admin
        if ($r) {
          $pseudo = ucfirst(mb_strtolower(unac_string_with_underscore($pseudo)));
          $entry["initials"]=$pseudo;
          if ( $telephone && verifTel($telephone) )
            $entry["telephonenumber"]=$telephone ;
          if (@ldap_modify ($ds, "uid=".$people_attr[0]["uid"].",".$dn["people"],$entry)) {
            // log de la modification dans /var/log/lcs/lcs_pseudo.log
            $fp=fopen($logpath."pseudo.log","a");
            if($fp) {
              fputs($fp,$people_attr[0]["uid"]."|".$pseudo."|".date("j/m/y:H:i")."|".$people_attr[0]["fullname"]."|".$REMOTE_ADDR."\n");
              fclose($fp);
            } else {exit;}
            // fin ecriture fichier de log
            echo "<strong>La modification de votre pseudo en <font color=\"orange\">".$pseudo."</font> a r&#233;ussi.</strong><BR>\n";
          } else {
            echo "<strong>Echec de la modification, veuillez contacter </strong><A HREF='mailto:$MelAdminLCS?subject=PB changement pseudo'>l'administrateur du syst&#232;me</A><BR>\n";
          }
コード例 #2
0
ファイル: mod_user_entry.php プロジェクト: rhertzog/lcs
      echo $html;
      // Positionnement des entrees a modifier
      // Nettoyage des accents
      $prenom = ucfirst(mb_strtolower(unac_string_with_space($prenom)));
      $nom = ucfirst(mb_strtolower(unac_string_with_space($nom)));
      $description = ucfirst(mb_strtolower(unac_string_with_space($description)));
      // Nettoyage accents et remplacement espace par underscore
      $pseudo = ucfirst(mb_strtolower(unac_string_with_underscore($pseudo)));

      $entry["sn"] = stripslashes ($nom);
      $entry["cn"] = stripslashes ($prenom." ".$nom);
      $entry["givenname"] = stripslashes ($prenom);

      if($user[0]["gecos"]!="") {
         $tab_gecos=explode(",",$user[0]["gecos"]);
         $entry["gecos"]=ucfirst(mb_strtolower(unac_string_with_underscore($prenom)))." ".ucfirst(mb_strtolower(unac_string_with_underscore($nom))).",".$tab_gecos[1].",".$tab_gecos[2].",".$tab_gecos[3];
      }

      if ( $shell ) {
		$entry["loginshell"] = $shell;
		$dnToModify = "uid=".$uid.",".$dn['people'];
		exec ("$scriptsbinpath/toggleShell.pl ". escapeshellarg($dnToModify) ." ". escapeshellarg($shell));
	}
      if ( $pseudo && verifPseudo($pseudo) )
          $entry["initials"]=$pseudo;
      if ( $telephone && verifTel($telephone) )
          $entry["telephonenumber"]=$telephone ;
      if ( $description && verifDescription($description) ) $entry["description"]=stripslashes($description);

      // Modification des entrees
      $ds = @ldap_connect ( $ldap_server, $ldap_port );