|
|
@ -166,23 +166,18 @@ function homeInfo($user) |
|
|
|
if ($rep === false) |
|
|
|
if ($rep === false) |
|
|
|
$ans = false; |
|
|
|
$ans = false; |
|
|
|
else |
|
|
|
else |
|
|
|
{ |
|
|
|
|
|
|
|
$ans = repDecode($rep); |
|
|
|
$ans = repDecode($rep); |
|
|
|
// if ($ans['lastblock'] == '?') |
|
|
|
|
|
|
|
// { |
|
|
|
|
|
|
|
// $ans['lastblock'] = 1401237522; |
|
|
|
|
|
|
|
// $ans['lastblock'] = 1403819191; |
|
|
|
|
|
|
|
// $ans['lastblock'] = 1407113822; |
|
|
|
|
|
|
|
// } |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return $ans; |
|
|
|
return $ans; |
|
|
|
} |
|
|
|
} |
|
|
|
# |
|
|
|
# |
|
|
|
function checkPass($user, $pass) |
|
|
|
function checkPass($user, $pass, $twofa) |
|
|
|
{ |
|
|
|
{ |
|
|
|
$passhash = myhash($pass); |
|
|
|
$passhash = myhash($pass); |
|
|
|
$flds = array('username' => $user, 'passwordhash' => $passhash); |
|
|
|
if ($twofa === null) |
|
|
|
|
|
|
|
$twofa = ''; |
|
|
|
|
|
|
|
$flds = array('username' => $user, 'passwordhash' => $passhash, |
|
|
|
|
|
|
|
'2fa' => $twofa); |
|
|
|
$msg = msgEncode('chkpass', 'chkpass', $flds, $user); |
|
|
|
$msg = msgEncode('chkpass', 'chkpass', $flds, $user); |
|
|
|
$rep = sendsockreply('checkPass', $msg); |
|
|
|
$rep = sendsockreply('checkPass', $msg); |
|
|
|
if (!$rep) |
|
|
|
if (!$rep) |
|
|
@ -190,11 +185,14 @@ function checkPass($user, $pass) |
|
|
|
return $rep; |
|
|
|
return $rep; |
|
|
|
} |
|
|
|
} |
|
|
|
# |
|
|
|
# |
|
|
|
function setPass($user, $oldpass, $newpass) |
|
|
|
function setPass($user, $oldpass, $newpass, $twofa) |
|
|
|
{ |
|
|
|
{ |
|
|
|
$oldhash = myhash($oldpass); |
|
|
|
$oldhash = myhash($oldpass); |
|
|
|
$newhash = myhash($newpass); |
|
|
|
$newhash = myhash($newpass); |
|
|
|
$flds = array('username' => $user, 'oldhash' => $oldhash, 'newhash' => $newhash); |
|
|
|
if ($twofa === null) |
|
|
|
|
|
|
|
$twofa = ''; |
|
|
|
|
|
|
|
$flds = array('username' => $user, 'oldhash' => $oldhash, |
|
|
|
|
|
|
|
'newhash' => $newhash, '2fa' => $twofa); |
|
|
|
$msg = msgEncode('newpass', 'newpass', $flds, $user); |
|
|
|
$msg = msgEncode('newpass', 'newpass', $flds, $user); |
|
|
|
$rep = sendsockreply('setPass', $msg); |
|
|
|
$rep = sendsockreply('setPass', $msg); |
|
|
|
if (!$rep) |
|
|
|
if (!$rep) |
|
|
@ -202,10 +200,12 @@ function setPass($user, $oldpass, $newpass) |
|
|
|
return repDecode($rep); |
|
|
|
return repDecode($rep); |
|
|
|
} |
|
|
|
} |
|
|
|
# |
|
|
|
# |
|
|
|
function resetPass($user, $newpass) |
|
|
|
function resetPass($user, $newpass, $twofa) |
|
|
|
{ |
|
|
|
{ |
|
|
|
$newhash = myhash($newpass); |
|
|
|
$newhash = myhash($newpass); |
|
|
|
$flds = array('username' => $user, 'newhash' => $newhash); |
|
|
|
if ($twofa === null) |
|
|
|
|
|
|
|
$twofa = ''; |
|
|
|
|
|
|
|
$flds = array('username' => $user, 'newhash' => $newhash, '2fa' => $twofa); |
|
|
|
$msg = msgEncode('newpass', 'newpass', $flds, $user); |
|
|
|
$msg = msgEncode('newpass', 'newpass', $flds, $user); |
|
|
|
$rep = sendsockreply('resetPass', $msg); |
|
|
|
$rep = sendsockreply('resetPass', $msg); |
|
|
|
if (!$rep) |
|
|
|
if (!$rep) |
|
|
@ -216,7 +216,8 @@ function resetPass($user, $newpass) |
|
|
|
function userReg($user, $email, $pass) |
|
|
|
function userReg($user, $email, $pass) |
|
|
|
{ |
|
|
|
{ |
|
|
|
$passhash = myhash($pass); |
|
|
|
$passhash = myhash($pass); |
|
|
|
$flds = array('username' => $user, 'emailaddress' => $email, 'passwordhash' => $passhash); |
|
|
|
$flds = array('username' => $user, 'emailaddress' => $email, |
|
|
|
|
|
|
|
'passwordhash' => $passhash); |
|
|
|
$msg = msgEncode('adduser', 'reg', $flds, $user); |
|
|
|
$msg = msgEncode('adduser', 'reg', $flds, $user); |
|
|
|
$rep = sendsockreply('userReg', $msg); |
|
|
|
$rep = sendsockreply('userReg', $msg); |
|
|
|
if (!$rep) |
|
|
|
if (!$rep) |
|
|
|