Quick Search:

View

Revision:

Diff

Diff from 179 to:

Annotations

Annotate by Age | Author | Mixed | None
/fisheye/browse/osCommerce/branches/hpdl/oscommerce/includes/classes/account.php

Annotated File View

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
hpdl
179
15     function &getEntry() {
16       global $osC_Database, $osC_Customer;
17
18       $Qaccount = $osC_Database->query('select customers_gender, customers_firstname, customers_lastname, unix_timestamp(customers_dob) as customers_dob, customers_email_address from :table_customers where customers_id = :customers_id');
19       $Qaccount->bindTable(':table_customers', TABLE_CUSTOMERS);
20       $Qaccount->bindInt(':customers_id', $osC_Customer->id);
21       $Qaccount->execute();
22
23       return $Qaccount;
24     }
25
26     function getID($email_address) {
27       global $osC_Database;
28
29       $Quser = $osC_Database->query('select customers_id from :table_customers where customers_email_address = :customers_email_address limit 1');
30       $Quser->bindTable(':table_customers', TABLE_CUSTOMERS);
31       $Quser->bindValue(':customers_email_address', $email_address);
32       $Quser->execute();
33
34       if ($Quser->numberOfRows() === 1) {
35         return $Quser->valueInt('customers_id');
36       }
37
38       return false;
39     }
40
hpdl
176
41     function checkEntry($email_address) {
42       global $osC_Database;
43
44       $Qcheck = $osC_Database->query('select customers_id from :table_customers where customers_email_address = :customers_email_address limit 1');
45       $Qcheck->bindTable(':table_customers', TABLE_CUSTOMERS);
46       $Qcheck->bindValue(':customers_email_address', $email_address);
47       $Qcheck->execute();
48
49       if ($Qcheck->numberOfRows() === 1) {
50         return true;
51       }
52
53       return false;
54     }
55
56     function checkPassword($email_address, $password) {
57       global $osC_Database;
58
59       $Qcheck = $osC_Database->query('select customers_password from :table_customers where customers_email_address = :customers_email_address limit 1');
60       $Qcheck->bindTable(':table_customers', TABLE_CUSTOMERS);
61       $Qcheck->bindValue(':customers_email_address', $email_address);
62       $Qcheck->execute();
63
64       if ($Qcheck->numberOfRows() === 1) {
65         if ( (strlen($password) > 0) && (strlen($Qcheck->value('customers_password')) > 0) ) {
66           $stack = explode(':', $Qcheck->value('customers_password'));
67
68           if (sizeof($stack) === 2) {
69             if (md5($stack[1] . $password) == $stack[0]) {
70               return true;
71             }
72           }
73         }
74       }
75
76       return false;
77     }
78   }
79 ?>