<?php //购物车 include "common.inc.php"; InitGP(array("action")); //初始化变量全局返回 include_once INC_PATH . "/cart.class.php"; $Cart = CartClass::init(); $dataarray = $Cart->getall(); //处理购物车数据 foreach ($dataarray as $val) { $temparray[$val['goodsseller']][] = $val; if (!empty($s[$val['goodsseller']])) { if ($val['sendprice'] > $s[$val['goodsseller']]) { $s[$val['goodsseller']] = $val['sendprice']; } } else { $s[$val['goodsseller']] = $val['sendprice']; } } $countdata = $Cart->countmoney($dataarray); include template('shopingcart'); //包含输出指定模板
function login($uname, $pwd) { global $timestamp; $rs = $this->CheckUser($uname, $pwd); //本地验证通过 -1格式错误 if ($rs != -1) { #api{{ if (defined('UC_API') && @(include_once ROOT_PATH . '/uc_client/client.php')) { //检查帐号UC list($uid, $username, $password, $email) = uc_user_login($uname, $pwd); if ($uid > 0) { //uc登录成功 $password = md5($password); if ($rs == -3) { //本地数据库不存在自动插入一个用户 $this->db->query("INSERT INTO `{$this->table}`(uid,uname,email,password,scores,money,regtime,logintime) values({$uid},'{$username}','{$email}','{$password}',0,0,{$timestamp},{$timestamp})"); } else { if ($rs == -2) { $this->db->query("update `{$this->table}` SET password='******' WHERE uname='{$username}'"); } } $rs = 1; //设置cookie $auth = $uid . "\t" . $username . "\t" . $password; set_cookie('loginauth', cookie_authcode($auth, 'ENCODE'), $this->cookietime); //生成同步登录的代码 $this->ucsynlogin = uc_user_synlogin($uid); return 'OK'; } else { if ($uid == -1) { //当UC不存在 系统存在,就注册一个 if ($rs == 1) { $row = $this->db->fetch_first("Select * From `{$this->table}` where uname like '{$uname}' "); $uid = uc_user_register($uname, $pwd, $row['email']); //设置cookie $auth = $uid . "\t" . $uname . "\t" . md5($pwd); set_cookie('loginauth', cookie_authcode($auth, 'ENCODE'), $this->cookietime); if ($uid > 0) { $ucsynlogin = uc_user_synlogin($uid); } include_once INC_PATH . "/cart.class.php"; $Cart = CartClass::init(); $Cart->amonymoustouname($uid, $uname); return 'OK'; } elseif ($rs == -3) { return lang('user_and_pass_notexist'); } else { return lang('pass_error'); } } else { $rs = -2; //密码错误 return lang('pass_error'); } } } else { if ($rs == 1) { #/aip}} //非ucenter模式下用户登录操作 $row = $this->db->fetch_first("Select * From `{$this->table}` where uname like '{$uname}' "); //设置cookie记录 $auth = $row['uid'] . "\t" . $uname . "\t" . $row['password']; set_cookie('loginauth', cookie_authcode($auth, 'ENCODE'), $this->cookietime); $this->db->query("update `{$this->table}` SET logintime={$timestamp} WHERE uname='{$uname}'"); include_once INC_PATH . "/cart.class.php"; $Cart = CartClass::init(); $Cart->amonymoustouname($row['uid'], $uname); if ($row['utype'] >= 1) { if (time() > $row['validity']) { $this->db->query("update `{$this->table}` SET utype=0,validity=0 WHERE uname='{$uname}'"); } } return 'OK'; } else { if ($rs == -2) { return lang('user_and_pass_error'); } else { return lang('username_notexist'); } } } } else { return lang('datatype_error'); } }