Moderator: Integra Moderator
<?php if (isset($_COOKIE["YOUR FORUM COOKIE NAME_sid"])) { $weathercookie = $_COOKIE["YOUR_COOKIE_NAME_sid"]; } $server = "mysql.YOUR_SITE.com"; $user = "YOUR_ACCOUNT_NAME"; $password = "YOUR_PASSWORD"; $database = "YOUR_DATABASE";$connect=mysql_connect($server,$user,$password); mysql_select_db($database) or die(mysql_error()); $who_am_i="SELECT `session_user_id` FROM `forum_sessions` WHERE `session_id`= '$weathercookie'";$weather_user = mysql_query($who_am_i,$connect);$count_rows = mysql_num_rows($weather_user); if($count_rows == 1) { $weather_id = mysql_fetch_assoc($weather_user); }$my_weather_id=$weather_id[session_user_id];$get_zip =("SELECT `user_zip` FROM `forum_users` WHERE `user_id`= $my_weather_id");$user_zip= mysql_query($get_zip);$count_rows2 = mysql_num_rows($user_zip); if($count_rows2 == 1) { $zip_id = mysql_fetch_assoc($user_zip); }$my_weather_zip=$zip_id[user_zip];mysql_close();$loc_weather='http]
in the above edit
[code]if (isset($_COOKIE["YOUR FORUM COOKIE NAME_sid"])) { $weathercookie = $_COOKIE["YOUR_COOKIE_NAME_sid"]; } $server = "mysql.YOUR_SITE.com"; $user = "YOUR_ACCOUNT_NAME"; $password = "YOUR_PASSWORD"; $database = "YOUR_DATABASE";[/code]
by filling in your specific entries
add a folder to your forum root called weather ([url=http]http://www.YOUR_SITE.com/FORUM_ROOT/weather[/url])
upload the local_cond.php to the weather folder
you need to add a zip code to your PCP
open your ACP and go to PCP
clcik "Fields Deffinition"
scroll to the bottom and click "Add a new field"
in base deffinitions fill in the following:
Field name:. user_zip
Legend of the field: User zip code
Explanation of the field: This is used to get your local CURRENT weather conditions
Click the OUTPUT TAB
set the following
CLASS: real
TYPE: VARCHAR
Display the text value: YES (all others to NO)
Click the INPUT TAB
Required field: YES (others to NO)
Get Mode: VARCHAR
Values List: NONE
Authe Level: Registered Users
Click SUBMIT
Click Here to create field in users table (DO THIS)
Set following
Type: VARCHAR
Length: 5
Unsigned: NO
Null Allowed: NO
Default Value: YOUR ZIP CODE (5 digit number)
UNCHECK: allow null
click sibmit
*** You should now have the field created and the filed added to your user table in your SQL database***
go back to PCP and click "PCP Wizard"
click add/remove page fields
in the left column of fields scroll down to fine the filed you just created "user_zip"
highlight it and click -> (this adds the filed ot your user reg page)
now in the RIGHT column find and highlight "user_zip"
click move up as many times as it takes to move "user_zip" so that it is under "user_state"
click submit
you should now have the "user_zip" added to your user profile.
Click IM Portal in ACP
Click Blocks Management
choose your portal page to add a block to
at the bottom find and click "ADD BLOCKS"
Name the Block: Local Weather Conditions
choose your block possition (header center footer etc)
activate the block
add the following in the text entry
[code]for [color=darkred][b][i][you]'s[/i][/b][/color] area.[web:37n3zd4r]http://www.YOUR_SITE.com/YOUR_FORUM ROOT/weather/local_cond.php[/web:37n3zd4r]
Registered users: App360MonitorBot, Bing [Bot]