313 lines
8.3 KiB
PHP
313 lines
8.3 KiB
PHP
|
<?
|
||
|
###########################################
|
||
|
#-----------Users login system------------#
|
||
|
###########################################
|
||
|
/*=========================================\
|
||
|
Author : Mohammed Ahmed(M@@king) \\
|
||
|
Version : 1.0 \\
|
||
|
Date Created: Aug 20 2005 \\
|
||
|
---------------------------- \\
|
||
|
Last Update: August 22 2005 \\
|
||
|
---------------------------- \\
|
||
|
Country : Palestine \\
|
||
|
City : Gaza \\
|
||
|
E-mail : m@maaking.com \\
|
||
|
MSN : m@maaking.com \\
|
||
|
AOL-IM : maa2pal \\
|
||
|
WWW : http://www.maaking.com \\
|
||
|
Mobile/SMS : 00972-599-622235 \\
|
||
|
\\
|
||
|
===========================================\
|
||
|
------------------------------------------*/
|
||
|
// NEED TO CHECK AGAINST SERVER VERSION
|
||
|
|
||
|
//skip the config file if somebody call it from the browser.
|
||
|
session_start();
|
||
|
|
||
|
if (eregi("config.php", $_SERVER['SCRIPT_NAME'])) {
|
||
|
Header("Location: index.php"); die();
|
||
|
}
|
||
|
|
||
|
$main_table = "Roadshow";
|
||
|
$resource_table = "Resource";
|
||
|
$field_lead = "roadshow_";
|
||
|
$from_name = "roadshow";
|
||
|
$local_name = "Road Show Events";
|
||
|
$local_singular = "Road Show Event";
|
||
|
$local_name_lc = "road show events";
|
||
|
$local_singular_lc = "road show event";
|
||
|
|
||
|
$site_url = "/roadshow";
|
||
|
include("../local/settings.php");
|
||
|
/*
|
||
|
|
||
|
FIELD NAMES:
|
||
|
roadshow_id
|
||
|
roadshow_date
|
||
|
roadshow_name
|
||
|
roadshow_name_tag
|
||
|
roadshow_address
|
||
|
roadshow_address_two
|
||
|
roadshow_city
|
||
|
roadshow_state
|
||
|
roadshow_state_tag
|
||
|
roadshow_zip
|
||
|
roadshow_lat
|
||
|
roadshow_lng
|
||
|
roadshow_phone
|
||
|
roadshow_fax
|
||
|
roadshow_email
|
||
|
roadshow_website
|
||
|
roadshow_stambassador
|
||
|
roadshow_stambassador_names
|
||
|
roadshow_triclub
|
||
|
roadshow_triclub_names
|
||
|
roadshow_coach
|
||
|
roadshow_coach_names
|
||
|
roadshow_racedirector
|
||
|
roadshow_racedirector_names
|
||
|
roadshow_brewery
|
||
|
roadshow_brewery_names
|
||
|
roadshow_local
|
||
|
roadshow_fitbike
|
||
|
roadshow_saddlechange
|
||
|
roadshow_motioncapture
|
||
|
roadshow_footbed
|
||
|
roadshow_wetsuit
|
||
|
roadshow_bike
|
||
|
roadshow_trispecific
|
||
|
roadshow_trispecific_names
|
||
|
roadshow_fist
|
||
|
roadshow_fist_names
|
||
|
roadshow_diagnostic
|
||
|
roadshow_shoe
|
||
|
roadshow_sock
|
||
|
roadshow_apparel_run
|
||
|
roadshow_apparel_tri
|
||
|
roadshow_swimgear
|
||
|
roadshow_bikeaccessory
|
||
|
roadshow_bikebody
|
||
|
roadshow_bikecomponent
|
||
|
roadshow_bikeelectronic
|
||
|
roadshow_bikehelmet
|
||
|
roadshow_biketrainer
|
||
|
roadshow_bikewheel
|
||
|
roadshow_runhydrate
|
||
|
roadshow_bodycare
|
||
|
roadshow_hours
|
||
|
roadshow_activity
|
||
|
roadshow_submitted_by
|
||
|
roadshow_valid
|
||
|
roadshow_user_tags
|
||
|
|
||
|
*/
|
||
|
|
||
|
//change this
|
||
|
$site_name = "Slowtwitch.com";
|
||
|
$site_email = "rappstar@slowtwitch.com";
|
||
|
|
||
|
define("MAPS_HOST", "maps.googleapis.com");
|
||
|
define("KEY", "AIzaSyA13hZb_mE3Fx3KPevCWrQPERPykhiTIIw");
|
||
|
$gmap_key = "AIzaSyAegmr3HHER_6rWivSpfxjvF0Dhv6oZV6I";
|
||
|
|
||
|
//added new code to fix compatibility issues.
|
||
|
//09-Nov-2005
|
||
|
$phpver = phpversion();
|
||
|
if ($phpver < '4.1.0') {
|
||
|
$_GET = $HTTP_GET_VARS;
|
||
|
$_POST = $HTTP_POST_VARS;
|
||
|
$_SERVER = $HTTP_SERVER_VARS;
|
||
|
}
|
||
|
if ($phpver >= '4.0.4pl1' && strstr($_SERVER["HTTP_USER_AGENT"],'compatible')) {
|
||
|
if (extension_loaded('zlib')) {
|
||
|
ob_end_clean();
|
||
|
ob_start('ob_gzhandler');
|
||
|
}
|
||
|
} else if ($phpver > '4.0') {
|
||
|
if (strstr($HTTP_SERVER_VARS['HTTP_ACCEPT_ENCODING'], 'gzip')) {
|
||
|
if (extension_loaded('zlib')) {
|
||
|
$do_gzip_compress = TRUE;
|
||
|
ob_start(array('ob_gzhandler',5));
|
||
|
ob_implicit_flush(0);
|
||
|
header('Content-Encoding: gzip');
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
$phpver = explode(".", $phpver);
|
||
|
$phpver = "$phpver[0]$phpver[1]";
|
||
|
if ($phpver >= 41) {
|
||
|
$PHP_SELF = $_SERVER['PHP_SELF'];
|
||
|
}
|
||
|
|
||
|
if (!ini_get("register_globals")) {
|
||
|
import_request_variables('GPC');
|
||
|
}
|
||
|
|
||
|
|
||
|
include("class/mysql.class.php");
|
||
|
$db = new sql_db($dbhost, $dbuname, $dbpass, $dbname, false);
|
||
|
if(!$db->db_connect_id) {
|
||
|
|
||
|
echo "<br><font color=red><h3><br><center>Error:</b><br><hr><br>
|
||
|
<b>Connection to database failed</b><br>
|
||
|
<br><br><br><br><br><br><br><br><br></b></center>";
|
||
|
|
||
|
exit();
|
||
|
}
|
||
|
|
||
|
$statecount = mysql_num_rows(mysql_query("SELECT * FROM gforum_Roadshow WHERE roadshow_valid = 1"));
|
||
|
|
||
|
$sql = "SELECT * FROM ".$prefix."ResourceStates ORDER BY stateid";
|
||
|
$result = mysql_query($sql) OR die(mysql_error());
|
||
|
$state_list = array();
|
||
|
$state_tag_list = array();
|
||
|
while ($row = mysql_fetch_array($result)) {
|
||
|
$state_list[$row['stateid']] = $row['statelong'];
|
||
|
$state_tag_list[] = $row['statetag'];
|
||
|
}
|
||
|
|
||
|
function curPageURL() {
|
||
|
$isHTTPS = (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on");
|
||
|
$port = (isset($_SERVER["SERVER_PORT"]) && ((!$isHTTPS && $_SERVER["SERVER_PORT"] != "80") || ($isHTTPS && $_SERVER["SERVER_PORT"] != "443")));
|
||
|
$port = ($port) ? ':'.$_SERVER["SERVER_PORT"] : '';
|
||
|
$url = ($isHTTPS ? 'https://' : 'http://').$_SERVER["SERVER_NAME"].$port.$_SERVER["REQUEST_URI"];
|
||
|
return $url;
|
||
|
}
|
||
|
|
||
|
function geocode($address) {
|
||
|
// Initialize delay in geocode speed
|
||
|
$delay = 0;
|
||
|
$base_url = "http://" . MAPS_HOST . "/maps/api/geocode/xml?"; // . "&key=" . KEY;
|
||
|
//echo ("Base URL: ".$base_url);
|
||
|
|
||
|
$status = "";
|
||
|
$geocode_pending = true;
|
||
|
|
||
|
while ($geocode_pending) {
|
||
|
$address = str_replace(" ", "+", $address);
|
||
|
$address = str_replace("#", "", $address);
|
||
|
$address = str_replace("\'", "", $address);
|
||
|
$address = str_replace("/", "", $address);
|
||
|
$request_url = $base_url . "address=" . $address . "&sensor=false"; //urlencode($address);
|
||
|
$request_url = mb_convert_encoding($request_url, "UTF-8", "auto");
|
||
|
//echo ($request_url."<br />");
|
||
|
// Create cUrl object to grab XML content using $request_url
|
||
|
$c = curl_init();
|
||
|
curl_setopt($c, CURLOPT_URL, $request_url);
|
||
|
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
|
||
|
$xmlContent = trim(curl_exec($c));
|
||
|
curl_close($c);
|
||
|
|
||
|
// Create SimpleXML object from XML Content
|
||
|
$xml = simplexml_load_string($xmlContent);
|
||
|
|
||
|
// Print out all of the XML Object
|
||
|
//print header("Content-type: text/plain");
|
||
|
//print_r($xml);
|
||
|
|
||
|
$resolution = $xml->result->geometry->location_type;
|
||
|
|
||
|
$status = $xml->status;
|
||
|
if (strcmp($status, "OK") == 0) {
|
||
|
// Successful geocode
|
||
|
$geocode_pending = false;
|
||
|
$lat = $xml->result->geometry->location->lat;
|
||
|
$lng = $xml->result->geometry->location->lng;
|
||
|
$latlng_array = array($lat, $lng);
|
||
|
return ($latlng_array);
|
||
|
} elseif (strcmp($status, "OVER_QUERY_LIMIT") == 0) {
|
||
|
// failure to geocode
|
||
|
$geocode_pending = false;
|
||
|
$status = "Road Show Event " . $row['roadshow_name'] . " failed to geocode. ";
|
||
|
$status = $status . "Received status " . $status . "</br></br>\n";
|
||
|
return ($status);
|
||
|
} else {
|
||
|
// failure to geocode
|
||
|
$geocode_pending = false;
|
||
|
$status = "Address " . $address . " failed to geocode. ";
|
||
|
$status = $status . "Received status " . $status . "</br></br>\n";
|
||
|
return ($status);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
//Array of states for use in the form
|
||
|
/** $state_list = array('AL'=>"Alabama",
|
||
|
'AK'=>"Alaska",
|
||
|
'AB'=>'Alberta',
|
||
|
'AZ'=>"Arizona",
|
||
|
'AR'=>"Arkansas",
|
||
|
'BC'=>'British Columbia',
|
||
|
'CB'=>"Caribbean",
|
||
|
'CA'=>"California",
|
||
|
'CM'=>"Central America",
|
||
|
'CO'=>"Colorado",
|
||
|
'CT'=>"Connecticut",
|
||
|
'DE'=>"Delaware",
|
||
|
'DC'=>"District of Columbia",
|
||
|
'FL'=>"Florida",
|
||
|
'GA'=>"Georgia",
|
||
|
'HI'=>"Hawaii",
|
||
|
'ID'=>"Idaho",
|
||
|
'IL'=>"Illinois",
|
||
|
'IN'=>"Indiana",
|
||
|
'IA'=>"Iowa",
|
||
|
'KS'=>"Kansas",
|
||
|
'KY'=>"Kentucky",
|
||
|
'LA'=>"Louisiana",
|
||
|
'ME'=>"Maine",
|
||
|
'MB'=>'Manitoba',
|
||
|
'MD'=>"Maryland",
|
||
|
'MA'=>"Massachusetts",
|
||
|
'MX'=>"Mexico",
|
||
|
'MI'=>"Michigan",
|
||
|
'MN'=>"Minnesota",
|
||
|
'MS'=>"Mississippi",
|
||
|
'MO'=>"Missouri",
|
||
|
'MT'=>"Montana",
|
||
|
'NE'=>"Nebraska",
|
||
|
'NV'=>"Nevada",
|
||
|
'NB'=>'New Brunswick',
|
||
|
'NL'=>'Newfoundland',
|
||
|
'NH'=>"New Hampshire",
|
||
|
'NJ'=>"New Jersey",
|
||
|
'NM'=>"New Mexico",
|
||
|
'NY'=>"New York",
|
||
|
'NC'=>"North Carolina",
|
||
|
'ND'=>"North Dakota",
|
||
|
'NS'=>'Nova Scotia',
|
||
|
'OH'=>"Ohio",
|
||
|
'OK'=>"Oklahoma",
|
||
|
'ON'=>'Ontario',
|
||
|
'OR'=>"Oregon",
|
||
|
'PA'=>"Pennsylvania",
|
||
|
'PE'=>'Prince Edward Island',
|
||
|
'QC'=>'Quebec',
|
||
|
'RI'=>"Rhode Island",
|
||
|
'SK'=>'Saskatchewan',
|
||
|
'SC'=>"South Carolina",
|
||
|
'SD'=>"South Dakota",
|
||
|
'TN'=>"Tennessee",
|
||
|
'TX'=>"Texas",
|
||
|
'UT'=>"Utah",
|
||
|
'VT'=>"Vermont",
|
||
|
'VA'=>"Virginia",
|
||
|
'WA'=>"Washington",
|
||
|
'WV'=>"West Virginia",
|
||
|
'WI'=>"Wisconsin",
|
||
|
'WY'=>"Wyoming",
|
||
|
// New Foreign "States",
|
||
|
'UK'=>"United Kingdom",
|
||
|
'FR'=>"France",
|
||
|
'DE'=>"Germany",
|
||
|
'IT'=>"Italy",
|
||
|
'CH'=>"Switzerland",
|
||
|
'JP'=>"Japan",
|
||
|
'AU'=>"Australia",
|
||
|
'NZ'=>"New Zealand",
|
||
|
'PI'=>"Pacific Islands",
|
||
|
'HK'=>"Hong Kong");
|
||
|
*/
|
||
|
?>
|