This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if ($_GET['submit']) { | |
//do SMT | |
} | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$answers = [ | |
['question_id' => 1, 'option' => 'C'], | |
['question_id' => 2, 'option' => 'A'], | |
['question_id' => 3, 'option' => 'C'], | |
['question_id' => 4, 'option' => 'B'], | |
['question_id' => 5, 'option' => 'C'], | |
['question_id' => 6, 'option' => 'C'], | |
['question_id' => 7, 'option' => 'D'], | |
['question_id' => 8, 'option' => 'D'] | |
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include ('database/connect.php'); | |
//print_r($db_qltc); | |
/** | |
* BÀI TOÁN PHÂN TRANG | |
* B1: Khai báo $limit_per_page (Số bản ghi trên trang) | |
* B2: Lấy $current_page (Trang hiện tại): $current_page = isset($_GET['page']) ? (int) $_GET['page'] : 1; | |
* B3: Tính $offset = ($current_page - 1) * $limit; | |
* B4: Đếm tổng số bản ghi (Có kèm điều kiện hoặc không có điều kiện): $totalRecord | |
* B5: Tính $totalPage = ceil($totalRecord/$limit) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include ('database/connect.php'); | |
// <a href="account.del.php?id=<?php echo $account['id']; | |
/** | |
* Xóa dữ liệu: Có 2 cách (Logic, Vật ly) | |
* + Logic (Cập nhật 1 trạng thái nào đó mà mình quy định nó sẽ được hiểu là bản ghi được xóa). delete_flag (1: Xóa, o: Tồn tại) | |
* => Dữ liệu không mất, khi cần có thể backup lại. Tuy nhiên, khi xử lý, phức tạp hơn xóa vật lý vì các dữ liệu sẽ liên đới với nhau. | |
* + Vật lý: Xóa mất luôn data trong CSDL. Dễ thao tác, dễ triển khai, nhưng rủi ro mất dữ liệu cao. | |
* Luân chuyển dữ liệu: | |
* Thay vì xóa đi, thì mình chuyển dữ về sang 1 table nháp, hoặc database nào đó, hoặc cập nhật sang 01 danh mục. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include ('database/connect.php'); | |
//B1 = check ID | |
//B2= nap lai data | |
//B3= update | |
$errors = []; | |
$id = isset($_GET['id']) ? (int) $_GET['id'] : 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$server = 'localhost'; | |
$username = 'giang2424_demo'; | |
$password = '05012011'; | |
$database = "giang2424_quanlythuchi"; | |
$db_qltc = new mysqli($server, $username, $password, $database);//Thay tên $db_qltc | |
$db_qltc->set_charset('utf8'); | |
if ($db_qltc->connect_error) { | |
echo "<br>Lỗi kết nối"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function wpuf_post_umgroup( $post_id, $form_id ) { | |
/* Build the post content by adding the referer URL to the comment and update the post */ | |
$lv_comment = $_POST['_my_comment'] . PHP_EOL . PHP_EOL . home_url() . wp_get_referer(); | |
$lv_post = array(); | |
$lv_post['ID'] = $post_id; | |
$lv_post['post_author'] = get_current_user_id(); | |
$lv_post['post_content'] = $lv_comment; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter('um_profile_tabs', 'pages_tab', 1000 ); | |
function pages_tab( $tabs ) { | |
$user_id = um_get_requested_user(); | |
// Show to profile owners only | |
if ( is_user_logged_in() && get_current_user_id() == $user_id ) { | |
$tabs['faves'] = array( | |
'name' => 'Faves', | |
'icon' => 'fa fa-star', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Create new shortcode for quickly displaying user metadata. | |
*** NOTE: This only works if you have the Ultimate Member plugin installed. | |
*** Use like regular wordpress shortcodes. Enter [USERMETA user_id="*id*" meta="*field_name*"] (replace *id* and *field_name* with actual values) | |
*** If you use it on an Ultimate Member profile page/tab, it will use the user currently being viewed. | |
*** On other pages, you must include the "user_id" within the shortcode. | |
*/ | |
//Add the shortcode to WordPress | |
add_shortcode('USER_META', 'user_meta_shortcode_handler'); | |
//create the function referenced by the add_shortcode() |
OlderNewer