Jump to content

Archived

This topic is now archived and is closed to further replies.

darkamex

Error mysql

Recommended Posts

I have this error on a module when i try to "send" a Text.

 

Warning: mysql_real_escape_string() expects parameter 1 to be string, array given in /home/safara/public_html/shop/admin/includes/functions/database.php on line 135

 

Warning: Cannot modify header information - headers already sent by (output started at /home/safara/public_html/shop/admin/includes/functions/database.php:135) in /home/safara/public_html/shop/admin/includes/functions/general.php on line 24

 

under firefox/mozilla (not IE)

 

what can it be?


no outside links in signatures allowed!

Share this post


Link to post
Share on other sites

this is the modules under admin:

<?php

/*

$Id: informations.php,v 1.00 2003/06/29 22:50:52 hpdl Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

 

require('includes/application_top.php');

 

$action = (isset($HTTP_GET_VARS['action']) ? $HTTP_GET_VARS['action'] : '');

 

if (tep_not_null($action)) {

switch ($action) {

case 'insert':

case 'save':

if (isset($HTTP_GET_VARS['iID'])) $informations_id = tep_db_prepare_input($HTTP_GET_VARS['iID']);

$informations_name = tep_db_prepare_input($HTTP_POST_VARS['informations_name']);

 

$sql_data_array = array('informations_name' => $informations_name);

 

if ($action == 'insert') {

$insert_sql_data = array('date_added' => 'now()');

 

$sql_data_array = array_merge($sql_data_array, $insert_sql_data);

 

tep_db_perform(TABLE_INFORMATIONS, $sql_data_array);

$informations_id = tep_db_insert_id();

} elseif ($action == 'save') {

$update_sql_data = array('last_modified' => 'now()');

 

$sql_data_array = array_merge($sql_data_array, $update_sql_data);

 

tep_db_perform(TABLE_INFORMATIONS, $sql_data_array, 'update', "informations_id = '" . (int)$informations_id . "'");

}

 

$languages = tep_get_languages();

for ($i=0, $n=sizeof($languages); $i<$n; $i++) {

$informations_name_array = $HTTP_POST_VARS['informations_name'];

$informations_text_array = $HTTP_POST_VARS['informations_text'];

$language_id = $languages[$i]['id'];

 

$sql_data_array = array('informations_name' => tep_db_prepare_input($informations_name_array[$language_id]));

$sql_text_array = array('informations_text' => tep_db_prepare_input($informations_text_array[$language_id]));

 

$sql_data_array = array_merge($sql_data_array, $sql_text_array);

if ($action == 'insert') {

$insert_sql_data = array('informations_id' => $informations_id,

'languages_id' => $language_id);

 

$sql_data_array = array_merge($sql_data_array, $insert_sql_data);

 

tep_db_perform(TABLE_INFORMATIONS_INFO, $sql_data_array);

} elseif ($action == 'save') {

tep_db_perform(TABLE_INFORMATIONS_INFO, $sql_data_array, 'update', "informations_id = '" . (int)$informations_id . "' and languages_id = '" . (int)$language_id . "'");

}

}

 

if (USE_CACHE == 'true') {

tep_reset_cache_block('informations');

}

 

tep_redirect(tep_href_link(FILENAME_INFORMATIONS, (isset($HTTP_GET_VARS['page']) ? 'page=' . $page . '&' : '') . 'iID=' . $informations_id));

break;

 

case 'deleteconfirm':

$informations_id = tep_db_prepare_input($HTTP_GET_VARS['iID']);

 

tep_db_query("delete from " . TABLE_INFORMATIONS . " where informations_id = '" . (int)$informations_id . "'");

tep_db_query("delete from " . TABLE_INFORMATIONS_INFO . " where informations_id = '" . (int)$informations_id . "'");

 

if (USE_CACHE == 'true') {

tep_reset_cache_block('informations');

}

 

tep_redirect(tep_href_link(FILENAME_INFORMATIONS, 'page=' . $HTTP_GET_VARS['page']));

break;

}

}

?>

<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">

<html <?php echo HTML_PARAMS; ?>>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">

<title><?php echo TITLE; ?></title>

<link rel="stylesheet" type="text/css" href="<?php echo DIR_WS_CURRENT_THEME; ?>stylesheet.css">

<script language="javascript" src="<?php echo DIR_WS_CURRENT_THEME; ?>general.js"></script>

<script language="javascript" type="text/javascript" src="<?php echo DIR_WS_CATALOG . DIR_WS_INCLUDES ?>javascripts/tiny_mce/tiny_mce.js"></script>

<script language="javascript" type="text/javascript">

tinyMCE.init({

mode : "textareas"

});

</script>

</head>

<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF" onload="SetFocus();">

<!-- header //-->

<?php require(DIR_WS_INCLUDES . 'header.php'); ?>

<!-- header_eof //-->

 

<!-- body //-->

<table border="0" width="100%" cellspacing="2" cellpadding="2">

<tr>

<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft">

<!-- left_navigation //-->

<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>

<!-- left_navigation_eof //-->

</table></td>

<!-- body_text //-->

<td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr>

<td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td class="pageHeading"><?php echo HEADING_TITLE; ?></td>

<td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>

</tr>

</table></td>

</tr>

<tr>

<td><table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr class="dataTableHeadingRow">

<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_INFORMATIONS; ?></td>

<td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?> </td>

</tr>

<?php

 

$informations_query_raw = "select informations_id, informations_name from " . TABLE_INFORMATIONS_INFO . " where languages_id= '". $languages_id ."'order by informations_name";

 

$informations_split = new splitPageResults($HTTP_GET_VARS['page'], MAX_DISPLAY_SEARCH_RESULTS, $informations_query_raw, $informations_query_numrows);

$informations_query = tep_db_query($informations_query_raw);

while ($informations = tep_db_fetch_array($informations_query)) {

if ((!isset($HTTP_GET_VARS['iID']) || (isset($HTTP_GET_VARS['iID']) && ($HTTP_GET_VARS['iID'] == $informations['informations_id']))) && !isset($mInfo) && (substr($action, 0, 3) != 'new')) {

 

$informations_dates_query = "select informations_id, date_added, last_modified from " . TABLE_INFORMATIONS . " where informations_id= '". $informations['informations_id'] ."'";

$informations_dates = tep_db_query($informations_dates_query);

$dates = tep_db_fetch_array($informations_dates);

 

$mInfo_array = array_merge($informations, $dates);

$mInfo = new objectInfo($mInfo_array);

}

 

if (isset($mInfo) && is_object($mInfo) && ($informations['informations_id'] == $mInfo->informations_id)) {

echo ' <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_INFORMATIONS, 'page=' . $HTTP_GET_VARS['page'] . '&iID=' . $informations['informations_id'] . '&action=edit') . '\'">' . "\n";

} else {

echo ' <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_INFORMATIONS, 'page=' . $HTTP_GET_VARS['page'] . '&iID=' . $informations['informations_id']) . '\'">' . "\n";

}

?>

<td class="dataTableContent">

<?php echo $informations['informations_name'] . ' ( <b>informations.php?informations_id='. $informations['informations_id'] . '</b> )'; ?>

</td>

<td class="dataTableContent" align="right"><?php if (isset($mInfo) && is_object($mInfo) && ($informations['informations_id'] == $mInfo->informations_id)) { echo tep_image(DIR_WS_ICONS . 'icon_arrow_right.gif'); } else { echo '<a href="' . tep_href_link(FILENAME_INFORMATIONS, 'page=' . $HTTP_GET_VARS['page'] . '&iID=' . $informations['informations_id']) . '">' . tep_image(DIR_WS_ICONS . 'icon_info.gif', IMAGE_ICON_INFO) . '</a>'; } ?> </td>

</tr>

<?php

}

?>

<tr>

<td colspan="2"><table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr>

<td class="smallText" valign="top"><?php echo $informations_split->display_count($informations_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $HTTP_GET_VARS['page'], TEXT_DISPLAY_NUMBER_OF_INFORMATIONS); ?></td>

<td class="smallText" align="right"><?php echo $informations_split->display_links($informations_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $HTTP_GET_VARS['page']); ?></td>

</tr>

</table></td>

</tr>

<?php

if (empty($action)) {

?>

<tr>

<td align="right" colspan="2" class="smallText"><?php echo '<a href="' . tep_href_link(FILENAME_INFORMATIONS, 'page=' . $HTTP_GET_VARS['page'] . '&iID=' . $mInfo->informations_id . '&action=new') . '">' . tep_image_button('button_insert.gif', IMAGE_INSERT) . '</a>'; ?></td>

</tr>

<?php

}

?>

</table></td>

<?php

$heading = array();

$contents = array();

 

switch ($action) {

case 'new':

$heading[] = array('text' => '<b>' . TEXT_HEADING_NEW_INFORMATION . '</b>');

 

$contents = array('form' => tep_draw_form('informations', FILENAME_INFORMATIONS, 'action=insert', 'post', 'enctype="multipart/form-data"'));

$contents[] = array('text' => TEXT_NEW_INTRO);

 

$information_inputs_string = '';

$languages = tep_get_languages();

for ($i=0, $n=sizeof($languages); $i<$n; $i++) {

 

$information_inputs_string .= '<br>' . tep_image(DIR_WS_THEME_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . ' ' . tep_draw_input_field('informations_name[' . $languages[$i]['id'] . ']');

}

$contents[] = array('text' => '<br>' . TEXT_INFORMATIONS_NAME . '<br>' . $information_inputs_string);

 

//qui!

 

$information_inputs2_string = '';

$languages = tep_get_languages();

for ($i=0, $n=sizeof($languages); $i<$n; $i++) {

$information_inputs2_string .= '<br>' . tep_image(DIR_WS_THEME_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . ' ' . tep_draw_textarea_field('informations_text[' . $languages[$i]['id'] .']', 'soft', '50', '15');

}

$contents[] = array('text' => '<br>' . TEXT_INFORMATIONS_TEXT . $information_inputs2_string);

//qui!

 

$contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_save.gif', IMAGE_SAVE) . ' <a href="' . tep_href_link(FILENAME_INFORMATIONS, 'page=' . $HTTP_GET_VARS['page'] . '&iID=' . $HTTP_GET_VARS['iID']) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');

break;

 

case 'edit':

$heading[] = array('text' => '<b>' . TEXT_HEADING_EDIT_INFORMATION . '</b>');

$contents = array('form' => tep_draw_form('informations', FILENAME_INFORMATIONS, 'page=' . $HTTP_GET_VARS['page'] . '&iID=' . $mInfo->informations_id . '&action=save', 'post', 'enctype="multipart/form-data"'));

$contents[] = array('text' => TEXT_EDIT_INTRO);

$information_inputs_string = '';

$languages = tep_get_languages();

for ($i=0, $n=sizeof($languages); $i<$n; $i++) {

$information_inputs_string .= '<br>' . tep_image(DIR_WS_THEME_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . ' ' . tep_draw_input_field('informations_name[' . $languages[$i]['id'] . ']', tep_get_information_name($mInfo->informations_id, $languages[$i]['id']));

}

$contents[] = array('text' => '<br>' . TEXT_INFORMATIONS_NAME . '<br>' . $information_inputs_string);

$information_inputs2_string = '';

$languages = tep_get_languages();

for ($i=0, $n=sizeof($languages); $i<$n; $i++) {

$information_inputs2_string .= '<br>' . tep_image(DIR_WS_THEME_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . ' ' . tep_draw_textarea_field('informations_text[' . $languages[$i]['id'] .']', 'soft', '50', '15', tep_get_information_text($mInfo->informations_id, $languages[$i]['id']));

}

$contents[] = array('text' => '<br>' . TEXT_INFORMATIONS_TEXT . $information_inputs2_string);

$contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_save.gif', IMAGE_SAVE) . ' <a href="' . tep_href_link(FILENAME_INFORMATIONS, 'page=' . $HTTP_GET_VARS['page'] . '&iID=' . $mInfo->informations_id) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');

break;

 

case 'delete':

$heading[] = array('text' => '<b>' . TEXT_HEADING_DELETE_information . '</b>');

 

$contents = array('form' => tep_draw_form('informations', FILENAME_INFORMATIONS, 'page=' . $HTTP_GET_VARS['page'] . '&iID=' . $mInfo->informations_id . '&action=deleteconfirm'));

$contents[] = array('text' => TEXT_DELETE_INTRO);

$contents[] = array('text' => '<br><b>' . $mInfo->informations_name . '</b>');

 

if ($mInfo->products_count > 0) {

$contents[] = array('text' => '<br>' . tep_draw_checkbox_field('delete_products') . ' ' . TEXT_DELETE_PRODUCTS);

$contents[] = array('text' => '<br>' . sprintf(TEXT_DELETE_WARNING_PRODUCTS, $mInfo->products_count));

}

 

$contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_delete.gif', IMAGE_DELETE) . ' <a href="' . tep_href_link(FILENAME_INFORMATIONS, 'page=' . $HTTP_GET_VARS['page'] . '&iID=' . $mInfo->informations_id) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');

break;

default:

if (isset($mInfo) && is_object($mInfo)) {

$heading[] = array('text' => '<b>' . $mInfo->informations_name . '</b>');

 

$contents[] = array('align' => 'center', 'text' => '<a href="' . tep_href_link(FILENAME_INFORMATIONS, 'page=' . $HTTP_GET_VARS['page'] . '&iID=' . $mInfo->informations_id . '&action=edit') . '">' . tep_image_button('button_edit.gif', IMAGE_EDIT) . '</a> <a href="' . tep_href_link(FILENAME_INFORMATIONS, 'page=' . $HTTP_GET_VARS['page'] . '&iID=' . $mInfo->informations_id . '&action=delete') . '">' . tep_image_button('button_delete.gif', IMAGE_DELETE) . '</a>');

$contents[] = array('text' => '<br>' . TEXT_DATE_ADDED . ' ' . tep_date_short($mInfo->date_added));

if (tep_not_null($mInfo->last_modified)) $contents[] = array('text' => TEXT_LAST_MODIFIED . ' ' . tep_date_short($mInfo->last_modified));

}

break;

}

 

if ( (tep_not_null($heading)) && (tep_not_null($contents)) ) {

echo ' <td width="25%" valign="top">' . "\n";

 

$box = new box;

echo $box->infoBox($heading, $contents);

 

echo ' </td>' . "\n";

}

?>

</tr>

</table></td>

</tr>

</table></td>

<!-- body_text_eof //-->

</tr>

</table>

<!-- body_eof //-->

 

<!-- footer //-->

<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>

<!-- footer_eof //-->

<br>

</body>

</html>

<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

 

it's for editing informations about the site (Shipping, Prvacy, ecc...) in all languages without editing php files...


no outside links in signatures allowed!

Share this post


Link to post
Share on other sites

×