Register'; if (isset($data['error'])) $pg .= "
".$data['error']." - please try again

"; $pg .= "
Username:
Email:
Password:
Retype Password:
 

All fields are required
"; return $pg; } # function doreg2($data) { if (isset($data['user'])) $user = htmlspecialchars($data['user']); else $user = ''; $pg = '

Registered

'; // $pg .= '
You will receive an email shortly to verify your account'; $pg .= '
Your account is registered and ready to mine.'; $pg .= '
Choose your own worker names in cgminer.'; $pg .= '
Worker names must start with your username like'; $pg .= ": ${user}_ or ${user}."; return $pg; } # function safepass($pass) { if (strlen($pass) < 6) return false; # Invalid characters $p2 = preg_replace('/[^ -~]/', '', $pass); if ($p2 != $pass) return false; # At least one lowercase $p2 = preg_replace('/[a-z]/', '', $pass); if ($p2 == $pass) return false; # At least one uppercase $p2 = preg_replace('/[A-Z]/', '', $pass); if ($p2 == $pass) return false; # At least one digit $p2 = preg_replace('/[0-9]/', '', $pass); if ($p2 == $pass) return false; return true; } # function show_reg($menu, $name, $u) { $user = getparam('user', false); $mail = trim(getparam('mail', false)); $pass = getparam('pass', false); $pass2 = getparam('pass2', false); $data = array(); if (nuem($user)) $data['user'] = ''; else $data['user'] = $user; if (nuem($mail)) $data['mail'] = ''; else $data['mail'] = $mail; $ok = true; if (nuem($user) || nuem($mail) || nuem($pass) || nuem($pass2)) $ok = false; else { if (safepass($pass) !== true) { $ok = false; $data['error'] = "Password is unsafe - requires 6 or more characters, including
" . "at least one of each uppercase, lowercase and digits"; } elseif ($pass2 != $pass) { $ok = false; $data['error'] = "Passwords don't match"; } $orig = $user; $user = preg_replace('/[_\\.]/', '', $orig); if ($user != $orig) { $ok = false; $data['error'] = "Username cannot include '.' or '_'"; $data['user'] = $user; } } if ($ok === true) { $passhash = myhash($pass); $flds = array('username' => $user, 'emailaddress' => $mail, 'passwordhash' => $passhash); $msg = msgEncode('adduser', 'reg', $flds); $rep = sendsockreply('show_reg', $msg); if (!$rep) dbdown(); $ans = repDecode($rep); if ($ans['STATUS'] == 'ok') gopage($data, 'doreg2', $menu, $name, $u, true, true, false); else $data['error'] = "Invalid details"; } gopage($data, 'doreg', $menu, $name, $u, true, true, false); } # ?>