0

i'm trying to register a user (from an Android app) to my server.

For my website, it works well and i receive my JSON response.

Into my app, when i send the request if all the data are good and the person is registered i do not get any response.

It's the same function ...

I found the line where, after this line i do not get any response on my app.

It's the one when i call my model to save the guy in my database. To encrypt his password, i use BCrypt with a cost of 13.

I thought it would take a long time and maybe the timeout of AsyncHttp was too small but it's 10s and on the website the user does not wait more than 1s when he get registered.


I didn't put any code because it's working perfectly on the website, and on the app i get all the error messages if there are any. It's just when i use BCrypt on the server, my app doesn't get any response ...

Any idea why ? I'd really appreciate any help. Thanks in advance ! :)


EDIT : Here's some code if that can help

// if mail already exists, refuse
if ($this->inscrit_model->does_mail_exists($mail) && !$this->inscrit_model->does_mail_exists_and_free($mail)) {         
    $response = array('status' => 'failed', 'error' => 'mail_already_exists');
    $data = json_encode($response);
    echo $data;
    return 0;
}

// if nickname already exists, refuse
if ($this->inscrit_model->does_pseudo_exists($pseudo) && !$this->inscrit_model->does_pseudo_exists_and_free($pseudo)) {         
    $response = array('status' => 'failed', 'error' => 'nickname_already_exists');
    $data = json_encode($response);
    echo $data;
    return 0;
}

// if the mail is available (used in projects but not registered), just make an update
if ($this->inscrit_model->does_mail_exists_and_free($mail)) {
    // le mail est deja present dans certains projets, on fait donc une maj pour l'inscrire
    $id_pers = $this->inscrit_model->update_inscrit($prenom, $nom, $pseudo, $id_facebook, $mail, $mdp);
}

// all is good, create the new user
else {
    // on crée par insert le nouvel inscrit
    $id_pers = $this->inscrit_model->creer_inscrit($prenom, $nom, $pseudo, $id_facebook, $mail, $mdp);
}

creer_inscrit function (to register the new guy) :

public function creer_inscrit ($p_prenom, $p_nom, $p_pseudo, $p_id_facebook, $p_mail, $p_mdp) {

    // mise en minuscule sauf premieres lettres (prenom/nom)
    $p_prenom = ucfirst(strtolower($p_prenom));
    $p_nom = ucfirst(strtolower($p_nom));
    $p_mail = strtolower($p_mail);

    $this->db->set('prenom', $p_prenom)
             ->set('nom', $p_nom)
             ->set('pseudo', $p_pseudo)
             ->set('idFacebook', $p_id_facebook)
             ->set('mail', $p_mail)
             ->set('mdp', $p_mdp)
             ->set('dateInscription', date("Y-m-d H:i:s"))
             ->set('dateDerniereCo', date("Y-m-d H:i:s"))
             ->insert('personne'); 

    return $this->db->insert_id();
}

If i call the function from a browser, it works, if i call the function from my android app, i do not get any answer from the server when it reachs the line

$id_pers = $this->inscrit_model->update_inscrit($prenom, $nom, $pseudo, $id_facebook, $mail, $mdp);

I can get the errors before like for example nickname_already_exists.

Thanks

maxime1992
  • 22,502
  • 10
  • 80
  • 121
  • No one as any idea ? even a clue ? – maxime1992 May 07 '14 at 07:22
  • 1
    at least post some code from mobile app, are you sure values sent correctly to server, use log on the server side, print all received values, and set log on registration process, see where it get stuck ... – Yazan May 07 '14 at 07:29
  • @Yazan i've added some code :) – maxime1992 May 07 '14 at 07:42
  • 1
    i think an error occurs at creer_inscrit(), save all params to a file, and check that file when the app calls the register process. i don't see error handling so it might be ... – Yazan May 07 '14 at 07:51
  • Thaaaaank you so much @Yazan !!! I didn't know how to use the log in codeigniter, i spotted that $id_facebook was not defined ... Your comment will help me a lot for next problems ;) ! cheers – maxime1992 May 07 '14 at 08:52

0 Answers0