Newsletter Email Tracking: Read or Not?

Filed Under (PHP) by Subesh Pokhrel on 26-10-2008

Tagged Under : , ,

I have completed first phase of a simple, yet useful Newsletter System. When I demonstrated to the clients, they came up with a question if the newsletter being send was opened or not by the newsletter subscribers ? I then thought.. let see how its done. Then I came with this simple tracking trick, most of the spammers used to verify if the email address was valid or not.
The first thing I did was adding 1px by 1px image on the footer of the newsletter, whose source was set something like this http://subesh.com.np/newsletter/track.php?identitycode=CLIENTID_SENDEMAILID. Here CLIENTID = Your Clients ID and SENDEMAILID = Id of the Newsletter sent. Now, when the image is loaded while viewing the newsletter on the mail or say when the client reads the newsletter email. The track.php page is requested with identitycode as the GET parameter. And when you get the request from the mail to your server’s page, you can do anything you want. What I did was setting the mail_read column of the database field as 1. And echoed the source of the image file on the last line.
The code below is for the track.php. Read the rest of this entry »

Ajaxified File Uploader Using IFrame

Filed Under (Ajax, PHP) by Subesh Pokhrel on 22-07-2008

Tagged Under : , ,

Today, while writing a code for AJAX file uploader, I was trying to do with SALAJAX. But, with SALAJAX I could not manage to send the headers for $_FILES. So I thought of an alternative. And the alternative was to load the action page of the form on IFrame, whose display would be hidden and the work for uploading the file will be done on the background without refreshing the page. Yeha.. Its not AJAX, but it gives a user the feel of asynchronous working on the page. So, my code is Asynchronous Feel Without Javascript and XML (AFWJAX). What do think about this?
So, Here’s the code.The code below is for the form.


<form action="iframeinc.php" method="post" enctype="multipart/form-data" id="uploadform" target="iframe" name="uploadform">
 File:
  <input name="pic" type="file" id="pic" style="margin-right:50px;" />
  <br />
<input type="submit" name="Submit" value="Upload" ><br />
<iframe name="iframe" src="iframeinc.php" width="200" height="500" style="display:none;"> </iframe>
</form>

Read the rest of this entry »

Mapping The IP Address to Latitude and Longitude In Google Maps

Filed Under (Google Maps, PHP) by Subesh Pokhrel on 11-07-2008

Tagged Under : , , , ,

At last I found hostip.info provides a service for getting the latitude and longitude of a place on the basis of the user’s ip address. Its light weight and free, rather than downloading bulky database and getting paid services, for getting latitude and longitude on the basis of IP.
Here is the simplest way to do it. Requested to http://api.hostip.info/?ip=$ip&position=true it responds XML formatted output. So we need to parse XML code using DOM class of PHP.(#19-#23). Remember, the position=true should be set to get the latitude and longitude otherwise it will not show on default.

Here is the code and I will soon upload the working demo.
[sourcecode=”php”]
/*
Subesh Pokhrel
subesh.com.np
Get the code for Real IP of the site from roshanbh.com.np
Mapping The IP Address to Latitude and Longitude.
*/
function IPtoLatLng($ip)
{
$latlngValue=array();
$dom = new DOMDocument();
$ipcheck = ip2long($ip); Read the rest of this entry »

Checking if the domain is registered or not ?

Filed Under (PHP) by Subesh Pokhrel on 17-06-2008

Tagged Under : , ,

On doing one of my project, I came across this situation when I need to find out whether the domain name supplied by the user is available or not? I then came up with a solution, here’s is what I did. But before that let me explain somethings. There is something called WHOIS LOOKUP. WHOIS LOOKUP is action relating to look on official WHOIS database server for the information related to domain name. Read the rest of this entry »

How To Generate Thumbnail of HTML Pages

Filed Under (PHP) by Subesh Pokhrel on 11-06-2008

Tagged Under : , ,

I was just adding my site on Alexa and in some minutes Alexa generated a thumbnail of my html site. And again it was same with blog catelog. So I thought is there any PHP code that crawled the site and generates its image thumb? After a lots of research I came out with these. Remember, this only works in windows server.
There is one thing called IECapt.exe ( A Internet Explorer Web Page Rendering Capture Utility). This renders the page and generate thumbnail of it. You can download it from IECapt.exe. And to run that through php here’s the code. Read the rest of this entry »

Calculating the difference between timestamps in PHP

Filed Under (PHP) by Subesh Pokhrel on 08-06-2008

Tagged Under : ,

Most of us, programmer have conditions of calculating the difference between timestamps, i.e the difference between now and the timestamp from mysql result. The logic for this is pretty simple. Just convert the two timestamps to Unix time format and take the difference between the two. Next convert the difference into corresponding days,hour,minutes or in any unit you want to. Read the rest of this entry »

Theme Modified By Self based on BlueUzor & BlueMechanics.