poker/index.php

57 lines
2.1 KiB
PHP
Raw Normal View History

2017-10-31 19:16:46 +01:00
<?php
//show all errors
error_reporting (E_ALL);
ini_set("display_errors","TRUE");
//standart includes, vars and constants
$page="";
if (isset($_GET['page'])) $page=$_GET['page'];
$BODY = ""; //the page content
$ERROR = ""; //error messages
$COMMENT = ""; //comments
if (isset($_GET['to_do'])) define ("TO_DO",$_GET['to_do']);
else define ("TO_DO","");
2025-10-03 17:19:35 +02:00
$db = mysqli_connect("localhost","poker","*******", "poker");
2017-10-31 19:16:46 +01:00
include("globals.php");
include("functions.php");
//User Login
if (!session_start()) $ERROR.="Server Session kann nicht eingerichtet werden, kein login m&ouml;glich!<br>";
if (TO_DO=="login") {
$login=$_POST['login'];
2025-10-03 17:19:35 +02:00
$query=mysqli_query($db, "SELECT `password` FROM `player` WHERE `alias` = '$login' AND `password` IS NOT NULL LIMIT 0 , 30");
$data=mysqli_fetch_array($query);
if ($data!==NULL && $data!==False && password_verify($_POST['password'], $data['password'])) {
2017-10-31 19:16:46 +01:00
$_SESSION['login']=$login;
2025-10-03 17:19:35 +02:00
} else {
$ERROR.="Login nicht erfolgreich!<br>";
2017-10-31 19:16:46 +01:00
}
}
if ($page=="logout") {
$_SESSION['login']="";
$page="";
}
if (isset($_SESSION['login'])) define ("LOGIN",$_SESSION['login']);
else define ("LOGIN","");
if (LOGIN!="") {
$BODY.='<table class="list" width="100%"><tr><th style="text-align:left">'.add_icon('user')."&nbsp;&nbsp;".LOGIN."&nbsp;&nbsp;&nbsp;&nbsp;";
2025-10-03 17:19:35 +02:00
$BODY.='<a class="list" href="index.php?page=edit_game&to_do=new_game">'.add_icon("new_game").'Neues Spiel</a>&nbsp;&nbsp;&nbsp;&nbsp;';
$BODY.='<a class="list" href="index.php?page=rank&to_do=update_rank">'.add_icon("arrow_out").'Rangliste Aktualisieren</a>&nbsp;&nbsp;&nbsp;&nbsp;';
2017-10-31 19:16:46 +01:00
$BODY.="</th></tr></table>";
}
$BODY.="<br><br>";
//include the requestet page
if ($page=="login") include ("login.php");
elseif ($page=="rank" ) include ("rank.php" );
elseif ($page=="games" ) include ("games.php" );
elseif ($page=="edit_game" ) include ("edit_game.php" );
elseif ($page=="poker_pott") include("poker_pott.php");
else include ("main.php");
//include the Template
include ("template.php");
//End of Script
2025-10-03 17:19:35 +02:00
mysqli_close($db);
2017-10-31 19:16:46 +01:00
?>