general.php coding trouble & install for SSL

Discussion in 'PHP' started by MichelleD, Apr 19, 2008.

  1. #1
    Need help with code for general.php file.

    I get this warning on my confirmation page of checkout for my site.

    Warning: htmlspecialchars() expects parameter 1 to be string, array given in /home/username/public_html/store/includes/functions/general.php on line 42

    I have installed SSL dedicated certificate to osCommerce setup/dedicated server. I edited the files for Includes-configure.php and Admin-Includes-configure.php. My site shows the https:// in the URL address and the lock shows at the bottom of the IE browser. Everything seems to work accept for this error message on the confirmation checkout page.

    Do I need to assign something to the following code? What in the following area of code in the general.php file needs to be changed for the SSL certificate to work?

    Thanks


    <?php
    /*
    $Id: general.php,v 1.231 2003/07/09 01:15:48 hpdl Exp $

    osCommerce, Open Source E-Commerce Solutions

    Copyright © 2003 osCommerce

    Released under the GNU General Public License
    */

    ////
    // Stop from parsing any further PHP code
    function tep_exit() {
    tep_session_close();
    exit();
    }

    ////
    // Redirect to another page or site
    function tep_redirect($url) {
    if ( (ENABLE_SSL == true) && (getenv('HTTPS') == 'on') ) { // We are loading an SSL page
    if (substr($url, 0, strlen(HTTP_SERVER)) == HTTP_SERVER) { // NONSSL url
    $url = HTTPS_SERVER . substr($url, strlen(HTTP_SERVER)); // Change it to SSL
    }
    }

    header('Location: ' . $url);

    tep_exit();
    }

    ////
    // Parse the data used in the html tags to ensure the tags will not break
    function tep_parse_input_field_data($data, $parse) {
    return strtr(trim($data), $parse);
    }

    function tep_output_string($string, $translate = false, $protected = false) {
    if ($protected == true) {
    return htmlspecialchars($string);
    } else {
    if ($translate == false) {
    return tep_parse_input_field_data($string, array('"' => '&quot;'));
    } else {
    return tep_parse_input_field_data($string, $translate);
    }
    }
    }

    function tep_output_string_protected($string) {
    return tep_output_string($string, false, true);
    }

    function tep_sanitize_string($string) {
    $string = ereg_replace(' +', ' ', trim($string));

    return preg_replace("/[<>]/", '_', $string);
    }
     
    MichelleD, Apr 19, 2008 IP