如何在PHP和MySQL中进行登录和注册?
我需要的代码示例,希望有人能帮助我如何使用php和mysql进行登录和注册?
这里是我的loginfragment代码:
Package com.example.administrator.mosbeau;
import android.app.Fragment;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
/**
* Created by Administrator on 9/1/2015.
*/
public class LoginFragment extends Fragment {
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
return inflater.inflate(R.layout.loginlayout, container, false);
}
}
,这里是我的loginlayout:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:fillViewport="false">
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_height="match_parent"
>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageView4"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:src="@drawable/logo"
android:maxHeight="54dp"
android:maxWidth="322dp"
android:layout_marginTop="20dp"
android:layout_marginLeft="100dp"
android:layout_marginRight="100dp" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageView5"
android:layout_below="@+id/imageView4"
android:layout_centerHorizontal="true"
android:src="@drawable/lock"
android:layout_marginLeft="150dp"
android:layout_marginRight="150dp"
android:layout_marginTop="-60dp" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/txtEmail"
android:layout_below="@+id/imageView5"
android:layout_centerHorizontal="true"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:hint="Email"
android:background="#ffeeeeee"
android:padding="10dp"
android:layout_marginTop="-30dp"
android:textColor="#ff6d6e71" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPassword"
android:ems="10"
android:id="@+id/txtPassword"
android:layout_below="@+id/txtEmail"
android:layout_centerHorizontal="true"
android:layout_marginLeft="30dp"
android:layout_marginTop="10dp"
android:layout_marginRight="30dp"
android:textColor="#ff6d6e71"
android:background="#ffeeeeee"
android:padding="10dp"
android:hint="Password" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Sign in"
android:id="@+id/btnSignin"
android:layout_centerHorizontal="true"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:textColor="#ff6d6e71"
android:layout_marginTop="10dp"
android:layout_below="@+id/txtPassword"
android:longClickable="false"
android:clickable="true"
android:background="#fffed4d4" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Forgot your Password ?"
android:id="@+id/textForgot"
android:layout_below="@+id/btnSignin"
android:layout_alignLeft="@+id/btnSignin"
android:layout_marginTop="10dp"
android:textColor="#ff607d8b"
android:textSize="18dp"
android:clickable="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Sign Up"
android:id="@+id/textSignup"
android:layout_alignBottom="@+id/textForgot"
android:layout_alignRight="@+id/btnSignin"
android:textColor="#ff607d8b"
android:textSize="18dp"
android:layout_marginTop="10dp"
android:clickable="true" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Login with facebook"
android:id="@+id/btnLoginfb"
android:layout_below="@+id/textForgot"
android:layout_centerHorizontal="true"
android:layout_marginLeft="30dp"
android:layout_marginTop="20dp"
android:layout_marginRight="30dp"
android:background="#ff2385ff"
android:textColor="#ffffffff"
android:clickable="true"
android:focusableInTouchMode="false" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Help"
android:id="@+id/btnLoginhelp"
android:layout_below="@+id/btnLoginfb"
android:layout_alignLeft="@+id/btnLoginfb"
android:layout_marginTop="10dp"
android:background="#fffed4d4"
android:textColor="#ff6d6e71"
android:clickable="true"
android:layout_marginBottom="20dp"
android:focusableInTouchMode="false" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Skip"
android:id="@+id/btnLoginskip"
android:background="#fffed4d4"
android:textColor="#ff6d6e71"
android:layout_alignTop="@+id/btnLoginhelp"
android:layout_alignRight="@+id/btnLoginfb"
android:clickable="true"
android:layout_marginBottom="20dp"
android:focusableInTouchMode="false" />
</RelativeLayout>
</ScrollView>
我是新到android,所以我真的不知道该怎么做。
我已经开发了登录并通过以下教程注册PHP和MySQL,但它使用活动。