Exemple #1
0
 ############################################################################################
 $reguserlogin = search_string(DATADIR . "datatmp/reguser.dat", strtolower($logs), 0);
 $regusermail = search_string(DATADIR . "datatmp/reguser.dat", $meil, 1);
 $regusernick = search_string(DATADIR . "datatmp/reguser.dat", strtolower($logs), 2);
 $blacklogin = search_string(DATADIR . "blacklogin.dat", strtolower($logs), 1);
 $blackmail = search_string(DATADIR . "blackmail.dat", $meil, 1);
 if (empty($blackmail)) {
     if (empty($blacklogin)) {
         if (empty($reguserlogin)) {
             if (empty($regusernick)) {
                 if (empty($regusermail)) {
                     $_SESSION['reguser'] = 1;
                     $_SESSION['protect'] = "";
                     unset($_SESSION['protect']);
                     if ($config['regkeys'] == 1) {
                         $reg_key = xoft_encode(SITETIME + 86400, $config['keypass']);
                     } else {
                         $reg_key = "";
                     }
                     $text = $logs . ':||:' . md5(md5($pars)) . ':||::||::||:' . $meil . ':||::||:' . SITETIME . ':||:107:||:0:||:0:||:1:||:0:||:0:||:' . $brow . ':||:' . $ip . ':||:N:||::||::||::||::||:' . $config['themes'] . ':||:' . $config['bookpost'] . ':||:' . $config['postnews'] . ':||:' . $config['forumpost'] . ':||:' . $config['forumtem'] . ':||:0:||:' . $config['chatpost'] . ':||::||:' . $config['boardspost'] . ':||::||:' . $config['timeclocks'] . ':||:' . $config['showtime'] . ':||:' . $config['privatpost'] . ':||:0:||::||::||:0:||:0:||:0:||::||::||:100:||:1:||:images/avators/noavatar.gif:||:' . SITETIME . ':||:1:||:' . $config['regkeys'] . ':||:' . $reg_key . ':||:0:||:0:||:0:||:0:||::||::||:0:||:0:||:0:||:0:||:0:||:50:||::||::||::||::||:0:||::||:0:||::||::||::||::||::||::||:0:||:0:||::||::||::||::||:';
                     write_files(DATADIR . "profil/{$logs}.prof", $text, 0, 0666);
                     $textpriv = $config['nickname'] . '|Добро пожаловать, ' . $logs . '! Теперь вы зарегистрированный пользователь сайта, сохраните ваш пароль и логин в надежном месте, они вам еще пригодится. Надеемся вам понравится на нашем портале!<br />Перед посещением сайта рекомендуем вам ознакомиться с [url=' . $config['home'] . '/pages/pravila.php?' . SID . ']правилами сайта[/url]<br />Желаем приятно провести время. С уважением администрация сайта|' . SITETIME . '|';
                     write_files(DATADIR . 'privat/' . $logs . '.priv', $textpriv . "\r\n", 0, 0666);
                     write_files(DATADIR . "datatmp/reguser.dat", strtolower($logs) . '|' . $meil . "||\r\n", 0, 0666);
                     if ($config['regkeys'] > 0) {
                         write_files(DATADIR . "datatmp/reglist.dat", $logs . '|' . $meil . '|' . SITETIME . "|\r\n", 0, 0666);
                     }
                     write_files(DATADIR . "datatmp/newuserday.dat", $logs . '|', 0, 0666);
                     /*
                     0 - Логин
                     1 - Пароль
 }
 ############################################################################################
 ##                            Подтверждение восстановления                                ##
 ############################################################################################
 if ($action == "send") {
     $uz = check($_POST['uz']);
     $provkod = (int) $_POST['provkod'];
     if ($uz != "") {
         if (preg_match('|^[a-z0-9\\-]+$|i', $uz)) {
             if ($_SESSION['protect'] == $provkod) {
                 if (file_exists(DATADIR . "profil/{$uz}.prof")) {
                     $uzdata = reading_profil($uz);
                     if (xoft_decode($uzdata[35], $config['keypass']) < SITETIME) {
                         $_SESSION['protect'] = "";
                         unset($_SESSION['protect']);
                         $restore_key = xoft_encode(SITETIME + 43200, $config['keypass']);
                         change_profil($uz, array(35 => $restore_key));
                         //---------------- Инструкция по восстановлению пароля на E-mail --------------------------//
                         if ($uzdata[4] != "") {
                             addmail($uzdata[4], "Подтверждение восстановления пароля на сайте " . $config['title'], "Здравствуйте, " . $uzdata[0] . " \nВами была произведена операция по восстановлению пароля на сайте " . $config['home'] . " \n\nДанные отправителя: \nIp: {$ip} \nБраузер: {$brow} \nОтправлено: " . date('j.m.y / H:i', SITETIME) . "\n\nДля того чтобы восстановить пароль, вам необходимо перейти по ссылке: \n\n" . $config['home'] . "/mail/lostpassword.php?action=restore&uz=" . $uzdata[0] . "&key=" . $restore_key . " \n\nЕсли это письмо попало к вам по ошибке или вы не собираетесь восстанавливать пароль, то просто проигнорируйте его");
                         }
                         echo 'Письмо с инструкцией по востановлению пароля успешно выслано на E-mail указанный в профиле<br />';
                         echo 'Внимательно прочтите письмо и выполните все необходимые действия для восстановления пароля<br />';
                         echo 'Восстанавливать пароль можно не чаще чем раз в 12 часов<br />';
                     } else {
                         show_error('Ошибка, с момента последнего восстановления пароля прошло менее 12 часов!');
                     }
                 } else {
                     show_error('Ошибка, пользователя с данным логином не зарегестрирован!');
                 }
             } else {
Exemple #3
0
    function open_session($login, $passwd, $cryptpasswd)
    { 
    	/* Verifie le login et le mot de passe sur l'annuaire ldap
          ouvre une session et cree le home et la bdd en cas de succes
          Renvoie :
                * true en cas de succes de la creation du home et de la bdd
                * false dans les autres cas
		*/
		
		global $urlauth, $scriptsbinpath, $authlink, $DBAUTH, $key_priv, $auth_mod;
		
		if ( user_valid_passwd ( $login , $passwd ) ) { 
			/* Le mot de passe de $login est valide
			   On ouvre une session LCS */
			
			// Ouverture de la session php Lcs
			session_name("Lcs");
			@session_start();
			$_SESSION['login'] = $login;
			$_SESSION['token'] = rand();
			// Creation du cookie LCSuser pour roundcube, pma...
			setcookie("LCSuser", xoft_encode( urlencode($passwd) ,$key_priv), 0,"/","",0);
			// Creation Espace Perso Utilisateur
			if ( !@is_dir("/home/".$login) ||  (@is_dir("/home/".$login) && ( !@is_dir("/home/".$login."/public_html") || !@is_dir("/home/".$login."/Maildir") || !@is_dir("/home/".$login."/Documents") || !@is_dir("/home/".$login."/Profile"))) ) {
				#system ("echo \"DBG >> Creation Espace perso\" >> /tmp/log.lcs");
				$group=strtolower(people_get_group ($login));
				exec ("/usr/bin/sudo /usr/share/lcs/scripts/mkhdir.sh ".escapeshellarg($login)." '$group' '$cryptpasswd' > /dev/null 2>&1");
			} else {
				// Verification acces bdd et reinitialisation le cas echeant
                #system ("echo \"DBG >> Verif. acces mysql $login $passwd\" >> /tmp/log.lcs");
                @((is_null($___mysqli_res = mysqli_close($GLOBALS["___mysqli_ston"]))) ? false : $___mysqli_res);
                @($GLOBALS["___mysqli_ston"] = mysqli_connect("localhost",  $login,  $passwd ));
                if ( ((is_object($GLOBALS["___mysqli_ston"])) ? mysqli_error($GLOBALS["___mysqli_ston"]) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false)) ) {
					exec ( escapeshellarg("$scriptsbinpath/mysqlPasswInit.pl")." ". escapeshellarg($login) ." ". escapeshellarg($passwd) );
                    #system ("echo \"DBG >> Reinit mdp mysql $login $passwd\" >> /tmp/log.lcs");
				}
				@((is_null($___mysqli_res = mysqli_close($GLOBALS["___mysqli_ston"]))) ? false : $___mysqli_res);
            }
            return true;
		} 
		return false;
    } 
    // Affichage des erreurs
    if( $mod_pwd )  {
        // Affichage des messages d'alerte
        if (!user_valid_passwd ( $login, $old_password ) ) {
            // Verification de l'ancien mot de passe
            echo gettext("<div class='error_msg'>Votre mot de passe actuel est erron&#233; !</div><br />\n");
        } elseif ( !verifPwd($new_password)  ) {
            // Verification du nouveau mot de passe
            echo gettext("<div class='error_msg'>Vous devez proposer un mot de passe d'une longueur comprise entre 4 et 8 caract&#232;res, compos&eacute; de lettre(s) et de chiffre(s) avec &#233;ventuellement les caract&#232;res sp&#233;ciaux suivants : $char_spec</div><br />\n");
        } elseif ( $new_password != $verif_password ) {
            // Verification de la coherence des deux mots de passe
            echo gettext("<div class='error_msg'>La v&#233;rification de votre nouveau mot de passe a &#233;chou&#233; !</div><br />\n");
        } elseif ( $new_password == $old_password ) {
            // Verification si le nouveau pasword est différent de l'ancien
            echo gettext("<div class='error_msg'>Le nouveau mot de passe doit &ecirc;tre diff&eacute;rent de l'ancien !</div><br />\n");
        }
    }
  } else {
    // Changement du mot de passe
    if ( userChangedPwd($login, $new_password, $old_password) ) {
        // On reposte le cookie LCSuser en cas de succes du changement du mot de passe
        setcookie("LCSuser", xoft_encode( urlencode($new_password) ,$key_priv), 0,"/","",0);
        $html = "<strong>Votre mot de passe a &#233;t&#233; modifi&#233; avec succ&#232;s.</strong><br>\n";
    } else $html = "<div class='error_msg'>Echec de la modification de votre mot de passe, veuillez contacter <A href='mailto:$MelAdminLCS?subject=PB changement mot de passe'>l'administrateur du syst&#232;me</A></div><br />\n";
    header_crypto_html("Modification mot de passe");
    aff_trailer ("5");
    echo $html;
  }
  include ("../lcs/includes/pieds_de_page.inc.php");
?>
Exemple #5
0
    $action = check($_GET['action']);
} else {
    $action = "";
}
############################################################################################
##                                       Авторизация                                      ##
############################################################################################
if ($action == "") {
    if (preg_match('|^[a-z0-9\\-]+$|i', $login) && preg_match('|^[a-z0-9\\-]+$|i', $pass)) {
        if (file_exists(DATADIR . "profil/{$login}.prof")) {
            $inform = file_get_contents(DATADIR . "profil/{$login}.prof");
            $info = explode(":||:", $inform);
            if ($login == $info[0] && md5(md5($pass)) == $info[1]) {
                if ($cookietrue == 1) {
                    $apar = xoft_encode($pass, $config['keypass']);
                    $alog = xoft_encode($login, $config['keypass']);
                    setcookie("cookpar", $apar, time() + 3600 * 24 * 365);
                    setcookie("cooklog", $alog, time() + 3600 * 24 * 365);
                }
                setcookie("cookname", $login, time() + 3600 * 24 * 365);
                $pr_ip = explode(".", $ip_addr);
                $my_ip = $pr_ip[0] . $pr_ip[1] . $pr_ip[2];
                $_SESSION['log'] = $login;
                $_SESSION['par'] = $pass;
                $_SESSION['my_ip'] = $my_ip;
                change_profil($login, array(11 => $info[11] + 1, 14 => $ip, 25 => 1, 44 => SITETIME));
                header("Location: index.php?" . SID);
                exit;
            }
        }
    }
Exemple #6
0
        // mot de passe
        if ( $userpwd && !verifPwd($userpwd) ) {
          echo "<div class='error_msg'>
                 Vous devez proposer un mot de passe d'une longueur comprise entre 4 et 8 caract&#232;res compos&eacute; de lettre(s) et de chiffre(s) avec &#233;ventuellement les caract&#232;res sp&#233;ciaux suivants ($char_spec)
                </div><br />\n";
        }
        // fin verification des saisies
      }
    } else {
      // Changement du mot de passe
      if ( $userpwd && verifPwd($userpwd) ) {
        if ( userChangedPwd($uid, $userpwd, '') ) {
          $html = "<strong>Le mot de passe a &#233;t&#233; modifi&#233; avec succ&#232;s.</strong><br>\n";
          if ( $login == $uid )
            // Cas du changement de son propre mot de passe, on reposte le cookie LCSuser
            setcookie("LCSuser", xoft_encode( urlencode($userpwd) ,$key_priv), 0,"/","",0);
        } else
          $html = "<div class='error_msg'>Echec de la modification du mot de passe, veuillez contacter <A HREF='mailto:$MelAdminLCS?subject=PB changement mot de passe'>l'administrateur du syst&#232;me</A></div><br />\n";
      }
      header_crypto_html("Modification fiche utilisateur");
      aff_trailer ("4");
      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);