Example #1
0
<?php

include 'connect.php';
// must return a MySQL connection
include 'functions.php';
$my_profile = createProfile();
$reviewable = false;
if ($my_profile->get_number_of_opinions() > 0) {
    $reviewable = true;
}
?>
<!DOCTYPE HTML>
<html lang="<?php 
echo $my_profile->language;
?>
" class="<?php 
echo $my_profile->uri;
?>
">
	<link href='http://fonts.googleapis.com/css?family=Roboto+Slab:100,300,400,700%7CArvo:400,700' rel='stylesheet'>
	<?php 
$my_profile->print_styles();
?>
    <link href="//netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css" rel="stylesheet">
    <link rel="shortcut icon" href="/favicon.png" />
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <meta name="viewport" content="width=device-width" />
    <meta name="keywords" content="<?php 
echo $my_profile->keywords;
?>
" />
function registerLicenseUUID($LicenseUUID, $LicenseName)
{
    global $authserver;
    $uuid = $LicenseUUID;
    $name = $LicenseName;
    // Есть ли в БД запись с таким LicenseUUID?
    $query1 = "SELECT `uuid` FROM `authserver`.`account_mojang` WHERE `license` = '{$LicenseUUID}';";
    $result1 = $authserver->query($query1) or responseWithError("InternalDatabaseError");
    // Да, запись есть
    if ($result1->num_rows) {
        // Вернём её uuid и имя
        $row = $result1->fetch_assoc();
        $uuid = $row['uuid'];
        $name = getProfileName($uuid);
        // Если обновилось имя, мы можем попробовать обновить его у себя
        if ($LicenseName != $name && isNameFree($LicenseName)) {
            $name = $LicenseName;
            // Регистрируем обновлённое имя учётной записи
            changeProfileName($uuid, $name);
        }
    } else {
        // Попытаемся создать новую запись с указанными LicenseName и LicenseUUID
        // Проверим возможность использовать LicenseUUID как UUID
        $query2 = "SELECT `uuid` FROM `authserver`.`accounts` WHERE `uuid` = '{$LicenseUUID}';";
        $result2 = $authserver->query($query2) or responseWithError("InternalDatabaseError");
        if ($result2->num_rows) {
            // Генерируем новый уникальный UUID, который ещё никем не занят
            $uuid = generateUserUUID(true);
        }
        // Регистрируем UUID и прицепляем ему LicenseUUID
        createProfile($uuid);
        bindProfileLicense($uuid, $LicenseUUID);
        // Проверим возможность использовать LicenseName как Name
        if (!isNameFree($name)) {
            // Генерируем новый уникальный ник
            $name = "License_" . substr($LicenseUUID, 0, 8);
        }
        // Регистрируем имя учётной записи
        changeProfileName($uuid, $name);
    }
    return array("uuid" => $uuid, "name" => $name);
}
                                        <input id="current-pass-control" name="phonenumber" class="span4" type="text" value="<?php 
if ($profile) {
    echo $profile->phonenumber;
}
?>
" autocomplete="false">

                                    </div>
                                    <br>

                                    

                        <?php 
if (isset($_POST['action']) && !isset($_GET['update'])) {
    $profile = array('firstname' => $_POST['fname'], 'lastname' => $_POST['lname'], 'middlename' => $_POST['mname'], 'mmname' => $_POST['mmname'], 'sex' => $_POST['sex'], 'type' => $_POST['type'], 'sssgsis' => $_POST['sssgsis'], 'sssgsis_number' => $_POST['sssgsis_number'], 'precinct' => $_POST['precinct'], 'phonenumber' => $_POST['phonenumber'], 'employee_id' => $_SESSION['user']['employee_id']);
    if (createProfile($profile)) {
        echo "Success";
        echo "<script>window.location.replace('/scc/?page=beibocp');</script>";
    } else {
        echo "Failed";
    }
} else {
    if (isset($_POST['action']) && isset($_GET['update'])) {
        echo "Update Successful";
    }
}
?>
                        
                    </div>
                    <footer id="submit-actions" class="form-actions">
                        <button id="submit-button" type="submit" class="btn btn-primary" name="action" value="CONFIRM">Save</button>