From 255dcdb94ece8f37df700b8a144bcd4ff1194815 Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Thu, 20 Oct 2011 07:47:29 -0400
Subject: [PATCH] Fixed: FS#1777 - AWStats: In months with two digits (10, 11, 12) order is broken => 1,10,11,12,2,3...9

---
 interface/lib/classes/auth.inc.php |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/interface/lib/classes/auth.inc.php b/interface/lib/classes/auth.inc.php
index 450f25a..aa4eb9f 100644
--- a/interface/lib/classes/auth.inc.php
+++ b/interface/lib/classes/auth.inc.php
@@ -123,6 +123,25 @@
 			exit;
 		}
 	}
+	
+	public function get_random_password($length = 8) {
+		$base64_alphabet='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
+		$password = '';
+		for ($n=0;$n<$length;$n++) {
+			$password.=$base64_alphabet[mt_rand(0,63)];
+		}
+		return $password;
+	}
+	
+	public function crypt_password($cleartext_password) {
+		$salt="$1$";
+		$base64_alphabet='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
+		for ($n=0;$n<8;$n++) {
+			$salt.=$base64_alphabet[mt_rand(0,63)];
+		}
+		$salt.="$";
+		return crypt($cleartext_password,$salt);
+	}
 		
 }
 

--
Gitblit v1.9.1