Example #1
0
$content = null;
#POST_CASE
if (isset($_POST['key']) && $_POST['key'] != '') {
    $_SESSION['comeFrom'] = 'index';
    if (is_array($_POST['key'])) {
        $location = "Location: links.php?";
        foreach ($_POST['key'] as $key) {
            if ($key != '') {
                $location .= 'ckey[]=' . ryzom_encrypt($key, FLUNKER_CRYPT_KEY) . '&';
            }
        }
        session_write_close();
        header($location);
    } else {
        session_write_close();
        header('Location: links.php?ckey=' . ryzom_encrypt($_POST['key'], FLUNKER_CRYPT_KEY));
    }
}
if ($content == null) {
    # First time case
    // Display the form to enter the API Key
    $content = '<form action="" method="post"><p>';
    $content .= __('Please enter the API Key(s) (guild or character) that you can find on');
    $content .= ' <a href="https://secure.ryzom.com/payment_profile">';
    $content .= __('your profile page');
    $content .= '</a>:</p>';
    $content .= '<input type="text" name="key[]"/><br/>';
    $content .= '<input type="text" name="key[]"/><br/>';
    $content .= '<input type="text" name="key[]"/><br/>';
    $content .= '<input type="text" name="key[]"/><br/>';
    $content .= '<input type="text" name="key[]"/><br/>';
function ryzom_ckey_handle($passphrase = '')
{
    if (isset($_GET['get_ckey'])) {
        die(ryzom_encrypt($_GET['get_ckey'], $passphrase));
    }
}
<?php

require_once 'ryzom_api/ryzom_api.php';
if (isset($_POST['key']) && $_POST['key'] != '') {
    header('Location: ?ckey=' . ryzom_encrypt($_POST['key']));
}
ryzom_ckey_handle();
header('Content-Type:text/html; charset=UTF-8');
echo '
	<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
	<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
	<head>
	<title>Character Profile</title>
	<meta http-equiv="content-type" content="text/html; charset=utf-8" />
	' . ryzom_render_header() . '
	' . ryzom_render_header_www() . '
	</head>
	<body>
';
if (isset($_GET['ckey']) && $_GET['ckey'] != '') {
    ryzom_log_start('example_profile');
    // Display the profile
    $ckey = $_GET['ckey'];
    $key = ryzom_decrypt($ckey);
    $uid = 0;
    $gid = 0;
    $slot = 0;
    $full = false;
    if (ryzom_character_valid_key($key, $uid, $slot, $full)) {
        $xml = ryzom_character_simplexml($key, 'full');
    } else {