i'm trying to connect my mobile application with database on server throw the url ,
at the first my code was working with emulator URL , when i replace it with server url that contains database it shows an error , (i update the php files with the database user name and password ) , please could any one help me with this :
here is the error:
05-06 07:04:08.069: E/AndroidRuntime(3350): FATAL EXCEPTION: main
05-06 07:04:08.069: E/AndroidRuntime(3350): java.lang.NullPointerException
05-06 07:04:08.069: E/AndroidRuntime(3350):     at com.example.weddingplanner.login$Login$1.run(login.java:178)
05-06 07:04:08.069: E/AndroidRuntime(3350):     at android.os.Handler.handleCallback(Handler.java:725)
05-06 07:04:08.069: E/AndroidRuntime(3350):     at android.os.Handler.dispatchMessage(Handler.java:92)
05-06 07:04:08.069: E/AndroidRuntime(3350):     at android.os.Looper.loop(Looper.java:137)
05-06 07:04:08.069: E/AndroidRuntime(3350):     at android.app.ActivityThread.main(ActivityThread.java:5041)
05-06 07:04:08.069: E/AndroidRuntime(3350):     at java.lang.reflect.Method.invokeNative(Native Method)
05-06 07:04:08.069: E/AndroidRuntime(3350):     at java.lang.reflect.Method.invoke(Method.java:511)
05-06 07:04:08.069: E/AndroidRuntime(3350):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run`(ZygoteInit.java:793)`
05-06 07:04:08.069: E/AndroidRuntime(3350):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
05-06 07:04:08.069: E/AndroidRuntime(3350):     at dalvik.system.NativeStart.main(Native Method)
and i used this code :
package com.example.weddingplanner;
import java.util.ArrayList;
import java.util.List;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import android.os.AsyncTask;
import android.os.Bundle;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.util.Log;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
public class login extends Activity {
private static final JSONParser jsonParser = new JSONParser();
private static final String URL_LOGIN ="http://weddingplannerg7/android_connect/login.php";
// JSON Node names
    private static final String TAG_SUCCESS = "success";
    private static final String TAG_USER = "user";
    private static final String TAG_TYPE = "type";
    static String FPWEmail;
private String email;
private String password;
private String type ;
private int success ;
private ProgressDialog pDialog; 
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.login);
    final Button b1 = (Button) findViewById(R.id.jbutton1);//forget password
    final Button b2 = (Button) findViewById(R.id.jbutton2);//log in
    final Button b3 = (Button) findViewById(R.id.jbutton3); // new user
    final EditText t1 = (EditText) findViewById(R.id.jeditText1);//user email
    final EditText t2 = (EditText) findViewById(R.id.jeditText2);//PW
    //forget password
    b1.setOnClickListener(new OnClickListener()
    {
    public void onClick(View v)
    {
        FPWEmail =  t1.getText().toString(); 
        if (!FPWEmail.equals(""))
        {
        Intent myIntent = new Intent(login.this, forgetPW1.class);
        login.this.startActivity(myIntent);
        }else
        {
            errEmaPW("sorry try again!!");
        }
    }
    });
    //login
    b2.setOnClickListener(new OnClickListener()
    {
    public void onClick(View v)
    {
         email = t1.getText().toString(); 
         password = t2.getText().toString();
        // search if email exist in DB or not and save it in boolean
    if( email.equals("") || password.equals(""))
    {
        //errormessage
        errEmaPW("sorry try again!!");
    }else
    {
        new Login().execute();
    }
    }
    });
    //new user
    b3.setOnClickListener(new OnClickListener()
    {
    public void onClick(View v)
    {
        Intent myIntent = new Intent(login.this, newUser.class);
        login.this.startActivity(myIntent);
    }
    });
}
@SuppressLint("NewApi")
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.login, menu);
     getActionBar().setDisplayShowTitleEnabled(false);
        getActionBar().setDisplayUseLogoEnabled(false);
        getActionBar().setHomeButtonEnabled(false);
    return true;
}
public void errEmaPW(String str)
{
    AlertDialog.Builder builder = new AlertDialog.Builder(login.this);
    builder.setMessage(str)
    .setTitle("error!")
           .setPositiveButton("okay", new DialogInterface.OnClickListener() {
               public void onClick(DialogInterface dialog, int id) { }})
           .show();
}
/**
 * Background Async Task 
 * */
class Login extends AsyncTask<String, String, String> {
    /**
     * Before starting background thread Show Progress Dialog
     * */
    @Override
    protected void onPreExecute() {
        super.onPreExecute();
        pDialog = new ProgressDialog(login.this);
        pDialog.setMessage("loading...");
        pDialog.setIndeterminate(false);
        pDialog.setCancelable(true);
        pDialog.show();
    }
    /**
     * 
     * */
    protected String doInBackground(String... params) {
        // updating UI from Background Thread
        runOnUiThread(new Runnable() {
            public void run() {
                // Check for success tag
                type = "";
                 success = 0 ;
                try {
                    // Building Parameters
                    List<NameValuePair> params = new ArrayList<NameValuePair>();
                    params.add(new BasicNameValuePair("email", email));
                    params.add(new BasicNameValuePair("password", password));
                    // getting product details by making HTTP request
                    // Note that product details url will use GET request
                    JSONObject json = jsonParser.makeHttpRequest(
                            URL_LOGIN, "POST", params);
                    // check your log for json response
                    Log.d("Single User", json.toString());
                    // json success tag
                    success = json.getInt(TAG_SUCCESS);
                    if (success == 1) {
                        type = json.getString(TAG_TYPE);
                        if (type.equals("user"))
                        {
                        // save user data 
                        user.email=email;
                        } else
                        {
                        admin.email=email;
                        }
                    }else
                    {
                        AlertDialog.Builder builder = new AlertDialog.Builder(login.this);
                        builder.setMessage("sorry")
                        .setTitle("error!")
                               .setPositiveButton("okay", new DialogInterface.OnClickListener() {
                                   public void onClick(DialogInterface dialog, int id) { }})
                               .show();
                    }
                } catch (JSONException e) {
                    e.printStackTrace();
                }
            }
        });
        return null;
    }
    /**
     * After completing background task Dismiss the progress dialog
     * **/
    protected void onPostExecute(String file_url) {
        // dismiss the dialog once got all details
        pDialog.dismiss();
        if(success == 1)
        {
        if(type.equals("user"))
        {
            Intent myIntent = new Intent(login.this, mainUser.class);
            login.this.startActivity(myIntent);
        } else if(type.equals("admin"))
        {
            Intent myIntent = new Intent(login.this, mainAdmin.class);
            login.this.startActivity(myIntent);
        }
        }
    }
}
}
i checked the php files , i get an error in the connect statment
this is the statement cuasing the error
// include db connect class
require_once __DIR__ . '/db_connect.php';
and this is the error it self i tryed to change the directory but it doesn't work please could any one help me !!
Warning: require_once(DIR/db_connect.php) [function.require-once]: failed to open stream: No such file or directory in /home/ashjan/public_html/android_connect/login.php on line 13
Fatal error: require_once() [function.require]: Failed opening required 'DIR/db_connect.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/ashjan/public_html/android_connect/login.php on line 13
 
     
    