## $Id$ require '.config.php'; require 'fx.inc.php'; ob_start('ob_tidyhandler'); #connect to database $conn = mysql_connect(SQL_HOST, SQL_USER, SQL_PASS) or die(mysql_error()); mysql_select_db(SQL_DATA); $prizes = array(); $sql = "select pdate, puser, pnote, pcountry from prize order by pdate desc limit 10"; $res = mysql_query($sql) or die(mysql_error()); while ($row = mysql_fetch_row($res)) { $prizes[] = array($row[0], $row[1], $row[2], $row[3]); } mysql_free_result($res); httpheader(); echo htmlheader('Travelrun: Prizes', usercss()); echo '<div class="prizenav">'; echo 'Go back to the <a href="index.php">start page</a>.'; echo '</div>'; echo '<div class="prizemain">'; echo 'Recent prizes:<br>'; echo '<table border="0" cellpadding="0" cellspacing="1" width="100%">'; echo '<tr><th>date</th><th>claimed</th><th>note</th><th>country</th></tr>'; foreach ($prizes as $p) { echo '<tr>'; echo '<td>', $p[0], '</td>'; echo '<td align="center">'; echo $p[1] ? $p[1] : '--'; echo '</td>'; echo '<td>', trim($p[2]) != '' ? $p[2] : ' ', '</td>'; echo '<td>', $p[3], '</td>';
<?php ## $Id$ #require '.config.php'; require 'fx.inc.php'; ob_start('ob_tidyhandler'); // open the database connection #$conn = mysql_connect(SQL_HOST, SQL_USER, SQL_PASS) or die(mysql_error()); #mysql_select_db(SQL_DATA); #mysql_close($conn); httpheader(); echo htmlheader('travelrun -- update all', usercss()); ?> <div class="updatenav"> Go back to the <a href="index.php">start page</a>. </div> <div class="updateform"> <form method="post" action="update2.php"> Refresh the item market to get rid of "NaN" values<br> Copy all of the torn country item page <i>(<b>Ctrl+A</b>, <b>Ctrl+C</b> probably works)</i><br> paste in the text box below <i>(<b>Ctrl+V</b> perhaps)</i> <!--font size="-2">(if you're paranoid, you can edit the amount you have to, for example, <b>$100</b>, but leave that line in with no other changes)</font--><br> and click the "UPDATE" button<br> <i>The pasted text has to contain the line with the country name and your money; you can safely edit the amount of money but leave that line otherwise unchanged</i><br> <br><input type="submit" value="UPDATE"><br> <textarea name="data" rows="20" cols="80"></textarea> <br><input type="submit" value="UPDATE"> <i>Thank you.</i> </form> </div>
<?php ## $Id: $ require '.config.php'; require 'fx.inc.php'; ob_start('ob_tidyhandler'); httpheader(); echo htmlheader('travelrun -- flower information', usercss()); echo '<div class="drugnav">Go back to the <a href="index.php">start page</a>.</div>'; // open the database connection $conn = mysql_connect(SQL_HOST, SQL_USER, SQL_PASS) or die(mysql_error()); mysql_select_db(SQL_DATA); // get the data $flowers = array(); $sql = <<<SQL_FLOWERS select stock.item, item.itemname, stock.country, country.countryname, stock.utctime, stock.price, stock.quantity from stock, lastflowers, item, country where stock.item = lastflowers.item and stock.item = item.itemid and stock.country = country.countryid and stock.country = lastflowers.country and stock.utctime = lastflowers.lastutc order by stock.utctime SQL_FLOWERS; $res = mysql_query($sql) or die(mysql_error()); while ($row = mysql_fetch_row($res)) { $flowers[] = array($row[0], $row[1], $row[2], $row[3], $row[4], $row[5], $row[6]); } mysql_free_result($res); mysql_close($conn); echo '<div class="drugdata">';
<?php ## $Id: $ require '.config.php'; require 'fx.inc.php'; ob_start('ob_tidyhandler'); httpheader(); echo htmlheader('travelrun -- plushie information', usercss()); echo '<div class="drugnav">Go back to the <a href="index.php">start page</a>.</div>'; // open the database connection $conn = mysql_connect(SQL_HOST, SQL_USER, SQL_PASS) or die(mysql_error()); mysql_select_db(SQL_DATA); // get the data $plushies = array(); $sql = <<<SQL_PLUSHIES select stock.item, item.itemname, stock.country, country.countryname, stock.utctime, stock.price, stock.quantity from stock, lastplushies, item, country where stock.item = lastplushies.item and stock.item = item.itemid and stock.country = country.countryid and stock.country = lastplushies.country and stock.utctime = lastplushies.lastutc order by stock.utctime SQL_PLUSHIES; $res = mysql_query($sql) or die(mysql_error()); while ($row = mysql_fetch_row($res)) { $plushies[] = array($row[0], $row[1], $row[2], $row[3], $row[4], $row[5], $row[6]); } mysql_free_result($res); mysql_close($conn); echo '<div class="drugdata">';
<?php ## $Id$ require '.config.php'; require 'fx.inc.php'; ob_start('ob_tidyhandler'); httpheader(); echo htmlheader('travelrun -- drug information', usercss()); echo '<div class="drugnav">Go back to the <a href="index.php">start page</a>.</div>'; // open the database connection $conn = mysql_connect(SQL_HOST, SQL_USER, SQL_PASS) or die(mysql_error()); mysql_select_db(SQL_DATA); // get the data $drugs = array(); $sql = <<<SQL_DRUGS select stock.item, item.itemname, stock.country, country.countryname, stock.utctime, stock.price, stock.quantity from stock, lastdrugs, item, country where stock.item = lastdrugs.item and stock.item = item.itemid and stock.country = country.countryid and stock.country = lastdrugs.country and stock.utctime = lastdrugs.lastutc order by item.itemname, stock.price SQL_DRUGS; $res = mysql_query($sql) or die(mysql_error()); while ($row = mysql_fetch_row($res)) { $drugs[] = array($row[0], $row[1], $row[2], $row[3], $row[4], $row[5], $row[6]); } mysql_free_result($res); mysql_close($conn); echo '<div class="drugdata">';
<?php ## $Id: $ require '.config.php'; require 'fx.inc.php'; ob_start('ob_tidyhandler'); httpheader(); echo htmlheader('travelrun -- all items information', usercss()); echo '<div class="drugnav">Go back to the <a href="index.php">start page</a>.</div>'; // open the database connection $conn = mysql_connect(SQL_HOST, SQL_USER, SQL_PASS) or die(mysql_error()); mysql_select_db(SQL_DATA); // get the data $itemall = array(); $sql = <<<SQL_ITEMALL select s.utctime, country.countryname, item.itemname, s.quantity, s.price from stock s , (select max(utctime) as mt, country, item from stock where manual = 0 group by country, item) smax , country , item where s.utctime = smax.mt and s.country = smax.country and s.item = smax.item and s.country = country.countryid and s.item = item.itemid and s.manual = 0 SQL_ITEMALL; if (isset($_GET['f']) && trim($_GET['f']) != '') { $safefilter = mysql_real_escape_string($_GET['f']);
} $scale = 1; if (isset($_GET['scale'])) { $scale = 1 * $_GET['scale']; } if ($scale < 1) { $scale = 1; } if ($scale > 1000) { $scale = 1000; } #connect to database $conn = mysql_connect(SQL_HOST, SQL_USER, SQL_PASS) or die(mysql_error()); mysql_select_db(SQL_DATA); httpheader(); echo htmlheader('travelrun', usercss()); echo '<div class="mannav">'; echo 'Return to the <a href="index.php">start page</a>.'; echo '</div>'; echo '<div>'; echo '<form>'; echo '<label>Country: <select name=c>'; $sql = "select letter, countryname from country order by countryid"; $res = mysql_query($sql) or die(mysql_error()); while ($row = mysql_fetch_row($res)) { echo '<option value="', $row[0], '"'; if ($row[0] == $cc) { echo ' selected'; } echo '>', $row[1]; }
mysql_select_db(SQL_DATA); $sql = <<<SQL_FLOWERS select item.itemid, item.itemname, country.countryname from country, item where country.flower = item.itemid order by item.itemname SQL_FLOWERS; $data = array(); $res = mysql_query($sql) or die(mysql_error()); while ($row = mysql_fetch_row($res)) { $data[] = array($row[0], $row[1], $row[2]); } mysql_free_result($res); mysql_close($conn); httpheader(); echo htmlheader('travelrun -- manual update', usercss()); echo '<div class="mantitle">'; echo '<h3>Manual Update</h3>'; echo '</div>'; echo '<div class="mannav">'; echo 'Return to the <a href="index.php">start page</a>.'; echo '</div>'; echo '<div class="manform">'; echo '<i>Data from this update is only shown in the graph.</i>'; echo '<form method="post" action="manupdate2.php">'; echo 'You can copy all of the date/time forum line or part of it as long as it includes the highlighted underscored portion: [Posted on Sun <b><u>Sep 29, 2013 15:23</u></b>:55]<br>'; echo '<label>Time: <input type="text" name="time" size="24" title="Copy/Paste the time from the flower thread"></label>'; echo ' '; echo '<label>GMT Offset: <input type="text" name="gmt" value="0" size="2"></label> (leave offset at 0 unless TC Time changes -- DST??)<br>'; echo 'Flower: <select name="flower"><option value="0">(select flower)'; foreach ($data as $flower) {
# delete files starting with $cch $files = glob('images/' . $cch . '*'); foreach ($files as $file) { if (is_file($file)) { unlink($file); } } } if ($prize) { $prizedate = gmdate('Y-m-d H:i:s'); $prizecode = md5(PRIZE_PREFIX . $prizedate); $sql = "insert into prize (pdate, pcode, puser, pcountry) values ('{$prizedate}', '{$prizecode}', 0, '{$safe_country}')"; mysql_query($sql) or die(mysql_error()); mysql_close($conn); httpheader(); echo htmlheader('travelrun -- prize', usercss()); echo '<div class="prize">'; echo '<h1>Congratulations!</h1>'; echo '<h2>You have won a prize.</h2>'; echo '<h3>send a in-game message to <a href="http://www.torn.com/profiles.php?XID=1757971">ebcdic</a> to reclaim it.</h3>'; echo '<h3>include the prize date and code in the message</h3>'; echo '<h3 style="text-align: center;"><pre>'; echo 'date: ', $prizedate, "\n"; echo 'code: ', $prizecode; echo '</pre></h3>'; echo '<br><i>Prizes are in testing phase: they\'ll be small prizes :)</i>'; echo '<br><br>'; echo 'Back to <a href="index.php?c=', $cch, '">the regular travelrun page</a>.'; echo '</div>'; echo htmlfooter(); exit(0);
<?php ## $Id: $ require '.config.php'; require 'fx.inc.php'; ob_start('ob_tidyhandler'); httpheader(); echo htmlheader('Travelrun: All Items', usercss()); echo '<br><br>'; // open the database connection $conn = mysql_connect(SQL_HOST, SQL_USER, SQL_PASS) or die(mysql_error()); mysql_select_db(SQL_DATA); // get the data $itemall = array(); $sql = <<<SQL_ITEMALL select s.utctime, country.countryname, item.itemname, s.quantity, s.price from stock s , (select max(utctime) as mt, country, item from stock where manual = 0 group by country, item) smax , country , item where s.utctime = smax.mt and s.country = smax.country and s.item = smax.item and s.country = country.countryid and s.item = item.itemid and s.manual = 0 SQL_ITEMALL; if (isset($_GET['f']) && trim($_GET['f']) != '') { $safefilter = mysql_real_escape_string($_GET['f']);
<?php ## $Id$ require '.config.php'; require 'fx.inc.php'; ob_start('ob_tidyhandler'); // open the database connection $conn = mysql_connect(SQL_HOST, SQL_USER, SQL_PASS) or die(mysql_error()); mysql_select_db(SQL_DATA); $sql = "select valint from config where configkey = 'LAST_FLOWER_PAGE'"; $res = mysql_query($sql) or die(mysql_error()); $last1st = mysql_result($res, 0, 0); mysql_free_result($res); mysql_close($conn); httpheader(); echo htmlheader('TravelRun: Last Forum Page', usercss()); echo '<br><br><br><br>'; echo '<div class="updateform">'; echo '<form method="post" action="firstoflast2.php">'; echo '<label>Last page in the flower thread: <input type="text" value="', $last1st, '" name="last1st" size="4"><br></label>'; echo '<input type="submit" value="UPDATE"><br>'; echo '</form>'; echo '<br>For the example below, you\'d use 860 for the last page.<br>'; echo '<img src="860.jpg" alt="page navigation on torn">'; echo '</div>'; echo htmlfooter();
$upk = $row[1]; } else { $viewk += $row[1]; $cvk[$row[0]] = $row[1]; } } mysql_free_result($res); // get first post of last page of flower thread $sql = "select valint from config where configkey = 'LAST_FLOWER_PAGE'"; $res = mysql_query($sql) or die(mysql_error()); $lastflower = 20 * (mysql_result($res, 0, 0) - 1); mysql_free_result($res); // close the database connection mysql_close($conn); httpheader(); echo htmlheader('Travelrun: Home', usercss()); echo '<br><table width="100%" height="8" cellspacing="1" cellpadding="2"><tr bgcolor="#303030"><td style="padding-top: 10px;border-bottom-left-radius: 5px" align="center"><a href="index.php?c=m"><img src="images/48/Mexico.png" title="', $cvk['m'], ' views" alt="', $cvk['m'], ' views"></a></td><td style="padding-top: 10px" align="center"><a href="index.php?c=i"><img src="images/48/Cayman-Islands.png" title="', $cvk['i'], ' views" alt="', $cvk['i'], ' views"></a></td><td style="padding-top: 10px" align="center"><a href="index.php?c=c"><img src="images/48/Canada.png" title="', $cvk['c'], ' views" alt="', $cvk['c'], ' views"></a></td><td style="padding-top: 10px" align="center"><a href="index.php?c=h"><img src="images/48/Hawaii-Flag.png" title="', $cvk['h'], ' views" alt="', $cvk['h'], ' views"></a></td><td style="padding-top: 10px" align="center"><a href="index.php?c=u"><img src="images/48/United-Kingdom.png" title="', $cvk['u'], ' views" alt="', $cvk['u'], ' views"></a></td><td style="padding-top: 10px" align="center"><a href="index.php?c=a"><img src="images/48/Argentina.png" title="', $cvk['a'], ' views" alt="', $cvk['a'], ' views"></a></td><td style="padding-top: 10px" align="center"><a href="index.php?c=s"><img src="images/48/Switzerland.png" title="', $cvk['s'], ' views" alt="', $cvk['s'], ' views"></a></td><td style="padding-top: 10px" align="center"><a href="index.php?c=j"><img src="images/48/Japan.png" title="', $cvk['j'], ' views" alt="', $cvk['j'], ' views"</a></td><td style="padding-top: 10px" align="center"><a href="index.php?c=x"><img src="images/48/China.png" title="', $cvk['x'], ' views" alt="', $cvk['x'], ' views"></a></td><td style="padding-top: 10px" align="center"><a href="index.php?c=e"><img src="images/48/United-Arab-Emirates.png" title="', $cvk['e'], ' views" alt="', $cvk['e'], ' views"></a></td><td style="padding-top: 10px" align="center"><a href="index.php?c=z"><img src="images/48/South-Africa.png" title="', $cvk['z'], ' views" alt="', $cvk['z'], ' views"></a></td><td align="center" style="padding-top: 10px;border-bottom-right-radius: 5px"><a href="itemall.php"><img src="images/48/item.png"></a></td></tr></table>'; echo '<div class="timeinfo">'; echo 'Current time is ', gmdate('Y-m-d H:i:s'), ' GMT.<br>'; echo 'Last update was made at ', $lastupdate, ' GMT for ', $lastcountry, '.'; echo '</div>'; echo '<hr>'; if (isset($_SESSION['recent_update'])) { echo '<div class="pub"><br><i>'; echo 'If you want to '; echo '<a href="http://www.torn.com/forums.php#!p=threads&f=10&t=15907728&b=0&a=0&start=999999">'; echo 'make a post in the '; echo 'flower thread and advertise travelrun</a>, you can use the '; echo 'code between the following lines:</i><br>'; echo '================================================<br>'; echo "{$_SESSION['recent_update']['qtd']} ";
<?php ## $Id: $ require '.config.php'; require 'fx.inc.php'; ob_start('ob_tidyhandler'); httpheader(); echo htmlheader('Travel Run: Flowers', usercss()); echo '<br><br>'; // open the database connection $conn = mysql_connect(SQL_HOST, SQL_USER, SQL_PASS) or die(mysql_error()); mysql_select_db(SQL_DATA); // get the data $flowers = array(); $sql = <<<SQL_FLOWERS select stock.item, item.itemname, stock.country, country.countryname, stock.utctime, stock.price, stock.quantity from stock, lastflowers, item, country where stock.item = lastflowers.item and stock.item = item.itemid and stock.country = country.countryid and stock.country = lastflowers.country and stock.utctime = lastflowers.lastutc order by stock.utctime SQL_FLOWERS; $res = mysql_query($sql) or die(mysql_error()); while ($row = mysql_fetch_row($res)) { $flowers[] = array($row[0], $row[1], $row[2], $row[3], $row[4], $row[5], $row[6]); } mysql_free_result($res); mysql_close($conn); echo '<div class="drugdata">';
<?php ## $Id: $ require '.config.php'; require 'fx.inc.php'; ob_start('ob_tidyhandler'); httpheader(); echo htmlheader('Travelrun: Plushies', usercss()); echo '<br><br>'; // open the database connection $conn = mysql_connect(SQL_HOST, SQL_USER, SQL_PASS) or die(mysql_error()); mysql_select_db(SQL_DATA); // get the data $plushies = array(); $sql = <<<SQL_PLUSHIES select stock.item, item.itemname, stock.country, country.countryname, stock.utctime, stock.price, stock.quantity from stock, lastplushies, item, country where stock.item = lastplushies.item and stock.item = item.itemid and stock.country = country.countryid and stock.country = lastplushies.country and stock.utctime = lastplushies.lastutc order by stock.utctime SQL_PLUSHIES; $res = mysql_query($sql) or die(mysql_error()); while ($row = mysql_fetch_row($res)) { $plushies[] = array($row[0], $row[1], $row[2], $row[3], $row[4], $row[5], $row[6]); } mysql_free_result($res); mysql_close($conn); echo '<div class="drugdata">';
<?php ## $Id$ require '.config.php'; require 'fx.inc.php'; ob_start('ob_tidyhandler'); httpheader(); echo htmlheader('Travelrun: Drugs', usercss()); echo '<br><br>'; // open the database connection $conn = mysql_connect(SQL_HOST, SQL_USER, SQL_PASS) or die(mysql_error()); mysql_select_db(SQL_DATA); // get the data $drugs = array(); $sql = <<<SQL_DRUGS select stock.item, item.itemname, stock.country, country.countryname, stock.utctime, stock.price, stock.quantity from stock, lastdrugs, item, country where stock.item = lastdrugs.item and stock.item = item.itemid and stock.country = country.countryid and stock.country = lastdrugs.country and stock.utctime = lastdrugs.lastutc order by item.itemname, stock.price SQL_DRUGS; $res = mysql_query($sql) or die(mysql_error()); while ($row = mysql_fetch_row($res)) { $drugs[] = array($row[0], $row[1], $row[2], $row[3], $row[4], $row[5], $row[6]); } mysql_free_result($res); mysql_close($conn); echo '<div class="drugdata">';
<?php ## $Id$ require '.config.php'; require 'fx.inc.php'; ob_start('ob_tidyhandler'); // open the database connection $conn = mysql_connect(SQL_HOST, SQL_USER, SQL_PASS) or die(mysql_error()); mysql_select_db(SQL_DATA); $sql = "select valint from config where configkey = 'LAST_FLOWER_PAGE'"; $res = mysql_query($sql) or die(mysql_error()); $last1st = mysql_result($res, 0, 0); mysql_free_result($res); mysql_close($conn); httpheader(); echo htmlheader('travelrun -- update first of last', usercss()); echo '<div class="updatenav">'; echo 'Go back to the <a href="index.php">start page</a>.'; echo '</div><br><br>'; echo '<div class="updateform">'; echo '<form method="post" action="firstoflast2.php">'; echo '<label>Last page in the flower thread: <input type="text" value="', $last1st, '" name="last1st" size="4"> possibly 1 more than the old value</label>'; echo '<input type="submit" value="UPDATE"><br>'; echo '</form>'; echo '<br>For the example below, you\'d use 860 for the last page.<br>'; echo '<img src="860.jpg" alt="page navigation on torn">'; echo '</div>'; echo htmlfooter();