ALTER TABLE users MODIFY id INT AUTO_INCREMENT;//$gender = $_POST["gender"];
if ($_SERVER["REQUEST_METHOD"] == "POST") {
if (empty($_POST["gender"])) {
$error_gender = "Choose gender.";
} else {
$gender = $_POST["gender"];
// ... usual gender choosing
}
}
<tr>
<td><?php echo T_("GENDER"); ?>:</td>
<td>
<input type="radio" name="gender" value="Male" /><?php echo T_("MALE"); ?>
<input type="radio" name="gender" value="Female" /><?php echo T_("FEMALE"); ?>
</td>
</tr><tr>
<td><?php echo T_("GENDER"); ?>:</td>
<td>
<input type="radio" name="gender" value="Male"
<?php if (!empty($_POST["gender"]) && $_POST["gender"] == "Male") echo "checked"; ?>
/> <?php echo T_("MALE"); ?>
<input type="radio" name="gender" value="Female"
<?php if (!empty($_POST["gender"]) && $_POST["gender"] == "Female") echo "checked"; ?>
/> <?php echo T_("FEMALE"); ?>
<?php if (!empty($error_gender)) { ?>
<div style="color:red;"><?php echo $error_gender; ?></div>
<?php } ?>
</td>
</tr>
<link rel="stylesheet" href="./snow/snow.style.css"><script src="./snow/snow.script.js"></script>
<table border="0" cellpadding="3" align="center"><div align="center"></table></div>
<?php
// Updated login for sql security May 14 2023
require_once("backend/functions.php");
dbconn();
session_start();
$site_config["LEFTNAV"] = $site_config["MIDDLENAV"] = $site_config["RIGHTNAV"] = false;
if (!empty($_REQUEST["returnto"])) {
if (!isset($_GET["nowarn"])) {
$nowarn = T_("MEMBERS_ONLY");
}
}
if (isset($_POST["username"]) && isset($_POST["password"])) {
if (!empty($_POST["username"]) && !empty($_POST["password"])) {
$username = $_POST["username"];
$password = $_POST["password"];
$password_hash = passhash($password);
$stmt = $GLOBALS["DBconnector"]->prepare("SELECT id, password, secret, status, enabled FROM users WHERE username = ? LIMIT 1");
$stmt->bind_param("s", $username);
$stmt->execute();
if ($stmt->error) {
die("Query failed: " . $stmt->error);
}
$res = $stmt->get_result();
$row = $res->fetch_assoc();
if ($row) {
if ($row["password"] !== $password_hash) {
$message = T_("LOGIN_INCORRECT");
} elseif ($row["status"] === "pending") {
$message = T_("ACCOUNT_PENDING");
} elseif ($row["enabled"] === "no") {
$message = T_("ACCOUNT_DISABLED");
}
} else {
$message = T_("NO_EMPTY_FIELDS");
}
if (!$message) {
logincookie($row["id"], $row["password"], $row["secret"]);
if (!empty($_POST["returnto"])) {
header("Refresh: 0; url=" . $_POST["returnto"]);
die();
} else {
header("Refresh: 0; url=index.php");
die();
}
} else {
show_error_msg(T_("ACCESS_DENIED"), $message, 1);
}
}
}
logoutcookie();
stdhead(T_("LOGIN"));
if (isset($nowarn)) {
show_error_msg(T_("ERROR"), $nowarn, 0);
}
begin_frame(T_("LOGIN"));
?>
<form method="post" action="account-login.php">
<div align="center">
<table border="0" width="70%" cellspacing="5" cellpadding="5">
<tr><td align="center"><b><?php echo T_("USERNAME"); ?>:</b> <input type="text" size="40" name="username" /></td></tr>
<tr><td align="center"><b><?php echo T_("PASSWORD"); ?>: </b> <input type="password" size="40" name="password" /></td></tr>
<tr><td> </td></tr>
<tr><td colspan="2" align="center"><input type="submit" value="<?php echo T_("LOGIN"); ?>" /><br /><br /><i><?php echo T_("COOKIES");?></i></td></tr>
<?php
if (!empty($_REQUEST["returnto"])) {
?>
<input type="hidden" name="returnto" value="<?php echo cleanstr($_REQUEST["returnto"]); ?>" />
<?php
}
?>
</form>
<td colspan="2" align="center">
<p align="center">
<a href="account-signup.php"><?php echo T_("SIGNUP"); ?></a> |
<a href="account-recover.php"><?php echo T_("RECOVER_ACCOUNT"); ?></a>
</p>
</td>
</tr>
</table> </div>
<?php
end_frame();
stdfoot();
?>
//==| sticky
if(get_user_class() >= 5){ // lowest class to make torrent sticky.
$sty = $_POST["sty"];
if ($sty == "yes") {
$sticky = "yes";
} else {
$sticky = "no";
}
}
//==| Sticky
?><tr><td align='left' class='css' valign='top'><?php echo T_("T_STICKY"); ?>:</td>
<td align='left' class='css-right' valign='top'><?php printf("<input name='sty' value='yes' type='radio' ".($sty ? " checked='checked'" : "")." /> ".T_("YES")."
<input name='sty' value='no' type='radio' ".(!$sty ? " checked='checked'" : "")." /> ".T_("NO").""); ?> <i><?php echo T_("STICKY_MSG");?></i></td></tr><?php
function logincookie($id, $password, $secret, $remember = false, $updatedb = 1, $expires = 0x7fffffff) {
//if ( !$remember ) $expires = null;//
$hash = sha1($id.$secret.$password.getip().$secret);
setcookie("pass", $hash, $expires, "/");
setcookie("uid", $id, $expires, "/");
if ($updatedb)
SQL_Query_exec("UPDATE users SET last_login = '".get_date_time()."' WHERE id = $id");
}
function logoutcookie() {
setcookie("pass", null, time(), "/");
setcookie("uid", null, time(), "/");
}
echo "<div id='uOnline' class='bMenu' ><center>";echo "<div id='uOnline' class='list' align='left'>";
.list {
display: flex;
flex-direction: column;
}
.Tsiz {
background-color:#f5f5f5;
-moz-border-radius: 2;
border-radius: 2px;
font-family: "Cagliostro", sans-serif;
font-size: 12px;
padding: 2px 4px 2px 4px;
border: solid #505050 1px;
text-decoration: none;
text-align: left;
min-width:75px;
margin-bottom: 5px;
}