Ejemplo n.º 1
0
function import($file, $dlc)
{
    global $db;
    $f = file_get_contents($file);
    if ($f === FALSE) {
        die("Error loading {$file}");
    }
    $c = explode("\n", $f);
    createTable("weapons");
    createItems("items");
    foreach ($c as $t) {
        list($id, $value, $hp, $weight, $dmg, $reload, $rate, $automatic, $slot, $ammo) = explode("|", $t);
        $id = hexdec($id);
        $slot = hexdec($slot);
        $automatic = hexdec($automatic);
        $ammo = hexdec($ammo);
        if ($id == 0) {
            continue;
        }
        $prep = $db->prepare("insert into weapons (baseID,damage,reload,rate,automatic,ammo,dlc) values (?, ?, ?, ?, ?, ?, ?)");
        if ($prep === FALSE) {
            echo "Fail: " . $id;
            continue;
        }
        $r = $prep->execute(array($id, $dmg, $reload, $rate, $automatic, $ammo, $dlc));
        if (!$r) {
            $arr = $prep->errorInfo();
            echo $arr[2];
        }
        $prep = $db->prepare("insert into items (baseID,value,health, weight, slot, dlc) values (?, ?, ?, ?, ?, ?)");
        if ($prep === FALSE) {
            echo "Fail: " . $id;
            continue;
        }
        $r = $prep->execute(array($id, $value, $hp, $weight, $slot, $dlc));
        if (!$r) {
            $arr = $prep->errorInfo();
            echo $arr[2];
        }
    }
}
Ejemplo n.º 2
0
                  <input id="searchbar" name="search" type="text" placeholder="Find Stuff">
      				  </div>
      				  <div class="large-4 small-3 columns">
                  <input type="submit" value="Search" id="searchbutton" href="#" class="alert button expand"/>
      				  </div>
              </form>
            </div>
          </li>
        </ul>
      </section>
    </nav>
  </div>

  <!-- If they are not logged into Facebook, show login button -->
  <!-- If they are logged into Facebook, our webapp accesses their fb automatically -->
  
  <div id="container">
    <ul id="container-ul" class="small-block-grid-1 medium-block-grid-3 large-block-grid-4">
			<?php 
if (!isset($_GET['search']) || $_GET['search'] == '') {
    $items = getAllItems();
} else {
    $items = getSelectedItems($_GET['search']);
}
createItems($items);
?>
    </ul>
  </div>
    
<?php 
include '_footer.php';