Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Aybek_Dzhumadillayev_diplomEN.docx
Скачиваний:
20
Добавлен:
25.02.2016
Размер:
630.99 Кб
Скачать

Figure 9 - jsonParser.Java

3.3 PHP scripts[11]

In the application, php scripts are used for processing information with JSON for storing dates in the database. All the scripts are used to connect to the database. Table 7 includes a detailed description of php scripts. Figure 10 has an example of one php script.

Table 7 - Description of php scripts

Name

Description

Save.php

Processes data and stores the contacts database

Sav.php

Clears the database from old contacts

Login.php

Checks the data for authorization

Backup.php

Copies the information from the database and sends to the application to save to phone

Register.php

Enters to the database of the new member

DB_connect.php

Creates a database connection

DB_config.php

Database Settings

<?php

$response = array();

if (isset($_POST['login']) && isset($_POST['password'])) {

$login = $_POST['login'];

$password = $_POST['password'];

require_once __DIR__ . '/db_connect.php';

$db = new DB_CONNECT();

$men = mysql_query("SELECT * FROM users where login = '$login'");

if(mysql_num_rows($men) > 0){

$response["success"] = 2;

$response["message"] = "login zanyat.";

echo json_encode($response);

}else{ $result = mysql_query("INSERT INTO users(login, password) VALUES('$login', '$password')");

if ($result) {

$response["login"] = $login;

$response["success"] = 1;

$response["message"] = "Product successfully created.";

echo json_encode($response);

} else {

$response["success"] = 0;

$response["message"] = "Oops! An error occurred.";

// echoing JSON response

echo json_encode($response);

}

}

}

?>

Figure 10 - Register.php

3.4 XML files[11]

Extensible Markup Language (XML) is a markup language that defines a set of rules for encoding documents in a format that is both human-readable and machine-readable. In this diploma project xml is used for designing the application. XML is face of application that visible for user. In table 8 xml’s used in diploma project. In figure 11 example of xml file.

Table 8 - XML descriptions.

Name

description

activity_main.xml

For designing main page

backup.xml

For designing backup page

Continue of Table 7 – variables of class JSONParser.java

call.xml

For designing call page

login.xml

For designing login page

register.xml

For designing register page

simple.xml

For creating list

success.xml

For designing logged in page

styles.xml

Design colors and font

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"

android:layout_width="match_parent"

android:layout_height="match_parent"

android:orientation="vertical"

>

<TextView

android:id="@+id/textView2"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text="login" />

<TextView

android:id="@+id/textView3"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text="password" />

<TextView

android:id="@+id/eError"

android:layout_width="wrap_content"

android:layout_height="wrap_content" />

<Button

android:id="@+id/bLogin"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text="Login" />

</LinearLayout>

Figure 11 - Login.XML

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]