function update_session($SessionKey, $SessionData) { // this function is destructive and will replace the entire array of session data previously stored $resp = _EDIT("sessions", array("KEY" => $SessionKey, "updated_at" => date("Y-m-d H:i:s"), "DATA" => serialize($SessionData))); return $resp[0]; }
list($func_out, $PARAMS["PhoneNumber"]) = validate_PhoneNumber($PARAMS["PhoneNumber"]); if ($func_out != 100) { $ERROR = $func_out; } } if ($ERROR == 100) { $AuthResp = AuthenticateUser(); if ($AuthResp[0] !== true) { $ERROR = $AuthResp[1]; } else { list($msg, $ReturnedUsers) = _VIEW("users", array("UserID" => $PARAMS['UserID'], "ScreenName" => $PARAMS['ScreenName'], "EMail" => $PARAMS['EMail'])); if ($msg == false) { $ERROR = $ReturnedUsers; } elseif (count($ReturnedUsers) == 1) { $UserData = only_table_columns($PARAMS, "users"); $UserData["PasswordHash"] = $ReturnedUsers[0]["PasswordHash"]; // no change if (strlen($PARAMS["NewPassword"]) > 0) { $UserData["PasswordHash"] = md5($PARAMS["NewPassword"] . $ReturnedUsers[0]['Salt']); } list($pass, $result) = _EDIT("users", $UserData); if (!$pass) { $ERROR = $result; } elseif (count($result) == 1) { foreach ($result[0] as $key => $val) { $OUTPUT["User"][$key] = $val; } } } } }
public function EDIT($params = null) { if ($params != null) { foreach ($params as $k => $v) { if (is_array($this->DATA) && in_array($k, array_keys($this->DATA))) { $this->DATA[$k] = $v; } } $resp = _EDIT($this->DaveTableObject->table(), $this->DATA); $this->clean_data(); if ($resp[0] === true) { return $resp[1][0]; } else { return $resp[1]; } } else { return true; } }