Plugin Directory

Changeset 1675786


Ignore:
Timestamp:
06/11/2017 06:46:37 AM (9 years ago)
Author:
bobcares_plugins
Message:

Added code to sanitize data

Location:
gift-certificate-creator
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • gift-certificate-creator/tags/1.1/classes/gcm-table.class.php

    r1673026 r1675786  
    1919 *
    2020 */
     21
     22// Exit if accessed directly
     23if ( ! defined( 'ABSPATH' ) ) {
     24        exit;
     25}
     26
    2127class GCListTable extends WP_List_Table {
    2228
     
    5460        $gcPerPage = $this->getPerPage();
    5561        $doingAjax = defined( 'DOING_AJAX' ) && DOING_AJAX;
    56 
     62       
    5763        // per page number
    5864        if ( isset( $_REQUEST['number'] ) ) {
     
    6167            $number = $gcPerPage + min( 8, $gcPerPage );
    6268        }
    63 
     69        $number = filter_var($number, FILTER_SANITIZE_NUMBER_INT);
    6470        $page = $this->get_pagenum();
    6571
    6672        // start number
    6773        if ( isset( $_REQUEST['start'] ) ) {
    68             $start = $_REQUEST['start'];
     74            $start = (int) $_REQUEST['start'];
    6975        } else {
    7076            $start = ( $page - 1 ) * $gcPerPage;
    7177        }
    72 
     78        $start = filter_var($start, FILTER_SANITIZE_NUMBER_INT);
     79       
    7380        // if ajax request
    7481        if ( $doingAjax && isset( $_REQUEST['offset'] ) ) {
    75             $start += $_REQUEST['offset'];
     82            $start += (int) $_REQUEST['offset'];
    7683        }
    7784
     85       
    7886        $args = array(
    7987            'search' => $search,
  • gift-certificate-creator/tags/1.1/classes/gcm.class.php

    r1673026 r1675786  
    88 *
    99 */
    10 
    1110/**
    1211 * The class contains all functions used for gc management
     
    1918 *
    2019 */
     20// Exit if accessed directly
     21if (!defined('ABSPATH')) {
     22    exit;
     23}
     24
    2125class GCM {
    2226
     
    2731     */
    2832    function getAllGCList($args = array()) {
    29         global $wpdb;       
     33        global $wpdb;
    3034        $number = absint($args['number']);
    31         $offset = absint($args['offset']);       
    32        
     35        $offset = absint($args['offset']);
     36
    3337        // if number is not empty
    34         if (!empty($number) && empty($args['count']) ) {
     38        if (!empty($number) && empty($args['count'])) {
    3539            $limits = !empty($offset) ? "LIMIT $offset, $number" : "LIMIT $number";
    3640        } else {
    3741            $limits = '';
    3842        }
    39        
     43
    4044        // fields of sql
    4145        $fields = !empty($args['count']) ? 'COUNT(*) count' : '*';
    42        
     46
    4347        // whree consition of sql
    4448        $where = "1=1";
    45         $where .= !empty($args['search']) ? " AND (user_name like '%".addslashes($args['search'])."%' or receip_name like '%".addslashes($args['search'])."%')" : "";
    46        
     49        $where .=!empty($args['search']) ? " AND (user_name like '%" . addslashes($args['search']) . "%' or receip_name like '%" . addslashes($args['search']) . "%')" : "";
     50
    4751        // order parameters
    4852        $order = ('DESC' == strtoupper($args['order']) ) ? 'ASC' : 'DESC';
    4953        $orderby = !empty($args['orderby']) ? $args['orderby'] : 'user_name';
    50        
     54
    5155        // create sql
    5256        $dbTable = $wpdb->prefix . "gift_certificates";
    53         $sql = "SELECT $fields FROM $dbTable WHERE $where $groupby ORDER BY $orderby $order $limits";
    54        
     57        $sql = "SELECT $fields FROM $dbTable WHERE $where ORDER BY $orderby $order $limits";
     58
    5559        // check whether count or list needed
    5660        if (!empty($args['count'])) {
    5761            $countInfo = $wpdb->get_row($sql, OBJECT);
    58             return  $countInfo->count;
     62            return $countInfo->count;
    5963        } else {
    60             $gcList = $wpdb->get_results($sql, OBJECT );
     64            $gcList = $wpdb->get_results($sql, OBJECT);
    6165            return $gcList;
    6266        }
    63        
    6467    }
    65    
     68
    6669    /**
    6770     * function to create new gift certificate
     
    6972     */
    7073    function createNewGCM($gcInfo) {
     74
    7175        global $wpdb;
    7276        $gc_cert_amount = $_REQUEST['cert_amount'];
    73         $gc_user_name  = esc_attr($gcInfo['user_name']);
     77        $gc_user_name = esc_attr($gcInfo['user_name']);
    7478        $gc_receip_name = esc_attr($gcInfo['receip_name']);
    7579        $gc_receip_address = esc_textarea($gcInfo['receip_address']);
    7680        $gc_cc_sec_code = sanitize_email($gcInfo['cc_sec_code']);
    77         $sql = "INSERT INTO $wpdb->prefix" . "gift_certificates(cert_amount, user_name, receip_name, cc_number, cc_exp, cc_sec_code, receip_address)
    78         values('{$gc_cert_amount}', '{$gc_user_name}', '{$gc_receip_name}',
    79         '{$gcInfo['cc_number']}', '{$gcInfo['cc_exp_month']}-{$gcInfo['cc_exp_year']}', '{$gc_cc_sec_code}', '{$gc_receip_address}')";
    80         $wpdb->query($sql);
     81        $wpdb->query($wpdb->prepare(
     82                        "INSERT INTO $wpdb->prefix"
     83                        . "gift_certificates(cert_amount, user_name, receip_name, cc_sec_code, receip_address) "
     84                        . "values(%f, %s, %s, %s, %s)
     85    ", $gc_cert_amount, $gc_user_name, $gc_receip_name, $gc_cc_sec_code, $gc_receip_address
     86        ));
    8187    }
    82    
    83    
     88
    8489    /**
    8590     * function to send gc reports to users
     
    9095     */
    9196    function sendGCMReportEmail($toEmail, $fromEmail, $subject, $gcInfo) {
    92        
     97
    9398        $headers[] = "From: Admin <$fromEmail>";
    9499        $headers[] = "Content-Type: text/html; charset=UTF-8";
     
    102107        <br>
    103108        <style>
    104         table {
    105             border-collapse: collapse;
    106             font-size: 12px;
    107             width: 60%;
    108         }
    109         table, td, th {
    110             border: 1px solid  #E1E1E1;
    111              color: #555555;
    112         }
    113         th, td {
    114             padding: 5px 10px;
    115         }
    116  
     109            table {
     110                border-collapse: collapse;
     111                font-size: 12px;
     112                width: 60%;
     113            }
     114            table, td, th {
     115                border: 1px solid  #E1E1E1;
     116                color: #555555;
     117            }
     118            th, td {
     119                padding: 5px 10px;
     120            }
     121
    117122        </style>
    118123        <table class="gc_report">
     
    135140        wp_mail($toEmail, $subject, $message, $headers);
    136141    }
    137    
     142
    138143}
  • gift-certificate-creator/tags/1.1/gc-list.php

    r1670034 r1675786  
    88 *
    99 */
     10
     11// Exit if accessed directly
     12if ( ! defined( 'ABSPATH' ) ) {
     13        exit;
     14}
    1015
    1116//include require files
  • gift-certificate-creator/tags/1.1/gcm-config.php

    r1670034 r1675786  
    99 */
    1010
    11 $path = dirname( dirname( dirname( dirname( __FILE__ ) ) ) );
     11// Exit if accessed directly
     12if ( ! defined( 'ABSPATH' ) ) {
     13        exit;
     14}
    1215 
    1316// define the gc displayed per page
  • gift-certificate-creator/tags/1.1/giftcertificates.php

    r1673026 r1675786  
    99 * License:
    1010 */
    11 $path = dirname(dirname(dirname(dirname(__FILE__))));
     11// Exit if accessed directly
     12if (!defined('ABSPATH')) {
     13    exit;
     14}
    1215
    1316//include require files
     
    134137 */
    135138function gc_options_validate($input) {
    136     if (is_null($input['admin_email']) || empty($input['admin_email']) || (!filter_var($input['admin_email'], FILTER_VALIDATE_EMAIL)) ) {
     139    if (is_null($input['admin_email']) || empty($input['admin_email']) || (!filter_var($input['admin_email'], FILTER_VALIDATE_EMAIL))) {
    137140        add_settings_error(
    138141                'gc_options_admin_email_validate_field', 'gc_options_admin_email_validate_error', 'Please enter a valid email address', 'error'
     
    162165
    163166    // check sections and include corresponding file
    164     if ($_REQUEST['action'] == 'Submit') {
    165         $bob_name = esc_html($_REQUEST['user_name']);
     167    if (isset($_REQUEST['action']) && isset($_REQUEST['action']) == 'Submit') {
    166168        $error = array();
    167169
     
    183185
    184186        //name validation
    185         if (preg_match('([A-Za-z0-9\\\'\\.\\-\\s\\,])', $_REQUEST['user_name'])) {
    186             $correctFormat = 1;
    187         } else {
    188             $correctFormat = -1;
    189             array_push($error, " Enter valid Name format ");
     187        if (preg_match('/^[a-zA-Z\s]+$/', $_REQUEST['user_name'])) {
     188            $correctFormat = 1;
     189        } else {
     190            $correctFormat = -1;
     191            array_push($error, " Enter valid Name format. Only letters and spaces are allowed ");
    190192        }
    191193
    192194        //Recipient Name  validation
    193         if (preg_match('([A-Za-z0-9\\\'\\.\\-\\s\\,])', $_REQUEST['receip_name'])) {
    194             $correctFormat = 1;
    195         } else {
    196             $correctFormat = -1;
    197             array_push($error, " Enter valid RecipientName format ");
    198         }
    199 
     195        if (preg_match('/^[a-zA-Z\s]+$/', $_REQUEST['receip_name'])) {
     196            $correctFormat = 1;
     197        } else {
     198            $correctFormat = -1;
     199            array_push($error, " Enter valid Recipient Name format. Only letters and spaces are allowed ");
     200        }
     201
     202        //Address validation
     203        if (strpos($_REQUEST['receip_address'], '<') === FALSE && strpos($_REQUEST['receip_address'], '>') === FALSE && strpos($_REQUEST['receip_address'], '%') === FALSE && strpos($_REQUEST['receip_address'], '\\') === FALSE) {
     204            $correctFormat = 1;
     205        } else {
     206            $correctFormat = -1;
     207            array_push($error, " Enter valid Address . Symbols like <,>,%,\ are not allowed ");
     208        }
    200209        //checking the validation if valid (ie$correctFormat == 1) enter
    201210        if (!$error) {
     
    216225            }
    217226        } else {
     227
    218228            $success = -1;
    219             writeLog($error[0] . "<br>" . $error[1], basename(__LINE__), basename(__FILE__));
     229            writeLog(print_r($error, TRUE), basename(__LINE__), basename(__FILE__));
    220230        }
    221231    } else {
     
    229239        writeLog(" Form values are not posted ", basename(__LINE__), basename(__FILE__));
    230240        ?>
    231         <div class="error">Please enter form details in proper format!<?php echo "<br>" . $error[0] . "<br>" . $error[1]; ?></div>
     241        <div class="error">Please enter form details in proper format!<br><?php
     242            foreach ($error as $text) {
     243                echo $text . "<br>";
     244            }
     245            ?></div>
    232246        <?php
    233247    }
     
    280294            <tr>
    281295                <th>Certificate Amount <span class="error">*</span>:</th>
    282                 <td><input type="text" name="cert_amount" value="<?php echo $_REQUEST['cert_amount']; ?>" placeholder ="$"></td>
     296                <td><input type="text" name="cert_amount" value="<?php echo isset($_REQUEST['cert_amount']) ? (int) $_REQUEST['cert_amount'] : ''; ?>" placeholder ="$"></td>
    283297            </tr>
    284298            <tr>
    285299                <th>Your Name <span class="error">*</span>:</th>
    286                 <td><input type="text" name="user_name" value="<?php echo $_REQUEST['user_name']; ?>"> </td>
     300                <td><input type="text" name="user_name" value="<?php echo isset($_REQUEST['user_name']) ? htmlspecialchars($_REQUEST['user_name']) : ''; ?>"> </td>
    287301            </tr>
    288302            <tr>
    289303                <th>Recipient Name <span class="error">*</span>:</th>
    290                 <td><input type="text" name="receip_name" value="<?php echo $_REQUEST['receip_name']; ?>"> </td>
     304                <td><input type="text" name="receip_name" value="<?php echo isset($_REQUEST['receip_name']) ? htmlspecialchars($_REQUEST['receip_name']) : ''; ?>"> </td>
    291305            </tr>
    292306            <tr>
    293307                <th>Recipient Email <span class="error">*</span>:</th>
    294                 <td><input type="text" name="cc_sec_code" value="<?php echo $_REQUEST['cc_sec_code']; ?>"></td>
     308                <td><input type="text" name="cc_sec_code" value="<?php echo isset($_REQUEST['cc_sec_code']) ? filter_var($_REQUEST['cc_sec_code'], FILTER_SANITIZE_EMAIL) : ''; ?>"></td>
    295309            </tr>
    296310            <tr>
    297311                <th>Recipient Address:</th>
    298                 <td><textarea name="receip_address" value="<?php echo $_REQUEST['receip_address']; ?>"></textarea>
     312                <td><textarea name="receip_address" value="<?php echo isset($_REQUEST['receip_address']) ? $_REQUEST['receip_address'] : ''; ?>"></textarea>
    299313            </tr>
    300314            <tr>
  • gift-certificate-creator/trunk/classes/gcm-table.class.php

    r1673026 r1675786  
    1919 *
    2020 */
     21
     22// Exit if accessed directly
     23if ( ! defined( 'ABSPATH' ) ) {
     24        exit;
     25}
     26
    2127class GCListTable extends WP_List_Table {
    2228
     
    5460        $gcPerPage = $this->getPerPage();
    5561        $doingAjax = defined( 'DOING_AJAX' ) && DOING_AJAX;
    56 
     62       
    5763        // per page number
    5864        if ( isset( $_REQUEST['number'] ) ) {
     
    6167            $number = $gcPerPage + min( 8, $gcPerPage );
    6268        }
    63 
     69        $number = filter_var($number, FILTER_SANITIZE_NUMBER_INT);
    6470        $page = $this->get_pagenum();
    6571
    6672        // start number
    6773        if ( isset( $_REQUEST['start'] ) ) {
    68             $start = $_REQUEST['start'];
     74            $start = (int) $_REQUEST['start'];
    6975        } else {
    7076            $start = ( $page - 1 ) * $gcPerPage;
    7177        }
    72 
     78        $start = filter_var($start, FILTER_SANITIZE_NUMBER_INT);
     79       
    7380        // if ajax request
    7481        if ( $doingAjax && isset( $_REQUEST['offset'] ) ) {
    75             $start += $_REQUEST['offset'];
     82            $start += (int) $_REQUEST['offset'];
    7683        }
    7784
     85       
    7886        $args = array(
    7987            'search' => $search,
  • gift-certificate-creator/trunk/classes/gcm.class.php

    r1673026 r1675786  
    88 *
    99 */
    10 
    1110/**
    1211 * The class contains all functions used for gc management
     
    1918 *
    2019 */
     20// Exit if accessed directly
     21if (!defined('ABSPATH')) {
     22    exit;
     23}
     24
    2125class GCM {
    2226
     
    2731     */
    2832    function getAllGCList($args = array()) {
    29         global $wpdb;       
     33        global $wpdb;
    3034        $number = absint($args['number']);
    31         $offset = absint($args['offset']);       
    32        
     35        $offset = absint($args['offset']);
     36
    3337        // if number is not empty
    34         if (!empty($number) && empty($args['count']) ) {
     38        if (!empty($number) && empty($args['count'])) {
    3539            $limits = !empty($offset) ? "LIMIT $offset, $number" : "LIMIT $number";
    3640        } else {
    3741            $limits = '';
    3842        }
    39        
     43
    4044        // fields of sql
    4145        $fields = !empty($args['count']) ? 'COUNT(*) count' : '*';
    42        
     46
    4347        // whree consition of sql
    4448        $where = "1=1";
    45         $where .= !empty($args['search']) ? " AND (user_name like '%".addslashes($args['search'])."%' or receip_name like '%".addslashes($args['search'])."%')" : "";
    46        
     49        $where .=!empty($args['search']) ? " AND (user_name like '%" . addslashes($args['search']) . "%' or receip_name like '%" . addslashes($args['search']) . "%')" : "";
     50
    4751        // order parameters
    4852        $order = ('DESC' == strtoupper($args['order']) ) ? 'ASC' : 'DESC';
    4953        $orderby = !empty($args['orderby']) ? $args['orderby'] : 'user_name';
    50        
     54
    5155        // create sql
    5256        $dbTable = $wpdb->prefix . "gift_certificates";
    53         $sql = "SELECT $fields FROM $dbTable WHERE $where $groupby ORDER BY $orderby $order $limits";
    54        
     57        $sql = "SELECT $fields FROM $dbTable WHERE $where ORDER BY $orderby $order $limits";
     58
    5559        // check whether count or list needed
    5660        if (!empty($args['count'])) {
    5761            $countInfo = $wpdb->get_row($sql, OBJECT);
    58             return  $countInfo->count;
     62            return $countInfo->count;
    5963        } else {
    60             $gcList = $wpdb->get_results($sql, OBJECT );
     64            $gcList = $wpdb->get_results($sql, OBJECT);
    6165            return $gcList;
    6266        }
    63        
    6467    }
    65    
     68
    6669    /**
    6770     * function to create new gift certificate
     
    6972     */
    7073    function createNewGCM($gcInfo) {
     74
    7175        global $wpdb;
    7276        $gc_cert_amount = $_REQUEST['cert_amount'];
    73         $gc_user_name  = esc_attr($gcInfo['user_name']);
     77        $gc_user_name = esc_attr($gcInfo['user_name']);
    7478        $gc_receip_name = esc_attr($gcInfo['receip_name']);
    7579        $gc_receip_address = esc_textarea($gcInfo['receip_address']);
    7680        $gc_cc_sec_code = sanitize_email($gcInfo['cc_sec_code']);
    77         $sql = "INSERT INTO $wpdb->prefix" . "gift_certificates(cert_amount, user_name, receip_name, cc_number, cc_exp, cc_sec_code, receip_address)
    78         values('{$gc_cert_amount}', '{$gc_user_name}', '{$gc_receip_name}',
    79         '{$gcInfo['cc_number']}', '{$gcInfo['cc_exp_month']}-{$gcInfo['cc_exp_year']}', '{$gc_cc_sec_code}', '{$gc_receip_address}')";
    80         $wpdb->query($sql);
     81        $wpdb->query($wpdb->prepare(
     82                        "INSERT INTO $wpdb->prefix"
     83                        . "gift_certificates(cert_amount, user_name, receip_name, cc_sec_code, receip_address) "
     84                        . "values(%f, %s, %s, %s, %s)
     85    ", $gc_cert_amount, $gc_user_name, $gc_receip_name, $gc_cc_sec_code, $gc_receip_address
     86        ));
    8187    }
    82    
    83    
     88
    8489    /**
    8590     * function to send gc reports to users
     
    9095     */
    9196    function sendGCMReportEmail($toEmail, $fromEmail, $subject, $gcInfo) {
    92        
     97
    9398        $headers[] = "From: Admin <$fromEmail>";
    9499        $headers[] = "Content-Type: text/html; charset=UTF-8";
     
    102107        <br>
    103108        <style>
    104         table {
    105             border-collapse: collapse;
    106             font-size: 12px;
    107             width: 60%;
    108         }
    109         table, td, th {
    110             border: 1px solid  #E1E1E1;
    111              color: #555555;
    112         }
    113         th, td {
    114             padding: 5px 10px;
    115         }
    116  
     109            table {
     110                border-collapse: collapse;
     111                font-size: 12px;
     112                width: 60%;
     113            }
     114            table, td, th {
     115                border: 1px solid  #E1E1E1;
     116                color: #555555;
     117            }
     118            th, td {
     119                padding: 5px 10px;
     120            }
     121
    117122        </style>
    118123        <table class="gc_report">
     
    135140        wp_mail($toEmail, $subject, $message, $headers);
    136141    }
    137    
     142
    138143}
  • gift-certificate-creator/trunk/gc-list.php

    r1134254 r1675786  
    88 *
    99 */
     10
     11// Exit if accessed directly
     12if ( ! defined( 'ABSPATH' ) ) {
     13        exit;
     14}
    1015
    1116//include require files
  • gift-certificate-creator/trunk/gcm-config.php

    r1134254 r1675786  
    99 */
    1010
    11 $path = dirname( dirname( dirname( dirname( __FILE__ ) ) ) );
     11// Exit if accessed directly
     12if ( ! defined( 'ABSPATH' ) ) {
     13        exit;
     14}
    1215 
    1316// define the gc displayed per page
  • gift-certificate-creator/trunk/giftcertificates.php

    r1673026 r1675786  
    99 * License:
    1010 */
    11 $path = dirname(dirname(dirname(dirname(__FILE__))));
     11// Exit if accessed directly
     12if (!defined('ABSPATH')) {
     13    exit;
     14}
    1215
    1316//include require files
     
    134137 */
    135138function gc_options_validate($input) {
    136     if (is_null($input['admin_email']) || empty($input['admin_email']) || (!filter_var($input['admin_email'], FILTER_VALIDATE_EMAIL)) ) {
     139    if (is_null($input['admin_email']) || empty($input['admin_email']) || (!filter_var($input['admin_email'], FILTER_VALIDATE_EMAIL))) {
    137140        add_settings_error(
    138141                'gc_options_admin_email_validate_field', 'gc_options_admin_email_validate_error', 'Please enter a valid email address', 'error'
     
    162165
    163166    // check sections and include corresponding file
    164     if ($_REQUEST['action'] == 'Submit') {
    165         $bob_name = esc_html($_REQUEST['user_name']);
     167    if (isset($_REQUEST['action']) && isset($_REQUEST['action']) == 'Submit') {
    166168        $error = array();
    167169
     
    183185
    184186        //name validation
    185         if (preg_match('([A-Za-z0-9\\\'\\.\\-\\s\\,])', $_REQUEST['user_name'])) {
    186             $correctFormat = 1;
    187         } else {
    188             $correctFormat = -1;
    189             array_push($error, " Enter valid Name format ");
     187        if (preg_match('/^[a-zA-Z\s]+$/', $_REQUEST['user_name'])) {
     188            $correctFormat = 1;
     189        } else {
     190            $correctFormat = -1;
     191            array_push($error, " Enter valid Name format. Only letters and spaces are allowed ");
    190192        }
    191193
    192194        //Recipient Name  validation
    193         if (preg_match('([A-Za-z0-9\\\'\\.\\-\\s\\,])', $_REQUEST['receip_name'])) {
    194             $correctFormat = 1;
    195         } else {
    196             $correctFormat = -1;
    197             array_push($error, " Enter valid RecipientName format ");
    198         }
    199 
     195        if (preg_match('/^[a-zA-Z\s]+$/', $_REQUEST['receip_name'])) {
     196            $correctFormat = 1;
     197        } else {
     198            $correctFormat = -1;
     199            array_push($error, " Enter valid Recipient Name format. Only letters and spaces are allowed ");
     200        }
     201
     202        //Address validation
     203        if (strpos($_REQUEST['receip_address'], '<') === FALSE && strpos($_REQUEST['receip_address'], '>') === FALSE && strpos($_REQUEST['receip_address'], '%') === FALSE && strpos($_REQUEST['receip_address'], '\\') === FALSE) {
     204            $correctFormat = 1;
     205        } else {
     206            $correctFormat = -1;
     207            array_push($error, " Enter valid Address . Symbols like <,>,%,\ are not allowed ");
     208        }
    200209        //checking the validation if valid (ie$correctFormat == 1) enter
    201210        if (!$error) {
     
    216225            }
    217226        } else {
     227
    218228            $success = -1;
    219             writeLog($error[0] . "<br>" . $error[1], basename(__LINE__), basename(__FILE__));
     229            writeLog(print_r($error, TRUE), basename(__LINE__), basename(__FILE__));
    220230        }
    221231    } else {
     
    229239        writeLog(" Form values are not posted ", basename(__LINE__), basename(__FILE__));
    230240        ?>
    231         <div class="error">Please enter form details in proper format!<?php echo "<br>" . $error[0] . "<br>" . $error[1]; ?></div>
     241        <div class="error">Please enter form details in proper format!<br><?php
     242            foreach ($error as $text) {
     243                echo $text . "<br>";
     244            }
     245            ?></div>
    232246        <?php
    233247    }
     
    280294            <tr>
    281295                <th>Certificate Amount <span class="error">*</span>:</th>
    282                 <td><input type="text" name="cert_amount" value="<?php echo $_REQUEST['cert_amount']; ?>" placeholder ="$"></td>
     296                <td><input type="text" name="cert_amount" value="<?php echo isset($_REQUEST['cert_amount']) ? (int) $_REQUEST['cert_amount'] : ''; ?>" placeholder ="$"></td>
    283297            </tr>
    284298            <tr>
    285299                <th>Your Name <span class="error">*</span>:</th>
    286                 <td><input type="text" name="user_name" value="<?php echo $_REQUEST['user_name']; ?>"> </td>
     300                <td><input type="text" name="user_name" value="<?php echo isset($_REQUEST['user_name']) ? htmlspecialchars($_REQUEST['user_name']) : ''; ?>"> </td>
    287301            </tr>
    288302            <tr>
    289303                <th>Recipient Name <span class="error">*</span>:</th>
    290                 <td><input type="text" name="receip_name" value="<?php echo $_REQUEST['receip_name']; ?>"> </td>
     304                <td><input type="text" name="receip_name" value="<?php echo isset($_REQUEST['receip_name']) ? htmlspecialchars($_REQUEST['receip_name']) : ''; ?>"> </td>
    291305            </tr>
    292306            <tr>
    293307                <th>Recipient Email <span class="error">*</span>:</th>
    294                 <td><input type="text" name="cc_sec_code" value="<?php echo $_REQUEST['cc_sec_code']; ?>"></td>
     308                <td><input type="text" name="cc_sec_code" value="<?php echo isset($_REQUEST['cc_sec_code']) ? filter_var($_REQUEST['cc_sec_code'], FILTER_SANITIZE_EMAIL) : ''; ?>"></td>
    295309            </tr>
    296310            <tr>
    297311                <th>Recipient Address:</th>
    298                 <td><textarea name="receip_address" value="<?php echo $_REQUEST['receip_address']; ?>"></textarea>
     312                <td><textarea name="receip_address" value="<?php echo isset($_REQUEST['receip_address']) ? $_REQUEST['receip_address'] : ''; ?>"></textarea>
    299313            </tr>
    300314            <tr>
Note: See TracChangeset for help on using the changeset viewer.