167 lines
5.1 KiB
PHP
167 lines
5.1 KiB
PHP
<?php
|
|
$page = "general";
|
|
include "header.php";
|
|
|
|
|
|
date_default_timezone_set('America/Phoenix');
|
|
if( !$user->user_exists)
|
|
{
|
|
$page = "error";
|
|
$smarty->assign('error_header', 639);
|
|
$smarty->assign('error_message', 656);
|
|
$smarty->assign('error_submit', 641);
|
|
include "footer.php";
|
|
}
|
|
function general(){
|
|
global $user, $database1, $database;
|
|
if(isset($_POST['distance'])) { $distance = $_POST['distance']; } elseif(isset($_GET['distance'])) { $distance = $_GET['distance']; } else { $distance = "5"; }
|
|
|
|
?><form id="travel" name="travel">
|
|
Select a Region: <select name="region" id="region"></select><input type="submit" value="Search" /><input type="hidden" name="country" value="<?=$_GET["country"]?>" /></form>
|
|
<?php
|
|
if($_GET["zip"]!="")
|
|
{
|
|
|
|
if($_GET["country"]!=""){
|
|
$query1=$database->database_query("SELECT id FROM bateworldcom_zips.countries WHERE name='".$database->database_real_escape_string($_GET["country"])."' LIMIT 1");
|
|
$row1=$database->database_fetch_array($query1);
|
|
$country=$row1["id"];
|
|
$query=$database->database_query("SELECT latitude, longitude FROM bateworldcom_zips.zipcodes1, bateworldcom_zips.countries WHERE bateworldcom_zips.zipcodes1.postal_code='".$database->database_real_escape_string($_GET["zip"])."' AND bateworldcom_zips.countries.id='".$country."' AND bateworldcom_zips.countries.alpha_2=bateworldcom_zips.zipcodes1.country_code LIMIT 1");
|
|
|
|
}
|
|
else{
|
|
|
|
$query=$database->database_query("SELECT latitude, longitude FROM bateworldcom_zips.zipcodes1 WHERE postal_code='".$database->database_real_escape_string($_GET["zip"])."' LIMIT 1");
|
|
}
|
|
|
|
$row=$database->database_fetch_array($query);
|
|
|
|
|
|
if($row["latitude"]!=""){
|
|
$coslat=cos(deg2rad($row["latitude"]));
|
|
$sinlat=sin( deg2rad($row["latitude"]) );
|
|
$radlon=deg2rad($row["longitude"]);
|
|
$sql1="SELECT country_code, place_name, admin_name1, admin_code1, postal_code, ( 3959 * acos( ".$coslat."
|
|
* cos( radianslat ) * cos( radianslon - ".$radlon." )
|
|
+ ".$sinlat." * sin( radianslat ) ) )
|
|
AS distance FROM bateworldcom_zips.zipcodes1 HAVING distance <= ".$database->database_real_escape_string($distance)."
|
|
ORDER BY distance ASC LIMIT 0 , 10000";
|
|
|
|
$url_string1 .="field_27=".urlencode($zip)."&";
|
|
$query1=$database->database_query($sql1);
|
|
$o=1;
|
|
while($row1=$database->database_fetch_array($query1))
|
|
{
|
|
if($o==1){
|
|
$zips="airbnbate.zip='".$row1["postal_code"]."'";
|
|
|
|
}
|
|
else{
|
|
$zips.=" OR airbnbate.zip='".$row1["postal_code"]."'";
|
|
}
|
|
$o++;
|
|
}
|
|
|
|
}
|
|
else{$total_users=0;}
|
|
|
|
|
|
|
|
}
|
|
?>
|
|
<script type="text/javascript" src="/travel.js"></script>
|
|
|
|
<script type="text/javascript">
|
|
|
|
|
|
function OnCountryChange()
|
|
|
|
{
|
|
|
|
document.forms.travel.region.length = 0;
|
|
|
|
document.forms.travel.region.options[ document.forms.travel.region.length ] = new Option( "-", "", false, false );
|
|
|
|
document.forms.travel.region.selectedIndex = 0;
|
|
|
|
|
|
|
|
var strCountry = "<?=$_GET["country"]?>";
|
|
|
|
|
|
|
|
for( var i in objRegions )
|
|
|
|
{
|
|
|
|
if( i == strCountry )
|
|
|
|
{
|
|
|
|
for( var j = 0; j < objRegions[ i ].length; j++ )
|
|
|
|
{
|
|
|
|
document.forms.travel.region.options[ document.forms.travel.region.length ] = new Option( objRegions[ i ][ j ], objRegions[ i ][ j ], false, false );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
OnCountryChange();</script>
|
|
<table><?
|
|
if($_GET["region"]!=""){
|
|
$sql="SELECT se_users.*, airbnbate.* FROM airbnbate, se_users WHERE se_users.user_id=airbnbate.userid AND country='".$database->database_real_escape_string($_REQUEST["country"])."' AND state='".$database->database_real_escape_string($_REQUEST["region"])."'";
|
|
|
|
$sql=$sql. "ORDER BY se_users.user_username";
|
|
$query=$database->database_query($sql);}
|
|
else{
|
|
$sql="SELECT se_users.*, airbnbate.* FROM airbnbate, se_users WHERE se_users.user_id=airbnbate.userid AND country='".$database->database_real_escape_string($_REQUEST["country"])."'";
|
|
$sql=$sql."ORDER BY se_users.user_username ASC";
|
|
$query=$database->database_query($sql);}
|
|
while($row=$database->database_fetch_array($query))
|
|
{
|
|
?><tr><td><strong><?=$row["user_username"]?></strong><br />
|
|
Hosting in: <? if(trim($row["city"])!=""){echo $row["city"].", ";}
|
|
|
|
if(trim($row["state"])!=""){echo $row["state"]." ";}
|
|
if(trim($row["zip"])!=""){echo "".$row["zip"]." ";}
|
|
if(trim($row["country"])!=""){echo $row["country"]." ";}
|
|
echo "<br />
|
|
<br />
|
|
".$row["description"];
|
|
if(trim($row["airurl"])!=""){echo "<br />
|
|
<br />
|
|
<a href='http://airbnb.com/".$row["airurl"]."' target='_blank'>Air BnB URL</a><br />
|
|
";}
|
|
if(trim($row["misterurl"])!=""){echo "<a href='http://misterbnb.com/".$row["misterurl"]."' target='_blank'>Mister BnB URL</a>";}
|
|
?>
|
|
|
|
|
|
</td><td align="center"><a href="profile.php?user=<?=$row["user_username"]?>"><? if($row["user_photo"]==""){?><img src="/images/nophoto.png" height="60" width="60" /><? }else{
|
|
$user_id=$row["userid"];
|
|
$subdir = $user_id+999-(($user_id-1)%1000);
|
|
|
|
$userdir = "./uploads_user/$subdir/$user_id/";
|
|
?>
|
|
<img src="<?=$userdir.$row["user_photo"]?>" height="60" width="60" />
|
|
<? }?><br />
|
|
See Full Profile</a></td></tr><tr><td colspan="2"><hr /></td></tr><?
|
|
}
|
|
?>
|
|
</table>
|
|
|
|
|
|
|
|
|
|
<?
|
|
}
|
|
// ASSIGN SMARTY VARS AND INCLUDE FOOTER
|
|
$smarty->assign('forumcats', $forumcat_array);
|
|
$smarty->assign('forum_is_moderator', $forum_is_moderator);
|
|
include "footer.php";
|
|
?>
|