Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Override
- protected Object doInBackground(Object... params) {
- String currentPassord = (String) params[0];
- String URL = PHPURL.url + "check_current_password.php";
- try {
- HttpClient client = Singleton.getInstance(getActivity()).getHttpClient();
- HttpPost post = new HttpPost(URL);
- List<NameValuePair> params1 = new ArrayList<NameValuePair>();
- params1.add(new BasicNameValuePair("currentPassord", currentPassord));
- UrlEncodedFormEntity ent = new UrlEncodedFormEntity(params1,HTTP.UTF_8);
- post.setEntity(ent);
- HttpResponse responsePOST = client.execute(post);
- HttpEntity resEntity = responsePOST.getEntity();
- if (resEntity != null) {
- String result = EntityUtils.toString(resEntity);
- JSONArray jarr = new JSONArray(result);
- for(int i =0 ; i < jarr.length(); i++){
- JSONObject jobj = jarr.getJSONObject(i);
- session_state = jobj.getString("session");
- if(session_state.equals("success")){
- check_pw = jobj.getString("check_pw");
- }
- }
- }
- } catch (Exception e) {
- Log.d("EXCEPTION", "ERROR IS " + e.getMessage());
- e.printStackTrace();
- }
- return null;
- }
- private Singleton(Context context){
- this.context = context;
- client = new DefaultHttpClient();
- manager = new Manager();
- }
- public static Singleton getInstance(Context c){
- if(uniqueInstance == null){
- synchronized (Singleton.class) {
- if(uniqueInstance == null){
- uniqueInstance = new Singleton(c.getApplicationContext());
- }
- }
- }
- return uniqueInstance;
- }
- public HttpClient getHttpClient(){
- return client;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement