live is really very beautiful

May 5th, 2007 by Quatrux

Yeah, it is really very beautiful, I just thought about it, even thought I thought the other way, it is than you think about it, but when you think in a a better way, live is really beautiful, there is no point to be depressed all the live, just for several months or years, hahaha, fuck you ;)

Posted in Personal | No Comments »

no time to do something serious

May 1st, 2007 by Quatrux

No time, I have no time to finish and do everything, so much to do so little time, hope the end will be a happy one for me. ;]

Posted in Personal | No Comments »

iAmiga

April 17th, 2007 by Quatrux

I found this site, it is an alternative to google search engine, but only searches through sites related to Amiga, seems quite nice as most of those sites died having Amiga content, due to most of Amiga sites went down or were closed and it was hard to update everything, so you can try iAmiga Search

Don’t be very happy as this is nothing just a custom Google Search, which anyone can do, I remember I played with it when I was 15 years old.

Posted in Amiga | No Comments »

started playing Warcraft!

April 16th, 2007 by Quatrux

Well, as I am quite an retro gamer and usually only play old games, but usually I don’t play, so due to I didn’t know what to do, I looked up my collection of DOS Games and started playing Warcraft using the good old and simple Dos-box, I finished the first mission quite fast, so I think with time I will play it and finish.. I remember on Amiga I played and finished with cheats and without cheats Dune II, that was really a great game, even though Amiga never had a version of Warcraft, I remember I tried to emulate MacOS on Amiga using Shape Shifter, due to I had an m68k processor as all Amiga’s had or added PPC, anyway, it was quite fast to run MacOS and Play the Mac version of Warcraft, but it annoyed me to emulate, so I never bothered to continue.. Also, Battlecraft had to be the game for Amiga to replace Warcraft, but as I know the project is/was abandon and never really worked as it could, only some demo is available with a map editor from the Aminet.. So I think I will enjoy Warcraft 1 Humans & Orcs ;)

Posted in Amiga, Personal | 1 Comment »

new Opera version 9.20 released!

April 15th, 2007 by Quatrux

Just noticed that a new non beta version of the Opera browser was released, so I upgraded from 9.10 to 9.20, even though there aren’t a lot of changes, but the changlog says that there are some minor changes, even I don’t care about them such as start bar disabled now by default, it was always annoying me ;] they also added support for GIF animations in skins.. Now more interesting changes: CSS height:inherit now inherits the computed value, scripts in framesets now execute onload and applets inserted with innerHTML can now be called by JavaScript! I still didn’t get into it, but there is somekind of Introduction of developer tools. Moreover, some other security and stability fixes and similar, you can read the full changelog for Opera 9.20

Posted in Windows | No Comments »

Gaim renamed to Pidgin!

April 13th, 2007 by Quatrux

Even though this is quite old news, only Today I found time to post about it, the popular open source multi-protocol instant messaging client Gaim was renamed to Pidgin and now can be found on a new address: http://www.pidgin.im and im doesn’t stand for Instant Messenger, in fact it is a country address/code, the same is with .tv and .cc and .fm even though the .fm usually looks something like a radio for use, .tv something associated with TV :D Anyway, the Gaim in the beginning were called GTK+ AOL Instant Messenger, at that time there were no AIM, but AOL didn’t like it, so they just called it Gaim and everything was fine, but recently, AOL didn’t like Gaim as it is similar to AIM and the name is still a short version of GTK+ AOL IM = GAIM, so after all those trademark stuff and lawsuits, Gaim was officially renamed to Pidgin, a word which really won’t bring any lawsuit.. And it was announced that the version 2.0.0 of this software will come soon, so Pidgin/Gaim will be really much better in my opinion, I quite got used to the new name after a week :D Remember when people disliked the names Phoenix, Firebird, Firefox, Mozilla, but now everyone is used to Firefox, so I think the name change won’t really affect the great IM client.. :P

Posted in Linux, Open Source, Windows | 1 Comment »

It is snowing on April

April 7th, 2007 by Quatrux

I thought summer is almost here, it was so hot here in Lithuania on April and the end of March, but now it is really cold, it is fakin April 7 and is snowing.. Even though when the sun comes, it gets quite warm, but not on the sun, with the really cold wind, I really feel the difference..

Posted in Personal | 2 Comments »

April Fools’ Day again

April 1st, 2007 by Quatrux

Time runs quite fast, another year, another April Fool’s Day.. I got fooled several times, but that isn’t nothing special, I don’t really care, but I visited Apex DC++ main site and saw some news, that Apex DC++ version 1.0 was released, didn’t even thought about the fucking fools day :D and downloaded, installed it and yeah, nothing changed, but I noticed it after re-installation, that there is no fucking Apex DC++ version 1.0 yet :P

And as always, Google introduced something, this time it is really evil ;)

Get your self Google Tisp :O

Posted in Personal | No Comments »

Want to delete a PHP Session?

March 15th, 2007 by Quatrux

A lot of PHP novice programmers which don’t want to understand how the sessions work in the beginning, usually doesn’t delete a session the right way, so I wanted to post an example PHP script session_delete(); which deletes everything as needed.

  1. function session_delete($sname = ‘Current User’) {
  2.         # Set Session Name to a Variable
  3.         $name = session_name();
  4.         /* Empty the Cookie from Session */
  5.         if (!headers_sent() ) { setcookie($name,"",0,"/"); }
  6.         /* Remove the Cookie Value */
  7.         unset($_COOKIE[$name]);
  8.         /* Remove all the Info from the Super Global */
  9.         $_SESSION = array();
  10.         /* Free all session variables */
  11.         session_unset();
  12.         /* Destroy all data registered to a session */
  13.         if (session_destroy() === FALSE) {
  14.                 return FALSE;
  15.         } else {
  16.                 return TRUE;
  17.         }       
  18. }

Posted in PHP | No Comments »

What is the difference between ["PHP_SELF"], ["SCRIPT_NAME"] and ["REQUEST_URI"]?

March 15th, 2007 by Quatrux

What is the difference between ‘PHP_SELF’, ‘SCRIPT_NAME’ and ‘REQUEST_URI’ in the superglobal $_SERVER[] or also known as $HTTP_SERVER_VARS which is deprecated since PHP 4.1.0 and isn’t really a superglobal, but anyway, what is the difference? On different support channels and forums people ask this question and I tried to search google and didn’t find an answer, so I thought to write it here.

$_SERVER['PHP_SELF'];

The filename of the currently executing script, relative to the document root. For instance, $_SERVER['PHP_SELF'] in a script at the address http://example.com/test.php/foo.bar would be /test.php/foo.bar.

  • http://example.com/ — – — /index.php
  • http://example.com/test/index.php — – — /test/index.php
  • http://example.com/index.php?q=submit — – — /index.php
  • http://example.com/index.php/test/ — – — /index.php/test

So actually it returns the path to the current filename typed in the url without the QUERY_STRING, but when we us index.php/test/download/ it shows the path to ../test/download/ as we want it to do that, because usually using PHP_SELF is very useful with submitting forms, so having the PATH_INFO included in the PHP_SELF is a good idea and if you don’t want it, just use SCRIPT_NAME which will always show the executing file.

$_SERVER['SCRIPT_NAME'];

Contains the current script’s path. This is useful for pages which need to point to themselves.

  • http://example.com/ — – — /index.php
  • http://example.com/test/index.php — – — /test/index.php
  • http://example.com/index.php?q=submit — – — /index.php
  • http://example.com/index.php/test/ — – — /index.php/

So it is similar to PHP_SELF, just the PATH_INFO isn’t included, so you just point to the current filename executing. Note; that SCRIPT_FILENAME actually is the same, but it also returns the server root and acts the same as $_SERVER['DOCUMENT_ROOT']; . ” . $_SERVER['SCRIPT_NAME'];

$_SERVER['REQUEST_URI'];

The URI which was given in order to access this page; for instance, ‘/index.html’.

A lot of people usually don’t understand the usage of this, for example if you wanted to access index.html but it didn’t exist on the server, you get redirected to say 404.php page which says that the filename doesn’t exist, when you will try to use any other value, like PHP_SELF or SCRIPT_NAME it will print you /404.php and not the file you requested, but when you will use REQUEST_URI, it will print the full URL which you typed in order to get to that page, this sometimes is quite useful.

In addition, I recommend to use the constant __FILE__ if you want to get the absolute path to your current dir and if you want to set an include path, it is best to do it also with this constant by adding the function dirname(); like this: dirname(__FILE__);

  1. /* Change Super Global */
  2. $s =& $_SERVER;
  3. /* Set the Default Include Path */
  4. set_include_path( dirname( $s[‘SCRIPT_FILENAME’] ).‘/includes’. PATH_SEPARATOR . dirname(__FILE__) );

If you ask if this is different, when I will say yes it is. The first value points to the currently executing file like /index.php and the second value is pointing to the current included file directory, it even can be outside /public_html/ somewhere in /home/user

Sometimes people don’t want to get the filename, but only the Query of the GET method, so there is a value $_SERVER['QUERY_STRING']; which returns everything after the ?

  • http://example.com// — – — (nothing)
  • http://example.com/test/index.php — – — (nothing)
  • http://example.com/index.php?q=submit — – — q=submit
  • http://example.com/index.php/test/ — – — (nothing)
  • http://example.com/index.php/test/?q=submit — – — q=submit

Furthermore, if you want to get the server root, you can use $_SERVER['DOCUMENT_ROOT']; which usually returns something like /home/user/public_html/

Moreover, sometimes you can have an headache if you want to get the domain the script is currently running on, you ask why? because sometimes you can use not the right $_SERVER array key for that.. if you’ll be using $_SERVER['SERVER_NAME']; you will get the domain of the server, but say you’re using CPanel and added a domain through it and you will execute under it, you will still get the original server domain, this is called virtual host, in order to get it you need to use $_SERVER['HTTP_HOST'];

Read more about Reserved Server Variables on PHP dot net Manual!

Posted in PHP | No Comments »

« Previous Entries     Next Entries »