Flux RSS des billets

DotMG's joblog

Work hard at whatever you do! (Ecc. 9. 10a)
Publié le 3 Oct 2012, 2:31 am dans cms, php

One reseller of webhosting at Dot.MG asked me to revamp one of her customer's website. The old webmaster seems to ignore anything about templating and dynamic pages, all files of the website were served statically. That's a good thing for my servers, but a very bad thing when it comes to touch something in his designs. We'll talk later about how I re-templated this installation.

This site had a bulletin board, which was hosted elsewhere, on free forum hosting, and integrated to his site with ugly <iframe>.

I had to install myself a discussion board, and, it's the first time in years that I had to play again with a bulletin board. Last time I've use one, PhpBB was the king of BBs. One of the forum I like is run by Vanilla and I went on their site to download one look for a download link. I was not looking to download the archive, rather looking for a download link, to copy the URL and use wget on the server. Actually, I feel very uncomfortable with downloading something to my PC and then uploading the file to my servers. I'm now used to get the tarball directly from my test server, doing the install there, and repeat the process on the production box when everything is okay.

But, VanillaForums didn't give a simple download link, the download was on a post form, so I was obviously obliged to use a browser and click the download button. I gave a last chance to Vanilla by passing --post-data to wget, but when this was also failing, I gave up and did a quick search for lightweight forum. Then I saw this stackoverflow discussion where I saw PunBB as one of the candidates. And yes, PunBB has usable download links. At my great surprise, PunBB has support for Sqlite, the installation was easy and straighforward.

And there are the reasons why I chose PunBB.

Publié le 2 Oct 2012, 8:33 am dans linux
Installing roundcube is really easy. Since I'm on Debian, roundcube packages are available, all I have to do is apt-get install roundcube. Before that, I've setup a virtual server on nginx for roundcube. But since nginx is not supported by the roundcube installation, I had to manually modify the nginx settings. There was a file apache.conf in the /etc/roundcube/ folder, and it helped me find out the changes to make to nginx.conf. Very easy, it's just to change the root folder:
#       root /home/dotmg/http/hosts/myvhost.com;
        root /var/lib/roundcube;
When launched, it threw this error:
main.inc.php was not found.
Please read the INSTALL instructions!
It's just because I run this vhost as another user, dotmg, but the roundcube install by apt-get assigned config files to user www-data. The main.inc.php file was on /etc/roundcube/. I needed also to give ownership of debian-db.php to my user. Then, I read the content of this file, and since my roundcube database backend is a sqlite server, I also gave ownership of the roundcube folder containing my database to this user. To know this folder, read $basepath and $dbname in debian-db.php
 chown dotmg:dotmg /etc/roundcube/main.inc.php
 chown dotmg:dotmg /etc/roundcube/debian-db.php
 chown dotmg:dotmg -R /var/lib/dbconfig-common/sqlite/roundcube/roundcube
Publié le 27 Sep 2012, 10:14 pm dans php
I was given a CD containing a website that the owner wanted to transfer to my Madagascar web hosting dot.mg. Well, I don't know how they did burn this disk, but when the copy and installation was completed, the site showed gibberish content and at the bottom of the page a sensitive part of the PHP source were exposed. Some of the PHP source were corrupted, and the <?php markers along with some code were replaced with binary lettersalad. I spotted only one file corrupted, but since this corruption could leak sensitive information, I needed a way to list all corrupted files so that I could reclaim them from the website owner. So, basically, what I want is a tool that checks all php files and list which ones of them contains binary data. The quick solution I created was this very simple command :
 grep -r $'[\x0e-\x1f]' * | grep php
My pattern is $'[\x0e-\x1f'], any character between ascii code hex 0E and 1F. I could have listed all character that cannot appear in normal text files, but somehow, this was sufficient. The option -r iterates through subfolders, and for this, I could not use *.php as file pattern. The first part of this command finds binary characters from 0E to 1F in all files. If a match is found, it outputs texts like
Binary file images/test.jpg matches
Binary file inc/connexion.php matches
Look! grep considered file inc/connexion.php as binary file. What remains is to filter this output and show only php files, that's what piping to grep php stands for. And voilà!
Publié le 25 Sep 2012, 12:14 pm dans html, css
One of the first advices I heard when doing my job as webmaster is to never use tables other than to list tabular data. On this work, I had to present two columns, they should have the same height, their width are fixed. On the left, I should have one column, grey background, 200px width that I call #sidebar, and on the right, another column, white background, 600px width that I call #main_content. These two block should have the same height, equal to the bigger one. With a table, the job would be very easy :
/* CSS: */
#sidebar {
 width: 200px;
 background: #ccc;}
#main_content {
 width: 600px;
 background: #fff;}
<td id="sidebar"></td>
<td id="main_content"></td>
With floating divs, this was my first try:
/* CSS: */
#sidebar {
 width: 200px;
 background: #ccc;
 float: left;
 min-height: 800px;}
#main_content {
 width: 600px;
 background: #fff;}
<div id="sidebar"></div>
<div id="main_content"></div>
Unfortunately, CSS3 doesn't have a rule to force the height of one block to be equal to the height of another. And I didn't want to experiment display:table-cell. The solution I found is to let the sidebar have the height it wants, as the min-height was totally useless here, so I removed background and min-height. To make my sidebar have a background color that would fill all the height, I had to put a parent div.
/* CSS */
#parentdiv {
  background: url('grey.png') repeat-y; }
#sidebar {
  width: 200px;
  float: left; }
#main_content {
  width: 600px; }
.closing {
  clear: both; }
<div id="parentdiv">
  <div id="sidebar"></div>
  <div id="main_content"></div>
  <div class="closing"></div>
The grey background of the sidebar had to be done on the parentdiv, using an image that fills only 200px on the left. But, hey, the height of the parentdiv is not what we think, because some of the child div is floating. Using the <div class="closing"> which is styled clear:both; fixes this. This div has no content, it serves just to fix the height of the parentdiv.
Publié le 10 Jui 2012, 2:16 pm dans dot.mg


I'm DotMG. I run a Malagasy web hosting company which offers shared hosting and domain names. My main clients are Malagasy or inhabitants of Madagascar, but there are also some international customers interested in acquiring a .mg domain name.

This site is a joblog, not a weblog. That means what I'll share here is my professional activities, the problems I encounter and the way I solved these issues. There will be also some thoughts or discussion about the IT world, the geek culture, and about the webhosting industry.

As you would have already noticed, I'm very bad in english. It's a choice to publish in a language I'm not fluent with, I reckon you'll find in this blog many childish sentences, too many errors, but all I just hope is that you can understand what I mean. And in ten years, I'll laugh at my own sentences...

For the technical part, this blog runs on Blite. Blite is a new blog engine, its particularity is that Blite is a light engine, consuming very little resource in terms of memory and sql access.

That's all. Good visit folks!

Pages: 1 2 3 4 5