blogartisanal/user/index.php

134 lines
2.4 KiB
PHP
Raw Blame History

<?php
require_once('config.php');
if(!@$_SESSION['session']){
session_start();
}
if(@$_SESSION['session']){
require_once('verifications.php');
}
include("".$MainDir."files/navheader.php");
?>
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<center>
<section>
<?php
if(!@$_SESSION['session'])
{
$page_name='Connexion';
include_once('top.php');
if(isset($_GET['error']))
{
echo'<span class="error">';
$error=$_GET['error'];
if($error=="username")
{
echo'Error : Your username is invalid';
}
if($error=="pass")
{
echo'error : Your password is invalid';
}
if($error=="connection")
{
echo"error : Your password don't match with your username";
}
echo'</span>';
}
?>
<form method="post" action="login.php">
<table width="300" border="0" align="center">
<tr>
<td colspan="2" >Login</td>
</tr>
<tr>
<td><label for="username">Username : </label></td>
<td><input type="text" name="username" id="username" /></td>
</tr>
<tr>
<td><label for="passwd">Password : </label></td>
<td><input type="password" name="passwd" id="passwd" />
</td>
</tr>
<tr>
<td>
<input type="submit" value="Login" class="addbutton" />
</td>
</tr>
</table>
</form>
<div align="center"><a href="register.php"> &rarr; Register !</a>
<?php
if($localite != 'local')
echo'<br /><a href="lost.php">Lost Password ?</a>';
echo'</div>';
}
else
{
require_once('config.php');
$page_name='Panneau Utilisateur';
include_once('top.php');
?>
<div align="center"><strong>Welcome in your user panel <?php echo htmlspecialchars($username) ?> !</strong></br ></br>
Your e-mail : <?php echo htmlspecialchars($email) ?><br />
Your id : <?php echo htmlspecialchars($id_user) ?> <br />
<a href="profile.php">Profile Modification</a><br />
<a href="logout.php">Logout</a></div>
<?php
$dbh = new PDO("mysql:host=$server;dbname=$base", $user, $passwd);
$sql = "SELECT user_rank FROM user WHERE id_user=$id_user";
$stmt = $dbh->query($sql);
$user_ranking = $stmt->fetch(PDO::FETCH_ASSOC);
echo "<br>";
echo("Votre rang est : ".$user_ranking['user_rank'].". ");
$user_rank="$user_ranking[user_rank]";
if($user_rank==1){
echo("Vous <20>tes administrateur.");
}
?>
<?php
}
include_once('bottom.php');
?>
</div>
</section>
</center>
</body>
</html>