Issues (1369)

login.php (3 issues)

1
<?php
2
3
/**
4
 * login.php
5
 *
6
 * @version 2.0 Security checks & tests by Gorlum for http://supernova.ws
7
 * @version 1.1 Security checks & tests by Gorlum for http://supernova.ws
8
 * @version 1.0
9
 * @copyright 2008 by ?????? for XNova
10
 */
11
12
define('LOGIN_LOGOUT', true);
13
14
$allow_anonymous = true;
15
16
include('includes/init.' . substr(strrchr(__FILE__, '.'), 1));
17
// die();
18
if($template_result[F_USER_IS_AUTHORIZED]) {
19
  sys_redirect('index' . DOT_PHP_EX);
20
}
21
lng_include('login');
22
lng_include('admin');
23
24
$username_unsafe = sys_get_param_str_unsafe('username');
25
$password_raw = trim(sys_get_param('password'));
0 ignored issues
show
It seems like sys_get_param('password') can also be of type array; however, parameter $string of trim() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

25
$password_raw = trim(/** @scrutinizer ignore-type */ sys_get_param('password'));
Loading history...
26
$password_repeat_raw = trim(sys_get_param('password_repeat'));
27
$email = sys_get_param_str('email');
28
29
30
$template = SnTemplate::gettemplate('login_body', true);
0 ignored issues
show
true of type true is incompatible with the type null|template expected by parameter $template of SnTemplate::gettemplate(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

30
$template = SnTemplate::gettemplate('login_body', /** @scrutinizer ignore-type */ true);
Loading history...
31
$template->assign_vars(array(
32
  'last_user'    => db_user_last_registered_username(),
0 ignored issues
show
Deprecated Code introduced by
The function db_user_last_registered_username() has been deprecated. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

32
  'last_user'    => /** @scrutinizer ignore-deprecated */ db_user_last_registered_username(),
Loading history...
33
  'online_users' => db_user_count(true),
34
  'id_ref' => sys_get_param_int('id_ref'),
35
  'F_LOGIN_MESSAGE' => $template_result[F_LOGIN_MESSAGE],
36
  'F_LOGIN_STATUS' => $template_result[F_LOGIN_STATUS],
37
  'LOGIN_ERROR_USERNAME' => LOGIN_ERROR_USERNAME,
38
  'LOGIN_ERROR_PASSWORD' => LOGIN_ERROR_PASSWORD,
39
  'REGISTER_ERROR_EMAIL_EXISTS' => REGISTER_ERROR_EMAIL_EXISTS,
40
  'PASSWORD_RESTORE_ERROR_WRONG_EMAIL' => PASSWORD_RESTORE_ERROR_EMAIL_NOT_EXISTS,
41
  'USERNAME'     => htmlentities($username_unsafe, ENT_QUOTES, 'UTF-8'),
42
  'EMAIL'     => htmlentities($email, ENT_QUOTES, 'UTF-8'),
43
  'PASSWORD'     => htmlentities($password_raw, ENT_QUOTES, 'UTF-8'),
44
  'PASSWORD_REPEAT' => htmlentities($password_repeat_raw, ENT_QUOTES, 'UTF-8'),
45
  'URL_RULES'    => SN::$config->url_rules,
46
  'URL_FORUM'    => SN::$config->url_forum,
47
  'URL_FAQ'      => SN::$config->url_faq,
48
  'GAME_BLITZ'   => SN::$config->game_mode == GAME_BLITZ,
49
));
50
51
SnTemplate::tpl_login_lang($template);
52
53
SnTemplate::display($template, $lang['Login']);
54