Question: Password Php Mysql Save

Password Php Mysql Save

Hello Can someone help me with the problem I have please. I made a registration form for the private shop when I insert the data, everything is inserted in database at the moment of login,

AP

Abdullah Patel

Asked
Hello
Can someone help me with the problem I have please.

I made a registration form for the private shop when I insert the data, everything is inserted in database at the moment of login, it gives me a login error, what I see is that the password is not encrypted the same as the system that I can do in that case by please help me.

$query = "INSERT INTO sma_users (username, first_name, last_name, phone, email, password, group_id) VALUES
('" . $_POST["userName"] . "', '" . $_POST["firstName"] . "', '" . $_POST["lastName"] . "', '" . $_POST["phone"] . "', '" . $_POST["userEmail"] . "', '" . crypt($_POST["password"]) . "', '" . $_POST["gender"] . "')";
$current_id = $db_handle->insertQuery($query);
  • MS

    Mian Saleem

    Answered
    Hello,

    You need to hash password before saving to database. You can use following method to save user. `register` method will hash the password before saving to database.

    ```php
    $this->load->library('ion_auth');
    /*
    * $username string
    * $password string
    * $email string
    * $additional_data array
    * $active boolean
    */
    $this->ion_auth->register($username, $password, $email, $additional_data, $active)
    ```

    > Please be informed that we don't offer support for modifications and modified versions. You are allowed to modify the item code at your own risk as per license.

    Thank you
  • AP

    Abdullah Patel

    Answered
    Thank You ver much
  • Login to Reply