tutorials

Simple Hello World Module for Drupal 6

This is a small and simple "Hello World!" module for quickstarters who uses Drupal 6x series. We need just one directory and two files:

  • modules/simple_hello_world/
  • modules/simple_hello_world/simple_hello_world.info
  • modules/simple_hello_world/simple_hello_world.module

modules/simple_hello_world/simple_hello_world.info

; $Id$
name = Simple Hello World
description = Description of Simple Hello World module
core = 6.x

modules/simple_hello_world/simple_hello_world.module

<?php

Comparison of free Shopping Carts - 2009

This is a comparison of free -mostly open source- "shopping carts" / "e-commerce systems": Magento, osCommerce , Virtuemart (+ Joomla), Ubercart (+ Drupal), X-Cart , Zen Cart , ShopCMS , CS-Cart , Cube Cart , eCommerce Framework G5 (ECF), Ecommerce Templates , FlyingCart, Go Ecommerce EShop Builder , Interspire Shopping Cart , iScripts Multicart , JadaSite , JShop , LiteCommerce , PhPepperShop, PrestaShop, ProductCart , Ecommerce Shopping Cart Software , VP-ASP Shopping Cart , WebAsyst Shop-Script , Zeus Cart (AJ Shopping Cart).

Check password safety with JavaScript while typing

You can show password strength to your visitors while typing before even submitting the page to the webserver. There are four character groups: letters, caps, numbers and symbols. A password which is longer than 7 characters and contains at least one character from each group is strong vz537gnjua. A password which is at least 8 character long and has all characters from one group is weak (but not very weak). A password which contains all characters from one group and at least 20 characters long is also strong.

Repair all mysql databases-tables with PHP

phpMyAdmin is a great tool but there is no option to repair all databases at once yet. Imagine you have no shell-access and need to repair all your 100 databases. It would take long time. This small PHP-Script lets you list, analyze and repair all your databases belong to same user at once.

If you already have shell access you can do it with mysqlcheck:

mysqlcheck -u root -p --auto-repair --check --optimize --all-databases


Repair with PHP:

  

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];

Drupal 6 vs. Joomla 1.5 (2009)

Drupal versus Joomla!This is a comparison of most popular content-management-systems Drupal 6x and Joomla 1.5 series.

Drupal pros: free, professional coded, multilang, multisite, performance, great community, flexibility, power, role-based user access, flexible content types, excellent taxonomy system, seo friendly urls, multi-db-support

Fix Google Adsense Search and Drupal Conflict

Google Adsense internal search code does not work with Drupal sites normally. The reason is $_GET[q] conflict between both services. $_GET[q] means "current page" for Drupal and "search query" for Google. We can fix it with two easy steps.

Step 1:
Create a custom page like "websearch" etc under Drupal and add Adsense Code for results page.

Step 2:
Add this code at the top of your Drupal's index.php:

// Fix Drupal-Adsense conflict
$_GET[q] = ($_GET['cx']) ? "websearch" : $_GET[q] ; 

Image watermark with PHP

To prevent quality images being stolen, we can use PHP to watermark web-images in popular formats like GIF/PNG/JPEG. We print a transparent gif-image on a jpeg-photo in this tutorial. For best results I prefer gif than png, because some png formats require extra functions to print a transparent image. We can convert this script to a batch-watermarker easily to watermark photo albums/galleries with multiple pictures by putting code in a loop or create a function.

Steps:

Page generation time and http-referers with PHP

Webmasters want to know where all visitors coming from, which pages they visit and how long does it take webpages to load in miliseconds. This tutorial shows how to save your visitors/website details like referrer, browser/client, ip-address, langind-page in three steps. Remember if your scripts ends with exit() or die() command, footer code will not work. Just remove that commands or put them below footer code.

  1. Create your mysql table
  2. Add top-code
  3. Add bottom-code

SQL Query

Smart Multi-Uploader and Thumbnail Creator from GIF/ JPEG/ PNG with PHP

Image uploader and thumbnail generatorThis is a multiple image uploader with flexible thumbnail generator. You can set how many images you want to upload at once. This script creates thumbnails automagically from GIF / JPEG and PGN images. You can also disable thumbnails completely. You can change easily path/to/upload and thumbnails max width and height. Script dedect automagically which dimestion to use for resize. It checks image-type and max-image-size. Comments and featurequest are welcome!

<?php
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.