@@ -239,7 +239,7 @@ function kkd_pff_paystack_dashboard_table_data($column, $post_id)
239239 break ;
240240 case 'payments ' :
241241
242- $ count_query = ' select count (*) from ' . $ table . ' WHERE post_id = " ' . $ post_id . ' " AND paid = "1" ' ;
242+ $ count_query = $ wpdb -> prepare ( " SELECT COUNT (*) FROM { $ table} WHERE post_id = %d AND paid = '1' " , $ post_id ) ;
243243 $ num = $ wpdb ->get_var ($ count_query );
244244
245245 echo '<u><a href=" ' . admin_url ('admin.php?page=submissions&form= ' . $ post_id ) . '"> ' . $ num . '</a></u> ' ;
@@ -292,7 +292,7 @@ function kkd_pff_paystack_editor_shortcode_details($post)
292292 <p class="description">
293293 <label for="wpcf7-shortcode">Copy this shortcode and paste it into your post, page, or text widget content:</label>
294294 <span class="shortcode wp-ui-highlight">
295- <input type="text" id="wpcf7-shortcode" onfocus="this.select();" readonly="readonly" class="large-text code" value="[pff-paystack id="<?php echo $ post ->ID ; ?> "]"></span>
295+ <input type="text" id="wpcf7-shortcode" onfocus="this.select();" readonly="readonly" class="large-text code" value="[pff-paystack id="<?php echo esc_html ( $ post ->ID ) ; ?> "]"></span>
296296 </p>
297297
298298 <?php
@@ -800,14 +800,14 @@ function kkd_pff_paystack_payment_submissions()
800800 $ data = $ exampleListTable ->prepare_items (); ?>
801801 <div id="welcome-panel" class="welcome-panel">
802802 <div class="welcome-panel-content">
803- <h1 style="margin: 0px;"><?php echo $ obj ->post_title ; ?> Payments </h1>
803+ <h1 style="margin: 0px;"><?php echo esc_html ( $ obj ->post_title ) ; ?> Payments </h1>
804804 <p class="about-description">All payments made for this form</p>
805805 <?php if ($ data > 0 ) {
806806 ?>
807807
808808 <form action="<?php echo admin_url ('admin-post.php ' ); ?> " method="post">
809809 <input type="hidden" name="action" value="kkd_pff_export_excel">
810- <input type="hidden" name="form_id" value="<?php echo $ id ; ?> ">
810+ <input type="hidden" name="form_id" value="<?php echo esc_html ( $ id) ; ?> ">
811811 <button type="submit" class="button button-primary button-hero load-customize">Export Data to Excel</button>
812812 </form>
813813 <?php
@@ -843,7 +843,9 @@ function Kkd_pff_export_excel()
843843 }
844844 $ table = $ wpdb ->prefix . KKD_PFF_PAYSTACK_TABLE ;
845845 $ data = array ();
846- $ alldbdata = $ wpdb ->get_results ("SELECT * FROM $ table WHERE (post_id = ' " . $ post_id . "' AND paid = '1') ORDER BY `id` ASC " );
846+ $ table = sanitize_text_field ($ table );
847+
848+ $ alldbdata = $ wpdb ->get_results ($ wpdb ->prepare ("SELECT * FROM {$ table } WHERE post_id = %d AND paid = '1' ORDER BY `id` ASC " , $ post_id ));
847849 $ i = 0 ;
848850
849851 if (count ($ alldbdata ) > 0 ) {
@@ -970,8 +972,7 @@ public function prepare_items()
970972
971973 $ table = $ wpdb ->prefix . KKD_PFF_PAYSTACK_TABLE ;
972974 $ data = array ();
973- $ alldbdata = $ wpdb ->get_results ("SELECT * FROM $ table WHERE (post_id = ' " . $ post_id . "' AND paid = '1') " );
974-
975+ $ alldbdata = $ wpdb ->get_results ($ wpdb ->prepare ("SELECT * FROM {$ table } WHERE post_id = %d AND paid = '1' " , $ post_id ));
975976 foreach ($ alldbdata as $ key => $ dbdata ) {
976977 $ newkey = $ key + 1 ;
977978 if ($ dbdata ->txn_code_2 != "" ) {
0 commit comments