n8coder's blog

Display E-Mail Adresse of anonym visitors in Drupal-comments securely

in

Visitors post comments and they live sometimes their contact information like email address to get feedback. If you display e-mail spambots will catch them before other visitors. If you dont display, other visitors cannot send feedback. What is the secure anti-spam solution?

Here is what I did:

- email adresse of comment-poster will just partly shown to other anonym visitors (and with a tip to register to see full email)
- email adresse of comment-poster will shown to other registered visitors fully

Backup all MySQL databases automagicly with the PHP admin script

Server administration software like Cpanel, Plesl, Webmin etc have already their backup solutions. But they are runned mostly once a week or max a day because of performance reasons. Let say we just want to backup all of our mysql-databases every 2 hours.

To do this:

  • Create a directory like /backup/mysql
  • Save code below under something like backup_mysql.php
  • Chmod it to 755
  • Run it manually or with cronjobs /root/scripts/backup_mysql.php
#!/usr/bin/php
<?php
// use this if your php.ini does not allow shell etc #!/usr/bin/php -n

How to select a secure password for your online logins

What is a good password?

A good paswword is:

- at least 8 char long
- includes letters, CAPS and numbers
- never repeated somewhere else
- cannot be found as a string on a search engines, Google finds 0 result for it
- cannot be found in any dictionary/database exists on the world
- nobody incl. your wife can guess / estimate it
- easy to remember for you

To do this build a long sentence, take the first chars of words, combine with usename-userid and service u logging on, encrpyt it with a formel just you know.

Never do:

Server Benchmark with PHP 5 : ThePlanet, Hosteurope, Hetzner

This is a small benchmark test / performance comparison with PHP 5 between ThePlanet, Hosteurope and Hetzner Servers. Servers are not same, and there are RAM difference but in this test RAM plays no big role, but CPU plays. The server from Hosteurope is a virtual server with min. 2GB ram guarantie. The other two are dedicated root servers. ThePlanet's OS is Redhat enterprise, The other two are using Debian.

Hetzner : Intel® Core™ i7-920 Quad-Core with 8GB Ram
Hosteurope: 8 Cores Intel® Xeon® with min 2GB or more
ThePlanet: 2x DualCore Intel(R) Xeon(TM) CPU 3.40GHz with 2GB

Save / open .ico files (icons) with Adobe Photoshop CS4 64 / 32 Bit

First visit http://www.telegraphics.com.au/sw/#icoformat and download the true version (32 / 64 Bit) for your OS (Mac / Windows / Linux)

Attention: at this time I could not get 64bit Plugin (... .8BI) works on 64Bit Windows7. But when I copied the 32 version of plug in I coult get it run on both 64 bit and 32 bit CS4. Also use "ICOFormat-1.6f9-win" instead of "ICOFormat-1.93b1-win64" below.

Extract files to folder (ICOFormat-1.93b1-win64). There is one .8bi file and gpl license, readme etc.

List of all SwishMax3 effects

This is a list of all SwishMax3 effect in 5 categories and sorted by name/filename. For each effect there is a ".sfx" file under "C:\Program Files (x86)\SWiSH Max3\effects\RELATED_CATEGORY\EFFECT_NAME.sfx" under Win7. I will try to create thumbnails / preview for all these effects.

APPEAR INTO POSITION:

Appear into position - 3D Spin in and grow.sfx
Appear into position - 3D Spin in and shrink.sfx
Appear into position - 3D Spin in and stand up.sfx
Appear into position - Alternate grow in curved.sfx
Appear into position - Alternate grow in.sfx

How to hide / encrypt CCK Email field with JS against spammer

I got headche while searching for a filter to encrypt/hide email cck field to protect email addresses from spambots. I have installed , deinstalled, activated-deactivated rearranged input filters with both invisimail and spamspan but no luck! Finally I decide to change code in email.module. It works! Go and open "sites/all/modules/email/email.module" and find the line 115 like this:

/**
 * Theme function for 'default' email field formatter.
 */
function theme_email_formatter_default($element) {

Mysql Order / Sort by before Group by

Every developer knows the horror of mysql sort/order by or select distinct using with group by. Mysql does group by before order by and you get mixed results not what you expected. This is a small solution with less performance problem:

SELECT * FROM 

(
select * from `my_table` order by timestamp desc
) as my_table_tmp

group by catid

order by nid desc

In this example we get latest news in each category. We create a temp table by sorting by timestamp and group by after it. It worked for me.

Photo Album / Picture Gallery Script with PHP


This is a all-in-one-file small and powerful image gallery script with PHP. Just upload your images to directory of script with FTP. It is free for private use. For a demo click on screenshot-image.

Features:

  • Scann directory and display images in web formats automagically
  • Create thumbnail images dynamically on the fly (from all JPEG, GIF, PNG)
  • Sort images by name, size or last modified time

Find top level domain from international urls with PHP

The format of both "sub.tld.org" and "tld.org.gr" is similar for php. But one of them is top level domain and the other one is a subdomain. explode(".", $tld) is not enaugh to find real tld in this case. This function helps to dedect all known tlds including multi-level regional tlds. It could be useful for fraud dedection or finding duplicate sites under different tlds.

<?php 

/**
*	powered by @cafewebmaster.com
*	free for private use
*	please support us with donations
*/

function find_tld($url){

$purl  = parse_url($url);
$host  = $purl[host];
Syndicate content

CafeWebmaster.com(CW) is a free online community for webdevelopers and beginners. Anybody can share their code, articles, tips, tutorials, code-examples or other webdesign related material on the site. Newbies can submit their questions and reply to existing questions. CW does not guarantee or warrant reliability of code, data and information published on the site. Use the site on your own risk. The site takes no responsibility of direct or indirect loss or any kind of harm to its users. The site also doesn't take responsibility of infected files or source code with any kind of infection or viruses, worms, spywares, malwares, trojan horses. CW reserves the right to edit, move, or delete any of content for any reason.