Click here to Skip to main content
15,921,716 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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)

voici mes codes

connect.php :

$hostname_localhost ="localhost";
$database_localhost ="virtual_university";
$username_localhost ="root";
$password_localhost ="";
$con = mysql_connect($hostname_localhost,$username_localhost,$password_localhost)
or
trigger_error(mysql_error(),E_USER_ERROR);
?>



authentif.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 = "";
$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 .= "";
}
$xml.="";
}
//close the root element
$xml .= "";
//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();
}


et merci d'avance
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900