doingword.com

Using wget to download contents of entire ftp directory

wget -r  ftp://127.0.0.1/*  --ftp-user=user --ftp-password=password
[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Add comment | October 17th, 2008

7287pwkr

redirect domain with .htaccess

Redirect domain with .htaccess

Options +FollowSymlinks
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www.domain.com$
RewriteRule ^(.*) http://www.domain.com/$1 [QSA,L,R=301]
[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Add comment | October 13th, 2008

7287pwkr

Total Blackjack

Hi Guys!
I changed the math for the cards, after finished a Magic card game, I think to make a casino game. I enjoy when I play blackjack, so… I make it.
In this version, the tables rules are the next:

  • Dealer stand on 17
  • No late surrender
  • No insurrance
  • Surrender pay 1 to 2
  • Blackjack pay 3 to 2

(Either JavaScript is not active or you are using an old version of Adobe Flash Player. Please install the newest Flash Player.)
Please, tell me what do you think about it!
I hope you enjoy it!

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Add comment | April 10th, 2008

7287pwkr

Math Attack - The Memory Counter Strike

Hi again!
This is second child of the family. I make a very simple interface, with no sound/music and no presentation. To play you need to find the couples between numbers and operations. The main goal of the game is clear all the pieces finding the valid operations. You have two way to to that.
1- Match the result of the operation with a number.
2- Two equal numbers
In all the level you can clear all the pieces.

Here the game!
(Either JavaScript is not active or you are using an old version of Adobe Flash Player. Please install the newest Flash Player.)
I hope you enjoy It!

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Add comment | April 10th, 2008

7287pwkr

Math Attack - The Revenge of the numbers

Hi guys!
This is my first flash game, the history is simple. One day I wake up with the idea to combine math with games, but in a easy way. The best option was Flash, the first steps was very hard, but always you have options, this time my option was my best friend, he is a flash game guru (take a look to his page).
I make a very simple interface, with no sound/music and no presentation. The game is very basic. I want to make it pretty and funny (this is a little complicated, because the most people hate maths!).
To play you need to find the couples between numbers and operations. The main goal of the game is clear all the pieces finding the valid operations. You have three way to to that.
1- Match the result of the operation with a number.
2- Two equal numbers
3- Two operations with the same result.
In all the level you can clear all the pieces.

Here the game!
(Either JavaScript is not active or you are using an old version of Adobe Flash Player. Please install the newest Flash Player.)
I hope you enjoy It!

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Add comment | April 10th, 2008

7287pwkr

Get the name of the file using substr

Hi guys,
Here the php code to get the actual name of the file. This is very usefull when you need to get the name of the file and you only have the full path like /download/games/getfile.php. To get the name I use the $_SERVER[”PHP_SELF”] var.
Here the code:

  1. $file = substr(strrchr($_SERVER["PHP_SELF"],"/"),1);

If $_SERVER[”PHP_SELF”] is /download/games/getfile.php the value of $file is getfile.php
Yes, I know, it’s very simple, but (at least for me) very usefull

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Add comment | December 10th, 2007

7287pwkr

How to get the extention of the file with php with strrchr function

Hi guys,
With this code you can get the extension of a file. This is very simple and useful.

  1. $ext = strrchr($file,".");

If the value of $file is “/files/games/mathattach.swf” the value of $ext will be “.swf”;

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Add comment | November 10th, 2007

7287pwkr

How to make a permanent reditect with php headers

Hi guys!
With this script you can make a permanent 302 redirection with php headers. This is very usefull when you want to make that google think that your domain.com is the same that www.domain.com.
Here the script:

if ($_SERVER[”HTTP_HOST”] == “www.domain.com”)
  1. {
  2. Header( "HTTP/1.1 301 Moved Permanently" );
  3. Header( "Location: http://domain.com".$_SERVER["REQUEST_URI"]);
  4. }

It’s very simple, but very usefull.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Add comment | November 10th, 2007

7287pwkr

Protect files from direct download

Hi guys,
With this script you can control the access to your files with a ACL from secures referrers.
Here the code:

//Array with valid referers.
  1. $validos = Array
  2. (
  3. "http://www.domain.com/files.php",
  4. "http://www.domain.com/forum.php",
  5. "http://www.domain.com/download/file.php"
  6. };
  7.  
  8. //If is the referer in the array, we open the file
  9. if (in_array($_SERVER["HTTP_REFERER"],$validos))
  10. {
  11. //Open the file
  12. $file = $_SERVER["DOCUMENT_ROOT"]."/somefile.rar";
  13. //Send the header with the content type of the file
  14. header("Content-type: application/x-rar-compressed;");
  15. //Send the header with the length of the file
  16. header('Content-Length: ' . filesize($file));
  17. //Send the header with the name of the file
  18. header('Content-Disposition: attachment; filename= somefile.rar');
  19. //Put the content in the var
  20. readfile($file);
  21. }
  22. else
  23. //we redirect the user to another page.
  24. header("Location:http://www.domain.com/notpermision.php");
[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Add comment | June 16th, 2007

7287pwkr

How to compress a directory with tar

Hi Guys,
If we need make a backup of a directory, the best options is use tar.
For example, you have a directory called /home/emanuelq/files and you would like to compress this directory,you can type tar command as follows:

  1. tar -zcvf backup.tar.gz /home/emanuelq/files

The above command will create an archive called backup.tar.gz in the current directory.
If you want to extract the content of the file you need to run this command.

  1. tar -vxfz backup.tar.gz

The above command will be extract the files in the current directory.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Add comment | February 21st, 2007

7287pwkr

Previous Posts