• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

[in development] Psychonaut04 AAC

psychonaut04

New Member
Joined
Mar 10, 2017
Messages
5
Reaction score
2
psychonaut04 AAC

Introduction
psychonaut04 AAC is a project in development, is an AAC on it's own way, it intends to have a easy design exploring new styles.
Note: The project is small right now, at the beginning, the code is not as good as possible. But if you take a look at github and give a feedback it would be nice.

Components(there will be more)

Bourbon, Neat, Refills, Sass, Bootstrap, animate.css

Code
Open Source, available on GitHub. No license information for now(don't use it).
Features(Not everything is done):

- Two account types, forum(website) and in-game.

- Changeable templates(footer, navbar...)

- MD5, sha1 and plaintext support

- Support to different encrypt method at website/game.

- Multi-language support.

- Admin login to edit server info

- Comments at news page with user forum account

- Ticket support system

- Forum

Old screenshots, testing the multi-language support(only at footer)

Screenshots:
aac progress.jpg aac1.png aac2.png
 
I would make it something like this:
PHP:
<?php
session_start();
header('Cache-control: private');

if (isSet($_GET['lang'])) {
    $lang = $_GET['lang'];

    // register the session and set the cookie
    $_SESSION['lang'] = $lang;
    setcookie('lang', $lang, time() + (3600 * 24 * 30));

} else {
    $lang = $_SESSION['lang'] ?? $_COOKIE['lang'] ?? substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
}

switch ($lang) {

    // English
    case 'en':
    $lang_file = 'lang.en.php';
    break;

    // Portuguese
    case 'pt':
    $lang_file = 'lang.pt.php';
    break;

    // Defaults to English
    default:
    $lang_file = 'lang.en.php';
}

include_once $lang_file;
?>
(Did some code modifcations, avoid loading a file based on HTTP_ACCEPT_LANGUAGE. Especially since you don't have all languages added yet).

WordPress has a pretty decent PHP coding standard:
PHP Coding Standards

Might be worth a look.
 
PHP Standards Recommendations - PHP-FIG
  • You should look into using composer
  • Mixing PHP and HTML is so 2012, maybe a template engine is a good fit
  • Your identation looks weird and doesnt seem you are following a pattern
  • There is no need to use ?> on PHP files if you end-up with PHP code

I always like projects like these. Good luck =)
 
Last edited:
I would make it something like this:
PHP:
<?php
session_start();
header('Cache-control: private');

if (isSet($_GET['lang'])) {
    $lang = $_GET['lang'];

    // register the session and set the cookie
    $_SESSION['lang'] = $lang;
    setcookie('lang', $lang, time() + (3600 * 24 * 30));

} else {
    $lang = $_SESSION['lang'] ?? $_COOKIE['lang'] ?? substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
}

switch ($lang) {

    // English
    case 'en':
    $lang_file = 'lang.en.php';
    break;

    // Portuguese
    case 'pt':
    $lang_file = 'lang.pt.php';
    break;

    // Defaults to English
    default:
    $lang_file = 'lang.en.php';
}

include_once $lang_file;
?>
(Did some code modifcations, avoid loading a file based on HTTP_ACCEPT_LANGUAGE. Especially since you don't have all languages added yet).

WordPress has a pretty decent PHP coding standard:
PHP Coding Standards

Might be worth a look.

PHP Standards Recommendations - PHP-FIG
  • You should look into using composer
  • Mixing PHP and HTML is so 2012, maybe a template engine is a good fit
  • Your identation looks weird and doesnt seem you are following a pattern
  • There is no need to use ?> on PHP files if you end-up with PHP code

I always like projects like these. Good luck =)


Thanks for the tips! I'll take a look in these links.
 
Back
Top