Archive for 'PHP' Category

Compress files with PHP


1 Estrelas2 Estrelas3 Estrelas4 Estrelas5 Estrelas (2 votes, average: 3.00 out of 5)
Loading ... Loading ...

Hello folks, today I will show you how to compress file with PHP. The procedure is very simple, if your server is with zlib enabled just run a code like this:

  1. <?
  2. / **
  3. * Inserts a file within a zip.
  4. *
  5. * @ Param string $ name name_of_zip ZIP file that will be worked.
  6. * @ Param string $ path_file Path original file that goes to the ZIP
  7. * @ Param string $ file_name file name inside the ZIP
  8. * @ Return Mixed
  9. * /
  10. $name_of_zip = null , $path_file = null , $file_name = null ) { fileToZip function ($ name_of_zip = null, $ path_file = null, $ file_name = null) (
  11. empty ( $name_of_zip ) || empty ( $path_file ) || empty ( $file_name ) ) { if ( empty ($ name_of_zip) | | empty ($ path_file) | | empty ($ file_name)) (
  12. ; return 'All parameters are required';
  13. )
  14. / / Create an instance of the ZIP
  15. ZipArchive; $ Zip = new ZipArchive;
  16. / / If unable to create the ZIP file
  17. $zip -> open ( $name_of_zip , ZIPARCHIVE:: CREATE ) === true ) { if ($ zip -> open ($ name_of_zip, ZIPARCHIVE:: CREATE) === true) (
  18. / / Add the file in the zip
  19. ( $path_file , $file_name ) ; $ Zip -> AddFile ($ path_file, $ file_name);
  20. ( ) ; // fecha a conexão com o ZIP $ Zip -> close () / / close the connection to the ZIP
  21. / / Optionally you can delete the original file, just insert a variable in the parameters
  22. / / Unlink ("/ path / to / file / file.php ');
  23. ; return true;
  24. { Else ()
  25. ; return false;
  26. )
  27. )
  28. ?>

Read the rest of this entry »

[Quickie] PHP - Do not write files. "Inc '


1 Estrelas2 Estrelas3 Estrelas4 Estrelas5 Estrelas (2 votes, average: 5.00 out of 5)
Loading ... Loading ...

If your Apache server is not configured properly it causes files. Inc is displayed on the screen. Soon, the entire contents of the file is displayed in the browser.

Say you have a file in which the arrow of your system settings, such as: Host of the database, username and password.
Saved with the name config.inc.
By accessing this file directly by URL see what happens:

config.inc sendo exibido no Firefox Read the rest of this entry »

2nd Meeting PHP MG


1 Estrelas2 Estrelas3 Estrelas4 Estrelas5 Estrelas (4 votes, average: 5.00 out of 5)
Loading ... Loading ...

OA staff all good?

Today I am posting the presentation of the lecture that I gave at the 2nd Meeting of PHP MG days 17/10/2009.

How to migrate your development environment for Linux.

Read the rest of this entry »

wget recursive


1 Estrelas2 Estrelas3 Estrelas4 Estrelas5 Estrelas (6 votes, average: 5.00 out of 5)
Loading ... Loading ...

Good morning everyone!

Today I am posting one more little hint of Linux (you should have noticed that Linux esto addicting)! I'll show you how to download files from an FTP recursively. But what good is it? Simple! Imagine the following scenario: I want to do a routine backup of my system.

Suppose my system is hosted at marcelosabadini.com.br / system / and want to download ALL contents. So would run the following command:

  1. ://USUARIO-DO-FTP:SENHA@marcelosabadini.com.br/sistema wget-r ftp: / / USER-DO-FTP: SENHA@marcelosabadini.com.br / system

Who does the magic here is the-r option. Here's some interesting options of wget: Read the rest of this entry »

1st Meeting of the PHP group MG


1 Estrelas2 Estrelas3 Estrelas4 Estrelas5 Estrelas (3 votes, average: 4.33 out of 5)
Loading ... Loading ...

In the last 25 days, was held in Belo Horizonte the 1st Meeting PHP MG , which gathered about 250 people from 31 cities.

I had the opportunity to attend the event and was very happy to see the packed auditorium. The event was very good and the networking was even better, met people who had heard (and to my surprise people had already heard of me :D ).

To me, the best presentation was that of Joachim of PHPrime about SCRUM. See the PDF here .

Read the rest of this entry »

Get Adobe Flash player Plugin by wpburn.com wordpress themes