private
void
login() {
try
{
httpclient =
new
DefaultHttpClient();
httppost=
new
HttpPost(
"http://웹서버ip/project/login.php"
);
nameValuePairs =
new
ArrayList<NameValuePair>(
2
);
try
{
myPWord = SimpleCrypto.encrypt(CRYPTO_SEED_PASSWORD, edtPass.getText().toString().trim());
}
catch
(Exception e) {
}
nameValuePairs.add(
new
BasicNameValuePair(
"id"
,edtId.getText().toString().trim()));
nameValuePairs.add(
new
BasicNameValuePair(
"password"
, myPWord));
httppost.setEntity(
new
UrlEncodedFormEntity(nameValuePairs,
"euc-kr"
));
ResponseHandler<String> responseHandler =
new
BasicResponseHandler();
String result = httpclient.execute(httppost, responseHandler);
System.out.println(
"Result : "
+ result);
runOnUiThread(
new
Runnable()
{
public
void
run() {
dialog.dismiss();
}
});
if
(result.equalsIgnoreCase(
"User Found"
))
{
runOnUiThread(
new
Runnable()
{
public
void
run()
{
Toast.makeText(Login.
this
,
"Login Success"
, Toast.LENGTH_SHORT).show();
}
});
finish();
startActivity(
new
Intent(Login.
this
, Main.
class
));
}
else
{
showAlert();
}
}
catch
(Exception e)
{
dialog.dismiss();
System.out.println(
"Exception : "
+ e.getMessage());
}
}