PHP: Lớp kết nối MySQL với PHP bằng câu lệnh đơn giảnPHP Code:class mysql{var $property = array( 'hostname' => 'localhost', 'database' => '', 'username' => '', 'password' => '',);function mysql($info){foreach($this->property as $k => $v){$this->property[$k]=$info[$k];}}function connec…Read More
Code C#: Mã hóa cổ điển Rail-Fence (Rail Fence Cipher)(RAIL FENCE CIPHER)///MÃ HÓApublic static string Encrypt(int rail, string plainText){ List<string> railFence = new List<string>(); for (int i = 0; i < rail; i++) { railFence.Add(""); } int number = 0; int increment = 1; foreach (char c i…Read More
Code C#: Mã hóa cổ điển Affine (Affine Cipher)///Hàm mã hóa Affine (Affine Encryption)/// e(x) = (ax + b)(mod m). Note: a & m là số nguyên tố cùng nhau.public static string AffineEncrypt(string plainText, int a, int b){string cipherText = "";char[] chars = plainText.ToUpper().ToCharArray();foreach (char c in chars){ int x = Convert.ToInt32(c - 65); cipherText += C…Read More
Code C#: Mã hóa cổ điển Vigenere (Vigenere Cipher)(VIGENERE CIPHER)///HÀM MÃ HÓAstatic void VigenereEncrypt(ref StringBuilder s, string key){ for (int i = 0; i < s.Length; i++) s[i] = Char.ToUpper(s[i]); key = key.ToUpper(); int j = 0; for (int i = 0; i < s.Length; i++) { if (Char.IsLetter(s[i])) &nbs…Read More
SQL Server: Câu lệnh truy vấn trong SQL Server 2005 (Select Command)Câu lệnh truy vấn trong SQL Server 2005 (Select Command)Các lệnh và các mệnh đề cơ bản trong SQL Server 2005Lệnh SELECTSELECT là một lệnh truy vấn dữ liệu cơ bản trong SQL. Có rất nhiều mệnh đề con tuỳ chọn trong câu lệnh SELECT.Cấu trúc SELECT – FROM – WHERECú pháp:SELECT <Danh sách các cột> FROM <Danh sách bảng> WHERE <Điều kiện>;Trong đó…Read More
PHP: Các hàm PHP xử lý chuỗiCác hàm PHP xử lý chuỗi1: addcslashes :Trích dẫn chuỗi kí tự với những vạch chéo trong kiểu C- Cấu trúc :addcslashes(string with special characters);2: addslashes :Trích dẫn chuỗi kí tự với những vạch chéo- Cấu trúc : addcslashes(a string with special characters);3: bin2hex :Chuyển đổi dữ liệu dạng nhị phân sang dạng biểu diễn hệ hexa- Cấu trúc :bin2hex(string);4: cho…Read More
Klik untuk melihat kode: