我正在使用hostinger.web.tr。我想上传小数据。它们是用户名,电子邮件和密码。当我点击按钮;我的模拟器给了我注册的吐司消息。但是当我检查我的PHPMyAdmin面板时;那里没有东西。如何将服务器连接到我的应用程序?
我的php文件夹:
<?php
define('HOST','mysql.hostinger.in');
define('USER','******');
define('PASS','******');
define('DB','******');
$con = mysqli_connect(HOST,USER,PASS,DB) or die('Unable to Connect');
$username = $_GET['username'];
$password = $_GET['password'];
$email = $_GET['email'];
if($username == '' || $password == '' || $email == '')
{
echo 'please fill all values';
}
else{
$sql = "SELECT * FROM signup WHERE username='$username' OR email='$email'";
$check = mysqli_fetch_array(mysqli_query($con,$sql));
if(isset($check)){
echo 'username or email already exist';
}else{
$sql = "INSERT INTO signup (username,password,email) VALUES('$username','$password','$email')";
if(mysqli_query($con,$sql)){
echo 'successfully registered';
}
else{
echo 'oops! Please try again!';
}
}
mysqli_close($con);
} ?>
我的Android活动:
giris_button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
registir();
}
private void registir() {
String user_name_string = kullanıcı_edittext.getText().toString().trim().toLowerCase();
String password_string = sifre_edittext.getText().toString().trim().toLowerCase();
String emai = sonra_sil_edittext.getText().toString().trim().toLowerCase();
register_information(user_name_string, emai, password_string);
}
});
}
private void register_information(String user_name_string, String emai, String password_string) {
String urlSuffix = "?username=" + user_name_string + "&password=" + emai + "&email=" + password_string;
class RegisterUser extends AsyncTask<String, Void, String> {
ProgressDialog loading;
@Override
protected void onPreExecute() {
super.onPreExecute();
loading = ProgressDialog.show(giris_ekrani.this, "Please Wait", null, true, true);
}
@Override
protected void onPostExecute(String s) {
super.onPostExecute(s);
loading.dismiss();
Toast.makeText(getApplicationContext(),"Registered", Toast.LENGTH_SHORT).show();
}
@Override
protected String doInBackground(String... params) {
String s = params[0];
BufferedReader bufferReader=null;
try {
URL url=new URL(REGISTER_URL+s);
HttpURLConnection con=(HttpURLConnection)url.openConnection();
bufferReader=new BufferedReader(new InputStreamReader(con.getInputStream()));
String result;
result=bufferReader.readLine();
return result;
}catch (Exception e){
return null;
}
}
}
RegisterUser ur=new RegisterUser();
ur.execute(urlSuffix);
}
我的logcat:
04-18 03:20:40.305 5465-5486/something.about.berkay.isim D/EGL_emulation: eglMakeCurrent: 0x9eb9dfe0: ver 2 0 (tinfo 0x9eb96920)
04-18 03:20:40.314 5465-5486/something.about.berkay.isim D/EGL_emulation: eglMakeCurrent: 0x9eb9dfe0: ver 2 0 (tinfo 0x9eb96920)
04-18 03:20:40.321 5465-5486/something.about.berkay.isim D/EGL_emulation: eglMakeCurrent: 0x9eb9dfe0: ver 2 0 (tinfo 0x9eb96920)
04-18 03:20:40.331 5465-5486/something.about.berkay.isim D/EGL_emulation: eglMakeCurrent: 0x9eb9dfe0: ver 2 0 (tinfo 0x9eb96920)
04-18 03:20:40.340 5465-5486/something.about.berkay.isim D/EGL_emulation: eglMakeCurrent: 0x9eb9dfe0: ver 2 0 (tinfo 0x9eb96920)
04-18 03:20:40.345 5465-5486/something.about.berkay.isim D/EGL_emulation: eglMakeCurrent: 0x9eb9dfe0: ver 2 0 (tinfo 0x9eb96920)
04-18 03:20:40.351 5465-5486/something.about.berkay.isim D/EGL_emulation: eglMakeCurrent: 0x9eb9dfe0: ver 2 0 (tinfo 0x9eb96920)
04-18 03:20:40.357 5465-5486/something.about.berkay.isim D/EGL_emulation: eglMakeCurrent: 0x9eb9dfe0: ver 2 0 (tinfo 0x9eb96920)
04-18 03:20:40.368 5465-5486/something.about.berkay.isim D/EGL_emulation: eglMakeCurrent: 0x9eb9dfe0: ver 2 0 (tinfo 0x9eb96920)
04-18 03:20:40.372 5465-5486/something.about.berkay.isim D/EGL_emulation: eglMakeCurrent: 0x9eb9dfe0: ver 2 0 (tinfo 0x9eb96920)
04-18 03:20:40.385 5465-5486/something.about.berkay.isim D/EGL_emulation: eglMakeCurrent: 0x9eb9dfe0: ver 2 0 (tinfo 0x9eb96920)
04-18 03:20:40.709 5465-5486/something.about.berkay.isim D/EGL_emulation: eglMakeCurrent: 0x9eb9dfe0: ver 2 0 (tinfo 0x9eb96920)
04-18 03:20:40.727 1587-2071/? W/InputMethodManagerService: Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@fd8c4a6 attribute=null, token = android.os.BinderProxy@fabdf40
04-18 03:20:40.741 5465-5486/something.about.berkay.isim D/EGL_emulation: eglMakeCurrent: 0x9eb9dfe0: ver 2 0 (tinfo 0x9eb96920)
04-18 03:20:40.767 5465-5486/something.about.berkay.isim D/EGL_emulation: eglMakeCurrent: 0x9eb9dfe0: ver 2 0 (tinfo 0x9eb96920)
04-18 03:20:40.900 1587-1607/? I/WindowManager: Destroying surface Surface(name=Please Wait) called by com.android.server.wm.WindowStateAnimator.destroySurface:2014 com.android.server.wm.WindowStateAnimator.destroySurfaceLocked:881 com.android.server.wm.WindowState.destroyOrSaveSurface:2073 com.android.server.wm.AppWindowToken.destroySurfaces:363 com.android.server.wm.WindowStateAnimator.finishExit:565 com.android.server.wm.WindowStateAnimator.stepAnimationLocked:491 com.android.server.wm.WindowAnimator.updateWindowsLocked:303 com.android.server.wm.WindowAnimator.animateLocked:704
04-18 03:20:41.234 5465-5486/something.about.berkay.isim D/EGL_emulation: eglMakeCurrent: 0x9eb9dfe0: ver 2 0 (tinfo 0x9eb96920)
04-18 03:20:43.283 1587-1607/? I/WindowManager: Destroying surface Surface(name=Toast) called by com.android.server.wm.WindowStateAnimator.destroySurface:2014 com.android.server.wm.WindowStateAnimator.destroySurfaceLocked:881 com.android.server.wm.WindowState.destroyOrSaveSurface:2073 com.android.server.wm.WindowSurfacePlacer.performSurfacePlacementInner:429 com.android.server.wm.WindowSurfacePlacer.performSurfacePlacementLoop:232 com.android.server.wm.WindowSurfacePlacer.performSurfacePlacement:180 com.android.server.wm.WindowManagerService$H.handleMessage:8079 android.os.Handler.dispatchMessage:102
04-18 03:20:43.492 1347-1369/? W/audio_hw_generic: Not supplying enough data to HAL, expected position 2024872 , only wrote 1872000