Your guestbook has Spam ?

December 6th, 2005 by Quatrux

Well a lot of people have problems with this, usually the bots find your guestbook and with time start adding some content about casino, gambling, viagra and medicine etc. this is so annoying, you get an email that somebody signed and you need to clean it, wow, what a waste of time ?! and other good robots might index it and that won’t look nice, your site might be thought of being spam one having links to porno sites :D so how can you protect from them, the bad robots ? well the first thing is banning, but as usually they have different IPs it does not help to much, the other thing is cookies, but usually those bots have cookies disabled and sends false headers, so it only might help from some guys spamming your guestbook, those idiots should be shot or their balls could be cut with a big big knife :) The best way is to have a random value of letters and numbers, though I prefer numbers, they look much nicer in the image, yeah so using for example with GD library create an image with that random value, do not forget to have random backgrounds, don’t use one colour, random positions of the letters or numbers, you might even use upper/lower case, but well this protection sometimes annoys the real users.. but that is life, you also should use sessions for this thing to work properly or any method you want. Here is a good PHP function which you can use to generate a value:

  1. < ?php
  3. function random_chars($length = ‘6′) {
  4.         /* Make Random Seed */  $value = ;
  5.         mt_srand((double) microtime() * 1000000);
  6.         $letters = "abcdefghijklmnopqrstuvwxyz"; /* add it if needed ‘123456789′ ‘ABCDEFGHIJKLMOPQRSTUVWXZ’ */
  7.                 for ($i = 0; $i < $length; $i++) {
  8.                         $value .= substr($letters, (mt_rand()%(strlen($letters))), 1);
  9.                 }
  10.         return $value;
  11. }
  13. ?>

So echo random_chars(); will parse a random value every time with the default length of 6, you can change the length you want.

Posted in PHP, Webmastering | 6 Comments »

Faustas Heading

December 5th, 2005 by Quatrux

As a Dog, Faustas had a lot to show in all his life and I think if I am in the mood I could be talking and talking about his life, in some way a dog is like your child, your best friend, as your brother and maybe even as your parent, but it could be an enemy too, if you’re crazy you can make love with it, but if you do, please get out of here and go jump from a building with more than 5 floors, then you will be a happy person, dead, but happy!

So seeing your dogs life from the time he had been born by his mother is quite fun, because humans are smarter than dogs, it is much harder to fool us for them, but still wouldn’t a dog be a perfect child ? just think about it, it does not know how to speak, it does not cost so much to upkeep it, you teach a dog to live, he learns from his fellow dogs too, a dog has no problems with smoking, alcohol and drugs, but eventually it has other problems, like eating other dogs shit, but some humans do it too, I hope they will be smart and jump from a building too. One minus about having a child like a dog, is that he will die faster than you, because his life is much shorter, so you would feel a lot of pain and pain is bad for you, pain is good for you, pain is bad for you. Think of other things, a dog won’t never put you into a pension like most of the grown up kids, you will always be the boss and you don’t need to be afraid when your child will become stronger and will be able to beat you physically.

So in conclusion, dog is one of the best things in our polluted and nasty world where you almost can’t find any truth, but who cares, what is better than a dog it is your own real child, you just have much more problems with it. But living without pain, suffering and problems and even more problems isn’t fun, even if sometimes you think that it would be better to have no problems.. A dog has a lot of problems too, like having apeshit or all the life staying virgin and not feeling the pleasures given by live.

Article taken from » Faustas homepage

Posted in Dog, Philosophy | No Comments »


December 5th, 2005 by Quatrux

Yeah, Monday is one of my worse days in the week, nothing special happens at Monday, I only get tired. Whoever created Mondays.. in school it is quite a hard day, not quite hard, but annoying and exhausting, so sleeping and listening to music is what I do, reading some programming manual or writing some article, like today I added some stories about my Dog Faustas at his homepage which you can find in the right menu, but I slept really well, I dreamed some kind of stupid dream, where I walked around and jumped into a river from a bridge and got a bill of 3 litas which I did not pay, wow even in dreams they have taxes. So I hate Mondays, but if there is no Monday there would not be any Tuesday, so tomorrow is one of the Days, better days, you don’t need to do anything in school except for maths, sometimes I think that maths is fun, but only sometimes. So what did I learn today ? Lets gather the info and make a conclusion – Nothing. But I still need to write something, wow it is midnight already, oh Yea, this has nothing to do with you, but the channel LTV (Lithuania TV) started to show a lot of good films and now is quite an interesting channel! I always laughed out of it, but now I enjoy watching it, but I rarely watch TV so it does not affect me, I never wrote anything more boring than this, so Night!

Posted in Personal | No Comments »

Linux Ubuntu

December 4th, 2005 by Quatrux

Ubuntu Linux the linux distribution for human beings, at least it is called like that, well it was my first distro of Linux which I used and I got the Cd’s by mail, gave some to my friends, because it is really easy to use for dummies, and people who does not play games on windows can fully use linux as their main Operating System, browsing the Internet and feeling save from danger and with better performance, isn’t this just great ? it comes in two Cd’s, the Live CD and Install CD with pre installed stuff and software.

Ubuntu is a free, open source operating system that starts with the breadth of Debian and adds regular releases (every six months), a clear focus on the user and usability (it should “Just Work”, TM) and a commitment to security updates with 18 months of support for every release. Ubuntu ships with the latest Gnome release as well as a selection of server and desktop software that makes for a comfortable desktop experience off a single installation CD.

Ubuntu use Gnome so if there are people who does not like it, you can just use Kubuntu which has KDE, I myself prefer KDE, even though it reminds me more of windows, but I still like it, why the hell we need Windows ? yeah, a little more software available and, yeah and a lot of Games which we can play, but as I am not a big fan of Games, I am more an retro gamer, so I don’t need windows, except for school ;)

Get Ubuntu Linux

P.S I myself Use Gentoo though, but it is for experienced users, so Firstly way go with Ubuntu, but as much as I like Ubuntu, better Get Kubuntu, you’ll have less problems and by installing an engine which makes GTK to QT your Gnome applications on KDE will look Good, I mean Bluefish, Gaim, Gimp etc.

Posted in Computers, Linux | No Comments »

Functions in PHP

December 4th, 2005 by Quatrux

custom Functions in PHP is one of the best things available to optimize your code, the things you can do with it are enormous, here is my two examples of some functions which you can use.

  1. < ?php
  3. function pw_encode($pass) {
  4.         /* Check Input */
  5.         if (is_string($pass) AND !empty($pass)) {
  6.                 /* Make a Random Seed */        $s = '';
  7.                 for ($i = 0; $i < 8; $i++) {
  8.                         $s .= substr('0123456789abcdef', mt_rand(0,15), 1);
  9.                 }
  10.                 return md5($s.$pass).$s;
  11.         } else {
  12.                 user_error('pw_encode() The input should be non empty string', E_USER_WARNING);
  13.                 return FALSE;
  14.         }
  15. }
  17. function pw_check($pass, $value) {
  18.         /* Check Input */
  19.         if (is_string($pass) AND is_string($value) AND !empty($pass) AND !empty($value)) {
  20.                 /* Get the Seed */
  21.                 $s = substr($value, 32, 8 );
  22.                 /* Check the Passwords */
  23.                 if (md5($s.$pass).$s == $value) {
  24.                         return TRUE;
  25.                 } else {
  26.                         return FALSE;
  27.                 }
  28.         } else {
  29.                 user_error('pw_decode() The both input values should be non empty strings', E_USER_WARNING);
  30.                 return FALSE;
  31.         }
  32. }

so now, how would you use those functions ? it is really simple, if you know some PHP, here is an example, you just need to call the function like an ordinary compiled php function :D

  1. < ?php
  2. /* Encode the Password */
  3. $password = pw_encode(‘my_pass’);
  4. // it is recommended to store the password somewhere in your database
  5. /* Check the Password */
  6. // the password could come from a Post method and the $password from the database or a txt file etc.
  7. if (pw_check($password, ‘my pass’)) {
  8.         echo ‘the password is correct’;
  9. } else {
  10.         echo ‘you forgot your password ?’;
  11. }
  12. ?>

This is just one example, in functions you can’t use variables from outside the script, unless you make them global, or you can use super globals like $_SERVER, $_GET, $_POST, $_SESSION inside the functions also $GLOBALS[] array and constants which you defined using define() like if you would like to use mysql_resource in the function, just pass it through into the function: function name($a, $b, $mysql_connection) {} and whola you can use mysql in the function without needing to connect inside the function, same for ftp and irc gateway connections. Don’t forget that include() function works well in the functions or you can use file() and everything you want, as I said it is enormous thing, imagine your simple site: file index.php

  1. < ?php
  3. /* My Site*/
  4. include "functions.php";
  5. echo_site();
  6. ?>

and the function will just output everything, well it is not the best way but it is possible. ;)
Enough for today :D

Posted in PHP, Webmastering | No Comments »

Nothing Special

December 4th, 2005 by Quatrux

It is December and it is quite cold here in Lithuania at this time, but yesterday it was much colder, well the day Sunday was rather annoying, but I liked it, I slept quite well and done my job for several hours too after which I felt exhausted, but anyway being home at last I found some time to tidy my room, it looked like a dumpster :S To continue, I made some changes in my PHP Project “Q Zone User Panel” but I need to improve it more that it would be much secure, you know never trust the User Information which is send, I mean the Headers, Post, Get, Put so I need to check it, but still I need to keep it very very optimized. I had a bottle of beer that I could sleep better when walking my dog, but the beer from the shop was much warmer than the Yard temperature :D but it was good, better than water at home, next time I will need to buy some juice, but it is more expensive than beer :) I still like Tea, home made Tea, so it is Tea time for me; Today I learned that having problems makes you much stronger than living without problems, I done almost all my weeks job in one day and the rest of the days I was resting, isn’t this great ? Have a good day fellow stupid People. ;)

Posted in Personal | No Comments »

Output Buffering

December 4th, 2005 by Quatrux

What I found interesting is that output buffering can be really handy and that using it for half of year I had no problems with it, I mean using ob_start() function with gz_handler here is an example, put it somewhere in top of your file:

  1. < ?php
  2. /* Start GZipped or Plain Output Buffering */
  3. if (extension_loaded(‘zlib’) AND (ini_get(‘zlib.output_compression’) != ‘1′ OR ini_get(‘output_handler’) != ‘ob_gzhandler’)) {
  4.         ob_start("ob_gzhandler");
  5. } else {
  6.         ob_start();
  7. }
  8. ?>

using it you can use header() function anywhere in the files even if you wrote echo or made some output, you can edit the output, just read about output buffering functions in the php manual –

because our html has so many the same tags it is just perfect for using gzip on it, it can compress up to 60% of your source, in this way you save bandwidth and time for the user to get the file and it works great because if the user browser can’t decode gzip it won’t be sent with gzip encoding, it saves time because apache does not need to use the resources of sending the file, but it uses a bit of resources to encode using gzip, all in all it is a thing which I found to late, but I am happy I found it, it opened me new possibilities. :D

Posted in PHP, Webmastering | 5 Comments »


December 4th, 2005 by Quatrux

Half of year has gone and I don’t think that a lot has changed, I don’t see any difference, but if I think deeper, those half year had many changes in me, I think that I am spending my days doing nothing, but as when I think of the results, I have done quite a lot, I am quite happy with that, don’t rush and you’ll be the first has some truth, I wonder if I could spend my time working and not watching TV or chatting everyday, how much I could do, but I like that I only do the things I want, if I don’t want to do it today, I won’t, this thing is really not good, but it works, when I am in the mood to do it, I really do it quite fast and quite well, so school, I won’t do homework today, maybe tomorrow, I am not afraid of having another 2 and I won’t. Time is my enemy now, but I need to learn to use it and make my enemy’s peaceful that they would not bother me. :)

Posted in Personal | No Comments »

Back Online

December 3rd, 2005 by Quatrux

Good Evening, my Blog which has not been working since 2005 summer came back Online, my host has pruned my account and I lost my database, so this is a good lesson to have backups and make them at least once a week, but yeah I know that it is so boring and time consuming..

Posted in Personal | 1 Comment »

    Next Entries »