Skip to content

Commit

Permalink
SUch commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Ne02ptzero committed Apr 13, 2014
1 parent 1590521 commit 23e4ea3
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 2 deletions.
2 changes: 1 addition & 1 deletion includes/footer.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
?>
<footer>
<?php echo "Il y a ".$query[0]." utilisateur(s) en ligne<br />";?>
dat footer, such git <a href="/N0ich/attlestar"><i class="icon-github3"></i></a>
dat footer, such git <a href="/N0ich/attlestar"><i class="icon-github3"></i></a>, Much wow
</footer>
</body>
</html>
2 changes: 2 additions & 0 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
<?php
if (isset($_GET['justlogged']) && isset($_SESSION['login'])) {
echo "<div class='alert success'>Bienvenue ".$_SESSION['login']. "!</div>";
} else if (isset($_GET['justdelog'])) {
echo "<div class='alert success'>Vous avez bien ete deconnecte. A la prochaine!</div>";
}
if (isset($_SESSION['login'])) {
echo "<center><h3>Chat <i class='icon-bubble'></i></h3></center>";
Expand Down
52 changes: 52 additions & 0 deletions modif_profil.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?php
include('includes/header.php');
include('includes/config.php');
?>
<div class="content">
<?php
if (isset($_SESSION['login'])) {
echo "<h1>Modifier mon profil</h1>";
$id = $_SESSION['id'];
echo "<form action='modif_profil.php' method='POST'>";
echo "<input type='password' name='actpass' placeholder='Mot de passe actuel' ><br />";
echo "<input type='password' name='newpass' placeholder='Modifier mon password' ><br />";
echo "<input type='password' name='newpass2' placeholder='Confirmer' ><br />";
echo "<hr />";
echo "<input type='text' name='img' placeholder='Modifier mon Avatar'>";
echo "<hr />";
echo "<input type='mail' name='mail' placeholder='Modifer mon mail'>";
echo "<hr />";
echo "<input type='submit' value='Modifier!'>";
echo "</form>";
if (isset($_POST['newpass']) && isset($_POST['newpass2']) && isset($_POST['actpass'])) {
if ($_POST['newpass'] == $_POST['newpass2']) {
$db = connect();
$query = $db->query('SELECT password FROM users WHERE id = '.$id);
$data = $query->fetch();
if ($data['password'] == sha1($_POST['actpass'])) {
$db->query('UPDATE users SET password = '.sha1($_POST['password'])." WHERE id = ".$id);
$success = "Votre mot de passe a bien ete mis a jour";
} else {
$error = "Le mot de passe actuel ne correspond pas!";
}
} else {
$error = "Les mots de passes ne correspondent pas!";
}
} if (isset($_POST['img'])) {
$db = connect();
$db->query('UPDATE users SET img = '.$_POST['img'].' WHERE id = '.$id);
$success = "Votre avatar a bien ete change!";
} if (isset($_POST['mail'])) {
$db = connect();
$db->query('UPDATE users SET mail = '.$_POST['mail'].' WHERE id = '.$id);
$success = "Votre mail a bien ete modifie!";
}
if (isset($error))
echo "<div class='alert error'>".$error."</div>";
if (isset($success))
echo "<div class='alert success'>".$success."</div>";
} else {
echo "<h1>Error 404: Page not found.</h1>";
}
?>
</div>
7 changes: 6 additions & 1 deletion profile.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@
));
$data = $query->fetch();
if ($data) {
if (isset($data['img'])) {
if (!($data['img'])) {
echo "<img class='profile' src='http://www.webdesignerforum.co.uk/uploads/profile/photo-1407.jpg?_r=1396701824'>";
} else {
echo "<img class='profile' src='".$data['img']."'>";
}
echo "<h1>".$data['login']."</h1>";
if ($data['online'])
Expand All @@ -39,6 +41,9 @@
echo "<br /><br />Nombre de partie jouees: ".($data['pwon'] + $data['ploose'])."<br />";
echo "Nombre de partie gagnees: <span style='color: green'>".$data['pwon']."</span><br />";
echo "Nombre de partie perdues: <span style='color: red'>".$data['ploose']."</span><br />";
if ($_SESSION['id'] == $_GET['id']) {
echo "<br /><a href='modif_profil.php'><button style='height: 80px; width: 250px; font-size: 20px;'>Modifier mon profil</button></a>";
}
} else {
echo "<h1>Profile not found :(</h1>";
}
Expand Down
5 changes: 5 additions & 0 deletions style/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,11 @@ button:hover {
background-color: #0A748F;
}

.slow {
height: 80px !important;
width: 250px !important;
}

.profile {
height: 200px;
width: 200px;
Expand Down

0 comments on commit 23e4ea3

Please sign in to comment.