Error database
Author: I. Swhere is the error in the code that gives me this error (Unable to connect to database. Check your connection paramenters.) on this site http://radiojazz.id1945.com/contact.php
<?php
$settings['imEmailForm_5_1'] = array(
"owner_email_from" => "",
"owner_email_to" => "",
"customer_email_from" => "",
"customer_email_to" => "",
"owner_message" => "",
"customer_message" => "",
"owner_subject" => "",
"customer_subject" => "",
"owner_csv" => False,
"customer_csv" => False,
"db_host" => "31.170.164.247",
"db_name" => "u995108557_jazz",
"db_table" => "my_base",
"db_username" => "u995108557_admin",
"db_password" => "youtET2356",
"confirmation_page" => "../contact.php"
);
if(substr(basename($_SERVER['PHP_SELF']), 0, 11) == "imEmailForm") {
include "../res/x5engine.php";
$answers = array(
);
$form_data = array(
array('label' => 'Nume', 'value' => $_POST['name']),
array('label' => 'Mesajul', 'value' => $_POST['mesaj'])
);
$database_data = array(
"my_base" => $_POST['name'],
"my_base" => $_POST['mesaj']
);
$files_data = array(
);
if(@$_POST['action'] != "check_answer") {
if(!isset($_POST['imJsCheck']) || $_POST['imJsCheck'] != "jsactive")
die(imPrintJsError());
if(isset($_POST['imSpProt']) && $_POST['imSpProt'] != "")
die(imPrintJsError());
$storage = new imDatabase($settings['imEmailForm_5_1']['db_host'], $settings['imEmailForm_5_1']['db_name'], $settings['imEmailForm_5_1']['db_username'], $settings['imEmailForm_5_1']['db_password'], $settings['imEmailForm_5_1']['db_table'], $settings['imEmailForm_5_1']['general']['dir']);
if (!$storage->test_connection())
die("Unable to connect to database. Check your connection paramenters.");
if ($storage->addData($database_data, $files_data)) {
@header('Location: ' . $settings['imEmailForm_5_1']['confirmation_page']);
} else
die("A error has occurred while storing your data.");
} else {
if(@$_POST['id'] == "" || @$_POST['answer'] == "" || strtolower(trim($answers[@$_POST['id']])) != strtolower(trim(@$_POST['answer'])))
echo "0";
else
echo "1";
}
}
// End of file
Duplicate post... please continue on the original thread at:
http://answers.websitex5.com/post/74042