public function registerUser($user, $keyActive) { $userNew = new User(); $userNew->email = $user['email']; $userNew->password = $user['password']; $userNew->username = $user['username']; $tokenId = $this->generateRandomString(30); $userNew->tokenId = $this->encodePassword($tokenId); $userNew->active = 0; $userNew->status = 0; // check email exits $userExits = User::where('email', $user['email'])->first(); if (is_null($userExits)) { if ($userNew->save()) { // create random key active $activeUser = new ActiveUser(); $activeUser->email = $user['email']; $activeUser->key = $keyActive; $activeUser->status = 0; $activeUser->save(); $user = User::where('email', $user['email'])->where('password', $user['password'])->first(); return array('status' => 200); } else { return array('status' => 302); } } else { return array('status' => 304); } }
public function active($keyActive) { $result = ActiveUser::where('key', $keyActive)->where('status', 0)->first(); if (is_null($result)) { return false; } else { if (ActiveUser::where('key', $keyActive)->update(array('status' => 1))) { return $result; } else { return false; } } }
{ $p = $this->db->query($sql); $p->setFetchMode(PDO::FETCH_ASSOC); $result = $p->fetchAll(); return $result[0]; } } error_reporting(E_ALL ^ E_NOTICE); //接收cid $stationid = $argv[1]; // $stationid = 8; if (!$stationid) { exit; } $date = date('Y-m-d', strtotime('-1 day')); $m = new ActiveUser($stationid); $m->executeall($date); /*$sdate = strtotime('2015-02-28'); $sdate = strtotime('+1 month',$sdate); $sdate = strtotime('-1 day',$sdate); $date = date('Y-m-d',$sdate); echo $date;exit;*/ /*function ExecuteDateArea($stationid,$sdate,$edate){ $sdate = strtotime($sdate); $edate = strtotime($edate); while ($sdate <= $edate) { $m = new ActiveUser($stationid); $date = date('Y-m-d',$sdate); $m -> executeall($date); // $sdate = strtotime('+1 month',$sdate); $sdate = strtotime('+1 day',$sdate);
function ExecuteDateArea($stationid, $sdate, $edate) { $sdate = strtotime($sdate); $edate = strtotime($edate); while ($sdate <= $edate) { $m = new ActiveUser($stationid); $date = date('Y-m-d', $sdate); $m->executeall($date); $sdate = strtotime('+1 day', $sdate); } }