Archive for the ‘PHP’ Category.

OC Mod: Advanced Spam by Country

This is the solution I use in classifiedsbarcelona.com to prevent Spam from India.

Usage:

Edit your commmon.php find the function isInSpamList

And replace the whole function with this code (there’s more than 1 function be aware)
Continue reading ‘OC Mod: Advanced Spam by Country’ »

OC Mod: Ads only in child categories

Just a simple mod to allow publishing advertisement in child categories.

Edit the files:

/content/item-new.php
/content/item-manage.php

Search for:

$query="SELECT idCategory,name,(select name from ".TABLE_PREFIX."categories where idCategory=C.idCategoryParent) FROM ".TABLE_PREFIX."categories C order by idCategoryParent, `order`";

Replace in both files for:

$query="SELECT idCategory,name,(select name from ".TABLE_PREFIX."categories where idCategory=C.idCategoryParent) 
	FROM ".TABLE_PREFIX."categories C where C.idCategoryParent!=0 order by idCategoryParent, `order`";

Calculate movie hash

PHP code to calculate the movie Hash.

Uses size + 64bit chksum of the first and last 64k (even if they overlap because the file is smaller than 128k)

Usage:

echo OpenSubtitlesHash("/home/chema/Desktop/Monty Pythons Life of Brian.avi");

Continue reading ‘Calculate movie hash’ »

Ocaku – classifieds community search engine

Last months I’ve been pretty busy with my studies and I needed to do a final project for my Master in Software Engineering.

This project is Ocaku, that was presented to the jury of the master 1 week a go. I’ve got an score of 9 over 10 possible points, not bad at all :D

Now I need to promote my work and I will love any kind of help spreading it ;)

What is Ocaku?

Ocaku.com is the finest community for classifieds sites all over the world.

With the union of all this pages we have a great multi lingual search engine that allows us to search everywhere in the world.

Ocaku is free of charge to use and will try to survive using advertisements, do not hesitate to contact us to advertise in our pages.

API for usage of Ocaku in your site.

Presentation (spanish sorry):
Continue reading ‘Ocaku – classifieds community search engine’ »

PHP Geotarget IP

Just a function to get geographical info about an IP.

I use this actually to stop spammers from certain countries…I know a bit to radical, but after using IP (of banned lists), captchas, akismet, banned names etc…I don’t know what else to do :S. (it seems is already working no spam in 1 week)

Usage:

$geoip=geoIP('81.60.189.183');//using an existing IP
$geoip=geoIP();//will use clients IP
 
print_r($geoip);
 
echo $geoip['country'];
echo $geoip['countryAb'];
echo $geoip['city'];
 
 if ($geoip['country']=='india')  die('country not allowed');//to ban a country

The code:

Continue reading ‘PHP Geotarget IP’ »

Follow me