Skip to content

Commit

Permalink
Merge pull request #2533 from QuizandSurveyMaster/dev-zubair
Browse files Browse the repository at this point in the history
fixed search result issue while using special text characters
  • Loading branch information
zubairraeen authored Apr 25, 2024
2 parents f60fb9e + 4fb1d73 commit c469981
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion php/admin/admin-results-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ function qsm_results_overview_tab_content() {
$order_by_sql = 'ORDER BY time_taken_real DESC';
if ( isset( $_GET['qsm_search_phrase'] ) && ! empty( $_GET['qsm_search_phrase'] ) ) {
// Sanitizes the search phrase and then uses $wpdb->prepare to properly escape the queries after using $wpdb->esc_like.
$sanitized_search_phrase = sanitize_text_field( wp_unslash( $_GET['qsm_search_phrase'] ) );
$sanitized_search_phrase = htmlentities( sanitize_text_field( wp_unslash( $_GET['qsm_search_phrase'] ) ) );
$search_phrase_percents = '%' . esc_sql( $wpdb->esc_like( $sanitized_search_phrase ) ) . '%';
$search_phrase_sql = $wpdb->prepare( ' AND (quiz_name LIKE %s OR name LIKE %s OR business LIKE %s OR email LIKE %s OR phone LIKE %s)', $search_phrase_percents, $search_phrase_percents, $search_phrase_percents, $search_phrase_percents, $search_phrase_percents );
}
Expand Down

0 comments on commit c469981

Please sign in to comment.