Probleme en j2me
salihou_dev
Messages postés
8
Statut
Membre
-
STARGATE43 Messages postés 13754 Date d'inscription Statut Contributeur Dernière intervention -
STARGATE43 Messages postés 13754 Date d'inscription Statut Contributeur Dernière intervention -
Bonjour
je fais une authentification avec j2me qui fait la connection à la base donnée et qui fait un test sur l'existence d'un utilisateur saisi
j' ai un probleme dans la connection
lorsque j'ecris l' url dans le navigateur i n y a pas de probleme ,mais lorsque j'ai essayé sur wireless toolkit un message d'erreur "impossible d'etablir la connection "
s'affiche
Merci
mes code et fichier:
je fais une authentification avec j2me qui fait la connection à la base donnée et qui fait un test sur l'existence d'un utilisateur saisi
j' ai un probleme dans la connection
lorsque j'ecris l' url dans le navigateur i n y a pas de probleme ,mais lorsque j'ai essayé sur wireless toolkit un message d'erreur "impossible d'etablir la connection "
s'affiche
Merci
mes code et fichier:
connect.php::
<?php
$hostname_localhost ="localhost";
$database_localhost ="dbrecette";
$username_localhost ="root";
$password_localhost ="";
$con = mysql_connect($hostname_localhost,$username_localhost,$password_localhost)
or
trigger_error(mysql_error(),E_USER_ERROR);
?>
authentif.php
<?php
require_once('connect.php');
$mail= $_GET['email'];
$mdp= $_GET['pwd'];
mysql_select_db($database_localhost,$con);
$query_search = "SELECT * FROM utilisateur WHERE email LIKE '$mail' AND password LIKE '$mdp';";
$query_exec = mysql_query($query_search) or die(mysql_error());
if($query_exec!=null){
$[/contents/1332-introduction-a-xml xml] = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
$root_element = "utilisateur";
$xml .= "<$root_element>";
while($result_array = mysql_fetch_assoc($query_exec))
{
$xml .= "<utilisateur>";
foreach($result_array as $key => $value)
{
//$key holds the table column name
$xml .= "<$key>";
//embed the SQL data in a CDATA element to avoid XML entity issues
$xml .= "<![CDATA[$value]]>";
//and close the element
$xml .= "</$key>";
}
$xml.="</utilisateur>";
}
//close the root element
$xml .= "</$root_element>";
//send the xml header to the browser
header ("Content-Type:text/xml");
//output the XML data
echo $xml;
}
?>
midlet:
public void commandAction(Command c, Displayable d) {
if ((c == Signin) && (d == formauth)) {
Thread t= new Thread(new Runnable() {
public void run() {
try {
PersonHandler personHand = new PersonHandler();
String urlauth = "[http://localhost/parsing/authentif.php?email=]"+tf_authmail.getString()+"&pwd="+tf_authMdp.getString();
SAXParser parser = SAXParserFactory.newInstance().newSAXParser();
HttpConnection hc = (HttpConnection) Connector.open(urlauth);
DataInputStream dis = new DataInputStream(hc.openDataInputStream());
parser.parse(dis, personHand);
utilisateur = personHand.getPerson();
if (utilisateur.length != 0) {
clcurr = utilisateur[0];
tb.setString(clcurr.getNom());
disp.setCurrent(form);
// disp.setCurrent(lst);
// disp.setCurrent(new CanvasMenu());
} else {
Alert al = new Alert("ERROR", "verifiez vos données", null, AlertType.INFO);
disp.setCurrent(al);
}
} catch (Exception e) {
disp.setCurrent(new Alert("Error", "Impossible d'etablir la connection", null, AlertType.ERROR), formauth);
}
}
});
t.start();
}
1 réponse
-
Bonsoir,
Les intervenants du forum n'étant pas des robots, mais des êtres humains agissant bénévolement, quelques mots de politesse sont toujours les bienvenus.
Une phrase commençant par "bonjour/bonsoir", "s'il vous plaît" et se finissant par "merci d'avance" a plus de chance d'avoir rapidement une réponse de qualité.
https://www.commentcamarche.net/infos/25855-charte-d-utilisation-de-commentcamarche-net-respect-d-autrui/
https://www.commentcamarche.net/infos/25857-charte-de-commentcamarche-net-conseils-d-ecriture/
http://piiiceandlauve.p.i.pic.centerblog.net/5phgausy.gif
Merci de votre compréhension.
STARGATE43, Contributeur CCM.