by Letoilenoir » Thu Aug 23, 2012 10:49 am
by Goddess Technical Help Line » Thu Aug 23, 2012 10:56 am
by Letoilenoir » Thu Aug 23, 2012 11:55 am
by Goddess Technical Help Line » Thu Aug 23, 2012 12:49 pm
by Corporation de Apple » Thu Aug 23, 2012 3:09 pm
Goddess Technical Help Line wrote:Yep, this is what I though of. Remember to ask/look for php on your server (if it's not already provided, like in LAMPP/WAMP).
by [violet] » Thu Aug 23, 2012 11:02 pm
by Letoilenoir » Thu Aug 23, 2012 11:49 pm
by BrownLands » Fri Aug 24, 2012 2:46 am
by Goddess Technical Help Line » Fri Aug 24, 2012 3:52 pm
by BrownLands » Sat Aug 25, 2012 2:59 am
Goddess Technical Help Line wrote:IMO, learning a general purpose programming language for simple web-based form processing and databases is a bit overkill. Also PHP is more readily supported by cheap hosting providers, while with perl you might have to subscribe to a higher tier service or VPS.
by Letoilenoir » Tue Sep 11, 2012 10:56 am
by Solm » Tue Sep 11, 2012 7:23 pm
Letoilenoir wrote:Seems from the source code to be a php job
Ellorea: A Region || IIwiki || UDL
by Unibot II » Tue Sep 11, 2012 7:49 pm
Letoilenoir wrote:-sic-
Vocenae wrote:Unibot, you have won NS.
General Halcones wrote:Look up to Unibot as an example.
by Lordieth » Sun Sep 16, 2012 5:31 am
<html>
<head>
<title>Choice</title>
</head>
<body>
<form action="choice.php" method="post">
<input type="radio" name="choice" value="agree" /> Agree
<input type="radio" name="choice" value="disagree" /> Disagree
<input type ="submit" value="Decide" />
</form>
</body>
</html>
<?php
$user = $_POST["choice"];
echo $user;
?>
by Letoilenoir » Sun Oct 28, 2012 1:49 pm
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Influence</title>
<style type="text/css" media="all">
@import "http://www.nationstates.net/ns_v61.css";
</style>
</head>
<body>
<input type="text" name="name[]" /><br />
<input type="text" name="name[]" /><br />
<input type="text" name="name[]" /><br />
<br />
<table><tr><th>Nation<th>Influence<th>Region
<?php
function get_data($nation, $shards = FALSE) {
if($shards != FALSE) {
$file = 'http://www.nationstates.net/cgi-bin/api.cgi?nation=' . $nation . '&q=' . $shards;
}
else {
$file = 'http://www.nationstates.net/cgi-bin/api.cgi?nation=' . $nation;
}
$xml = simplexml_load_file($file);
return $xml;
}
ini_set('user_agent', 'Letoilenoir');
function display_influence($nation) {
$data = get_data($nation, 'name+influence+region');
$name = (string) $data->NAME;
$influence = (string) $data->INFLUENCE;
$region = (string) $data->REGION;
echo "<tr><td><a rel='nofollow' target='_blank' href='http://www.nationstates.net/nation=$name'>$name</a>";
echo "<td>$influence</a>";
echo "<td><a rel='nofollow' target='_blank' href='http://www.nationstates.net/region=$region'>$region</a>";
}
display_influence('General Halcones');
display_influence('Unibot III');
display_influence('Krulltopia');
?></table>
</body>
</html>
by Letoilenoir » Tue Jan 01, 2013 4:39 pm
<style type="text/css" media="all">
@import "http://www.nationstates.net/ns_v61.css";
</style>
</HEAD><BODY>
<table><tr><th>Region<th>Delegate<th>Endorsements<th>Population
<?php
// I removed the comments from this one. See other example for those :p
$dump = file_get_contents('regions.xml');
$array = explode('<REGION>',$dump);
array_shift($array);
foreach ($array as $value)
{
$delegatestart = strpos($value,'<DELEGATE>')+10;
$delegateend = strpos($value,'</DELEGATE>');
$delegatename = $regionname = substr($value,$delegatestart,$delegateend-$delegatestart);
{
$namestart = strpos($value,'<NAME>')+6;
$nameend = strpos($value,'</NAME>');
$regionname = substr($value,$namestart,$nameend-$namestart);
$nationsstart = strpos($value,'<NUMNATIONS>')+12;
$nationsend = strpos($value,'</NUMNATIONS>');
$numnations = substr($value,$nationsstart,$nationsend-$nationsstart);
$endosstart = strpos($value,'<DELEGATEVOTES>')+15;
$endosend = strpos($value,'</DELEGATEVOTES>');
$endos = substr($value,$endosstart,$endosend-$endosstart);
echo "<tr><td><a rel='nofollow' target='_blank' href='http://www.nationstates.net/region=$regionname'>$regionname</a>";
echo "<td><a rel='nofollow' target='_blank' href='http://www.nationstates.net/nation=$delegatename'>$delegatename</a>";
echo "<td>$endos<td>$numnations";
}
}
?></table></BODY></HTML>
http://www.nationstates.net/cgi-bin/api.cgi?q=regionsbytag;tags=isolationist
by Scoochi2 » Tue Jan 01, 2013 4:58 pm
$allregions = array(); // array of regions in the game
$unwantedregions = array(); // array of regions from the isolationist call
$wantedregions = array_diff($allregions,$unwantedregions); // array of regions WITHOUT the isolationist tag.
if (!in_array($currentregion,$unwantedregions))
// do stuff for this wanted region
by Letoilenoir » Fri Mar 15, 2013 12:17 pm
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css" media="all">
@import "http://www.nationstates.net/ns_v61.css";
</style><!--[if IE 5]>
<style type="text/css">
/* place css box model fixes for IE 5* in this conditional comment */
.twoColFixLt #sidebar1 { width: 230px; }
</style>
<![endif]--><!--[if IE]>
<style type="text/css">
/* place css fixes for all versions of IE in this conditional comment */
.twoColFixLt #sidebar1 { padding-top: 30px; }
.twoColFixLt #mainContent { zoom: 1; }
/* the above proprietary zoom property gives IE the hasLayout it needs to avoid several bugs */
</style>
<![endif]--></head>
<body class="twoColFixLt">
<div id="container">
<div id="sidebar1">
<div id="mainContent">
<h1> Ether </h1>
<table><tr><th>Nation<th>Influence<th>WA<th>Endorsements<th>Region
<?php
function get_data($nation, $shards = FALSE) {
if($shards != FALSE) {
$file = 'http://www.nationstates.net/cgi-bin/api.cgi?nation=' . $nation . '&q=' . $shards;
}
else {
$file = 'http://www.nationstates.net/cgi-bin/api.cgi?nation=' . $nation;
}
$xml = simplexml_load_file($file);
return $xml;
}
ini_set('user_agent', 'Letoilenoir');
function display_strategic_report($nation) {
$data = get_data($nation, 'name+influence+wa+endorsements+region');
$name = (string) $data->NAME;
$influence = (string) $data->INFLUENCE;
$wa = (string) $data->UNSTATUS;
$endorsements = (string) $data->ENDORSEMENTS;
$region = (string) $data->REGION;
echo "<tr><td><a rel='nofollow' target='_blank' href='http://www.nationstates.net/nation=$name'>$name</a>";
echo "<td>$influence</a>";
echo "<td>$wa</a>";
echo "<td>$endorsements</a>";
echo "<td><a rel='nofollow' target='_blank' href='http://www.nationstates.net/region=$region'>$region</a>";
}
display_strategic_report('#1');
display_strategic_report('#2');
display_strategic_report('#3');
display_strategic_report('#4');
display_strategic_report('#5');
display_strategic_report('#6');
display_strategic_report('#7');
display_strategic_report('#8');
display_strategic_report('#9');
display_strategic_report('#10');
display_strategic_report('#11');
display_strategic_report('#12');
display_strategic_report('#13');
display_strategic_report('#14');
display_strategic_report('#15');
display_strategic_report('#16');
display_strategic_report('#17');
display_strategic_report('#18');
display_strategic_report('#19');
display_strategic_report('#20');
display_strategic_report('#21');
display_strategic_report('#22');
display_strategic_report('#23');
display_strategic_report('#24');
display_strategic_report('#25');
display_strategic_report('#26');
display_strategic_report('#27');
display_strategic_report('#28');
display_strategic_report('#29');
display_strategic_report('#30');
display_strategic_report('#31');
display_strategic_report('#32');
display_strategic_report('#33');
display_strategic_report('#34');
display_strategic_report('#35');
display_strategic_report('#36');
display_strategic_report('#37');
display_strategic_report('#38');
display_strategic_report('#39');
display_strategic_report('#40');
sleep(30);
display_strategic_report('#41');
display_strategic_report('#42');
display_strategic_report('#43');
display_strategic_report('#44');
display_strategic_report('#45');
display_strategic_report('#46');
display_strategic_report('#47');
display_strategic_report('#48');
display_strategic_report('#49');
display_strategic_report('#50');
display_strategic_report('#51');
display_strategic_report('#52');
display_strategic_report('#53');
display_strategic_report('#54');
display_strategic_report('#55');
display_strategic_report('#56');
display_strategic_report('#57');
display_strategic_report('#58');
display_strategic_report('#59');
display_strategic_report('#60');
display_strategic_report('#61');
display_strategic_report('#62');
display_strategic_report('#63');
display_strategic_report('#64');
display_strategic_report('#65');
display_strategic_report('#66');
display_strategic_report('#67');
display_strategic_report('#68');
display_strategic_report('#69');
display_strategic_report('#70');
display_strategic_report('#71');
display_strategic_report('#72');
display_strategic_report('#73');
display_strategic_report('#74');
display_strategic_report('#75');
display_strategic_report('#76');
display_strategic_report('#77');
display_strategic_report('#78');
display_strategic_report('#79');
display_strategic_report('#80');
sleep(30);
display_strategic_report('#81');
display_strategic_report('#82');
display_strategic_report('#83');
display_strategic_report('#84');
display_strategic_report('#85');
display_strategic_report('#86');
display_strategic_report('#87');
display_strategic_report('#88');
display_strategic_report('#89');
display_strategic_report('#90');
display_strategic_report('#91');
display_strategic_report('#92');
display_strategic_report('#93');
display_strategic_report('#94');
display_strategic_report('#95');
display_strategic_report('#96');
display_strategic_report('#97');
display_strategic_report('#98');
display_strategic_report('#99');
display_strategic_report('#100');
display_strategic_report('#101');
display_strategic_report('#102');
display_strategic_report('#103');
display_strategic_report('#104');
?></table>
<!-- end #container --></div>
</body>
</html>
by Glen-Rhodes » Fri Mar 15, 2013 1:20 pm
function display_strategic_reports($arr) {
for($i = 0; $i < count($arr); $i++) {
if($count == 49) {
$count = 0;
sleep(30);
}
$nation = $arr[$i];
$data = get_data($nation, 'name+influence+wa+endorsements+region');
$name = (string) $data->NAME;
$influence = (string) $data->INFLUENCE;
$wa = (string) $data->UNSTATUS;
$endorsements = (string) $data->ENDORSEMENTS;
$region = (string) $data->REGION;
$html = <<<HTML
<tr>
<td><a rel='nofollow' target='_blank' href='http://www.nationstates.net/nation=$name'>$name</a></td>
<td>$influence</td>
<td>$wa</td>
<td>$endorsements</td>
<td><a rel='nofollow' target='_blank' href='http://www.nationstates.net/region=$region'>$region</a></td>
</tr>
HTML;
echo $html;
$count++;
}
}
by Letoilenoir » Fri Mar 15, 2013 2:10 pm
$nation = $arr[$i];
by Glen-Rhodes » Fri Mar 15, 2013 2:38 pm
Letoilenoir wrote:Many thanks for the swift response G-R the code that inspired this was one of you originals!
I'm guessing that this section in your above example is the part that calls the relevant array?
by Letoilenoir » Thu Oct 24, 2013 1:31 pm
Scoochi2 wrote:that code looks very familiar
If I understand what you're after (a list of regions that doesn't include the ones from the call) then think of using array_diff()
Essentially, you have two arrays: a list of regions and a list of regions you *don't* want. Use array diff to work out which regions are NOT in the unwanted list.
I've had a busy day so won't do a working example, but the following should make you understand it.
- Code: Select all
$allregions = array(); // array of regions in the game
$unwantedregions = array(); // array of regions from the isolationist call
$wantedregions = array_diff($allregions,$unwantedregions); // array of regions WITHOUT the isolationist tag.
OR you could just add something to the loop to check if the region currently being evaluated is in the array of unwanted regions.
- Code: Select all
if (!in_array($currentregion,$unwantedregions))
// do stuff for this wanted region
<HTML><HEAD>
<style type="text/css" media="all">
@import "http://w11.zetaboards.com/c/22619/11/css.css";
</style>
</HEAD><BODY>
<table><tr><th>Region<th>Delegate<th>Endorsements<th>Population<th>Power<th>Rank
<?php
$dump = file_get_contents('regions.xml');
$array = explode('<REGION>',$dump);
array_shift($array);
$allregions = array("Asgard","Ether","Astyria","Kingdom of Rohan","Osiris","Hyrule");
foreach ($allregions as $value)
// I get that the explode above opens up the REGIONS in the XML via an array but how, where do I then put a second array to loop through to pull back dtails for only a select set eg("Asgard","Ether","Astyria","Kingdom of Rohan","Osiris","Hyrule") the resulting page brings back six results so its picking something up?
{
$delegatestart = strpos($value,'<DELEGATE>')+10;
$delegateend = strpos($value,'</DELEGATE>');
$delegatename = $regionname = substr($value,$delegatestart,$delegateend-$delegatestart);
{
$namestart = strpos($value,'<NAME>')+6;
$nameend = strpos($value,'</NAME>');
$regionname = substr($value,$namestart,$nameend-$namestart);
$nationsstart = strpos($value,'<NUMNATIONS>')+12;
$nationsend = strpos($value,'</NUMNATIONS>');
$numnations = substr($value,$nationsstart,$nationsend-$nationsstart);
$endosstart = strpos($value,'<DELEGATEVOTES>')+15;
$endosend = strpos($value,'</DELEGATEVOTES>');
$endos = substr($value,$endosstart,$endosend-$endosstart);
$powerstart = strpos($value,'<POWER>')+7;
$powerend = strpos($value,'</POWER>');
$power = substr($value,$powerstart,$powerend-$powerstart);
$iNumber = $iNumber + 1;
echo "<tr><td><a href='http://www.nationstates.net/region=$regionname'>$regionname</a>";
echo "<td><a href='http://www.nationstates.net/nation=$delegatename'>$delegatename</a>";
echo "<td>$endos<td>$numnations";
echo "<td>$power";
echo "<td>$iNumber";
}
}
?></table></BODY></HTML>
by Letoilenoir » Sat Dec 20, 2014 12:55 pm
ini_set('user_agent', '**************'');
function display_strategic_report($nation) {
$data = get_data($nation, 'name+influence+wa+censusscore-65+censusscore-66');
$name = (string) $data->NAME;
$influence = (string) $data->INFLUENCE;
$wa = (string) $data->UNSTATUS;
$censusscore1 = (string) $data->CENSUSSCORE;
$censusscore2 = (string) $data->CENSUSSCORE;
$region = (string) $data->REGION;
echo "<tr><td><a rel='nofollow' target='_blank' href='http://www.nationstates.net/nation=$name'>$name</a>";
echo "<td>$influence</a>";
echo "<td>$wa</a>";
echo "<td>$censusscore1</a>";
echo "<td>$censusscore2</a>";
ini_set('user_agent', '*************');
function display_strategic_report($nation) {
$data = get_data($nation, 'name+influence+wa+censusscore-66+censusscore-65');
$name = (string) $data->NAME;
$influence = (string) $data->INFLUENCE;
$wa = (string) $data->UNSTATUS;
$censusscore1 = (string) $data->CENSUSSCORE;
$censusscore2 = (string) $data->CENSUSSCORE;
$region = (string) $data->REGION;
echo "<tr><td><a rel='nofollow' target='_blank' href='http://www.nationstates.net/nation=$name'>$name</a>";
echo "<td>$influence</a>";
echo "<td>$wa</a>";
echo "<td>$censusscore1</a>";
echo "<td>$censusscore2</a>";
by Belique » Sat Dec 20, 2014 2:01 pm
Advertisement
Users browsing this forum: Absolutus, Bagong Timog Mindanao, The Nafhaea
Advertisement