Browse code

#17 php warning fix

Jimako authored on 2026/04/29 10:53:51
Showing 1 changed files
... ...
@@ -169,13 +169,20 @@ if(isset($_POST['submit'])) {
169 169
 		$smtp_password = $_POST['newsmtp_password'];
170 170
 		$result = dbquery("UPDATE ".$settingsprefix."fanfiction_settings SET smtp_host = '$smtp_host', smtp_username = '$smtp_username', smtp_password = '$smtp_password' WHERE sitekey ='".SITEKEY."'");
171 171
 	}
172
-	if($result) {
172
+	if ($result) {
173 173
 		$output .= write_message(_ACTIONSUCCESSFUL);
174
-		$sect = $sects[(array_search($sect, $sects) + 1)];
175
-		if(!$sect) $sect = $sects[0];
174
+		
175
+		$idx = array_search($sect, $sects);
176
+		if ($idx !== false) {
177
+			$next_idx = $idx + 1;
178
+			if ($next_idx >= count($sects)) {
179
+				$next_idx = 0;
180
+			}
181
+			$sect = $sects[$next_idx];
182
+		}
183
+	} else {
184
+		$output .= write_error(_ERROR);
176 185
 	}
177
-	else $output .= write_error(_ERROR);
178
-}
179 186
 	$settingsresults = dbquery("SELECT * FROM ".$settingsprefix."fanfiction_settings WHERE sitekey ='".SITEKEY."'");
180 187
 	$settings = dbassoc($settingsresults);
181 188