คือเพิ่งลองหัด PHP กับ sql งงไปหมดครับ
คือผมมี2เว็บ ต้องการให้เวลาสมัครที่นึงแต่สามารถใช้userกับpassได้2เว็บอ่ะครับ แต่เวลาจะสมัครให้สมัครได้แค่ที่เว็บเดียวครับ
ไปแกะๆแงะๆมา ที่เว็บที่จะให้สมัครมีโค๊ดตัวนี้ ซึ่งจะดึงข้อมูลการใช้งานDatabaseมาจาก config
$this->db->query("INSERT INTO " . DB_PREFIX . "customer SET email = '" . $this->db->escape($data['email']) . "',password = '" . $this->db->escape(sha1($salt . sha1($salt . sha1($data['password'])))) . "';
คือจะเอา user กับ pass ที่สมัครจากเวบแรกไปลงที่
Table = ac_users
row = user_login
row = user_email
ของ Database ชื่อ acsite
แต่ข้อมูลการใช้งาน Database อีกอัน เป็นแบบนี้
define('DB_NAME', 'acsite');
define('DB_USER', 'user');
define('DB_HOST', 'localhost');
$table_prefix = 'ac_';
แล้วที่เวบที่จะให้สมัครเวลามีการเปลี่ยน Password จะอัพเดทข้อมูลแบบนี้
public function editPassword($email, $password) {
$this->db->query("UPDATE " . DB_PREFIX . "customer SET salt = '" . $this->db->escape($salt = substr(md5(uniqid(rand(), true)), 0, 9)) . "', password = '" . $this->db->escape(sha1($salt . sha1($salt . sha1($password)))) . "' WHERE LOWER(email) = '" . $this->db->escape(utf8_strtolower($email)) . "'");
}
ต้องการให้อีกเวบอัพเดทด้วยครับ
ต้องเขียนโคดยังไงครับ