| Server IP : 109.234.162.214 / Your IP : 216.73.216.222 Web Server : Apache System : Linux servd162214.srv.odns.fr 4.18.0-372.26.1.lve.1.el8.x86_64 #1 SMP Fri Sep 16 14:08:19 EDT 2022 x86_64 User : carpe ( 1178) PHP Version : 8.0.30 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/carpe/public_html/CURSED/V3/ |
Upload File : |
<?php
session_start();
include '../database.php';
$database = new Database();
$connexion = $database->getConnection();
if (isset($_SESSION['login'])) {
header("Location: cursedV3.php");
exit(); // Assurez-vous que la redirection fonctionne bien
}
// Vérifier si un message d'erreur a été stocké dans un cookie
$error_message = isset($_COOKIE["user"]) ? $_COOKIE["user"] : "";
// Traitement de la connexion
if (isset($_POST['connexion'])) {
if (!empty($_POST['nom']) && !empty($_POST['mdp'])) {
$nom = $_POST['nom'];
$mdp = $_POST['mdp'];
$sql = "SELECT * FROM users WHERE pseudo = :nom";
$statement = $connexion->prepare($sql);
$statement->bindParam(':nom', $nom, PDO::PARAM_STR);
$statement->execute();
$user = $statement->fetch(PDO::FETCH_ASSOC);
if ($user) {
if (password_verify($mdp, $user['mdp'])) {
$_SESSION['login'] = $nom;
header("Location: cursedV3.php");
exit();
} else {
$error_message = "Mot de passe incorrect";
setcookie("user", $error_message, time() + 10, "/"); // Durée courte pour le cookie
}
} else {
$error_message = "Nom d'utilisateur inconnu";
setcookie("user", $error_message, time() + 10, "/"); // Durée courte pour le cookie
}
}
}
// Traitement de l'inscription
if (isset($_POST['inscription'])) {
if (!empty($_POST['nom']) && !empty($_POST['mdp'])) {
$nom = $_POST['nom'];
$mdp = $_POST['mdp'];
$password_hashed = password_hash($mdp, PASSWORD_DEFAULT);
// Vérifier si l'utilisateur existe déjà
$sql = "SELECT COUNT(*) FROM users WHERE pseudo = :nom";
$statement = $connexion->prepare($sql);
$statement->bindParam(':nom', $nom, PDO::PARAM_STR);
$statement->execute();
$exists = $statement->fetchColumn();
if ($exists) {
$error_message = "Nom d'utilisateur déjà pris";
setcookie("user", $error_message, time() + 10, "/");
} else {
// Insérer le nouvel utilisateur
$sql2 = "INSERT INTO users (pseudo, mdp, vie, vivres, gold, monde, quest, niv, bateau, mess)
VALUES (:nom, :mdp, 100, 100, 200, 0, 1, 1, 1, 1)";
$statement2 = $connexion->prepare($sql2);
$statement2->bindParam(':nom', $nom, PDO::PARAM_STR);
$statement2->bindParam(':mdp', $password_hashed, PDO::PARAM_STR);
$statement2->execute();
$sql = "SELECT * from users where pseudo = '$nom'";
$statement = $connexion->prepare($sql);
$statement->execute();
$results = $statement->fetchAll(PDO::FETCH_ASSOC);
foreach ($results as $row) {
$id = $row['id_user'];
}
$sql = "INSERT INTO `inv`(`id_user`, `nom`, `quantite`) VALUES ('$id','fishing_road','1')";
$statement = $connexion->prepare($sql);
$statement->execute();
$sql = "INSERT INTO `inv`(`id_user`, `nom`, `quantite`) VALUES ('$id','lettre','1')";
$statement = $connexion->prepare($sql);
$statement->execute();
$_SESSION['login'] = $nom;
header("Location: cursedV3.php");
exit();
}
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CURSED</title>
<link rel="icon" type="image/png" href="images/coin2.png">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Pixelify+Sans:wght@400..700&display=swap" rel="stylesheet">
<style>
body{
width:100%;
height:100vh;
background:url('images/texture.png');
background-size:cover;
margin:0;
padding:0;
font-family: "Pixelify Sans", serif;
font-optical-sizing: auto;
font-weight: <weight>;
font-style: normal;
position:fixed;
display:flex;
justify-content:center;
align-items:center;
}
#canvas{
width:100%;
height:100%;
min-width:1200px;
background-image:url('images/skyV2.png');
background-size:cover;
background-position:center;
image-rendering: pixelated;
overflow:hidden;
position:relative;
}
#eau{
position:absolute;
left:0;
width:100%;
z-index:2;
bottom:0px;
}
#radeau{
width:25%;
height:auto;
position:absolute;
bottom:17%;
z-index:4;
left:65%;
}
#error_message{
display:none;
}
#error_mess{
display:none;
}
@media screen and (max-width: 1100px) {
#responsive{
width:100%;
height:100%;
z-index:999;
backdrop-filter: blur(3px);
background: rgba(255, 255, 255, 0.2);
position:absolute;
display:flex;
justify-content:center;
align-items:center;
}
#error_message{
display:block;
background:red;
margin:30px;
text-align:center;
height:30%;
display:flex;
flex-wrap:wrap;
justify-content:center;
align-items:center;
background:url('images/bg.png');
background-size: 100% 100%;
background-repeat: no-repeat; /* Pour éviter la répétition */
background-position: center;
padding:10px;
color:#543626;
position:relative;
}
#error_mess{
display:block;
position:absolute;
z-index:1000;
top:-10px;
right:-10px;
width:50Px;
}
body{
position:fixed;
}
}
#contain{
position:absolute;
width:auto;
left:30%;
top:43%;
transform:translate(-50%,-50%);
z-index:10;
display:flex;
justify-content:center;
flex-wrap:wrap;
align-items:start;
}
#logo{
width:300px;
height:130px;
position:relative;
right:40px;
}
#contain2{
width:100%;
}
#infos{
margin-top:20px;
display:flex;
justify-content:space-around;
align-items:center;
color:#543626;
text-decoration:underline;
}
#infos h1{
cursor:pointer;
}
form{
width:70%;
margin:auto;
margin-top:20px;
}
form div{
display:flex;
align-items:center;
justify-content:space-between;
color:#543626;
}
#send{
position:relative;
left:30%;
transform:translate(-50%);
background:url('images/bg.png');
background-size: 100% 100%;
background-repeat: no-repeat; /* Pour éviter la répétition */
background-position: center;
border:none;
padding:10px 15px 10px 15px;
font-size:1.4rem;
font-family: "Pixelify Sans", serif;
font-optical-sizing: auto;
font-weight: bold;
font-style: normal;
color:#543626;
margin-top:20px;
cursor:pointer;
}
#send2{
position:relative;
left:40%;
transform:translate(-50%);
background:url('images/bg.png');
background-size: 100% 100%;
background-repeat: no-repeat; /* Pour éviter la répétition */
background-position: center;
border:none;
padding:10px 15px 10px 15px;
font-size:1.4rem;
font-family: "Pixelify Sans", serif;
font-optical-sizing: auto;
font-weight: bold;
font-style: normal;
color:#543626;
margin-top:20px;
cursor:pointer;
}
form input{
all:initial;
font-family: "Pixelify Sans", serif;
font-optical-sizing: auto;
font-weight: bold;
font-style: normal;
color:#543626;
}
#error{
text-align:center;
color:#543626;
font-weight: bold;
margin-top:40px;
position:absolute;
left:36%;
transform:(-50%);
}
#description{
color:#543626;
width:600px;
text-align:center;
font-size:1.2rem;
font-weight:600;
}
#clouds{
width:100%;
position:absolute;
top:-50px;
}
#clouds2{
width:100%;
top:-50px;
left:100%;
position:absolute;
}
</style>
<body>
<div id='responsive'>
<div id='error_message'>
<h2>Désolé... Le jeu n’est encore pas disponible pour votre format d’écran. </h2>
<h2>Il est recommandé de jouer sur un ordinateur, </h2>
<img id='error_mess' src='images/error.png'>
</div>
</div>
<div id='canvas'>
<img id='eau' src='../aie/Untitled00086401.png'>
<img src='images/clouds3.png' id='clouds'>
<img src='images/clouds3.png' id='clouds2'>
<img id='radeau' class='boat' src='images/b.png'>
<div id='contain'>
<img id='logo' src='images/logo2.png'>
<div id='contain2'>
<form method='POST' action='first.php'>
<h3 id='description'>Ce jeu est un dispositif intéractif vous permettant de découvrir mon univers. Une histoire principale guidera l'aventure des plus curieux, mais, libre à vous d'explorer les différentes fonctionnalitées du jeu à votre guise.</h3>
<div>
<h2>Pseudo :</h2>
<input type='text' name='nom' maxlength="10" placeholder='..............................' required>
</div>
<div>
<h2>Mot de passe :</h2>
<input type='PASSWORD' name='mdp' maxlength="10" placeholder='..............................' required>
</div>
<input id='send' type='submit' value='Connexion' name='connexion'>
<input id='send2' type='submit' value='Inscription' name='inscription'>
</form>
<p id="error">
<?php
if (!empty($error_message)) {
echo htmlspecialchars($error_message);
}
?>
</p>
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.4.1.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
<script>
setInterval(function(){
var screenWidth = window.innerWidth;
var leftValue_bg = parseFloat($('#clouds').css('left')) / screenWidth * 100;
var nouvelleValeurbg = leftValue_bg - (1 / screenWidth * 100);
var leftValue_bg2 = parseFloat($('#clouds2').css('left')) / screenWidth * 100;
var nouvelleValeurbg2 = leftValue_bg2 - (1 / screenWidth * 100);
if (nouvelleValeurbg < -100) { // Ajuste selon la largeur relative
nouvelleValeurbg = 100;
}
if (nouvelleValeurbg2 < -100) {
nouvelleValeurbg2 = 100;
}
console.log(nouvelleValeurbg)
$('#clouds').css('left', nouvelleValeurbg + '%');
$('#clouds2').css('left', nouvelleValeurbg2 + '%');
}, 40);
//EAU
var eau_src = $('#eau').attr('src');
var eau_index = parseInt(eau_src.match(/\d+/)[0]);
setInterval(function(){
eau_index++;
var eau_src2 = "../aie/Untitled000" + eau_index + ".png";
$('#eau').attr('src',eau_src2);
if(eau_index>86574){
eau_index=86402;
}
},40)
//dérive du bateau
var boat = document.querySelectorAll('.boat');
var derive = 0;
setInterval(function(){
boat.forEach(index =>{
var leftValue = parseFloat(window.getComputedStyle(index).left)
var nouvelleValeur3 = 0;
if(derive<34){
nouvelleValeur3 = leftValue + 1;
}else{
nouvelleValeur3 = leftValue - 1;
}
index.style.left = nouvelleValeur3 + 'px';
})
derive++;
if(derive>100){
derive=0;
}
},40)
</script>
</body>
</html>