function allow_reset($error) { $pg = '<br><br><table cellpadding=5 cellspacing=0 border=1><tr><td class=dc>'; $pg .= '<h1>Password Reset</h1>'; if ($error !== null) { $pg .= "<br><b>{$error} - please try again</b><br><br>"; } $pg .= makeForm('reset'); $pg .= "\n<table>\n<tr><td class=dc colspan=2>Enter a new password twice.<br>\n" . passrequires() . "\n<input type=hidden name=k value=reset></td></tr>\n<tr><td class=dr>Password:</td>\n <td class=dl><input type=password name=pass></td></tr>\n<tr><td class=dr>Retype Password:</td>\n <td class=dl><input type=password name=pass2></td></tr>\n<tr><td class=dr><span class=st1>*</span>2nd Authentication:</td>\n <td class=dl><input type=password name=2fa size=10></td></tr>\n<tr><td colspan=2 class=dc><br><font size=-1><span class=st1>*</span>\n Leave blank if you haven't enabled it</font></td></tr>\n<tr><td> </td>\n <td class=dl><input type=submit name=Update value=Update></td></tr>\n</table>\n</form>"; $pg .= '</td></tr></table>'; return $pg; }
function doregres($data, $u) { if (isset($data['data']['user'])) { $user = htmlspecialchars($data['data']['user']); } else { $user = ''; } if (isset($data['data']['mail'])) { $mail = htmlspecialchars($data['data']['mail']); } else { $mail = ''; } $pg = "<br><span class=urg>WARNING:</span> \n<b>Do not</b> give your username+password to anyone else.<br>\n<b>Do not</b> give your username+password to apps or web sites.<br>\nA monitoring app or web site will <b>ONLY</b> need your username+API key.<br>\nYou can setup an API key from the 'Account'->'User Settings' menu page after you login.<br>\nYour miner password should be '<b>x</b>' and <b>must not</b> use your login password.<br>"; $pg .= makeForm('') . "<br>\n<table cellpadding=0 cellspacing=0 border=0><tr>\n<td>User:</td><td><input type=text name=User size=10 value=''></td>\n<td> Pass:</td><td><input type=password name=Pass size=10 value=''></td>\n<td> <input type=submit name=Login value=Login></td>\n</tr></table></form>"; $pg .= '<br><h1>or choose one:</h1>'; $pg .= '<table cellpadding=5 cellspacing=0 border=1><tr><td class=dc>'; $pg .= '<h1>Login</h1>'; if (isset($data['data']['error'])) { $pg .= "<br><b>" . $data['data']['error'] . " - please try again</b><br><br>"; } $pg .= makeForm(''); $pg .= "\n<table>\n<tr><td class=dr>Username:</td>\n <td class=dl><input name=User value=''></td></tr>\n<tr><td class=dr>Password:</td>\n <td class=dl><input type=password name=Pass value=''></td></tr>\n<tr><td class=dr><span class=st1>*</span>2nd Authentication:</td>\n <td class=dl><input type=password name=2fa size=10></td></tr>\n<tr><td colspan=2 class=dc><font size=-1><span class=st1>*</span>\n Leave blank if you haven't enabled it</font></td></tr>\n<tr><td> </td>\n <td class=dl><input type=submit name=Login value=Login></td></tr>\n</table>\n</form>"; $pg .= '</td></tr><tr><td class=dc>'; $pg .= '<h1>Register</h1>'; if (isset($data['data']['error'])) { $pg .= "<br><b>" . $data['data']['error'] . " - please try again</b><br><br>"; } $pg .= makeForm(''); $pg .= "\n<table>\n<tr><td class=dr>Username:</td>\n <td class=dl><input name=user value=\"{$user}\"></td></tr>\n<tr><td class=dr>Email:</td>\n <td class=dl><input name=mail value=\"{$mail}\"></td></tr>\n<tr><td class=dr>Password:</td>\n <td class=dl><input type=password name=pass value=''></td></tr>\n<tr><td class=dr>Retype Password:</td>\n <td class=dl><input type=password name=pass2 value=''></td></tr>\n<tr><td> </td>\n <td class=dl><input type=submit name=Register value=Register></td></tr>\n<tr><td colspan=2 class=dc><br><font size=-1><span class=st1>*</span>\n All fields are required<br>Your Username can't be a BTC address</font></td></tr>\n<tr><td colspan=2 class=dc><font size=-1><br>Note: your username is upper/lowercase sensitive,<br>\nand you must also have upper/lowercase correct on all your miners<br><br>" . passrequires() . "</font></td></tr>\n</table>\n</form>"; $pg .= '</td></tr><tr><td class=dc>'; $pg .= '<h1>Password Reset</h1>'; $pg .= makeForm(''); $pg .= "\n<table>\n<tr><td class=dr>Username:</td>\n <td class=dl><input name=user value=\"{$user}\"></td></tr>\n<tr><td class=dr>Email:</td>\n <td class=dl><input name=mail value=''></td></tr>\n<tr><td> </td>\n <td class=dl><input type=submit name=Reset value=Reset></td></tr>\n<tr><td colspan=2 class=dc><br><font size=-1>\nIf you enter the details correctly,<br>\nan Email will be sent to you to let you reset your password</font></td></tr>\n</table>\n</form>"; $pg .= '</td></tr></table>'; return $pg; }
function dosettings($data, $user) { $err = ''; $chg = getparam('Change', false); $check = false; switch ($chg) { case 'EMail': $email = getparam('email', false); if (stripos($email, 'hotmail') !== false) { $err = 'hotmail not allowed'; } else { $pass = getparam('pass', false); $twofa = getparam('2fa', false); $ans = userSettings($user, $email, null, $pass, $twofa); $err = 'EMail changed'; $check = true; } break; case 'Address': if (!isset($data['info']['u_multiaddr'])) { $addr = getparam('baddr', false); $addrarr = array(array('addr' => $addr)); $pass = getparam('pass', false); $twofa = getparam('2fa', false); $ans = userSettings($user, null, $addrarr, $pass, $twofa); $err = 'Payout address changed'; $check = true; } break; case 'Password': $oldpass = getparam('oldpass', false); $pass1 = getparam('pass1', false); $pass2 = getparam('pass2', false); $twofa = getparam('2fa', false); if (!safepass($pass1)) { $err = 'Unsafe password. ' . passrequires(); } elseif ($pass1 != $pass2) { $err = "Passwords don't match"; } else { $ans = setPass($user, $oldpass, $pass1, $twofa); $err = 'Password changed'; $check = true; } break; } $doemail = false; if ($check === true) { if ($ans['STATUS'] != 'ok') { $err = $ans['STATUS']; if ($ans['ERROR'] != '') { $err .= ': ' . $ans['ERROR']; } } else { $doemail = true; } } $ans = userSettings($user); if ($ans['STATUS'] != 'ok') { dbdown(); } // Should be no other reason? if (isset($ans['email'])) { $email = $ans['email']; } else { $email = ''; } // Use the first one - updating will expire all others if (isset($ans['rows']) and $ans['rows'] > 0) { $addr = $ans['addr:0']; } else { $addr = ''; } if ($doemail) { if ($email == '') { if ($err != '') { $err .= '<br>'; } $err .= 'An error occurred, check your details below'; goto iroiroattanoyo; } $emailinfo = getOpts($user, emailOptList()); if ($emailinfo['STATUS'] != 'ok') { if ($err != '') { $err .= '<br>'; } $err .= 'An error occurred, check your details below'; goto iroiroattanoyo; } switch ($chg) { case 'EMail': if (isset($_SESSION['old_set_email'])) { $old = $_SESSION['old_set_email']; } else { $old = null; } emailAddressChanged($email, zeip(), $emailinfo, $old); break; case 'Address': payoutAddressChanged($email, zeip(), $emailinfo); break; case 'Password': passChanged($email, zeip(), $emailinfo); break; } } iroiroattanoyo: $pg = settings($data, $user, $email, $addr, $err); return $pg; }