(v1) travelto.php:
<?php
/*==================================
Travel To User Location By Cyanide
http://suburban-assault.com
http://infintium.net
This is FREE software.
===================================*/
session_start();
require "global_func.php";
if($_SESSION['loggedin']==0) { header("Location: login.php");exit; }
$userid=$_SESSION['userid'];
require "header.php";
$h = new headers;
$h->startheaders();
include "mysql.php";
global $c;
$is=mysql_query("SELECT u.*,us.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid WHERE u.userid=$userid",$c) or die(mysql_error());
$ir=mysql_fetch_array($is);
check_level();
$fm=money_formatter($ir['money']);
$cm=money_formatter($ir['crystals'],'');
$lv=date('F j, Y, g:i a',$ir['laston']);
$h->userdata($ir,$lv,$fm,$cm);
$h->menuarea();
if($ir['money'] < 5000)
{
print "<center><br/><br/><br/><font color='red'><b>ERROR:</b></font> You dont have enough money travel to this location.<br/>
<a href='viewuser.php?u={$_GET['ID']}'>> Go Back</a>";
$h->endpage();
exit();
}
$ct=mysql_query("SELECT * FROM cities WHERE cityid='{$_GET['to']}'",$c) or die(mysql_error());
$to=mysql_fetch_array($ct);
if($ir['level'] < $to['cityminlevel'])
{
print "<center><br/><br/><br/><font color='red'><b>ERROR:</b></font> You cannot yet travel to this location.<br/>
<a href='viewuser.php?u={$_GET['ID']}'>> Go Back</a>";
$h->endpage();
exit();
}
else
{
mysql_query("UPDATE users SET money=money-5000, location='{$_GET['to']}' WHERE userid=$userid",$c) or die(mysql_error());
print "<center>You have paid $5,000 and traveled to {$to['cityname']}.<br/>
<a href='viewuser.php?u={$_GET['ID']}'>> Back to Users Profile</a>";
$h->endpage();
exit();
}
?>
(v2) travelto.php:
<?php
/*==================================
Travel To User Location By Cyanide
http://suburban-assault.com
http://infintium.net
This is FREE software.
===================================*/
include "globals.php";
if($ir['money'] < 5000)
{
print "<center><br/><br/><br/><font color='red'><b>ERROR:</b></font> You dont have enough money travel to this location.<br/>
<a href='viewuser.php?u={$_GET['ID']}'>> Go Back</a>";
$h->endpage();
exit();
}
$ct=mysql_query("SELECT * FROM cities WHERE cityid='{$_GET['to']}'",$c) or die(mysql_error());
$to=mysql_fetch_array($ct);
if($ir['level'] < $to['cityminlevel'])
{
print "<center><br/><br/><br/><font color='red'><b>ERROR:</b></font> You cannot yet travel to this location.<br/>
<a href='viewuser.php?u={$_GET['ID']}'>> Go Back</a>";
$h->endpage();
exit();
}
else
{
mysql_query("UPDATE users SET money=money-5000, location='{$_GET['to']}' WHERE userid=$userid",$c) or die(mysql_error());
print "<center>You have paid $5,000 and traveled to {$to['cityname']}.<br/>
<a href='viewuser.php?u={$_GET['ID']}'>> Back to Users Profile</a>";
$h->endpage();
exit();
}
?>
Add think link to viewuser.php:
<a href='travelto.php?to={$r['location']}&ID={$r['userid']}'>[Travel to Location]</a>