These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | namespace AnkitJain\RegistrationModule; |
||
3 | require_once (dirname(__DIR__) . '/config/database.php'); |
||
4 | |||
5 | class Validate |
||
6 | { |
||
7 | protected $connect; |
||
8 | |||
9 | public function __construct() |
||
10 | { |
||
11 | $this->connect = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME); |
||
12 | } |
||
13 | |||
14 | View Code Duplication | public function validateEmailInDb($email) |
|
15 | { |
||
16 | $query = "SELECT login_id FROM login WHERE email = '$email'"; |
||
17 | if ($result = $this->connect->query($query)) |
||
18 | { |
||
19 | if ($result->num_rows > 0) { |
||
20 | return 1; |
||
21 | } |
||
22 | else |
||
23 | return 0; |
||
24 | } |
||
25 | } |
||
26 | |||
27 | View Code Duplication | function validateUsernameInDb($username) |
|
0 ignored issues
–
show
|
|||
28 | { |
||
29 | $query = "SELECT login_id FROM login WHERE username = '$username'"; |
||
30 | if ($result = $this->connect->query($query)) { |
||
31 | if ($result->num_rows > 0) { |
||
32 | return 1; |
||
33 | } |
||
34 | else |
||
35 | return 0; |
||
36 | } |
||
37 | } |
||
38 | } |
||
39 |
Adding explicit visibility (
private
,protected
, orpublic
) is generally recommend to communicate to other developers how, and from where this method is intended to be used.