Witam.
Chciałbym prosić o pomoc przy przy zmianie metody logowania w userpanelu tak aby ID klienta było pobierane z pozycji INFO klienta.
Do tej pory zamieniłem kilka wpisów w pliku authentication.inc, który teraz wygląda jak poniżej, jednakże bez efektu.
<?php
global $LMS;
function GetCustomerIDByPhoneAndPIN($phone, $pin) { global $DB; if(!ereg('^[a-zA-Z0-9]+$', $pin)) return NULL;
$authinfo['id'] = $DB->GetOne('SELECT info FROM customers, customercontacts WHERE customerid = customers.info AND phone=? LIMIT 1', array($phone)); if ($authinfo['id'] == NULL) return NULL;
$authinfo['passwd'] = $DB->GetOne('SELECT pin FROM customers, customercontacts WHERE customerid = customers.info AND pin=? AND phone=? LIMIT 1', array($pin, $phone));
return $authinfo; }
function GetCustomerIDByIDAndPIN($id, $pin) { global $DB; if(!ereg('^[a-zA-Z0-9]+$', $pin) || !ereg('^[0-9]+$', $id)) return NULL;
$authinfo['id'] = $DB->GetOne('SELECT info from customers WHERE info=?', array($id)); if ($authinfo['id'] == NULL) return NULL;
$authinfo['passwd'] = $DB->GetOne('SELECT pin from customers WHERE pin=? AND info=?', array($pin, $id));
return $authinfo; }
// It requires "contract" field. function GetCustomerIDByContractAndPIN($contract, $pin) { global $DB; if(!ereg('^[a-zA-Z0-9]+$', $pin)) return NULL; $authinfo['id'] = $DB->GetOne('SELECT info FROM customers WHERE contract=?', array($contract));
if ($authinfo['id'] == NULL) return NULL; $authinfo['passwd'] = $DB->GetOne('SELECT pin FROM customers WHERE pin=? AND contract=?', array($pin, $contract));
return $authinfo; }
function GetCustomerAuthInfo($customerid) { global $DB; return $DB->GetRow('SELECT customerid AS id, lastlogindate, lastloginip, failedlogindate, failedloginip, enabled FROM up_customers WHERE customerid=?', array($customerid)); }
function SetCustomerAuthInfo($authinfo) { global $DB; $actauthinfo = GetCustomerAuthInfo($authinfo['id']); if ($actauthinfo != null) { $DB->Execute('UPDATE up_customers SET lastlogindate=?, lastloginip=?, failedlogindate=?, failedloginip=?, enabled=? WHERE customerid=?', array($authinfo['lastlogindate'], $authinfo['lastloginip'], $authinfo['failedlogindate'], $authinfo['failedloginip'], $authinfo['enabled'], $authinfo['id'])); } else { $DB->Execute('INSERT INTO up_customers(customerid, lastlogindate, lastloginip, failedlogindate, failedloginip, enabled) VALUES (?, ?, ?, ?, ?, ?)', array($authinfo['id'], $authinfo['lastlogindate'], $authinfo['lastloginip'], $authinfo['failedlogindate'], $authinfo['failedloginip'], $authinfo['enabled'])); } }
?>