As a web master, I often send out mass mailings. After the mailing is done, the bounced emails are returned to my Outlook. I go through them manually. The real bouncers are put in a “Bounced” folder and, Out of office messages in the “Trash”. The rest of the emails are addresses I need to update in my database or people that wish to unsubscribe. Since sorting through 2000 bouncers can take up a lot of time, I did some research on how to automate this.
PHP offers a set of functions to connect to a mail server (IMAP/POP3). The plan was to let my web server connect to the mail server and sort out the bouncers for me. Below is a little script to give you some ideas of what I came up with.
function __autoload($className) {
include_once __autoloadFilename($className);
}
function __autoloadFilename($className) {
return str_replace('_','/',$className).".php";
}
$class = new myclass();
When a Class is not found, php will pass the classname to the __autoload function.
You can name your class like Folder1_Folder1a_Myclass and this function will look for it in Folder1/Folder1a/Myclass.php
You can put multiple classes in one folder and still make this work by creating a link to the correct file.
On Unix, Linux machines use the command “ln -s targetfile.php nonexistingclassfile.php”
Beware when posting data from a multiple select through ajax. You can’t send an array with a Prototype ajax call.
expl.
function postmydata(){
new Ajax.Request(’data.php’,
{
method:’post’,
parameters: {selectdata: $F(’myselect’)},
onSuccess: function(transport){
var response = transport.responseText || alert(”couldn’t add data”);
$(’mydiv’).update(response);
},
onFailure: function(){ $(’mydiv’).update(’error’); }
});
}
This won’t work. Your php page will not get an array.
Solution
replace the parameter part with:
parameters: {selectdata: $F(’myselect’).join(”,”)}, // this will send a comma seperated string
In your php code use:
$myselect = = explode(’,',$_POST['selectdata']);
Google finally released an api for Analytics this month. The example code includes code for java and javascript but no PHP. Fortunatly The electric toolbox hosts some example data of how it can be used with Curl.
Companys put a lot of time and effort in creating compelling websites. Tons of resources are spend to ensure sites add to sales. But is all this money well spend? Thats what analytics software should clarify. Tools like Google Analytics, AWstats,… give a wide overview of visitors, time on site, conversions and other usefull information. But what if this is not enough? What if you want to target your visitors in a more personal way. What follows are some of the options that I found and that could help you change your content on a page per page level.
GeoIP:
This tool allows you to check the visitors ip adres and make an estimated guess as to where he/she is from. Maxmind offers a free and a licensed version for GeoIP Country and GeoIP City.
I tried out the free version and it gave me:
country code
city
Postal code
latitude – longitude
Device
Handsetdetection.com has a big list of hardware it can detect. Even Kindle 2 is included.
PHP
With php you have a few tools to analyse your visitors. Just like GeoIP, you cannot be 100% sure. Some of the data that gets send to the server can be manipulated. Here are some of the things that I use.
$_SERVER referer. What is the page that the visitor was on before he came to the current. get_browser A php function that uses an ini file to detect browserinfo.
CSS, HTML and Javascript
css history: a css-javascript trick to check visited sites from a list. This is a very old bug but noone seems to be fixing it. Spajax is a good example of this. [Blackhat]
Iamcam posted a good hack on his blog. It makes your unchecked checkboxes show up in the $_POST on the server.
It’s very simple and doesn’t need javascript.
The following is a simple dos trick to create a playlist of all your mp3’s.
go to the start menu
click run
enter cmd => this opens a black dos window
type dir /b/s *.mp3 > c:\mp3list.m3u
When this command finishes, a file will be created under c: with a list of all your mp3 files.
The m3u file is a plain text file with links to all your music. Some audio applications us this format for playlists.