57 lines
1.9 KiB
PHP
57 lines
1.9 KiB
PHP
|
|
<?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","");
|
||
|
|
define ('DB',mysql_connect("localhost","poker","JuzFQK6rnNfx75v8"));
|
||
|
|
mysql_select_db("poker",DB);
|
||
|
|
include("globals.php");
|
||
|
|
include("functions.php");
|
||
|
|
|
||
|
|
//User Login
|
||
|
|
if (!session_start()) $ERROR.="Server Session kann nicht eingerichtet werden, kein login möglich!<br>";
|
||
|
|
if (TO_DO=="login") {
|
||
|
|
$login=$_POST['login'];
|
||
|
|
$password=md5($_POST['password']);
|
||
|
|
$query=mysql_query("SELECT `password` FROM `player` WHERE `alias` = '$login' AND `password` IS NOT NULL LIMIT 0 , 30",DB);
|
||
|
|
$data=mysql_fetch_array($query);
|
||
|
|
if ($data['password']==$password) {
|
||
|
|
$_SESSION['login']=$login;
|
||
|
|
}
|
||
|
|
else $ERROR.="Login nicht erfolgreich!<br>";
|
||
|
|
}
|
||
|
|
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')." ".LOGIN." ";
|
||
|
|
$BODY.='<a class="list" href="index.php?page=edit_game&to_do=new_game">'.add_icon("new_game").'Neues Spiel</a>';
|
||
|
|
$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
|
||
|
|
mysql_close(DB);
|
||
|
|
?>
|