本文整理汇总了PHP中ss函数的典型用法代码示例。如果您正苦于以下问题:PHP ss函数的具体用法?PHP ss怎么用?PHP ss使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ss函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: login
/**
* 登入方法
* @param null $input
* @return array
*/
public function login($input = null)
{
$input = $input ? $input : rq();
if (!empty($input['user_type']) && $input['user_type'] == 'doctor' && !empty($input['cust_id'])) {
$d = M('doctor');
$d = $d->where('cust_id', $input['cust_id'])->first();
if ($d) {
log_him_in(['uid' => $d->id]);
add_chara($input['user_type']);
return ss();
}
return $d ? ss($d) : ee(2);
}
if (!empty($input['user_type']) && !empty($input['username']) && !empty($input['password'])) {
$input['password'] = hash_password($input['password']);
$user = $this->user_exists($input['user_type'], array_only($input, ['username', 'password']));
if ($user) {
log_him_in(['username' => $user->username, 'uid' => $user->id]);
add_chara($input['user_type']);
return ss();
}
} else {
return ee(2);
}
return ee(2);
}
示例2: robot
public function robot()
{
if (!he_is('agency')) {
abort(403);
}
$data = DB::table('i_robot')->select('i_robot.*', 'i_robot_lease_log.*', 'i_hospital.name as hospital_name', 'i_employee.name as employee_name')->leftJoin('i_robot_lease_log', 'i_robot.id', '=', 'i_robot_lease_log.robot_id')->leftJoin('i_hospital', 'i_hospital.id', '=', 'i_robot_lease_log.hospital_id')->leftJoin('i_employee', 'i_employee.id', '=', 'i_robot.employee_id')->where('i_robot_lease_log.recent', 1)->where('i_robot_lease_log.agency_id', uid())->orderBy('i_robot.id', 'i_robot_lease_log.lease_ended_at desc')->get();
return ss($data);
}
示例3: change_password
public function change_password($row = null)
{
$row = $row ? $row : rq();
$ins = $this->find($row['id']);
$ins->password = hash_password($row['password']);
$r = $ins->save();
return $r ? ss($r) : ee(1);
}
示例4: chs
function chs($var, $def = 0)
{
if (isset($_REQUEST[$var])) {
return ss($_REQUEST[$var]);
} else {
return $def;
}
}
示例5: r
public function r()
{
if (!intval(rq('id'))) {
ss('无效ID', 0);
}
$data = $this->find(rq('id'));
$this->eventFire('r', $data);
return ss($data);
}
示例6: index
public function index()
{
if (ss('uid')) {
header('Location: /?c=default&a=main');
}
$this->data['side'] = true;
$this->data['title'] = $this->data['top_title'] = '首页';
render($this->data);
}
示例7: change_password
public function change_password($row = null)
{
$row = $row ? $row : rq();
$ins = $this->find($row['id']);
$ins->password = hash_password($row['password']);
$r = $ins->save();
// trigger log
$this->eventFire('pass', $ins);
return $r ? ss($r) : ee(1);
}
示例8: ss
function ss($n)
{
foreach ($n as $k => $v) {
if (is_array($v)) {
$n[$k] = ss($v);
} else {
$n[$k] = stripslashes($v);
}
}
}
示例9: read
public function read()
{
$id = rq('id');
$data = $this->find($id);
$res = 0;
if ($data->recipientid == uid()) {
$data->read = 1;
$res = $data->save();
}
return ss($res);
}
示例10: recover
public function recover()
{
if (rq('id')) {
$row = $this->find(rq('id'));
$row->update(['status' => 1, 'wechat_id' => null]);
$this->eventFire('recover', $row);
return ss($row);
} else {
ee(2);
}
}
示例11: __construct
function __construct()
{
// 载入默认的
parent::__construct();
$a = g('a');
$c = g('c');
session_start();
if (!ss('uid') && $c != 'login') {
header('Location: /?c=login');
exit;
}
}
示例12: Set
function Set($var, $val, $perm = true)
{
$this->data[$var] = $val;
if ($perm) {
global $NATS;
$q = "UPDATE fnconfig SET fnc_val=\"" . ss($val) . "\" WHERE fnc_var=\"" . ss($var) . "\"";
$NATS->DB->Query($q);
if ($NATS->DB->Affected_Rows() <= 0) {
$q = "INSERT INTO fnconfig(fnc_var,fnc_val) VALUES(\"" . ss($var) . "\",\"" . ss($val) . "\")";
mysql_query($q);
}
}
}
示例13: forget
/**
* 找回密码
* @param [type] $p3 找回密码类型 - employee , agency
* @return [type] [description]
*/
public function forget($p3 = null)
{
$email = rq('email');
$ins = Route::current()->parameter('p3');
$row = M($ins)->where('email', $email)->first();
if ($row) {
// 发送邮件
$hash = hash_password($row->email . time());
Mail::send('emails.reminder', ['user' => $row, 'hash' => $hash], function ($m) use($row) {
$m->to($row->email, $row->name)->subject('密码重置');
});
// 发送log
Event::fire(new LogEvent('reminder', 'auth', ['type' => $ins, 'user' => $row, 'hash' => $hash]));
return ss('邮件已发送');
} else {
return ss('无相关用户', 0);
}
}
示例14: login
/**
* 登入方法
* @param null $input
* @return array
*/
public function login($input = null)
{
$input = $input ? $input : rq();
if (!empty($input['user_type']) && $input['user_type'] == 'doctor' && !empty($input['cust_id'])) {
$d = M('doctor');
$d = $d->where('cust_id', $input['cust_id'])->first();
if ($d) {
log_him_in(['uid' => $d->id]);
add_chara($input['user_type']);
return ss();
}
return $d ? ss($d) : ee(2);
}
if (!empty($input['user_type']) && !empty($input['username']) && !empty($input['password'])) {
$input['password'] = hash_password($input['password']);
$user = $this->user_exists($input['user_type'], array_only($input, ['username', 'password']));
if ($user) {
$lifetime = 6000;
log_him_in(['username' => $user->username, 'uid' => $user->id], $lifetime);
add_chara($input['user_type']);
if ($input['user_type'] == 'employee') {
sess('permission', $user->permissions);
} else {
sess('permission', []);
}
if ($input['user_type'] == 'agency') {
sess('org', $user->name);
sess('name_in_charge', $user->name_in_charge);
}
if ($input['user_type'] == 'department') {
sess('org', $user->hospital_name . ':' . $user->name);
}
if ($input['user_type'] == 'employee') {
sess('org', $user->name);
}
// 添加日志
ILog::login($input['user_type'], $user);
return ss($user);
}
} else {
return ee(2);
}
return ee(2);
}
示例15: scan_u
public function scan_u()
{
if (rq('cust_id')) {
$ins = $this->where('cust_id', rq('cust_id'))->first();
} else {
return ee(2, 'missing_cust_id');
}
if (!$ins) {
return ee(2, 'record_not_found');
}
if ($ins->used_at) {
return ee(2, 'mark_is_already_used');
}
$ins->doctor_id = uid();
$ins->used_at = \Carbon\Carbon::now();
if ($ins->save()) {
return ss();
}
}