fackz


Member since 08/14/2008

31 snippets

19395 profile views

1 Comment(s) Posted

View their favorites

Profile

Achievement

first submission:submitting first snipplet popular snippet:having a snipplet with 20 favorites

fackz's Recent PHP Snippets



« Prev 1 2
I can't say I can rely on mb_detect_encoding(). Had some freaky false positives a while back. The following code will detect when you need to enconde or decode it.
1 2787 posted 10 years ago by fackz
In wordpress, if you want to auto convert all URLs in your string into clickable hyperlinks, you can actually do it using the built-in function make_clickable(). If you need to do that outside of wordpress, you can use the same function. Example...
2 4434 posted 13 years ago by fackz
This function removes a directory and its contents. Use with careful, no undo!
1 2004 posted 13 years ago by fackz
usage: <?php>
1 1847 posted 14 years ago by fackz
1 2279 posted 15 years ago by fackz
The script below connects to a MySQL database server on "localhost" using the login name "test" and password "123456" and then connects to the database "test". It then copies the table structure and data from the table "products" to a new table "prod...
4 3416 posted 15 years ago by fackz
This example shows how to delete specific files after a given time span. This works good for cleaning cached files.
1 1976 posted 15 years ago by fackz
PHP encrypts your E-mail address and generates the javascript that decrypts it. Most bots and spiders can't execute javascript and that is what makes this work.
3 2393 posted 16 years ago by fackz
This is another way to get a list of files ordered by upload time.
1 2100 posted 16 years ago by fackz
This piece of code will store each line of a txt file into a mysql database
2 2431 posted 16 years ago by fackz
3 1914 posted 16 years ago by fackz
count files in a given dir
2 1890 posted 16 years ago by fackz
A few days ago i was looking for a script witch one will help me to unzip a file using PHP . There is 2 different ways to do it.One just execute a commend to unzip the file in the shell using PHP and another one is using library functions
2 1915 posted 16 years ago by fackz
3 3030 posted 17 years ago by fackz
4 4277 posted 17 years ago by fackz
1 1517 posted 17 years ago by fackz
A basic PHP script that I simply FTP to the server and use to evaluate extensions on the server. I simply supply the extensions I require and the script does the rest of the work.
1 1630 posted 17 years ago by fackz
delete all files in a directory that are more than 7 days old.
4 2362 posted 17 years ago by fackz
The .jpg extension can be changed to any extension. So if you want to pull out only .txt files, you just need to replace the .jpg with .txt. If you want to list ALL files, just remove the condition.
1 2281 posted 17 years ago by fackz
The best part about this script is that any table you put in the query on line 14 will be the headers and data in the CSV. No need to hand type out all the table headers unless you want to comment that section out and put in your own. So if you have...
2 1954 posted 17 years ago by fackz
Database backup function that you can call whenever you want — including nightly CRONs.
6 3175 posted 17 years ago by fackz
1 1951 posted 17 years ago by fackz
Para utilizar, proceda assim: echo formata_data_extenso('2007-04-17'); echo formata_data_extenso('2007-04-17 15:20:35');
1 1853 posted 17 years ago by fackz
Here’s a snippet that can help you to remove a non-empty directory from the server. It’s a recursive function that deletes the directory with its files, folders and sub-folders.
2 1871 posted 17 years ago by fackz
This is a function that selects files from a directory and orders them by the last time they were changed, in ascending or descending order. The snippet also calculates how much time passed since the file’s content was changed.
2 2732 posted 17 years ago by fackz
1 1469 posted 17 years ago by fackz
« Prev 1 2