function mu_html_signupForm($error_msg = '') { ?> <script type="text/javascript"> var RecaptchaOptions = { theme : '<?php echo YOURLS_MULTIUSER_CAPTCHA_THEME; ?> ' }; </script> <div id="login"> <form method="post" action="?act=join"> <?php // reset any QUERY parameters ?> <?php if (!empty($error_msg)) { echo '<p class="error">' . $error_msg . '</p>'; unset($_SESSION['error_msg']); } ?> <p> <label for="username">Username (e-mail)</label><br /> <input type="text" id="username" name="username" size="30" class="text" /> </p> <p> <label for="password">Password</label><br /> <input type="password" id="password" name="password" size="30" class="text" /> </p> <p> <?php if (captchaEnabled()) { require_once 'recaptchalib.php'; $publickey = YOURLS_MULTIUSER_CAPTCHA_PUBLIC_KEY; echo recaptcha_get_html($publickey); } ?> </p> <input type="submit" id="submit" name="submit" value="Join!" class="button" /> </p> </form> <script type="text/javascript">$('#username').focus();</script> </div> <?php }
$id = getUserIdByToken($token); $_SESSION['user'] = array("id" => $id, "user" => $username, "token" => $token); yourls_redirect("index.php"); } else { $error_msg = "Problems to login."; require_once 'form.php'; } } break; case "joinform": require_once 'formjoin.php'; break; case "join": $username = yourls_escape($_POST['username']); $password = $_POST['password']; if (captchaEnabled()) { require_once 'recaptchalib.php'; $privatekey = YOURLS_MULTIUSER_CAPTCHA_PRIVATE_KEY; $resp = recaptcha_check_answer($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]); if (!$resp->is_valid) { $error_msg = "Captch is incorrect."; require_once 'formjoin.php'; break; } } if (!empty($username) && !empty($password)) { if (validEmail($username) === false) { $error_msg = "E-mail not recognized!"; require_once 'formjoin.php'; } else { $table = YOURLS_DB_TABLE_USERS;