keep default value be integer

This commit is contained in:
xiaomlove
2021-01-06 01:39:45 +08:00
parent 9bce2ac1a4
commit 28ab56fe70
5 changed files with 31 additions and 31 deletions

View File

@@ -148,7 +148,7 @@ echo "<tr><td>".$row["name"]."</td><td>".$row["url"]."</td><td>".$row["title"].
echo "</table>";
?>
<?php if ($_GET['action'] == "edit") {
$id = ($_GET["id"] ?? 0);
$id = intval($_GET["id"] ?? 0);
$result = sql_query ("SELECT * FROM links where id = ".sqlesc($id));
if ($row = mysql_fetch_array($result)) {
?>

View File

@@ -177,10 +177,10 @@ else {
elseif (isset($_POST['do']) && $_POST['do'] == "add")
sql_query ("INSERT INTO chronicle (userid,added, txt) VALUES ('".$CURUSER["id"]."', now(), ".sqlesc($txt).")") or sqlerr(__FILE__, __LINE__);
elseif (isset($_POST['do'] ) && $_POST['do'] == "update"){
$id = $_POST['id'] ?? 0;
$id = intval($_POST['id'] ?? 0);
if (!$id) { header("Location: log.php?action=chronicle"); die();}
else sql_query ("UPDATE chronicle SET txt=".sqlesc($txt)." WHERE id=".$id) or sqlerr(__FILE__, __LINE__);}
else {$id = ($_GET['id'] ?? 0);
else {$id = (intval($_GET['id'] ?? 0));
if (!$id) { header("Location: log.php?action=chronicle"); die();}
elseif ($_GET['do'] == "del")
sql_query ("DELETE FROM chronicle where id = '".$id."'") or sqlerr(__FILE__, __LINE__);
@@ -315,7 +315,7 @@ else {
break;
case "poll":
$do = $_GET["do"] ?? '';
$pollid = $_GET["pollid"] ?? 0;
$pollid = intval($_GET["pollid"] ?? 0);
$returnto = htmlspecialchars($_GET["returnto"] ?? '');
if ($do == "delete")
{

View File

@@ -96,17 +96,17 @@ if(get_user_class()>=$torrentonpromotion_class)
{
if(!isset($_POST["sel_spstate"]) || $_POST["sel_spstate"] == 1)
$updateset[] = "sp_state = 1";
elseif(($_POST["sel_spstate"] ?? 0) == 2)
elseif(intval($_POST["sel_spstate"] ?? 0) == 2)
$updateset[] = "sp_state = 2";
elseif(($_POST["sel_spstate"] ?? 0) == 3)
elseif(intval($_POST["sel_spstate"] ?? 0) == 3)
$updateset[] = "sp_state = 3";
elseif(($_POST["sel_spstate"] ?? 0) == 4)
elseif(intval($_POST["sel_spstate"] ?? 0) == 4)
$updateset[] = "sp_state = 4";
elseif(($_POST["sel_spstate"] ?? 0) == 5)
elseif(intval($_POST["sel_spstate"] ?? 0) == 5)
$updateset[] = "sp_state = 5";
elseif(($_POST["sel_spstate"] ?? 0) == 6)
elseif(intval($_POST["sel_spstate"] ?? 0) == 6)
$updateset[] = "sp_state = 6";
elseif(($_POST["sel_spstate"] ?? 0) == 7)
elseif(intval($_POST["sel_spstate"] ?? 0) == 7)
$updateset[] = "sp_state = 7";
//promotion expiration type
@@ -128,9 +128,9 @@ if(get_user_class()>=$torrentonpromotion_class)
}
if(get_user_class()>=$torrentsticky_class)
{
if(($_POST["sel_posstate"] ?? 0) == 0)
if(intval($_POST["sel_posstate"] ?? 0) == 0)
$updateset[] = "pos_state = 'normal'";
elseif(($_POST["sel_posstate"] ?? 0) == 1)
elseif(intval($_POST["sel_posstate"] ?? 0) == 1)
$updateset[] = "pos_state = 'sticky'";
}
@@ -138,28 +138,28 @@ $pick_info = "";
$place_info = "";
if(get_user_class()>=$torrentmanage_class && $CURUSER['picker'] == 'yes')
{
if(($_POST["sel_recmovie"] ?? 0) == 0)
if(intval($_POST["sel_recmovie"] ?? 0) == 0)
{
if($row["picktype"] != 'normal')
$pick_info = ", recomendation canceled!";
$updateset[] = "picktype = 'normal'";
$updateset[] = "picktime = '0000-00-00 00:00:00'";
}
elseif(($_POST["sel_recmovie"] ?? 0) == 1)
elseif(intval($_POST["sel_recmovie"] ?? 0) == 1)
{
if($row["picktype"] != 'hot')
$pick_info = ", recommend as hot movie";
$updateset[] = "picktype = 'hot'";
$updateset[] = "picktime = ". sqlesc(date("Y-m-d H:i:s"));
}
elseif(($_POST["sel_recmovie"] ?? 0) == 2)
elseif(intval($_POST["sel_recmovie"] ?? 0) == 2)
{
if($row["picktype"] != 'classic')
$pick_info = ", recommend as classic movie";
$updateset[] = "picktype = 'classic'";
$updateset[] = "picktime = ". sqlesc(date("Y-m-d H:i:s"));
}
elseif(($_POST["sel_recmovie"] ?? 0) == 3)
elseif(intval($_POST["sel_recmovie"] ?? 0) == 3)
{
if($row["picktype"] != 'recommended')
$pick_info = ", recommend as recommended movie";

View File

@@ -101,7 +101,7 @@ if ($allsec == 1) //show torrents from all sections
// ----------------- end whether ignoring section ---------------------//
// ----------------- start bookmarked ---------------------//
if ($_GET)
$inclbookmarked = $_GET["inclbookmarked"] ?? 0;
$inclbookmarked = intval($_GET["inclbookmarked"] ?? 0);
elseif ($CURUSER['notifs']){
if (strpos($CURUSER['notifs'], "[inclbookmarked=0]") !== false)
$inclbookmarked = 0;
@@ -139,7 +139,7 @@ if (!isset($CURUSER) || get_user_class() < $seebanned_class)
$wherea[] = "banned != 'yes'";
// ----------------- start include dead ---------------------//
if (isset($_GET["incldead"]))
$include_dead = $_GET["incldead"] ?? 0;
$include_dead = intval($_GET["incldead"] ?? 0);
elseif ($CURUSER['notifs']){
if (strpos($CURUSER['notifs'], "[incldead=0]") !== false)
$include_dead = 0;
@@ -172,7 +172,7 @@ elseif ($include_dead == 2) //dead
}
// ----------------- end include dead ---------------------//
if ($_GET)
$special_state = $_GET["spstate"] ?? 0;
$special_state = intval($_GET["spstate"] ?? 0);
elseif ($CURUSER['notifs']){
if (strpos($CURUSER['notifs'], "[spstate=0]") !== false)
$special_state = 0;
@@ -291,19 +291,19 @@ elseif ($special_state == 7) //30% down
}
}
$category_get = $_GET["cat"] ?? 0;
$category_get = intval($_GET["cat"] ?? 0);
$source_get = $medium_get = $codec_get = $standard_get = $processing_get = $team_get = $audiocodec_get = 0;
if ($showsubcat){
if ($showsource) $source_get = $_GET["source"] ?? 0;
if ($showmedium) $medium_get = $_GET["medium"] ?? 0;
if ($showcodec) $codec_get = $_GET["codec"] ?? 0;
if ($showstandard) $standard_get = $_GET["standard"] ?? 0;
if ($showprocessing) $processing_get = $_GET["processing"] ?? 0;
if ($showteam) $team_get = $_GET["team"] ?? 0;
if ($showaudiocodec) $audiocodec_get = $_GET["audiocodec"] ?? 0;
if ($showsource) $source_get = intval($_GET["source"] ?? 0);
if ($showmedium) $medium_get = intval($_GET["medium"] ?? 0);
if ($showcodec) $codec_get = intval($_GET["codec"] ?? 0);
if ($showstandard) $standard_get = intval($_GET["standard"] ?? 0);
if ($showprocessing) $processing_get = intval($_GET["processing"] ?? 0);
if ($showteam) $team_get = intval($_GET["team"] ?? 0);
if ($showaudiocodec) $audiocodec_get = intval($_GET["audiocodec"] ?? 0);
}
$all = $_GET["all"] ?? 0;
$all = intval($_GET["all"] ?? 0);
if (!$all)
{
@@ -675,14 +675,14 @@ if (isset($searchstr))
else{
$notnewword="notnewword=1&";
}
$search_mode = $_GET["search_mode"] ?? 0;
$search_mode = intval($_GET["search_mode"] ?? 0);
if (!in_array($search_mode,array(0,1,2)))
{
$search_mode = 0;
write_log("User " . $CURUSER["username"] . "," . $CURUSER["ip"] . " is hacking search_mode field in" . $_SERVER['SCRIPT_NAME'], 'mod');
}
$search_area = $_GET["search_area"] ?? 0 ;
$search_area = intval($_GET["search_area"] ?? 0) ;
if ($search_area == 4) {
$searchstr = (int)parse_imdb_id($searchstr);

View File

@@ -8,7 +8,7 @@ if (get_user_class() < $viewuserlist_class)
permissiondenied();
$search = trim($_GET['search']);
$class = $_GET['class'];
$country = $_GET['country'] ?? 0;
$country = intval($_GET['country'] ?? 0);
$letter = trim($_GET["letter"]);
if (strlen($letter) > 1)