mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-24 12:07:23 +08:00
fix some security issues + change username min length to 3
This commit is contained in:
+25
-14
@@ -19,23 +19,34 @@ if (empty($_POST["usernw"]) && empty($_POST["desact"]) && empty($_POST["delete"]
|
||||
|
||||
if (!empty($_POST["usernw"]))
|
||||
{
|
||||
$msg = sqlesc("Your Warning Has Been Removed By: " . $CURUSER['username'] . ".");
|
||||
$added = sqlesc(date("Y-m-d H:i:s"));
|
||||
$userid = implode(", ", $_POST['usernw']);
|
||||
//sql_query("INSERT INTO messages (sender, receiver, msg, added) VALUES (0, $userid, $msg, $added)") or sqlerr(__FILE__, __LINE__);
|
||||
//$msg = sqlesc("Your Warning Has Been Removed By: " . $CURUSER['username'] . ".");
|
||||
//$added = sqlesc(date("Y-m-d H:i:s"));
|
||||
//$userid = implode(", ", $_POST['usernw']);
|
||||
////sql_query("INSERT INTO messages (sender, receiver, msg, added) VALUES (0, $userid, $msg, $added)") or sqlerr(__FILE__, __LINE__);
|
||||
//
|
||||
//$r = sql_query("SELECT modcomment FROM users WHERE id IN (" . implode(", ", $_POST['usernw']) . ")")or sqlerr(__FILE__, __LINE__);
|
||||
//$user = mysql_fetch_array($r);
|
||||
//$exmodcomment = $user["modcomment"];
|
||||
//$modcomment = date("Y-m-d") . " - Warning Removed By " . $CURUSER['username'] . ".\n". $modcomment . $exmodcomment;
|
||||
//sql_query("UPDATE users SET modcomment=" . sqlesc($modcomment) . " WHERE id IN (" . implode(", ", $_POST['usernw']) . ")") or sqlerr(__FILE__, __LINE__);
|
||||
//
|
||||
//$do="UPDATE users SET warned='no', warneduntil=null WHERE id IN (" . implode(", ", $_POST['usernw']) . ")";
|
||||
//$res=sql_query($do);
|
||||
|
||||
$r = sql_query("SELECT modcomment FROM users WHERE id IN (" . implode(", ", $_POST['usernw']) . ")")or sqlerr(__FILE__, __LINE__);
|
||||
$user = mysql_fetch_array($r);
|
||||
$exmodcomment = $user["modcomment"];
|
||||
$modcomment = date("Y-m-d") . " - Warning Removed By " . $CURUSER['username'] . ".\n". $modcomment . $exmodcomment;
|
||||
sql_query("UPDATE users SET modcomment=" . sqlesc($modcomment) . " WHERE id IN (" . implode(", ", $_POST['usernw']) . ")") or sqlerr(__FILE__, __LINE__);
|
||||
|
||||
$do="UPDATE users SET warned='no', warneduntil=null WHERE id IN (" . implode(", ", $_POST['usernw']) . ")";
|
||||
$res=sql_query($do);}
|
||||
$modcomment = date("Y-m-d") . " - Warning Removed By " . $CURUSER['username'];
|
||||
\App\Models\User::query()->whereIn('id', $_POST['usernw'])
|
||||
->update([
|
||||
'warned' => 'no',
|
||||
'warneduntil' => null,
|
||||
'modcomment' => \Nexus\Database\NexusDB::raw("if(modcomment = '', '$modcomment', concat_ws('\n', '$modcomment', modcomment))")
|
||||
]);
|
||||
}
|
||||
|
||||
if (!empty($_POST["desact"])){
|
||||
$do="UPDATE users SET enabled='no' WHERE id IN (" . implode(", ", $_POST['desact']) . ")";
|
||||
$res=sql_query($do);}
|
||||
//$do="UPDATE users SET enabled='no' WHERE id IN (" . implode(", ", $_POST['desact']) . ")";
|
||||
//$res=sql_query($do);
|
||||
\App\Models\User::query()->whereIn('id', $_POST['desact'])->update(['enabled' => 'no']);
|
||||
}
|
||||
}
|
||||
}
|
||||
header("Refresh: 0; url=warned.php");
|
||||
|
||||
Reference in New Issue
Block a user