salihou_dev
Messages postés6Date d'inscriptionlundi 1 décembre 2014StatutMembreDernière intervention19 février 2019
-
Modifié par BunoCS le 9/01/2015 à 09:47
BunoCS
Messages postés15472Date d'inscriptionlundi 11 juillet 2005StatutModérateurDernière intervention25 mars 2024
-
9 janv. 2015 à 09:48
Bonjour, j'ai cherché une solution à ma probleme depuis 5 jours
si quelqu'un peux m'aider
j'ai fait une authentification en j2me le probleme est à cause de la connection
si j'ecris url dans le navigateur il marche mais si je test avec wireless toolkit il affiche un erreur "Impossible d'etablir la connection" (Exception)
<?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){
$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;
}
?>
dans le 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();
}