This repository has been archived by the owner on Aug 5, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
83 lines (69 loc) · 2.41 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
include('assets/php/start.php');
include('assets/php/header.php');
?>
<div class="search-area-wrapper">
<div class="search-area container">
<h3 class="search-header">SÖK</h3>
<p class="search-tag-line">Sök på personnummer, registreringsnummer, namn, nick (smeknamn) eller telefonnummer</p>
<form autocomplete="off" class="search-form clearfix" id="search-form" novalidate="novalidate">
<input type="text" title="* Please enter a search term!" placeholder="Skriv här för att söka" name="s" id="searchbox" class="search-term required" autocomplete="off" value="<?php echo isset($_GET['s'])?$_GET['s']:''; ?>">
<div id="search-error-container"></div>
<img src="/assets/images/spinner.gif" class="spinner">
</form>
</div>
</div>
<div class="container-fluid main-container" id="main">
<?php
if ( isset($_GET['s']) ) {
try {
$result = $oauth->get('http://api.crew.dreamhack.se/1/eventinfo/search/current/'.$_GET['s']);
} catch (Exception $err) {
die($err->getMessage());
}
if ( isset($result['oauth_problem']) ) {
die('Kommunikationsproblem: '.$result['oauth_problem']);
}
if (!$result)
die('Hittade inga träffar, pröva sök på något annat!');
$members = $nonmembers = array();
foreach($result as $key => $line ) {
if ( isset($line['teams']) ) {
$members[] = $line;
} else {
$nonmembers[] = $line;
}
}
foreach($members as $key => $line ) {
include("assets/php/box.php");
}
echo '<hr>';
foreach($nonmembers as $key => $line ) {
include("assets/php/box.php");
}
}
?>
</div>
<script>
$(function() {
var cache = {};
$( "#searchbox" ).autocomplete({
source: function( request, response ) {
$.get( "search.php", request, function( data, status, xhr ) {
$('.search-area').removeClass('searching');
$("#main").html(data);
});
},
change: function( event, ui ) {
},
search: function( event, ui ) {
$('.search-area').addClass('searching');
}
});
});
</script>
<?php
include('assets/php/footer.php');
?>