Το έκανα και μου εμφανίζει τα παρακάτω error...
Code: Select all
Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\xampp\htdocs\opencart\system\library\mail.php on line 157Warning: mysql_real_escape_string(): 105 is not a valid MySQL-Link resource in C:\xampp\htdocs\opencart\system\database\mysql.php on line 55Warning: mysql_real_escape_string(): 105 is not a valid MySQL-Link resource in C:\xampp\htdocs\opencart\system\database\mysql.php on line 55Warning: mysql_query(): 105 is not a valid MySQL-Link resource in C:\xampp\htdocs\opencart\system\database\mysql.php on line 21Warning: mysql_error(): 105 is not a valid MySQL-Link resource in C:\xampp\htdocs\opencart\system\database\mysql.php on line 49Warning: mysql_errno(): 105 is not a valid MySQL-Link resource in C:\xampp\htdocs\opencart\system\database\mysql.php on line 49Notice: Error:
Error No:
SELECT * FROM customer WHERE LOWER(email) = '' AND password = '' AND status = '1' in C:\xampp\htdocs\opencart\system\database\mysql.php on line 49
Fatal error: Call to a member function get() on a non-object in C:\xampp\htdocs\opencart\index.php on line 103
Η εγγραφή όμως πέρασε κανονικότατα απο ότι είδα.. Μάλλον κάνω σύνδεση με την άλλη βάση ενώ δεν έχει ολοκληρωθεί η διαδικασία που αφορά την αρχική βάσης του opencart.
Τον κώδικα τον έχω γράψει στο τέλος της παρακάτω συνάρτησης :
Code: Select all
public function addCustomer($data) {
$this->db->query("INSERT INTO " . DB_PREFIX . "customer SET store_id = '" . (int)$this->config->get('config_store_id') . "', firstname = '" . $this->db->escape($data['firstname']) . "', lastname = '" . $this->db->escape($data['lastname']) . "', email = '" . $this->db->escape($data['email']) . "', telephone = '" . $this->db->escape($data['telephone']) . "', fax = '" . $this->db->escape($data['fax']) . "', password = '" . $this->db->escape(md5($data['password'])) . "', newsletter = '" . (isset($data['newsletter']) ? (int)$data['newsletter'] : 0) . "', customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "', status = '1', date_added = NOW()");
$customer_id = $this->db->getLastId();
$this->db->query("INSERT INTO " . DB_PREFIX . "address SET customer_id = '" . (int)$customer_id . "', firstname = '" . $this->db->escape($data['firstname']) . "', lastname = '" . $this->db->escape($data['lastname']) . "', company = '" . $this->db->escape($data['company']) . "', address_1 = '" . $this->db->escape($data['address_1']) . "', address_2 = '" . $this->db->escape($data['address_2']) . "', city = '" . $this->db->escape($data['city']) . "', postcode = '" . $this->db->escape($data['postcode']) . "', country_id = '" . (int)$data['country_id'] . "', zone_id = '" . (int)$data['zone_id'] . "'");
$address_id = $this->db->getLastId();
$this->db->query("UPDATE " . DB_PREFIX . "customer SET address_id = '" . (int)$address_id . "' WHERE customer_id = '" . (int)$customer_id . "'");
if (!$this->config->get('config_customer_approval')) {
$this->db->query("UPDATE " . DB_PREFIX . "customer SET approved = '1' WHERE customer_id = '" . (int)$customer_id . "'");
}
$this->language->load('mail/customer');
$subject = sprintf($this->language->get('text_subject'), $this->config->get('config_name'));
$message = sprintf($this->language->get('text_welcome'), $this->config->get('config_name')) . "\n\n";
if (!$this->config->get('config_customer_approval')) {
$message .= $this->language->get('text_login') . "\n";
} else {
$message .= $this->language->get('text_approval') . "\n";
}
$message .= $this->url->link('account/login', '', 'SSL') . "\n\n";
$message .= $this->language->get('text_services') . "\n\n";
$message .= $this->language->get('text_thanks') . "\n";
$message .= $this->config->get('config_name');
$mail = new Mail();
$mail->protocol = $this->config->get('config_mail_protocol');
$mail->parameter = $this->config->get('config_mail_parameter');
$mail->hostname = $this->config->get('config_smtp_host');
$mail->username = $this->config->get('config_smtp_username');
$mail->password = $this->config->get('config_smtp_password');
$mail->port = $this->config->get('config_smtp_port');
$mail->timeout = $this->config->get('config_smtp_timeout');
$mail->setTo($data['email']);
$mail->setFrom($this->config->get('config_email'));
$mail->setSender($this->config->get('config_name'));
$mail->setSubject($subject);
$mail->setText($message);
$mail->send();
// Send to main admin email if new account email is enabled
if ($this->config->get('config_account_mail')) {
$mail->setTo($this->config->get('config_email'));
$mail->send();
// Send to additional alert emails if new account email is enabled
$emails = explode(',', $this->config->get('config_alert_emails'));
foreach ($emails as $email) {
if (strlen($email) > 0 && preg_match('/^[^\@]+@.*\.[a-z]{2,6}$/i', $email)) {
$mail->setTo($email);
$mail->send();
}
}
}
/*************************************************************/
$connection = mysql_connect("localhost", "root", "");
if (!$connection) {
die('Unable to connect to secondary DB: ' . mysql_error());
}
if (!mysql_select_db("login_db")) {
die('Unable to select login_db: ' . mysql_error());
}
mysql_query("INSERT INTO customer(customer_id,firstname,lastname,email,telephone,fax,address_id,customer_group_id,status,approved)
VALUES(2,'testfirst','testlast','testmail@yahoo.com',2810301740,'',1,8,1,1)") or die('Unable to submit query: ' . mysql_error());
mysql_close($connection);
/*************************************************************/
}
Καμιά ιδέα ?