Files
Testing/viewtravel.php

138 lines
3.8 KiB
PHP
Raw Permalink Normal View History

2026-11-17 16:15:01 -05:00
<?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, $database;
?><form id="travel" name="travel">
<div class="col-sm-1" style="padding-top:5px;">Select a Region:</div><div class="col-sm-2"><select name="region" id="region" class="form-control"></select></div><div class="col-sm-2"><input type="submit" value="Search" class="form-control" /></div><input type="hidden" name="country" value="<?=$_GET["country"]?>" /></form>
<div class="clearfix"></div><br>
<br>
<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"]!=""){$query=$database->database_query("SELECT se_users.*, travelers.* FROM travelers, se_users WHERE se_users.user_id=travelers.userid AND depart>".time()." AND country='".$database->database_real_escape_string($_REQUEST["country"])."' AND province='".$database->database_real_escape_string($_REQUEST["region"])."' ORDER BY arrive ASC");}
else{$query=$database->database_query("SELECT se_users.*, travelers.* FROM travelers, se_users WHERE se_users.user_id=travelers.userid AND depart>".time()." AND country='".$database->database_real_escape_string($_REQUEST["country"])."' ORDER BY arrive ASC");}
while($row=$database->database_fetch_array($query))
{
?><tr><td><strong><?=$row["user_username"]?></strong><br />
<strong>Visiting: </strong><? if(trim($row["city"])!=""){echo $row["city"].", ";}
if(trim($row["province"])!=""){echo $row["province"]." ";}
if(trim($row["zip"])!=""){echo "".$row["zip"]." ";}
if(trim($row["country"])!=""){echo $row["country"]." ";}
?>
<br />
<strong>From: </strong><?=date("F j, Y", $row["arrive"])?>
<br />
<strong>To: </strong><?=date("F j, Y", $row["depart"])?><br />
<strong>Seeks: </strong><?
$seek=unserialize($row["seeking"]);
$seeking="";
$split=explode(",", $seek);
if(in_array("1", $split))
{
$seeking="J/O date";
}
if(in_array("2", $split))
{
if($seeking==""){
$seeking="Accommodation";}
else{
$seeking.=", Accommodation";}
}
if(in_array("3", $split))
{
if($seeking==""){
$seeking="J/O date(and more)";}
else{
$seeking.=", J/O date(and more)";}
}
if(in_array("4", $split))
{
if($seeking==""){
$seeking="Coffee/Dinner";}
else{
$seeking.=", Coffee/Dinner";}
}
echo $seeking;
?>
<br>
<strong>More info:</strong><br>
<?php echo $row["moreinfo"];?>
</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";
?>