hpdl
|
176
|
1
|
<?php
|
|
2
|
/*
|
|
3
|
$Id: address_book.php 166 2005-08-05 10:14:21 +0200 (Fr, 05 Aug 2005) hpdl $
|
|
4
|
|
|
5
|
osCommerce, Open Source E-Commerce Solutions
|
|
6
|
http://www.oscommerce.com
|
|
7
|
|
|
8
|
Copyright (c) 2005 osCommerce
|
|
9
|
|
|
10
|
Released under the GNU General Public License
|
|
11
|
*/
|
|
12
|
|
|
13
|
class osC_Account {
|
|
14
|
|
|
15
|
function checkEntry($email_address) {
|
|
16
|
global $osC_Database;
|
|
17
|
|
|
18
|
$Qcheck = $osC_Database->query('select customers_id from :table_customers where customers_email_address = :customers_email_address limit 1');
|
|
19
|
$Qcheck->bindTable(':table_customers', TABLE_CUSTOMERS);
|
|
20
|
$Qcheck->bindValue(':customers_email_address', $email_address);
|
|
21
|
$Qcheck->execute();
|
|
22
|
|
|
23
|
if ($Qcheck->numberOfRows() === 1) {
|
|
24
|
return true;
|
|
25
|
}
|
|
26
|
|
|
27
|
return false;
|
|
28
|
}
|
|
29
|
|
|
30
|
function checkPassword($email_address, $password) {
|
|
31
|
global $osC_Database;
|
|
32
|
|
|
33
|
$Qcheck = $osC_Database->query('select customers_password from :table_customers where customers_email_address = :customers_email_address limit 1');
|
|
34
|
$Qcheck->bindTable(':table_customers', TABLE_CUSTOMERS);
|
|
35
|
$Qcheck->bindValue(':customers_email_address', $email_address);
|
|
36
|
$Qcheck->execute();
|
|
37
|
|
|
38
|
if ($Qcheck->numberOfRows() === 1) {
|
|
39
|
if ( (strlen($password) > 0) && (strlen($Qcheck->value('customers_password')) > 0) ) {
|
|
40
|
$stack = explode(':', $Qcheck->value('customers_password'));
|
|
41
|
|
|
42
|
if (sizeof($stack) === 2) {
|
|
43
|
if (md5($stack[1] . $password) == $stack[0]) {
|
|
44
|
return true;
|
|
45
|
}
|
|
46
|
}
|
|
47
|
}
|
|
48
|
}
|
|
49
|
|
|
50
|
return false;
|
|
51
|
}
|
|
52
|
|
|
53
|
function getID($email_address) {
|
|
54
|
global $osC_Database;
|
|
55
|
|
|
56
|
$Quser = $osC_Database->query('select customers_id from :table_customers where customers_email_address = :customers_email_address limit 1');
|
|
57
|
$Quser->bindTable(':table_customers', TABLE_CUSTOMERS);
|
|
58
|
$Quser->bindValue(':customers_email_address', $email_address);
|
|
59
|
$Quser->execute();
|
|
60
|
|
|
61
|
if ($Quser->numberOfRows() === 1) {
|
|
62
|
return $Quser->valueInt('customers_id');
|
|
63
|
}
|
|
64
|
|
|
65
|
return false;
|
|
66
|
}
|
|
67
|
}
|
|
68
|
?>
|