andresbejarano / DentalRegistry

A data-management system for dental clinics. Keeps record of patients, appointments, treatments, procedures and budgets.
20 stars 10 forks source link

Login failed #5

Open nozge opened 4 years ago

nozge commented 4 years ago

Hello.. i cannot login into the web/app when i press login it doesnt show nothing.. ?? why I already inserted the user into database/user.. but still cannot connect into it.. Can u please help me thank you!

matst14 commented 3 years ago

Hi nozge.

For first, on index.php the form action is empty. You should add startsession.php: < form action="modules/startsession.php" id="loginform" method="post" > In the same file, you should add input with submit type: < input id="button" type="submit" value="Ingresar" / >

If you are using new version from php (version 7), yo should change in "modules/obhandler.php" getUserLoginData function, with something like this:

function getUserLoginData($username){
    $data = null;
    $link = mysqli_connect(self::DB_SERVER,self::DB_USERNAME,self::DB_PASSWORD);
    mysqli_select_db( $link, self::DB_NAME);
    $query = 'SELECT `id`,`firstname`,`middlename`,`firstlastname`,`secondlastname`,`sex`,`privileges` 
        FROM `sonri-citas`.`user` WHERE `username` = "' . $username . '"';
    $result = mysqli_query($link,$query);
    if(mysqli_num_rows($result) == 1){
        $data = mysqli_fetch_array($result);
    }
    mysqli_close($link);
    return $data;
}

With this (adding previously the user in database) it will work. But when access, does not redirect anywhere. Copy any url from the program, and you will see connected (like: http://localhost/dental/patientslist.php)

If you will use php version 7, you have to update all the code. Other option is to use php 5 version (not recommended). Note: In the sql you create de DB with "sonri-citas" name, but in the code the name are "dental". This generates confusion

Regards! Mat