-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0330085
commit f686eff
Showing
13 changed files
with
208 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
include('includes/config.php'); | ||
session_start(); | ||
$db = connect(); | ||
$db->query('UPDATE users SET online = false WHERE id = '.$_SESSION['id']); | ||
$_SESSION['id'] = null; | ||
$_SESSION['login'] = null; | ||
$_SESSION['mail'] = null; | ||
$_SESSION['pwon'] = null; | ||
$_SESSION['ploose'] = null; | ||
session_destroy(); | ||
header('Location: index.php?justdelog'); | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,11 @@ | ||
<?php include('includes/config.php'); | ||
$db = connect(); | ||
$query = $db->query("SELECT COUNT(*) FROM users WHERE online = true"); | ||
$query = $query->fetch(); | ||
?> | ||
<footer> | ||
dat footer | ||
<?php echo "Il y a ".$query[0]." utilisateur(s) en ligne<br />";?> | ||
dat footer, such git <a href="https://github.com/N0ich/attlestar"><i class="icon-github3"></i></a> | ||
</footer> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
include('includes/config.php'); | ||
include('includes/header.php'); | ||
|
||
echo "<div class='content'><center>"; | ||
echo "<table>"; | ||
echo "<tr> | ||
<th>Position</th> | ||
<th>Login</th> | ||
<th>Victoires</th> | ||
<th>Defaites</th> | ||
<th>Ratio</th> | ||
</tr>"; | ||
$db = connect(); | ||
$i = 1; | ||
$query = $db->query('SELECT * FROM `users` ORDER BY (pwon / (pwon + ploose)) DESC'); | ||
while ($data = $query->fetch()) { | ||
if ($i == 1) { | ||
$image = "icon-rocket"; | ||
} else if ($i == 2) { | ||
$image = "icon-evil"; | ||
} else if ($i == 3) { | ||
$image = "icon-fire"; | ||
} else { | ||
$image = "icon-thumbs-up"; | ||
} | ||
echo "<tr> | ||
<td>$i <i class='".$image."'></i></td> | ||
<td><a href='profile.php?id=".$data['id']."'>".$data['login']."</a></td> | ||
<td style='color: green;'>".$data['pwon']."</td> | ||
<td style='color: red'>".$data['ploose']."</td> | ||
<td>".intval(($data['pwon'] / ($data['pwon'] + $data['ploose']) * 100), 100)."%</td> | ||
</tr>"; | ||
$i++; | ||
} | ||
echo "</table></center>"; | ||
include('includes/footer.php'); | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
include('../includes/config.php'); | ||
session_start(); | ||
if ($_SESSION['id'] && $_GET['player']) { | ||
if ($_GET['player'] == "2" || $_GET['player'] == "3" || $_GET['player'] == "4") { | ||
$db = connect(); | ||
$myquery = "SELECT ".$_GET['player']."player FROM lobby"; | ||
$query = $db->query($myquery); | ||
$data = $query->fetch(); | ||
|
||
if ($data[$_GET['player']."player"]) { | ||
$tab = explode(',', $data[$_GET['player']."player"]); | ||
for ($i = 0; $tab[$i] != $_SESSION['id'] && $i < count($tab); $i++); | ||
if (!$tab[$i]) { | ||
$newparse = $data[$_GET['player']."player"].",".$_SESSION['id']; | ||
$myquery = "UPDATE lobby SET `".$_GET['player']."player` = '".$newparse."'"; | ||
$query = $db->query($myquery); | ||
} | ||
} else | ||
$db->query('INSERT INTO lobby('.$_GET['player'].'player) VALUES("'.$_SESSION['id'].'")'); | ||
} | ||
} | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
include('../includes/config.php'); | ||
$db = connect(); | ||
$query = $db->query('SELECT '.$_GET['player'].'player FROM lobby'); | ||
$query = $query->fetch(); | ||
if (count(explode(',', $query[$_GET['player']."player"])) == $_GET['player']) | ||
echo "ok"; | ||
else | ||
echo "Veuillez patienter, ".(count(explode(',', $query[$_GET['player']."player"])) - 1)." joueurs trouves..."; | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
include('includes/header.php'); | ||
include('includes/play.php'); | ||
?> | ||
<div class="content"> | ||
<h1>Jouer!</h1> | ||
<h3>Nombre de joueurs</h3> | ||
<select id="player"> | ||
<option value="2">2</option> | ||
<option value="3">3</option> | ||
<option value="4">4</option> | ||
</select> | ||
<input type="submit" value="Chercher des adversaires!" onclick="lobby()"> | ||
<div id="wait_players"></div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
include('includes/config.php'); | ||
include('includes/header.php'); | ||
?> | ||
<div class="content"> | ||
<?php | ||
$db = connect(); | ||
$query = $db->prepare("SELECT * FROM users WHERE id = :id"); | ||
$query->execute(array( | ||
'id' => $_GET['id'] | ||
)); | ||
$data = $query->fetch(); | ||
if ($data) { | ||
echo "<h1>".$data['login']."</h1>"; | ||
if ($data['online']) | ||
echo "<h3 style='color: green;'>Online</h3>"; | ||
else | ||
echo "<h3 style='color: red'>Offline</h3>"; | ||
echo "<h4>Ratio de victoire</h4>"; | ||
$ratio = intval(($data['pwon'] / ($data['pwon'] + $data['ploose']) * 100), 100); | ||
echo $ratio."% "; | ||
if ($ratio < 10) { | ||
echo "<i class='icon-neutral'></i>"; | ||
} else if ($ratio < 50) { | ||
echo "<i class='icon-smiley'></i>"; | ||
} else if ($ratio < 70) { | ||
echo "<i class='icon-cool2'></i>"; | ||
} else if ($ratio < 90) { | ||
echo "<i class='icon-shocked2'></i>"; | ||
} else { | ||
echo "<i class='icon-evil'></i>"; | ||
} | ||
} else { | ||
echo "<h1>Profile not found :(</h1>"; | ||
} | ||
?> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
include('includes/config.php'); | ||
include('includes/header.php'); | ||
?> | ||
<div class="content"> | ||
<?php | ||
$db = connect(); | ||
$query = $db->query("SELECT ".$_GET['player']."player FROM lobby"); | ||
$data = $query->fetch(); | ||
$tab = explode(',', $data[$_GET['player']."player"]); | ||
for ($i = 0; $tab[$i] != $_SESSION['id'] && $i < count($tab[$i]); $i++); | ||
if ($tab[$i]) { | ||
echo "<h1>La partie va commencer! Tenez-vous pret!</h1>"; | ||
for ($i = 0; $i < count($tab); $i++) { | ||
if ($result) | ||
$result .= "player".($i + 1)."=".$tab[$i]."&"; | ||
else | ||
$result = "player".($i + 1)."=".$tab[$i]."&"; | ||
} | ||
header('Location: attlestar/index.php?'.$result); | ||
} | ||
?> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters