$_POST['name'] = '';
    $_POST['email'] = '';
    $_POST['sex'] = 2;
    $_POST['autologin'] = 0;
}
$kuriseed = crc32(KURIKEY . microtime());
srand($kuriseed);
$check = time();
$kurichallenge = "{$kuriseed}|{$check}|" . rand(3, 12);
$iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_ECB);
$iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
$kurichallenge = mcrypt_encrypt(MCRYPT_RIJNDAEL_128, md5(KURIKEY . $check, true), $kurichallenge, MCRYPT_MODE_ECB, $iv);
$kurichallenge = base64_encode($kurichallenge);
$kuridata = mcrypt_encrypt(MCRYPT_RIJNDAEL_128, md5(KURIKEY, true), "{$kuriseed}|{$check}|{$kurichallenge}", MCRYPT_MODE_ECB, $iv);
$kuridata = base64_encode($kuridata);
$fields = array('username' => "<input type=\"text\" name=\"name\" maxlength=20 size=24 value=\"" . htmlspecialchars($_POST['name']) . "\" class=\"required\">", 'password' => "<input type=\"password\" name=\"pass\" size=24 class=\"required\">", 'password2' => "<input type=\"password\" name=\"pass2\" size=24 class=\"required\">", 'email' => "<input type=\"email\" name=\"email\" value=\"" . htmlspecialchars($_POST['email']) . "\" maxlength=\"60\" size=24>", 'sex' => MakeOptions("sex", $_POST['sex'], $sexes), 'readfaq' => "<label><input type=\"checkbox\" name=\"readFaq\">" . format(__("I have read the {0}FAQ{1}"), "<a href=\"" . actionLink("faq") . "\">", "</a>") . "</label>", 'kurichallenge' => "<img src=\"" . resourceLink("kurichallenge.php?data=" . urlencode($kuridata)) . "\" alt=\"[reload the page if the image fails to load]\"><br>\n\t\t<input type=\"text\" name=\"kurichallenge\" size=\"10\" maxlength=\"6\" class=\"required\">\n\t\t<input type=\"hidden\" name=\"kuridata\" value=\"" . htmlspecialchars($kuridata) . "\">", 'autologin' => "<label><input type=\"checkbox\" checked=\"checked\" name=\"autologin\"" . ($_POST['autologin'] ? ' checked="checked"' : '') . ">" . __("Log in afterwards") . "</label>", 'btnRegister' => "<input type=\"submit\" name=\"register\" value=\"" . __("Register") . "\">");
echo "<form action=\"" . htmlentities(actionLink("register")) . "\" method=\"post\">";
RenderTemplate('form_register', array('fields' => $fields));
echo "<span style=\"display : none;\"><input type=\"checkbox\" name=\"likesCake\"> I am a robot</span></form>";
function MakeOptions($fieldName, $checkedIndex, $choicesList)
{
    $checks[$checkedIndex] = " checked=\"checked\"";
    foreach ($choicesList as $key => $val) {
        $result .= format("\n\t\t\t\t\t<label>\n\t\t\t\t\t\t<input type=\"radio\" name=\"{1}\" value=\"{0}\"{2}>\n\t\t\t\t\t\t{3}\n\t\t\t\t\t</label>", $key, $fieldName, $checks[$key], $val);
    }
    return $result;
}
function IsProxy()
{
    if ($_SERVER['HTTP_X_FORWARDED_FOR'] && $_SERVER['HTTP_X_FORWARDED_FOR'] != $_SERVER['REMOTE_ADDR']) {
        return true;
Example #2
0
        setcookie("logsession", $sessionID, 0, $boardroot, "", false, true);
        Query("INSERT INTO {sessions} (id, user, autoexpire) VALUES ({0}, {1}, {2})", doHash($sessionID . $salt), $user["id"], 0);
        redirectAction("board");
    }
}
$sexes = array(__("Male"), __("Female"), __("N/A"));
$name = "";
if (isset($_POST["name"])) {
    $name = htmlspecialchars($_POST["name"]);
}
$email = "";
if (isset($_POST["email"])) {
    $email = htmlspecialchars($_POST["email"]);
}
$sex = 2;
if (isset($_POST["sex"])) {
    $sex = validateSex($_POST["sex"]);
}
echo "\n<script src=\"" . resourceLink('js/register.js') . "\"></script>\n<script src=\"" . resourceLink('js/zxcvbn.js') . "\"></script>\n<form action=\"" . actionLink("register") . "\" method=\"post\">\n\t<table class=\"outline margin width50\">\n\t\t<tr class=\"header0\">\n\t\t\t<th colspan=\"2\">\n\t\t\t\t" . __("Register") . "\n\t\t\t</th>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td class=\"cell2\">\n\t\t\t\t<label for=\"un\">" . __("User name") . "</label>\n\t\t\t</td>\n\t\t\t<td class=\"cell0\">\n\t\t\t\t<input type=\"text\" id=\"un\" name=\"name\" value=\"{$name}\" maxlength=\"20\" style=\"width: 98%;\"  class=\"required\" />\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td class=\"cell2\">\n\t\t\t\t<label for=\"pw\">" . __("Password") . "</label>\n\t\t\t</td>\n\t\t\t<td class=\"cell1\">\n\t\t\t\t<input type=\"password\" id=\"pw\" name=\"pass\" size=\"13\" maxlength=\"32\" class=\"required\" /> / " . __("Repeat:") . " <input type=\"password\" id=\"pw2\" name=\"pass2\" size=\"13\" maxlength=\"32\" class=\"required\" />\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td class=\"cell2\">\n\t\t\t\t<label for=\"email\">" . __("Email address") . "</label>\n\t\t\t</td>\n\t\t\t<td class=\"cell0\">\n\t\t\t\t<input type=\"email\" id=\"email\" name=\"email\" value=\"{$email}\" style=\"width: 98%;\" maxlength=\"60\" />\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td class=\"cell2\">\n\t\t\t\t" . __("Sex") . "\n\t\t\t</td>\n\t\t\t<td class=\"cell1\">\n\t\t\t\t" . MakeOptions("sex", $sex, $sexes) . "\n\t\t\t</td>\n\t\t</tr>";
if ($haveSecurimage) {
    echo "\n\t\t<tr>\n\t\t\t<td class=\"cell2\">\n\t\t\t\t" . __("Security") . "\n\t\t\t</td>\n\t\t\t<td class=\"cell1\">\n\t\t\t\t<img width=\"200\" height=\"80\" id=\"captcha\" src=\"" . actionLink("captcha", shake()) . "\" alt=\"CAPTCHA Image\" />\n\t\t\t\t<button onclick=\"document.getElementById('captcha').src = '" . actionLink("captcha", shake()) . "?' + Math.random(); return false;\">" . __("New") . "</button><br />\n\t\t\t\t<input type=\"text\" name=\"captcha_code\" size=\"10\" maxlength=\"6\" class=\"required\" />\n\t\t\t</td>\n\t\t</tr>";
}
echo "\n\t\t<tr class=\"cell2\">\n\t\t\t<td></td>\n\t\t\t<td>\n\t\t\t\t<input type=\"submit\" name=\"action\" value=\"" . __("Register") . "\"/>\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td colspan=\"2\" class=\"cell0 smallFonts\">\n\t\t\t\t" . __("Specifying an email address is not exactly a hard requirement, but it will allow you to reset your password should you forget it. By default, your email is not shown.") . "\n\t\t\t</td>\n\t\t</tr>\n\t</table>\n</form>";
function MakeOptions($fieldName, $checkedIndex, $choicesList)
{
    $checks[$checkedIndex] = " checked=\"checked\"";
    foreach ($choicesList as $key => $val) {
        $result .= format("\n\t\t\t\t\t<label>\n\t\t\t\t\t\t<input type=\"radio\" name=\"{1}\" value=\"{0}\"{2} />\n\t\t\t\t\t\t{3}\n\t\t\t\t\t</label>", $key, $fieldName, $checks[$key], $val);
    }
    return $result;
}
Example #3
0
                $rMods = Query($qMods);
                if (NumRows($rMods)) {
                    while ($mod = Fetch($rMods)) {
                        $qMod = "select name, id, powerlevel, sex from users where id=" . $mod['user'];
                        $rMod = Query($qMod);
                        $mod2 = Fetch($rMod);
                        $localMods .= UserLink($mod2) . ", ";
                    }
                    $localMods = __("Moderated by:") . " " . substr($localMods, 0, strlen($localMods) - 2);
                } else {
                    $localMods = __("No mods");
                }
                $thelist .= format("\n\t\t<div class=\"errorc left cell1\" style=\"clear: both; overflow: auto;\">\n\n\t\t\t<div style=\"float: left; width: 60%;\">\n\t\t\t\t<form action=\"editfora.php\" method=\"post\">\n\t\t\t\t\t<input type=\"text\" name=\"title\" value=\"{0}\" style=\"width: 70%;\" />\n\t\t\t\t\t<input type=\"submit\" name=\"action\" value=\"" . __("Edit") . "\" /><br />\n\t\t\t\t\t<input type=\"text\" name=\"description\" style=\"width: 90%;\" value=\"{1}\" />\n\t\t\t\t\t<input type=\"hidden\" name=\"fid\" value=\"{2}\" /><br/>\n\t\t\t\t\t<small>{3} (<a href=\"managemods.php\">" . __("Edit") . "</a>) &bull; " . __("{4} thread(s), {5} post(s).") . "</small>\n\t\t\t\t</form>\n\t\t\t</div>\n\n\t\t\t<form action=\"editfora.php\" method=\"post\">\n\t\t\t\t{7}\n\t\t\t\t <input type=\"text\" name=\"order\" value=\"{6}\" size=\"2\" maxlength=\"2\" /><br />\n\t\t\t\t<input type=\"submit\" name=\"action\" value=\"" . __("Move") . "\" /> \n\t\t\t\t<input type=\"submit\" name=\"action\" value=\"" . __("Remove") . "\" />\n\t\t\t\t<input type=\"hidden\" name=\"fid\" value=\"{2}\" />\n\t\t\t</form>\n\n\t\t</div>\n", htmlval($forum['title']), htmlval($forum['description']), $forum['id'], $localMods, $forum['numthreads'], $forum['numposts'], $forum['forder'], MakeOptions($forum['catid']));
            }
        }
    }
    write("\n\t<div class=\"outline width50 margin\">\n\t\t<div class=\"errort\"><strong>" . __("Forum list") . "</strong></div>\n\t\t{0}\n\t</div>\n", $thelist);
}
write("\n\t<form action=\"editfora.php\" method=\"post\">\n\t\t<div class=\"outline width50 margin\">\n\t\t\t<div class=\"errort\"><strong>" . __("Add a Forum") . "</strong></div>\n\t\t\t<div class=\"errorc left cell1\" style=\"clear: both; overflow: auto;\">\n\t\t\t\t<div style=\"float: left; width: 60%;\">\n\t\t\t\t\t<input type=\"text\" name=\"title\" style=\"width: 70%;\" /><br/>\n\t\t\t\t\t<input type=\"text\" name=\"description\" style=\"width: 90%;\" />\n\t\t\t\t</div>\n\t\t\t\t{0}\n \t\t\t\t<input type=\"text\" name=\"order\" value=\"0\" size=\"2\" maxlength=\"2\" /> \n\t\t\t\t{1}\n\t\t\t\t<input type=\"submit\" name=\"action\" value=\"Add\" /> \n\t\t\t</div>\n\t\t</div>\n\t</form>\n\n\t<p>\n\t\t" . __("For more complex things, try PMA. This is just a toy-like quick access.") . "\n\t</p>\n", MakeOptions(-1), $levels);
function MakeOptions($catid)
{
    $sel[$catid] = " selected=\"true\"";
    $qFora = "select id,name from categories";
    $rFora = Query($qFora);
    $result = "<select name=\"category\" size=\"1\">";
    while ($forum = Fetch($rFora)) {
        $result .= "<option value=\"" . $forum['id'] . "\"" . $sel[$forum['id']] . "\\>" . $forum['name'] . "</option>";
    }
    $result .= "</select>";
    return $result;
}