Weather Forecast Script
Senior Editor, TheScripts.com
The Weather
The specific affiliate program you will be using will be the top one with the image called the weather magnet. When you sign up, are are asked to select the region you want to be displaying the weather from. Select it accordingly. I will use the method I did though so you understand what I actually did. I went through all of the options, selected North America, then United States, the state, and then the city. This produced code for me, normally copied and pasted into your web page. I did not want it to look like this though, as I only wanted the image part. So the code I grabbed from it was :
<a href="http://oap.weather.com/fcgi-bin/oap/redirect_magnet?
loc_id=IDNUMBER&par=internal&site=magnet
&code=AFFILIATENUMBER&promo=english">
<img border=0 width=270 height=140
src="http://oap.weather.com/fcgi-bin/oap/generate_magnet2?
loc_id=IDNUMBER&code=AFFILIATENUMBER"></a>
The important thing here really is just the ID number, but the affiliate thing as well if you care about that. This is what will be displaying our weather on our pages though, so write it down somewhere. Now we have to know how to personalize the loc_id field (IDNUMBER). This is achieved in the signup process as well. Notice how as you selected your regions, you had to specify the exact city you wanted to use? What you will do is grab all of the <option Value=""> tags, and use those in your form. The value is the important part, as it is the IDNUMBER, but, the name tells you what city you are viewing.
Here is an example
<OPTION VALUE="USNY0996">NEW YORK is obviously New York City, while
<OPTION VALUE="USCA0987">SAN FRANCISCO is San Francisco.
You will be using these options in your signup forms accordingly, if you would like the user to specify the city they view the weather from anyways. Since there are so many options, the tutorial later on will only use the major centres, though you can do whatever you want.
Now that I've explained that but, we need to setup our MySQL table.
CREATE TABLE personalize (
Name varchar(50) NOT NULL,
Password varchar(20) NOT NULL,
News1 varchar(25) NOT NULL,
News2 varchar(25) NOT NULL,
Weather varchar(10) NOT NULL,
PRIMARY KEY (Name)
);
We will place this table in a database called 'users'.
You of course can have as many fields as you want, as you may have more options available to your users, such as fonts and colour schemes. They all do follow the same principles though.
