Friday, July 13, 2018

Insert.php



package com.example.mactech.spinevent;

import android.app.AlertDialog;
import android.app.DatePickerDialog;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Bitmap;
import android.net.ConnectivityManager;
import android.net.Uri;
import android.provider.MediaStore;
import android.provider.Settings;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Base64;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.DatePicker;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.RelativeLayout;
import android.widget.Toast;

import com.example.mactech.spinevent.Helper.AppConfig;

import org.json.JSONException;
import org.json.JSONObject;

import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Locale;

import de.hdodenhof.circleimageview.CircleImageView;
import retrofit.Callback;
import retrofit.RestAdapter;
import retrofit.RetrofitError;
import retrofit.client.Response;

public class SignUp extends AppCompatActivity {

    private Button btn_signup_su;
    private CircleImageView img_user_su;
    private EditText et_fname_su, et_lname_su, et_mobile_no_su, et_email_su, et_password_su, et_conf_password_su, et_dob_su, et_city_su, et_referal_su;
    private RadioGroup radiogroup_su;
    private RadioButton rb_male_su, rb_female_su;
    private ImageView img_dob_su;

   // String BASE_URL = "http://www.newblockchain.in/";    private String BASE_URL="http://sktechnocast.com/";
    Calendar myCalendar = Calendar.getInstance();
    private static int PICK_IMAGE_REQUEST = 1;
    private Uri filePath;
    private Bitmap bitmap;
    private String uploadImage;
    private String Gender;
    private RelativeLayout rl_bod_su;
    private String lname, fname, mobileno, email, password, conf_password, dob, city, referal;
    int RESULT_LOAD_IMAGE=1;
    private String android_id;
    private SharedPreferences sharedpreferences;
    private String TokenGenret;


    @Override    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_sign_up);
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);

        ActionBar ab = getSupportActionBar();
        ab.setTitle("SignUp");
        android_id = Settings.Secure.getString(getApplicationContext().getContentResolver(), Settings.Secure.ANDROID_ID);

        getPefreanceToken();

        init();
        listner();
    }

    @Override    public boolean onSupportNavigateUp() {
        onBackPressed();
        return true;
    }




    private void getPefreanceToken()
    {
        sharedpreferences = this.getSharedPreferences("MainActivitysss", Context.MODE_PRIVATE);
        TokenGenret=sharedpreferences.getString("isStart",TokenGenret);
    }
    public void init() {

        btn_signup_su = (Button) findViewById(R.id.btn_signup_su);
        img_user_su = (CircleImageView) findViewById(R.id.img_user_su);
        img_dob_su = (ImageView) findViewById(R.id.img_dob_su);
        radiogroup_su = (RadioGroup) findViewById(R.id.radiogroup_su);
        rb_male_su = (RadioButton) findViewById(R.id.rb_male_su);
        rb_female_su = (RadioButton) findViewById(R.id.rb_female_su);
        rl_bod_su = (RelativeLayout) findViewById(R.id.rl_bod_su);

        et_fname_su = (EditText) findViewById(R.id.et_fname_su);
        et_lname_su = (EditText) findViewById(R.id.et_lname_su);
        et_mobile_no_su = (EditText) findViewById(R.id.et_mobile_no_su);
        et_email_su = (EditText) findViewById(R.id.et_email_su);
        et_password_su = (EditText) findViewById(R.id.et_password_su);
        et_conf_password_su = (EditText) findViewById(R.id.et_conf_password_su);
        et_dob_su = (EditText) findViewById(R.id.et_dob_su);
        et_city_su = (EditText) findViewById(R.id.et_city_su);
        et_referal_su = (EditText) findViewById(R.id.et_referal_su);

    }

    public void listner() {


        btn_signup_su.setOnClickListener(new View.OnClickListener() {
            @Override            public void onClick(View view) {

                ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
                if (cm.getActiveNetworkInfo() != null) {


                fname = et_fname_su.getText().toString();
                lname = et_lname_su.getText().toString();
                mobileno = et_mobile_no_su.getText().toString();
                email = et_email_su.getText().toString();
                password = et_password_su.getText().toString();
                conf_password = et_conf_password_su.getText().toString();
                dob = et_dob_su.getText().toString();
                city = et_city_su.getText().toString();
                referal = et_referal_su.getText().toString();

                if (et_fname_su.length() > 0 && et_lname_su.length() > 0 && et_mobile_no_su.length() > 0 && et_mobile_no_su.length() == 10 && et_password_su.length() > 0 && et_password_su.length() >= 4 && et_conf_password_su.length() > 0 && et_email_su.length() > 0 && isValidEmail(email) && et_dob_su.length() > 0 && et_city_su.length() > 0 && rb_male_su.isChecked() || rb_female_su.isChecked()) {
                   // if (et_password_su.getText().toString().equals(et_conf_password_su.getText().toString())) {
                        if (filePath != null) {

                            if (radiogroup_su.getCheckedRadioButtonId() == rb_male_su.getId()) {
                                Gender = "Male";
                            } else if (radiogroup_su.getCheckedRadioButtonId() == rb_female_su.getId()) {
                                Gender = "Female";
                            }

                            uploadImage = getStringImage(bitmap);
                            Signup_data_insert();
                        } else {
                            final AlertDialog.Builder alertDialog = new AlertDialog.Builder(SignUp.this);
                            alertDialog.setTitle("Alert");
                            alertDialog.setMessage("Please Select Image");
                            alertDialog.setPositiveButton("YES", new DialogInterface.OnClickListener() {
                                public void onClick(DialogInterface dialog, int which) {
                                    dialog.cancel();
                                }
                            });
                            alertDialog.show();
                        }


                } else {

                    if (fname.length() <= 0) {
                        et_fname_su.requestFocus();
                        et_fname_su.setError("Enter First Name");
                    } else if (lname.length() <= 0) {

                        et_lname_su.requestFocus();
                        et_lname_su.setError("Enter Last Number");
                    } else if (mobileno.length() <= 0) {

                        et_mobile_no_su.requestFocus();
                        et_mobile_no_su.setError("Enter Phone Number");
                    } else if (mobileno.length() < 10) {

                        et_mobile_no_su.requestFocus();
                        et_mobile_no_su.setError("Enter Must Be 10 Digit");
                    } else if (email.length() <= 0) {

                        et_email_su.requestFocus();
                        et_email_su.setError("Enter Email Address");
                    } else if (!isValidEmail(email)) {
                        et_email_su.requestFocus();
                        et_email_su.setError("Enter valid Email");
                    } else if (password.length() <= 0) {

                        et_password_su.requestFocus();
                        et_password_su.setError("Enter Password");
                    } else if (password.length() <= 5) {
                        et_password_su.requestFocus();
                        et_password_su.setError("Password More Then character ");
                    } else if (conf_password.length() <= 0) {
                        et_password_su.requestFocus();
                        et_password_su.setError("Enter Confirm Password");
                    } else if (conf_password.length() <= 5) {
                        et_password_su.requestFocus();
                        et_password_su.setError("Confirm Password More Then character ");
                    } else if (!et_password_su.getText().toString().equals(et_conf_password_su.getText().toString()))  //conform password velidation textviee nu id levu                    {
                        et_conf_password_su.requestFocus();
                        et_conf_password_su.setError("Password And Confirm Password Does Not Match");
                    } else if (!rb_male_su.isChecked() && !rb_female_su.isChecked()) {
                        final AlertDialog.Builder alertDialog = new AlertDialog.Builder(SignUp.this);
                        alertDialog.setTitle("Alert");
                        alertDialog.setMessage("Please Select Gender");
                        alertDialog.setPositiveButton("YES", new DialogInterface.OnClickListener() {
                            public void onClick(DialogInterface dialog, int which) {
                                dialog.cancel();
                            }
                        });
                        alertDialog.show();
                    } else if (dob.length() <= 0) {

                        et_dob_su.requestFocus();
                        et_dob_su.setError("Select Your BirthDate");
                    } else if (city.length() <= 0) {

                        et_city_su.requestFocus();
                        et_city_su.setError("Enter Your City");
                    }


                }


                } else {
                    Toast.makeText(getApplicationContext(), "Turn On Your Internet Connection", Toast.LENGTH_SHORT).show();
                }
            }

        });


        final DatePickerDialog.OnDateSetListener date = new DatePickerDialog.OnDateSetListener() {

            @Override            public void onDateSet(DatePicker view, int year, int monthOfYear,
                                  int dayOfMonth) {
                // TODO Auto-generated method stub                myCalendar.set(Calendar.YEAR, year);
                myCalendar.set(Calendar.MONTH, monthOfYear);
                myCalendar.set(Calendar.DAY_OF_MONTH, dayOfMonth);


                updateLabel();

            }

        };

        img_user_su.setOnClickListener(new View.OnClickListener() {
            @Override            public void onClick(View v) {
                Intent i=new Intent(Intent.ACTION_PICK,android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
                startActivityForResult(i,RESULT_LOAD_IMAGE);
            }
        });

        et_dob_su.setOnClickListener(new View.OnClickListener() {
            @Override            public void onClick(View view) {
                new DatePickerDialog(SignUp.this, date, myCalendar                        .get(Calendar.YEAR), myCalendar.get(Calendar.MONTH),
                        myCalendar.get(Calendar.DAY_OF_MONTH)).show();
            }
        });
        rl_bod_su.setOnClickListener(new View.OnClickListener() {
            @Override            public void onClick(View view) {
                new DatePickerDialog(SignUp.this, date, myCalendar                        .get(Calendar.YEAR), myCalendar.get(Calendar.MONTH),
                        myCalendar.get(Calendar.DAY_OF_MONTH)).show();
            }
        });

    }

    public String getStringImage(Bitmap bmp) {
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        bmp.compress(Bitmap.CompressFormat.JPEG, 100, baos);
        byte[] imageBytes = baos.toByteArray();
        String encodedImage = Base64.encodeToString(imageBytes, Base64.DEFAULT);
        return encodedImage;
    }


    private void updateLabel() {

        String myFormat = "yyyy-MM-dd"; //In which you need put here        SimpleDateFormat sdf = new SimpleDateFormat(myFormat, Locale.US);

        et_dob_su.setText(sdf.format(myCalendar.getTime()));

    }


    public final static boolean isValidEmail(CharSequence email) {
        return !TextUtils.isEmpty(email) && android.util.Patterns.EMAIL_ADDRESS.matcher(email).matches();
    }

    @Override    protected void onActivityResult(int requestCode, int resultCode, Intent data)
    {
        super.onActivityResult(requestCode, resultCode, data);

        if (requestCode == RESULT_LOAD_IMAGE && resultCode == RESULT_OK)
        {
            filePath = data.getData();
            try            {
                bitmap = MediaStore.Images.Media.getBitmap(getContentResolver(), filePath);
                bitmap = Bitmap.createScaledBitmap(bitmap, 240, 240, false);
                img_user_su.setImageBitmap(bitmap);
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
        }
    }

//-------/ Sign up data insert /---------------------------------------------

    public void Signup_data_insert() {

        final ProgressDialog loading = new ProgressDialog(this, ProgressDialog.STYLE_SPINNER);
        loading.setMessage("Loading");
        loading.show();
        loading.setCancelable(true);
        loading.setCanceledOnTouchOutside(false);


        RestAdapter adapter = new RestAdapter.Builder()
                .setEndpoint(BASE_URL) //Setting the Root URL                .build();

        AppConfig.insert_signup_record api = adapter.create(AppConfig.insert_signup_record.class);
        api.insertsignupData(

                et_fname_su.getText().toString(),
                et_lname_su.getText().toString(),
                et_mobile_no_su.getText().toString(),
                et_email_su.getText().toString(),
                et_password_su.getText().toString(),
                et_conf_password_su.getText().toString(),
                et_dob_su.getText().toString(),
                et_city_su.getText().toString(),
                et_referal_su.getText().toString(),
                Gender,
                android_id,
                TokenGenret,
                uploadImage,


                new Callback<Response>() {
                    @Override                    public void success(Response result, Response response) {

                        try {

                            BufferedReader reader = new BufferedReader(new InputStreamReader(result.getBody().in()));
                            String resp;
                            resp = reader.readLine();
                            Log.d("success", "" + resp);

                            JSONObject jObj = new JSONObject(resp);
                            int success = jObj.getInt("success");

                            if (success == 1) {

                                loading.dismiss();
                                Toast.makeText(getApplicationContext(), "Successfully Registration", Toast.LENGTH_SHORT).show();
                                startActivity(new Intent(getApplicationContext(), Login.class));
                                finish();
                            } else {
                                loading.dismiss();
                                Toast.makeText(getApplicationContext(), "Your Mobile Already Registreed Plese Try Another Mobile", Toast.LENGTH_SHORT).show();
                            }

                        } catch (IOException e) {
                            Log.d("Exception", e.toString());
                        } catch (JSONException e) {
                            Log.d("JsonException", e.toString());
                        }
                    }

                    @Override                    public void failure(RetrofitError error) {
                        Toast.makeText(SignUp.this, "Check Your Internet Connection", Toast.LENGTH_LONG).show();

                    }


                }

        );

    }


}


Insert_activity.xml

<?xml version="1.0" encoding="utf-8"?><ScrollView    android:layout_width="match_parent"    android:layout_height="wrap_content"    xmlns:android="http://schemas.android.com/apk/res/android">

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"    xmlns:app="http://schemas.android.com/apk/res-auto"    xmlns:tools="http://schemas.android.com/tools"    android:layout_width="match_parent"    android:layout_height="match_parent"    android:background="@drawable/app_bg"    tools:context="com.example.mactech.spinevent.SignUp">

        <RelativeLayout            android:layout_width="match_parent"            android:layout_height="wrap_content"            android:layout_marginBottom="50dp"            android:layout_marginLeft="10dp"            android:layout_marginRight="10dp"            android:layout_marginTop="20dp">

            <de.hdodenhof.circleimageview.CircleImageView                android:id="@+id/img_user_su"                android:layout_width="100dp"                android:layout_height="100dp"                android:layout_centerHorizontal="true"                app:civ_border_color="@color/circle_img_view_border"                app:civ_border_width="2dp"                android:layout_gravity="center_horizontal"                android:layout_marginTop="10dp"                android:src="@drawable/profile" />


            <LinearLayout                android:layout_width="match_parent"                android:layout_height="wrap_content"                android:layout_below="@+id/img_user_su"                android:layout_marginLeft="10dp"                android:layout_marginRight="10dp"                android:layout_marginTop="10dp"                android:orientation="vertical">

                <LinearLayout                    android:layout_width="match_parent"                    android:layout_height="wrap_content"                    android:background="@drawable/et_shadow"                    android:orientation="horizontal">

                    <ImageView                        android:layout_width="40dp"                        android:layout_height="40dp"                        android:layout_marginLeft="10dp"                        android:layout_gravity="center_vertical"                        android:background="@drawable/name" />

                    <android.support.design.widget.TextInputLayout                        android:layout_width="match_parent"                        android:layout_height="wrap_content"                        android:layout_gravity="center_vertical"                        android:backgroundTint="@android:color/transparent"
                        >

                        <android.support.design.widget.TextInputEditText                            android:id="@+id/et_fname_su"                            android:layout_width="match_parent"                            android:layout_height="wrap_content"                            android:backgroundTint="@android:color/transparent"                            android:hint="First Name"                            android:inputType="text"                            android:textColor="@color/event_txt_color"                            android:textColorHint="@color/event_txt_color"                            android:textStyle="bold"                            android:textSize="20dp"                            />
                    </android.support.design.widget.TextInputLayout>
                </LinearLayout>

                <LinearLayout                    android:layout_width="match_parent"                    android:layout_height="wrap_content"                    android:layout_marginTop="10dp"                    android:background="@drawable/et_shadow"                    android:orientation="horizontal">

                    <ImageView                        android:layout_width="40dp"                        android:layout_height="40dp"                        android:layout_marginLeft="10dp"                        android:layout_gravity="center_vertical"                        android:background="@drawable/name" />

                    <android.support.design.widget.TextInputLayout                        android:layout_width="match_parent"                        android:layout_height="wrap_content"                        android:layout_gravity="center_vertical"                        android:backgroundTint="@android:color/transparent"
                        >

                        <android.support.design.widget.TextInputEditText                            android:id="@+id/et_lname_su"                            android:layout_width="match_parent"                            android:layout_height="wrap_content"                            android:backgroundTint="@android:color/transparent"                            android:hint="Last Name"                            android:inputType="text"                            android:textColor="@color/event_txt_color"                            android:textColorHint="@color/event_txt_color"                            android:textStyle="bold"                            android:textSize="20dp"/>
                    </android.support.design.widget.TextInputLayout>
                </LinearLayout>

                <LinearLayout                    android:layout_width="match_parent"                    android:layout_height="wrap_content"                    android:layout_marginTop="10dp"                    android:background="@drawable/et_shadow"                    android:orientation="horizontal">

                    <ImageView                        android:layout_width="40dp"                        android:layout_height="40dp"                        android:layout_marginLeft="10dp"                        android:layout_gravity="center_vertical"                        android:background="@drawable/mobile" />

                    <android.support.design.widget.TextInputLayout                        android:layout_width="match_parent"                        android:layout_height="wrap_content"                        android:layout_gravity="center_vertical"                        android:backgroundTint="@android:color/transparent">

                        <android.support.design.widget.TextInputEditText                            android:id="@+id/et_mobile_no_su"                            android:layout_width="match_parent"                            android:layout_height="wrap_content"                            android:backgroundTint="@android:color/transparent"                            android:hint="Mobile No."                            android:maxLength="10"                            android:inputType="number"                            android:textColor="@color/event_txt_color"                            android:textColorHint="@color/event_txt_color"                            android:textStyle="bold"                            android:textSize="20dp"/>
                    </android.support.design.widget.TextInputLayout>

                </LinearLayout>

                <LinearLayout                    android:layout_width="match_parent"                    android:layout_height="wrap_content"                    android:layout_marginTop="10dp"                    android:background="@drawable/et_shadow"                    android:orientation="horizontal">

                    <ImageView                        android:layout_width="40dp"                        android:layout_height="40dp"                        android:layout_marginLeft="10dp"                        android:layout_gravity="center_vertical"                        android:background="@drawable/email" />

                    <android.support.design.widget.TextInputLayout                        android:layout_width="match_parent"                        android:layout_height="wrap_content"                        android:layout_gravity="center_vertical"                        android:backgroundTint="@android:color/transparent"
                        >

                        <android.support.design.widget.TextInputEditText                            android:id="@+id/et_email_su"                            android:layout_width="match_parent"                            android:layout_height="wrap_content"                            android:backgroundTint="@android:color/transparent"                            android:hint="E-Mail"                            android:inputType="textEmailAddress"                            android:textColor="@color/event_txt_color"                            android:textColorHint="@color/event_txt_color"                            android:textStyle="bold"                            android:textSize="20dp"/>
                    </android.support.design.widget.TextInputLayout>
                </LinearLayout>


                <LinearLayout                    android:layout_width="match_parent"                    android:layout_height="wrap_content"                    android:layout_marginTop="10dp"                    android:background="@drawable/et_shadow"                    android:orientation="horizontal">

                    <ImageView                        android:layout_width="40dp"                        android:layout_height="40dp"                        android:layout_marginLeft="10dp"                        android:layout_gravity="center_vertical"                        android:background="@drawable/password" />

                    <android.support.design.widget.TextInputLayout                        android:layout_width="match_parent"                        android:layout_height="wrap_content"                        android:layout_gravity="center_vertical"                        android:backgroundTint="@android:color/transparent"                        app:passwordToggleEnabled="true">

                        <android.support.design.widget.TextInputEditText                            android:id="@+id/et_password_su"                            android:layout_width="match_parent"                            android:layout_height="wrap_content"                            android:backgroundTint="@android:color/transparent"                            android:hint="Password"                            android:inputType="textPassword"                            android:textColor="@color/event_txt_color"                            android:textColorHint="@color/event_txt_color"                            android:textStyle="bold"                            android:textSize="20dp"/>
                    </android.support.design.widget.TextInputLayout>
                </LinearLayout>

                <LinearLayout                    android:layout_width="match_parent"                    android:layout_height="wrap_content"                    android:layout_marginTop="10dp"                    android:background="@drawable/et_shadow"                    android:orientation="horizontal">

                    <ImageView                        android:layout_width="40dp"                        android:layout_height="40dp"                        android:layout_marginLeft="10dp"                        android:layout_gravity="center_vertical"                        android:background="@drawable/password" />

                    <android.support.design.widget.TextInputLayout                        android:layout_width="match_parent"                        android:layout_height="wrap_content"                        android:layout_gravity="center_vertical"                        android:backgroundTint="@android:color/transparent"                        app:passwordToggleEnabled="true">

                        <android.support.design.widget.TextInputEditText                            android:id="@+id/et_conf_password_su"                            android:layout_width="match_parent"                            android:layout_height="wrap_content"                            android:backgroundTint="@android:color/transparent"                            android:hint="Confirm Password"                            android:inputType="textPassword"                            android:textColor="@color/event_txt_color"                            android:textColorHint="@color/event_txt_color"                            android:textStyle="bold"                            android:textSize="20dp"/>
                    </android.support.design.widget.TextInputLayout>
                </LinearLayout>


                <LinearLayout                    android:layout_width="match_parent"                    android:layout_height="wrap_content"                    android:layout_marginTop="10dp"                    android:background="@drawable/et_shadow"                    android:orientation="horizontal">

                    <ImageView                        android:layout_width="40dp"                        android:layout_height="40dp"                        android:layout_marginLeft="10dp"                        android:layout_gravity="center_vertical"                        android:background="@drawable/gender" />

                    <RadioGroup                        android:id="@+id/radiogroup_su"                        android:layout_width="match_parent"                        android:layout_height="wrap_content"                        android:layout_gravity="center_vertical|center_horizontal"                        android:orientation="horizontal">

                        <RadioButton                            android:id="@+id/rb_male_su"                            android:layout_width="wrap_content"                            android:layout_height="wrap_content"                            android:layout_marginRight="10dp"                            android:text="Male"                            android:textSize="20dp"                            android:textColor="@color/event_txt_color" />

                        <RadioButton                            android:id="@+id/rb_female_su"                            android:layout_width="wrap_content"                            android:layout_height="wrap_content"                            android:text="Female"                            android:textSize="20dp"                            android:textColor="@color/event_txt_color" />
                    </RadioGroup>
                </LinearLayout>

                <RelativeLayout                    android:id="@+id/rl_bod_su"                    android:layout_width="match_parent"                    android:layout_height="match_parent"                    android:layout_marginTop="10dp"                    android:background="@drawable/et_shadow"                    android:orientation="horizontal">

                    <ImageView                        android:id="@+id/imageView2"                        android:layout_width="40dp"                        android:layout_height="40dp"                        android:layout_marginLeft="10dp"                        android:layout_marginTop="12dp"                        android:layout_gravity="center_vertical"                        android:background="@drawable/bod" />

                    <android.support.design.widget.TextInputLayout                        android:layout_width="250dp"                        android:layout_height="wrap_content"                        android:layout_alignParentTop="true"                        android:layout_gravity="center_vertical"                        android:layout_toEndOf="@+id/imageView2"                        android:layout_toRightOf="@+id/imageView2"                        android:backgroundTint="@android:color/transparent"                        android:id="@+id/view">

                    </android.support.design.widget.TextInputLayout>


                    <ImageView                        android:id="@+id/img_dob_su"                        android:layout_width="40dp"                        android:layout_height="40dp"                        android:background="@drawable/bod"                     android:layout_marginRight="10dp"                        android:layout_gravity="center_vertical"                        android:layout_alignTop="@+id/et_dob_su"                        android:layout_alignParentRight="true"                        android:layout_alignParentEnd="true" />

                    <android.support.design.widget.TextInputEditText                        android:id="@+id/et_dob_su"                        android:layout_width="200dp"                        android:layout_height="wrap_content"                        android:backgroundTint="@android:color/transparent"                        android:hint="Select Date Of Birth"                        android:inputType="text"                        android:textColor="@color/event_txt_color"                        android:textColorHint="@color/event_txt_color"                        android:textStyle="bold"                        android:textSize="20dp"                        android:layout_alignTop="@+id/imageView2"                        android:layout_centerHorizontal="true" />


                </RelativeLayout>

                <LinearLayout                    android:layout_width="match_parent"                    android:layout_height="wrap_content"                    android:layout_marginTop="10dp"                    android:background="@drawable/et_shadow"                    android:orientation="horizontal">

                    <ImageView                        android:layout_width="40dp"                        android:layout_height="40dp"                        android:layout_marginLeft="10dp"                        android:layout_gravity="center_vertical"                        android:background="@drawable/city" />

                    <android.support.design.widget.TextInputLayout                        android:layout_width="match_parent"                        android:layout_height="wrap_content"                        android:layout_gravity="center_vertical"                        android:backgroundTint="@android:color/transparent"
                        >

                        <android.support.design.widget.TextInputEditText                            android:id="@+id/et_city_su"                            android:layout_width="match_parent"                            android:layout_height="wrap_content"                            android:backgroundTint="@android:color/transparent"                            android:hint="City"                            android:inputType="text"                            android:textColor="@color/event_txt_color"                            android:textColorHint="@color/event_txt_color"                            android:textStyle="bold"                            android:textSize="20dp"/>
                    </android.support.design.widget.TextInputLayout>
                </LinearLayout>

                <LinearLayout                    android:layout_width="match_parent"                    android:layout_height="wrap_content"                    android:layout_marginBottom="20dp"                    android:layout_marginTop="10dp"                    android:background="@drawable/et_shadow"                    android:orientation="horizontal">

                    <ImageView                        android:layout_width="40dp"                        android:layout_height="40dp"                        android:layout_marginLeft="10dp"                        android:layout_gravity="center_vertical"                        android:background="@drawable/referal" />

                    <android.support.design.widget.TextInputLayout                        android:layout_width="match_parent"                        android:layout_height="wrap_content"                        android:layout_gravity="center_vertical"                        android:backgroundTint="@android:color/transparent"
                        >

                        <android.support.design.widget.TextInputEditText                            android:id="@+id/et_referal_su"                            android:layout_width="match_parent"                            android:layout_height="wrap_content"                            android:backgroundTint="@android:color/transparent"                            android:hint="Referal (Optional)"                            android:inputType="text"                            android:textColor="@color/event_txt_color"                            android:textColorHint="@color/event_txt_color"                            android:textStyle="bold"                            android:textSize="20dp"/>
                    </android.support.design.widget.TextInputLayout>
                </LinearLayout>


                <Button                    android:id="@+id/btn_signup_su"                    android:layout_width="200dp"                    android:layout_height="60dp"                    android:layout_alignParentBottom="true"                    android:layout_centerHorizontal="true"                    android:layout_gravity="center_horizontal"                    android:layout_marginBottom="20dp"                    android:background="@drawable/signup_new" />
            </LinearLayout>

        </RelativeLayout>

</RelativeLayout>
</ScrollView>

Insert.php

<?php
//error_reporting(0);
include('connection.php');
$res=array();
$userdata=array();

$imagepath=$_POST['image'];
$title=$_POST['title'];
$fnm=$_POST['firstname'];
$lnm=$_POST['lastname'];
$email=$_POST['email'];
$mobile=$_POST['mobileno'];
$unm=$_POST['username'];
$pass=$_POST['password'];
$cpass=$_POST['cpassword'];
$hobby=$_POST['hobby'];
$bod=$_POST['birthdate'];
$age=$_POST['age'];
$gender=$_POST['gender'];
$c_job=$_POST['current_job'];
$c_companynm=$_POST['current_companynm'];
$experiance=$_POST['experiance'];
$technology=$_POST['technology'];
$c_degigration=$_POST['current_degigration'];
$c_address=$_POST['company_address'];
$skils=$_POST['skils'];
$self=$_POST['self'];
$android_id=$_POST['android_id'];


   
$query="select * from IT_Registration where device_id='$android_id'";
$result_1=mysqli_query($con,$query);
if(mysqli_num_rows($result_1)>0)
{
    $res['status_code']='0';  
    $res['msg']="Please Try Later";
}
else
{
   
    $path = "upload/$unm.jpg";
     $actualpath = "http://sktechnocast.com/android/Monika/IT_Programing/$path";
   
   
    $query="insert into IT_Registration (image,title,firstname,lastname,email,mobileno,username,password,cpassword,hobby,birthdate,age,gender,current_job,current_companynm,experiance,technology,current_degigration,company_address,skils,self,device_id,flag)values('$actualpath','$title','$fnm','$lnm','$email','$mobile','$unm','$pass','$cpass','$hobby','$bod','$age','$gender','$c_job','$c_companynm','$experiance','$technology','$c_degigration'
        ,'$c_address','$skils','$self','$android_id','1')";
   
       
    $result=mysqli_query($con,$query) or Die(mysql_error());
   
    if($result>0)
    {
        file_put_contents($path,base64_decode($imagepath));
         $res['status_code']='1';
        $res['msg']="Registration Successfully";
    }
    else
    {   
        $res['status_code']='0';  
        $res['msg']="Please Try Later";
    }
}
     echo json_encode($res);
?>

No comments:

Post a Comment

Insert,Update and delete in Device Calender

Androidmanifest.xml < uses-permission android :name ="android.permission.WRITE_CALENDAR" /> < uses-permission androi...