Issues (4542)

cek_login.php (10 issues)

1
<?php
2
include 'config/koneksi.php';
3
function anti_injection($data)
4
{
5
    $filter = mysql_real_escape_string(stripslashes(strip_tags(htmlspecialchars($data, ENT_QUOTES))));
0 ignored issues
show
Deprecated Code introduced by
The function mysql_real_escape_string() has been deprecated: 5.5 Escapes special characters in a string for use in an SQL statement ( Ignorable by Annotation )

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

5
    $filter = /** @scrutinizer ignore-deprecated */ mysql_real_escape_string(stripslashes(strip_tags(htmlspecialchars($data, ENT_QUOTES))));

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
6
7
    return $filter;
8
}
9
10
//$pass=md5($_POST[password]);
11
12
$userid = anti_injection($_POST['userid']);
13
$pass = anti_injection($_POST['password']);
14
$module = anti_injection($_POST['module']);
15
16
$login = mysql_query("SELECT a.*,b.id_tipe_sales 
0 ignored issues
show
Deprecated Code introduced by
The function mysql_query() has been deprecated: 5.5 Send a MySQL query ( Ignorable by Annotation )

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

16
$login = /** @scrutinizer ignore-deprecated */ mysql_query("SELECT a.*,b.id_tipe_sales 

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
17
                    FROM user a LEFT JOIN groups b
18
                    on a.id_groups = b.id_groups
19
                    WHERE a.id_user='$userid' AND a.password='$pass' and a.aktif='Y'");
20
21
$find = mysql_num_rows($login);
0 ignored issues
show
Deprecated Code introduced by
The function mysql_num_rows() has been deprecated: 5.5 ( Ignorable by Annotation )

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

21
$find = /** @scrutinizer ignore-deprecated */ mysql_num_rows($login);

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
22
$r = mysql_fetch_array($login);
0 ignored issues
show
Deprecated Code introduced by
The function mysql_fetch_array() has been deprecated: 5.5 Fetch a result row as an associative array, a numeric array, or both ( Ignorable by Annotation )

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

22
$r = /** @scrutinizer ignore-deprecated */ mysql_fetch_array($login);

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
23
24
// Apabila userid dan password ditemukan
25
if ($find > 0) {
26
    session_start();
27
28
    $id_user = $r['id_user'];
29
    $_SESSION['userid'] = $r['id_user'];
30
    $_SESSION['username'] = $r['username'];
31
    $_SESSION['iusername'] = $r['username'];
32
    $_SESSION['password'] = $r['password'];
33
    $_SESSION['groups'] = $r['id_groups'];
34
    $_SESSION['tipe_sales'] = $r['id_tipe_sales'];
35
    $_SESSION['outlet'] = $r['id_outlet'];
36
    $_SESSION['role'] = $r['role'];
37
    $_SESSION['pict'] = $r['pict'];
38
    $_SESSION['r_input'] = $r['r_input'];
39
    $_SESSION['r_edit'] = $r['r_edit'];
40
    $_SESSION['r_delete'] = $r['r_delete'];
41
    $_SESSION['r_admin'] = $r['r_admin'];
42
43
    $gsql = mysql_query("SELECT main_page FROM groups WHERE id_groups ='$r[id_groups]'");
0 ignored issues
show
Deprecated Code introduced by
The function mysql_query() has been deprecated: 5.5 Send a MySQL query ( Ignorable by Annotation )

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

43
    $gsql = /** @scrutinizer ignore-deprecated */ mysql_query("SELECT main_page FROM groups WHERE id_groups ='$r[id_groups]'");

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
44
    $g = mysql_fetch_array($gsql);
0 ignored issues
show
Deprecated Code introduced by
The function mysql_fetch_array() has been deprecated: 5.5 Fetch a result row as an associative array, a numeric array, or both ( Ignorable by Annotation )

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

44
    $g = /** @scrutinizer ignore-deprecated */ mysql_fetch_array($gsql);

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
45
46
    if ($g['main_page']) {
47
        $lmodule = $g['main_page'];
48
    } else {
49
        $lmodule = '?module='.$module;
50
    }
51
52
    $sql = mysql_query("SELECT * FROM modul WHERE link ='$lmodule'");
0 ignored issues
show
Deprecated Code introduced by
The function mysql_query() has been deprecated: 5.5 Send a MySQL query ( Ignorable by Annotation )

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

52
    $sql = /** @scrutinizer ignore-deprecated */ mysql_query("SELECT * FROM modul WHERE link ='$lmodule'");

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
53
54
    $r = mysql_fetch_array($sql);
0 ignored issues
show
Deprecated Code introduced by
The function mysql_fetch_array() has been deprecated: 5.5 Fetch a result row as an associative array, a numeric array, or both ( Ignorable by Annotation )

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

54
    $r = /** @scrutinizer ignore-deprecated */ mysql_fetch_array($sql);

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
55
56
    if ($r['id_modul']) {
57
        $imodule = $r['link'];
58
        $id_module = $r['id_modul'];
59
        $kode = $r['kode'];
60
    } else {
61
        $imodule = '?home';
62
        $id_module = '54';
63
        $kode = '';
64
    }
65
66
    // update user last login
67
    $loginDateFormat = 'Y-m-d H:i:s';
68
    $last_login = date($loginDateFormat, time());
69
    $sql = mysql_query("UPDATE user SET last_login='$last_login' WHERE id_user='$id_user'");
0 ignored issues
show
Deprecated Code introduced by
The function mysql_query() has been deprecated: 5.5 Send a MySQL query ( Ignorable by Annotation )

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

69
    $sql = /** @scrutinizer ignore-deprecated */ mysql_query("UPDATE user SET last_login='$last_login' WHERE id_user='$id_user'");

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
70
71
    // user_log
72
    user_log('Login ke Aplikasi Puskesmas');
73
74
    header('location:main.php'.$imodule.'&id_module='.$id_module.'&kode='.$kode.'');
75
} else {
76
    echo "<script>window.alert('User Id atau password tidak cocok.'); window.location=('index.php?userid=$userid&module=$module')</script>"; ?>
77
78
<?php
79
}
80
?>
0 ignored issues
show
It is not recommended to use PHP's closing tag ?> in files other than templates.

Using a closing tag in PHP files that only contain PHP code is not recommended as you might accidentally add whitespace after the closing tag which would then be output by PHP. This can cause severe problems, for example headers cannot be sent anymore.

A simple precaution is to leave off the closing tag as it is not required, and it also has no negative effects whatsoever.

Loading history...
81