Showing posts with label web programming. Show all posts
Showing posts with label web programming. Show all posts

Thursday, February 7, 2008

Using the mail() function in php

I've been using this function quite a lot. I just want to share how to use this function which is very easy.

The mail() function in php is used to send email.

Examples :

$to = "name@example.com";
$subject = "Test Subject"; //be careful to have this as one line or it will not be sent properly
$message = "This is the message";

// sends am email to $to email address with subject $subject and message $message
mail($to, $subject, $message);

//example header
$headers = "From : admin@example.com
Reply-To : admin@example.com";

//this time we added the optional parameter headers
mail($to, $subject, $message, $headers);


That's basically it. Now you know how to send emails in php.

Friday, December 14, 2007

Some good tools for web development

I work remotely on most of my projects. Some I need to use ftp to transfer files and some needs to be worked on directly through ssh. The programs I use to do these tasks are putty and coreftp.

Core FTP can be used to connect to the ftp server. It has two versions, Core FTP LE and Core FTP Pro. Core FTP LE is a free software that include ftp features. Core FTP Pro on the other hand is for advanced users that comes with a very low price. Be sure to check them out. Core FTP has been very helpful to me. You can download it here.

PuTTY is a terminal emulator application that can be used for SSH, Telnet, rlogin and raw TCP. I have been using this program for SSH access. It also very easy to use and lightweight. To find out more about putty, you can visit it's homepage here or it's wikipedia entry here. You can download it here.

Sunday, December 9, 2007

Developing over ftp using vim

Vim, which is short for Vi IMproved, is a text editor that lets you edit a remote file via ftp. It is cross-platform but most popular in Unix-like operating systems.

To use vim, the syntax is : vim ftp:///user@domain//path/file

Example : vim ftp://username@example.com//var/www/index.html

You will be asked for the matching password to your user name after. Just enter the password and you'll have the file opened for editing. Vim has made things easier for me. I hope it will do the same to you.

Saturday, December 8, 2007

Using lftp in copying files between two servers in ssh

LFTP is sophisticated ftp/http client, file transfer program supporting a number of network protocols. It is very useful and I've been always using this. There is this case where I need to login on one server through ssh before I will connect to this server and this has helped me a lot.

To connect to a server type :
lftp -u [username],[password] [servername]

Example : lftp -u username,password example.com

Once you are connected, you can do basic commands like "cd" to change directories and "ls" to list files and subdirectories.

To download a file, go to the directory where you want to download the file then connect to the other server using lftp. Go to the directory where the file you want to copy is located then type :
get [filename]

Example : get myfile.txt

To upload a file, go to the directory where the file is located then connect to the other server using lftp. Go to the directory where you want to upload the file then type :
put [filename]

Example : put myfile.txt

Easy isn't it? And it will help you a lot too. Try it out! :)

Saturday, December 1, 2007

Google Maps Not Working in Internet Explorer, Operation Aborted

This has been bothering me for a while now. This is about the phpGoogleStoreLocator script that I have been working on integrating into a site the past few days. Just when everything was fine and seems to be working properly, it wouldn't function on Internet Explorer. Everytime I open it, it just crashes. I let other people try it and they experience the same thing.

So after googling around I found out that this problem usually occur when you have a script tag inside your tables. This was not the case on my part but I'll be sure to look out for this one. Apparently the solution to my problem is to put the map initialization code into a function say "loadMap()" and attach it to the body tag like this .

Other solutions to the problem if the the ones above still won't work for you are :

  1. Enclosing with a div tag where you want your map to appear. Something like this one : <div id=”map” style=”width: 400px; height: 400px”> and then make sure that all your javascripts are at the bottom of your document below the body tag. Thanks to Ryan.
  2. Moving the map function in the window.onload() handler. Thanks to Justin.
These solution will mostly work but if it still won't try to visit the Microsoft support site here.

Wednesday, November 21, 2007

Another web programming day with phpGoogleStoreLocator Part 2

It's been a very slow day... at least for my programming. As for everything, it's been a very tough day. We've been hit by a big typhoon and it's been raining very for almost 2 days now. It even became a super typhoon on some parts of the country and lots of properties were destroyed already. Internet here also went down for about 12 hours. What a day!

Anyway, I just continued working on my current project which involves the phpGoogleStoreLocator script. What I did last time did great, according to my boss, but what is needed is to make the template look a lot better and add some functions on the admin area. Functions include having a control for the admin to add data for the store maps by uploading csv files or grabbing the data by downloading a csv file for the existing database. And also a few additional controls to further control the store locator script.

I'm also starting on another project about a fund raising website. The project looks good and sounds very interesting. The web site helps fund raisers reach their goals through sports online.

This is it for now. I will go through further details next time.

Tuesday, November 20, 2007

Another web programming day with phpGoogleStoreLocator

It's been a very tiring day for me. It's raining hard the whole day. Today, I continued with what I have been programming the past 2 days. I've been working on a store locator for a dietary supplement drink website. I've been using this very cool php script phpGoogleStoreLocator which you can download here.

phpGoogleStoreLocator is an application that uses the Google Maps API service which can serve as a store locator in your website. It is very easy to set up and these are all you need to get it running:

  • Google API Key (http://maps.google.com/apis/maps/)
  • Webserver with php 4.0+
  • MySQL 3.0+
Very good right? It is compatible with different browsers too. These are the browsers that are compatible with it right now:
  • Internet Explorer 5.5+
  • Mozilla/Firefox 1.0+
  • Safari 1.2+
  • Konqueror 3.0+
  • Galeon 1.2+
  • Epiphany 1.0+
  • Flock 1.0+
  • Opera 9.01
To install, just extract the files to a directory and run install.php. You will know what to do when you get there. Remember to delete your install.php file after installing.

Some of it's features are :
  • A Google Map
  • Customizable Map Icons
  • Balloon images for store locations
  • Stores are searchable by country, street address, city, state and zip code.
  • Support for address level geocoding for the US, UK, CA, AU, All of Europe, Taiwan, India, and New Zealand
  • City level geocoding for the entire planet
It also has an admin panel and a customizable layout which is very easy. You can see the full features here.

What I have been doing the past 2 days were modifying some parts of the script and also the template to suit the site owner's requirements. So far so good and it's working like the way he wanted it to be. I'm just waiting for some feedbacks after he finished testing the site. If there are any problems then I will be working on it again tomorrow. For now I'll be on stadnby on that part and I'm going to work on another project for another client. I'll talk about this one tomorrow.