Download về máy tính giải nén, cấu hình theo hướng dẫn trong file readme.txt trong cùng thư mục CHI TIẾT: Trong source này có dùng ADOdb, Savant3, jQuery, Bootstrap, swiperjs, chartscss
1/ Môi trường chạy PHP, MySQL có thể dùng PHP5 -> PHP8 MySQL 5.7 hoặc MariaDB hoặc Percona
2/ Cấu hình database: Tạo 1 database tên login_system import table
CREATE TABLE IF NOT EXISTS `tbluser` ( `user_id` int(11) NOT NULL AUTO_INCREMENT, `user_passwd` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `user_checkword` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `user_fullname` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `user_address` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `user_emailadd` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `user_status` tinyint(1) NOT NULL DEFAULT '0', `user_register_date` datetime DEFAULT NULL, `user_last_login` datetime DEFAULT NULL, `user_last_activity` datetime DEFAULT NULL, `user_gender` enum('F','M','N') COLLATE utf8_unicode_ci DEFAULT 'N', `user_mobile` char(64) COLLATE utf8_unicode_ci DEFAULT NULL, `user_keycode` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `external_auth_cate` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'github, facebook, google', PRIMARY KEY (`user_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
mở file core/config_database.php thay đổi các thông tin
// DNS support ADODB Library $databse_user = 'root'; $database_pwd = 'pwdRoor@11'; $database_name = 'login_system'; $database_host = 'localhost';
3/ Cấu hình SMTP account gửi mail Bạn phải có 1 tài khoản SMTP cho việc gửi mail (có thể dùng gmail smtp - nếu bạn có tài khoản gmail) Dùng gửi mail kích hoạt tài khoản đăng ký, gửi mail quên mật khẩu lấy lại mật khẩu
//SMTP Config $arrConSMTP = array('smtp_host' => '10.17.22.71', //smtp.gmail.com 'smtp_port' => '587', // port smtp 'smtp_auth' => true, //nếu port 587 dùng port 25 thì chuyển thành false 'smtp_username' => 'def@gmail.com', //tài khoản email smtp 'smtp_passowrd' => 'mail password', //password email smtp 'smtp_sent_from' => 'abc@gmail.com', //email người nhận sẽ thấy khi nhận mail );
Các hàm dùng config này xem source tại core/Mail.php hàm static function sendmail( sẽ dùng các config này để gửi mail đi
Kiến thức nền tảng: Khi dùng LoginSystem này bạn cần có một số kỹ thuật sau - PHP, MySQL, SMTP, XAMPP hoặc các hosting (Linux, Ubuntu) - Layer làm việc Database: dùng ADOdb tham khảo https://adodb.org/dokuwiki/doku.php?id=index để xây dưng các hàm kết nối query db sẵn cho bạn có tính bảo mật cao, bạn không cần viết lại các hàm query, queryAssoc, queryRow, queryOne, queryCol, queryAll, deleteRow, updateRow, insertRow, ....
- templates engine dùng trong LoginSystem là Savant3 tham khảo https://github.com/saltybeagle/Savant3 Thuần PHP để bạn chia 2 loai file ra file php chuyên xử lý php truyền thông tin vào templates, file html chuyên hiển thi html giúp bạn dễ dàng trong quá trình code
|