• 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!

Linux Gesior2012 guild_images doesnt show

Idk if ngnix has sth like that, but in apache you can check logs in /var/logs/apache2/error.log which can be really helpful.
And also you can turn on error reporting so you can see errors which are hiden for now.
And that should tell you what's wrong with guild_image script.
 
Post your guild_image.php here.
Code:
<?php
if(!defined('INITIALIZED'))
        exit;
$guild_id = (int) $_REQUEST['id'];
$guild = new Guild($guild_id);
$guildLogo = $guild->getGuildLogo();
$guildLogoInfo = explode(';', $guildLogo, 3);
$image = array();
$image['content_mtime'] = $guildLogoInfo[0];
if(isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && strtotime(preg_replace('/;.*$/','',$_SERVER["HTTP_IF_MODIFIED_SINCE"])) == $image['content_mtime'])
{
        header('HTTP/1.0 304 Not Modified');
        /* PHP/webserver by default can return 'no-cache', so we must modify it */
        header('Cache-Control: public');
        header('Pragma: cache');
        header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $image['content_mtime']) . ' GMT');
}
else
{
        $image['content_type'] = substr($guildLogoInfo[1], 5);
        $image['content'] = base64_decode(substr($guildLogoInfo[2], 7));
        header('Content-Type: ' . $image['content_type']);
        header('Cache-Control: public');
        header('Pragma: cache');
        header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $image['content_mtime']) . ' GMT');
        echo $image['content'];
}
there aren't any logs specific to guilds in my error log.
 
I think that you have downloaded it from a source other than the official github GesiorACC, because I do not see even a script in a website folder.
 
Either set rights to www/images folder or make sure you have the default_guild.jpg or smth image file.
Also check if you have any queries of that image in your database.
 
I spent 10 minutes with Wireshark to find it, because I don't like bugs in version 2012!

Somehow your server adds 'new line' character before image code. It sends image 'bytes' and 'new line' before them. When I removed 'new line' I could open it on windows image explorer.

You server answer:

HTTP/1.1 200 OK
Server: nginx/1.6.1
Date: Wed, 27 Aug 2014 14:14:22 GMT
Content-Type: image/gif
Transfer-Encoding: chunked
Connection: keep-alive
X-Powered-By: PHP/5.5.16-1~dotdeb.1
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: public
Pragma: cache
Last-Modified: Wed, 27 Aug 2014 03:35:38 GMT
<one new line, it's HTTP protocol, good>

b27 <what the hell is that 'b27 and new line'? >
<what? another new line?>

GIF89a@...<rest of image>

If you click 'view source' on any page in 'Chrome' you will see that server adds 'new line' at start of every answer. For HTML it's fine (just skip it), but for binary transfer like image it's big problem.
(about HTTP protocol.. it should be: HTTP HEADERS , ONE EMPTY LINE , CONTENT OF FILE/SITE)

I got no idea what is wrong in nginx/php and how to fix it. I just found out what is wrong.

// I think that change to old images system won't help, as old images were also served by PHP script. Old system -> get images from files, new system -> get images from database, rest of it is almost the same.
 
Last edited:
I spent 10 minutes with Wireshark to find it, because I don't like bugs in version 2012!

Somehow your server adds 'new line' character before image code. It sends image 'bytes' and 'new line' before them. When I removed 'new line' I could open it on windows image explorer.

You server answer:

HTTP/1.1 200 OK
Server: nginx/1.6.1
Date: Wed, 27 Aug 2014 14:14:22 GMT
Content-Type: image/gif
Transfer-Encoding: chunked
Connection: keep-alive
X-Powered-By: PHP/5.5.16-1~dotdeb.1
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: public
Pragma: cache
Last-Modified: Wed, 27 Aug 2014 03:35:38 GMT
<one new line, it's HTTP protocol, good>

b27 <what the hell is that 'b27 and new line'? >
<what? another new line?>

GIF89a@...<rest of image>

If you click 'view source' on any page in 'Chrome' you will see that server adds 'new line' at start of every answer. For HTML it's fine (just skip it), but for binary transfer like image it's big problem.
(about HTTP protocol.. it should be: HTTP HEADERS , ONE EMPTY LINE , CONTENT OF FILE/SITE)

I got no idea what is wrong in nginx/php and how to fix it. I just found out what is wrong.

// I think that change to old images system won't help, as old images were also served by PHP script. Old system -> get images from files, new system -> get images from database, rest of it is almost the same.
seems like nginx issue maybe it's because im using latest stable version and it has a bug like that?
my nginx conf
Code:
user  nginx;
worker_processes  1;

error_log  /var/log/nginx/error.log warn;
pid        /var/run/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    keepalive_timeout  65;

    #gzip  on;
    include /etc/nginx/conf.d/*.conf;
}

albania.conf
Code:
server {
root   /var/www;
    listen       80;
    server_name  albaniaot.com www.albaniaot.com;

    #charset koi8-r;
    #access_log  /var/log/nginx/log/host.access.log  main;

    location / {
        index   index.html index.php;
    }

    #error_page  404              /404.html;

    # redirect server error pages to the static page /50x.html
    #
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;
    }

location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires 1y;
log_not_found off;
}
location ~ [^/]\.php(/|$) {
                fastcgi_split_path_info ^(.+?\.php)(/.*)$;
                if (!-f $document_root$fastcgi_script_name) {
                        return 404;
                }

                fastcgi_pass 127.0.0.1:9000;
                fastcgi_index index.php;
                include fastcgi_params;
        }
}
seems like not , i created a test php with sample content :
view-source:http://albaniaot.com/okok.php
 
Last edited:
It can be bug in any PHP file :/
If in one of acc. maker files [basic ones like index.php or one of 'system' folder files/Website class/Visitor class...] you added ?> at end [in 2012 I removed all ?> ] and after it 'new line' [or enter before <?php ]all pages of acc. maker will add this 'new line' before content. It can be also something with file encoding (UTF-8/UTF-8-without-BOM).
Hard to say without access to files. Add me on Skype: [email protected] , we can try to find it in acc. maker files
EDIT:
We can try to do some stupid tricks like buffer all PHP output of acc. maker [PHP function] and before 'send' to nginx check if there is 'new line at start]. Stupid, but may work :p
EDIT2:
I'm going out now, but you can test it without me. There is file guild_image.php in main folder of acc. maker [not in 'pages'], there is:
PHP:
<?php
// if we set ONLY_PAGE, then it will not login / connect to MySQL until we use SQL query in our script
define('ONLY_PAGE', true);
$_GET['subtopic'] = 'guild_image';
$_REQUEST['subtopic'] = 'guild_image';
include('index.php');
Replace it with:
PHP:
<?php

// TRICK: start buffering
ob_start();

// if we set ONLY_PAGE, then it will not login / connect to MySQL until we use SQL query in our script
define('ONLY_PAGE', true);
$_GET['subtopic'] = 'guild_image';
$_REQUEST['subtopic'] = 'guild_image';
include('index.php');

// TRICK: output buffer without first character, substring from character nr '1' to end (first character is nr 0)
echo substr(ob_get_clean(), 1);
This is not a real solution, because there may occur other problems (like cookies/session problems if server send that 'enter' before send cookies), but should fix guild images.
 
Last edited:
Back
Top