commit c2c1ee7b9bf84286f6ecefea8f4dbaf35c3eeff3 Author: Hausmeister Date: Tue Oct 31 19:16:46 2017 +0100 saving php5 version diff --git a/design/holz_bg.jpg b/design/holz_bg.jpg new file mode 100755 index 0000000..3b33d71 Binary files /dev/null and b/design/holz_bg.jpg differ diff --git a/design/holz_bg.psd b/design/holz_bg.psd new file mode 100755 index 0000000..cc417b9 Binary files /dev/null and b/design/holz_bg.psd differ diff --git a/design/karten.psd b/design/karten.psd new file mode 100755 index 0000000..9ebe273 Binary files /dev/null and b/design/karten.psd differ diff --git a/design/logo.png b/design/logo.png new file mode 100755 index 0000000..298750c Binary files /dev/null and b/design/logo.png differ diff --git a/design/logo.psd b/design/logo.psd new file mode 100755 index 0000000..6d74bb9 Binary files /dev/null and b/design/logo.psd differ diff --git a/design/main_menu.psd b/design/main_menu.psd new file mode 100755 index 0000000..704ad26 Binary files /dev/null and b/design/main_menu.psd differ diff --git a/design/the_ring.psd b/design/the_ring.psd new file mode 100755 index 0000000..772e6b4 Binary files /dev/null and b/design/the_ring.psd differ diff --git a/edit_game.php b/edit_game.php new file mode 100755 index 0000000..bd1a6f3 --- /dev/null +++ b/edit_game.php @@ -0,0 +1,102 @@ +"; + } + } + + if ($EDIT_ID) { + $query=mysql_query("SELECT * FROM `games` WHERE `id` = $EDIT_ID LIMIT 0 , 1",DB); + $data =mysql_fetch_array($query); + $BODY.='
'; + $BODY.=''; + $BODY.=''; + $BODY.=''; + $BODY.=''; + $BODY.=''; + $BODY.=''; + $BODY.=''; + $BODY.=''; + $BODY.=''; + $BODY.=''; + $BODY.=''; + $BODY.=''; + $BODY.=''; + $BODY.=''; + $BODY.=''; + $BODY.=''; + $BODY.=''; + + $BODY.='
Location:
Datum/Zeit:
Spieler:'; + $BODY.='
Rangspiel:
Einsatz:
 1. Platz2. Platz3. Platz
Spieler:
Preisgeld:
Speichern:
'; + } +} +else { + $ERROR.="Sie müssen sich einloggen!
"; +} +?> diff --git a/functions.php b/functions.php new file mode 100755 index 0000000..28bec19 --- /dev/null +++ b/functions.php @@ -0,0 +1,168 @@ +"; +} + +function print_percent ($percent) { + while (strlen($percent)<2) $percent="0".$percent; + $return=($percent) ? substr($percent,0,strlen($percent)-1).",".substr($percent,strlen($percent)-1,1)."%" : "0€"; + return ($return); +} + +function print_bill ($bill) { + while (strlen($bill)<3) $bill="0".$bill; + $return=($bill) ? substr($bill,0,strlen($bill)-2).",".substr($bill,strlen($bill)-2,2)."€" : "0€"; + return ($return); +} + +function money_to_bill($money) { + $money=str_replace("€","",$money); + $money=str_replace(",",".",$money); + return ($money*100); +} + +function user_id_to_alias($id) { + $query=mysql_query("SELECT * FROM `player` WHERE `id` = $id LIMIT 0 , 30",DB); + $data=mysql_fetch_array($query); + return ($data['alias']); +} + +function count_games () { + $query=mysql_query("SELECT `id` FROM `games` WHERE `scoregame` = 'TRUE'",DB); + return (mysql_num_rows($query)); +} + +function user_count_last_missed_games($id) +{ + $games = 0; + $query = mysql_query("SELECT `id` FROM `games` WHERE `scoregame` = 'TRUE' ORDER BY `datetime` DESC",DB); + while ($data=mysql_fetch_array($query)) { + $player_array = array(); + $player_array = player_of_game($data['id']); + $deposition=0; + foreach ($player_array as $player) + if ($player==$id) $deposition++; + if (!$deposition) $games++; + else break; + } + return ($games); +} + +function user_count_games($id) { //counts the games wich are played by the user $id + $games = 0; + $query = mysql_query("SELECT `id` FROM `games`",DB); + while ($data=mysql_fetch_array($query)) { + $player_array = array(); + $player_array = player_of_game($data['id']); + $deposition = 0; + foreach ($player_array as $player) + if ($player==$id) $deposition++; + if ($deposition) $games++; + } + return ($games); +} + +function user_count_point_games($id) { //counts the games wich are played by the user $id + $games = 0; + $query = mysql_query("SELECT `id` FROM `games` WHERE `scoregame` = 'TRUE'",DB); + while ($data=mysql_fetch_array($query)) { + $player_array = array(); + $player_array = player_of_game($data['id']); + $deposition = 0; + foreach ($player_array as $player) + if ($player==$id) $deposition++; + if ($deposition) $games++; + } + return ($games); +} + +function user_count_place($id,$place) { //counts how often a user ($id) has made the place ($place) + $games = 0; + $query = mysql_query("SELECT `".$place."_id` FROM `games` WHERE `scoregame` = 'TRUE'",DB); + while ($data=mysql_fetch_row($query)) { + if ($data[0]==$id) $games++; + } + return ($games); +} + +function user_min_bill() { + $minbill=0; + $query=mysql_query("SELECT `id` FROM `player`",DB); + while ($data=mysql_fetch_row($query)){ + $helpvar=user_count_bill($data[0]); + if ($helpvar<$minbill) $minbill=$helpvar; + } + return ($minbill); +} + +function user_max_bill() { + $maxbill=0; + $query=mysql_query("SELECT `id` FROM `player`",DB); + while ($data=mysql_fetch_row($query)){ + $helpvar=user_count_bill($data[0]); + if ($helpvar>$maxbill) $maxbill=$helpvar; + } + return ($maxbill); +} + +function user_count_bill($id) { + $bill=0; + $query=mysql_query("SELECT * FROM `games` WHERE `scoregame` = 'TRUE'",DB); + while ($data=mysql_fetch_array($query)) { + $playerlist=player_of_game($data['id']); + foreach ($playerlist as $player) { + if ($player==$id) $bill-=$data['base_bill']; + } + if ($data['first_id']==$id) $bill+=$data['first_bill']; + if ($data['second_id']==$id) $bill+=$data['second_bill']; + if ($data['third_id']==$id) $bill+=$data['third_bill']; + } + return ($bill); +} + +function player_of_game($game_id) { + $player_array=array(); + + $query =mysql_query("SELECT `player` FROM `games` WHERE `id` = $game_id",DB); + $data =mysql_fetch_array($query); + $player=$data['player']; + + while (strlen($player)>0) { + while (substr($player,0,1)==",") $player=substr($player,1,strlen($player)-1); //delete leading commata + $position=0; + $deposition=""; + for ($position=0;substr($player,$position,1)!="," && $position0) ? substr($player,$position,strlen($player)-$position):""; + } + return ($player_array); +} + +function gibmirzeit_von_datetime($format,$datetime) { + $yyyy= substr($datetime,0,4); + $yy = substr($datetime,2,2); + $mm = substr($datetime,5,2); + $dd = substr($datetime,8,2); + $HH = substr($datetime,11,2); + $MM = substr($datetime,14,2); + $SS = substr($datetime,17,2); + + $format=str_replace("yyyy",$yyyy,$format); + $format=str_replace("jjjj",$yyyy,$format); + $format=str_replace("yy" ,$yy ,$format); + $format=str_replace("jj" ,$yy ,$format); + $format=str_replace("mm" ,$mm ,$format); + $format=str_replace("dd" ,$dd ,$format); + $format=str_replace("tt" ,$dd ,$format); + $format=str_replace("HH" ,$HH ,$format); + $format=str_replace("MM" ,$MM ,$format); + $format=str_replace("SS" ,$SS ,$format); + + return ($format); +} +?> diff --git a/games.php b/games.php new file mode 100755 index 0000000..dc365a1 --- /dev/null +++ b/games.php @@ -0,0 +1,48 @@ +'; + if ($expand_view) + $BODY.=''.add_icon("arrow_in").''; + else + $BODY.=''.add_icon("arrow_out").''; +$BODY.=' Datum, Zeit + Spielerzahl + Rangspiel + Sieger + Zweiter + Dritter + '; + +$query=mysql_query("SELECT * FROM `games` ORDER BY `datetime` ASC",DB); +while ($data=mysql_fetch_array($query)) { + $id=$data['id']; + $BODY.=""; + if (LOGIN!="") + $BODY.="".add_icon("pencil").""; + $BODY.=""; + $BODY.="".gibmirzeit_von_datetime(DATETIMEFORMAT,$data['datetime'])."\n"; + $BODY.="".count(player_of_game($id))."\n"; + $BODY.="".(($data['scoregame']=="TRUE") ? add_icon("accept"):"")."\n"; + $BODY.="".user_id_to_alias($data['first_id']).(($expand_view)? "(".print_bill($data['first_bill']).")":"")."\n"; + $BODY.="".user_id_to_alias($data['second_id']).(($expand_view)? "(".print_bill($data['second_bill']).")":"")."\n"; + $BODY.="".user_id_to_alias($data['third_id']).(($expand_view)? "(".print_bill($data['third_bill']).")":"")."\n"; + $BODY.=""; + if ($expand_view) { + $BODY.=""; + $BODY.="".htmlentities(nl2br($data['location']))."\n"; + $BODY.="Spieler: "; + $player_array=player_of_game($id); + $i=0; + for ($i=0;$i"; + $BODY.=" "; + } +} +$BODY.=' '; +?> diff --git a/globals.php b/globals.php new file mode 100755 index 0000000..45f81b6 --- /dev/null +++ b/globals.php @@ -0,0 +1,34 @@ + diff --git a/icons/accept.png b/icons/accept.png new file mode 100755 index 0000000..b9e2389 Binary files /dev/null and b/icons/accept.png differ diff --git a/icons/add.png b/icons/add.png new file mode 100755 index 0000000..61d2595 Binary files /dev/null and b/icons/add.png differ diff --git a/icons/arrow_in.png b/icons/arrow_in.png new file mode 100755 index 0000000..f774b67 Binary files /dev/null and b/icons/arrow_in.png differ diff --git a/icons/arrow_out.png b/icons/arrow_out.png new file mode 100755 index 0000000..bc30caa Binary files /dev/null and b/icons/arrow_out.png differ diff --git a/icons/asc.png b/icons/asc.png new file mode 100755 index 0000000..587f62d Binary files /dev/null and b/icons/asc.png differ diff --git a/icons/desc.png b/icons/desc.png new file mode 100755 index 0000000..96452b0 Binary files /dev/null and b/icons/desc.png differ diff --git a/icons/disk.png b/icons/disk.png new file mode 100755 index 0000000..378f449 Binary files /dev/null and b/icons/disk.png differ diff --git a/icons/new_game.png b/icons/new_game.png new file mode 100755 index 0000000..38ad812 Binary files /dev/null and b/icons/new_game.png differ diff --git a/icons/pencil.png b/icons/pencil.png new file mode 100755 index 0000000..407a627 Binary files /dev/null and b/icons/pencil.png differ diff --git a/icons/user.png b/icons/user.png new file mode 100755 index 0000000..c4b84e2 Binary files /dev/null and b/icons/user.png differ diff --git a/images/holz_bg.jpg b/images/holz_bg.jpg new file mode 100755 index 0000000..3b33d71 Binary files /dev/null and b/images/holz_bg.jpg differ diff --git a/images/main_menu_log_left.png b/images/main_menu_log_left.png new file mode 100755 index 0000000..56ddb9d Binary files /dev/null and b/images/main_menu_log_left.png differ diff --git a/images/main_menu_log_mid_in.png b/images/main_menu_log_mid_in.png new file mode 100755 index 0000000..6e53e35 Binary files /dev/null and b/images/main_menu_log_mid_in.png differ diff --git a/images/main_menu_log_mid_in_hover.png b/images/main_menu_log_mid_in_hover.png new file mode 100755 index 0000000..fe46007 Binary files /dev/null and b/images/main_menu_log_mid_in_hover.png differ diff --git a/images/main_menu_log_mid_out.png b/images/main_menu_log_mid_out.png new file mode 100755 index 0000000..05723b9 Binary files /dev/null and b/images/main_menu_log_mid_out.png differ diff --git a/images/main_menu_log_mid_out_hover.png b/images/main_menu_log_mid_out_hover.png new file mode 100755 index 0000000..389680a Binary files /dev/null and b/images/main_menu_log_mid_out_hover.png differ diff --git a/images/main_menu_log_right.png b/images/main_menu_log_right.png new file mode 100755 index 0000000..4cbfe56 Binary files /dev/null and b/images/main_menu_log_right.png differ diff --git a/images/main_menu_rl_left.png b/images/main_menu_rl_left.png new file mode 100755 index 0000000..f18fe06 Binary files /dev/null and b/images/main_menu_rl_left.png differ diff --git a/images/main_menu_rl_mid.png b/images/main_menu_rl_mid.png new file mode 100755 index 0000000..ee2d2d5 Binary files /dev/null and b/images/main_menu_rl_mid.png differ diff --git a/images/main_menu_rl_mid_hover.png b/images/main_menu_rl_mid_hover.png new file mode 100755 index 0000000..b9f2956 Binary files /dev/null and b/images/main_menu_rl_mid_hover.png differ diff --git a/images/main_menu_rl_right.png b/images/main_menu_rl_right.png new file mode 100755 index 0000000..7349e9b Binary files /dev/null and b/images/main_menu_rl_right.png differ diff --git a/images/main_menu_sl_left.png b/images/main_menu_sl_left.png new file mode 100755 index 0000000..3b6d8ca Binary files /dev/null and b/images/main_menu_sl_left.png differ diff --git a/images/main_menu_sl_mid.png b/images/main_menu_sl_mid.png new file mode 100755 index 0000000..10965ef Binary files /dev/null and b/images/main_menu_sl_mid.png differ diff --git a/images/main_menu_sl_mid_hover.png b/images/main_menu_sl_mid_hover.png new file mode 100755 index 0000000..d2d8150 Binary files /dev/null and b/images/main_menu_sl_mid_hover.png differ diff --git a/images/main_menu_sl_right.png b/images/main_menu_sl_right.png new file mode 100755 index 0000000..f71d2ab Binary files /dev/null and b/images/main_menu_sl_right.png differ diff --git a/images/main_menu_top.png b/images/main_menu_top.png new file mode 100755 index 0000000..67a0b5a Binary files /dev/null and b/images/main_menu_top.png differ diff --git a/images/the_ring.png b/images/the_ring.png new file mode 100755 index 0000000..8fa0160 Binary files /dev/null and b/images/the_ring.png differ diff --git a/index.php b/index.php new file mode 100755 index 0000000..0776f36 --- /dev/null +++ b/index.php @@ -0,0 +1,57 @@ +"; + 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!
"; + } + if ($page=="logout") { + $_SESSION['login']=""; + $page=""; + } + if (isset($_SESSION['login'])) define ("LOGIN",$_SESSION['login']); + else define ("LOGIN",""); + if (LOGIN!="") { + $BODY.='
'.add_icon('user')."  ".LOGIN."    "; + $BODY.=''.add_icon("new_game").'Neues Spiel'; + $BODY.="
"; + } + $BODY.="

"; + +//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); +?> diff --git a/index.php~ b/index.php~ new file mode 100755 index 0000000..ad8affd --- /dev/null +++ b/index.php~ @@ -0,0 +1,21 @@ + diff --git a/login.php b/login.php new file mode 100755 index 0000000..89b4dd4 --- /dev/null +++ b/login.php @@ -0,0 +1,11 @@ +



+
+
+
+ +
+ + '; +?> diff --git a/main.php b/main.php new file mode 100755 index 0000000..2cce316 --- /dev/null +++ b/main.php @@ -0,0 +1,16 @@ +
+ + + +
+ + + aktueller Ringträger ist:
+
'.user_id_to_alias($data['first_id']).' +
'; +$BODY.="

"; +$BODY.='Tabelle zur Aufteilung des Pott (Gewinnausschüttung)'; +?> diff --git a/poker_pott.php b/poker_pott.php new file mode 100755 index 0000000..4e28892 --- /dev/null +++ b/poker_pott.php @@ -0,0 +1,88 @@ +=($FMTS*$b)) && ($b>=$SMTT*$c) )) + { + //transport from c to b + if ($b<($SMTT*$c) && $c>0) + { + $b++; + $c--; + } + //transport from b to a + if ($a<($FMTS*$b) && $b>0) + { + $a++; + $b--; + } + } + $RetVal=array(); + $RetVal[0]=0; //empty + $RetVal[1]=$a; //1st place + $RetVal[2]=$b; //2nd place + $RetVal[3]=$c; //3th place + return $RetVal; +} +$BODY.='
'; +$BODY.=''; +$BODY.='Einsatz: '; +$BODY.='
"; + +$BODY.='Erster bekommt mindestens '; +$BODY.='mehr als der Zweite
"; + +$BODY.='Zweiter bekommt mindestens '; +$BODY.='mehr als der Dritte
"; + +$BODY.=''; + +$BODY.='
'; + +$BODY.= ""; +$BODY.= ""; +$BODY.= ""; +$BODY.= ""; +$BODY.= ""; +$BODY.= ""; +$BODY.= ""; +$BODY.= ""; +for ($i=4; $i<=20; $i++) +{ + $Ret = GetDotByPott($Stake*$i); + $BODY.= ""; + $BODY.= ""; + $BODY.= ""; + $BODY.= ""; + $BODY.= ""; + $BODY.= ""; + $BODY.= ""; +} +$BODY.= "
SpielerPott1.Platz2.Platz3.Platz
".$i."".($i*$Stake)."€".$Ret[1]."€".$Ret[2]."€".$Ret[3]."€
"; +?> diff --git a/rank.php b/rank.php new file mode 100755 index 0000000..9162db5 --- /dev/null +++ b/rank.php @@ -0,0 +1,125 @@ +"; + if (!$failure) { + $query=mysql_query("SELECT `alias` FROM `player` WHERE `alias` = '$alias' LIMIT 0 , 30",DB); + $data=mysql_fetch_array($query); + if ($data['alias']==$alias) $failure.="Spitzname existiert bereits!
"; + } + if (!$failure) { + mysql_query("INSERT INTO `player` ( `alias` ) VALUES ( '$alias' );",DB); + } + else { + $value_ip_alias = $alias; + } + $ERROR.=$failure; +} + +if (TO_DO=="save_edit_player" && LOGIN!="" && ($player=$_GET['player'])) { + $failure=""; + if (!($alias=$_POST['alias'])) $failure.="Spitznamen angeben!
"; + if (!$failure) { + $query=mysql_query("SELECT `id`,`alias` FROM `player` WHERE `alias` = '$alias' LIMIT 0 , 30",DB); + while ($data=mysql_fetch_array($query)) + if ($data['id']!=$player) $failure.="Spitzname existiert bereits!
"; + } + if (!$failure) { + mysql_query("UPDATE `player` SET `alias` = '$alias' WHERE `id` = '$player' LIMIT 1 ;",DB); + } + $ERROR.=$failure; +} + +$BODY.=' + + + + + + + + + + + + + '; + +$query=mysql_query("SELECT * FROM `player` $SORTSTRING",DB); +while ($data=mysql_fetch_array($query)) { + $id = $data['id']; + $alias = $data['alias']; + if (TO_DO=="edit_player" && LOGIN!="" && $_GET['player']==$alias) { + $BODY.=""; + $BODY.=""; + $BODY.="\n"; + $BODY.="\n"; + $BODY.=""; + } + else { + $BODY.=""; + $BODY.=""; + $BODY.=""; + $BODY.=""; + $BODY.=""; + $BODY.=""; + $rate=$data['rate']; + $BODY.=""; + $BODY.=""; + $BODY.=""; + $BODY.="\n"; + } +} + +if (LOGIN!="") { + $BODY.=' + + + + + + + + '; +} + +$BODY.='
 '.(($SORTBY=="alias") ? add_icon($SORTORDER):"").'Spitzname'.(($SORTBY=="cnt_games") ? add_icon($SORTORDER):"").'Spiele'.(($SORTBY=="cnt_first") ? add_icon($SORTORDER):"").'#1'.(($SORTBY=="cnt_second") ? add_icon($SORTORDER):"").'#2'.(($SORTBY=="cnt_third") ? add_icon($SORTORDER):"").'#3'.(($SORTBY=="points") ? add_icon($SORTORDER):"").'Punkte'.(($SORTBY=="rate") ? add_icon($SORTORDER):"").'Quote'.(($SORTBY=="bill") ? add_icon($SORTORDER):"").'Umsatz'.(($SORTBY=="rank") ? add_icon($SORTORDER):"").'Rang
"; + if (LOGIN!="") + $BODY.="".add_icon("pencil").""; + $BODY.="$alias".$data['cnt_games']."".$data['cnt_first']."".$data['cnt_second']."".$data['cnt_third']."".$data['points']."".print_percent($data['rate'])."".print_bill($data['bill'])."".$data['rank']."
'.add_icon("add").'
'; + +$COMMENT.=' + Punkte Für jeden Sieg gibt es drei Punkte, für jeden zweiten Platz zwei Punkte und für jeden dritten Platz einen Punkt.
+ Quote: Die Punktequote, wie oft man pro Spiel einen Punkt erreicht. 100% geben an, dass man jedes teilgenomme Spiel einen Punkt gemacht hat. (maximal 300%, wenn man alle Spiele gewonnen hat)
+ Rang: Er ist abhängig von der Quote, dem Umsatz und der Teilnahmehäufigkeit an Rangspielen. Maximal kann ein Rang von 10000 erreicht werden. + '; +?> diff --git a/style.css b/style.css new file mode 100755 index 0000000..c3c0b45 --- /dev/null +++ b/style.css @@ -0,0 +1,90 @@ +body { + color:#fff; + font-weight:bold; +} + +.list { + color:#ffffff; + font-family:verdana; + font-size:10pt; + font-weight:normal; +} +table.list { + border-spacing:0px; +} +table.list td { + text-align:center; +} +table.list th{ + padding-left:3px; + padding-right:3px; + font-weight:bold; + border-bottom-color:#ffffff; + border-bottom-width:1px; + border-bottom-style:solid; + text-align:center; + vertical-align:middle; +} +.list a { + padding-left:3px; + padding-right:3px; + color:#ffffff; + font-weight:bold; + text-decoration:none; +} +.list a:hover { + text-decoration:underline; +} + +a { + color:#fff; + font-weight:bold; + text-decoration:none; +} + +a:hover { + text-decoration:underline; +} + +table.the_ring { + text-align:center; + font-family:verdana; + color:#ffffff; + font-size:16pt; + font-weight:bold; +} +table.the_ring th { + text-decoration:underline; +} + +input { + color:#000000; + background-color:#ffffff; + border-color:#000000; + border-width:1px; + border-style:solid; + text-align:center; +} + +.submit_save { + background-image:url(./icons/disk.png); + background-color:transparent; + display:block; + border-width:0px; + width:16px; + height:16px; +} + +.errormessage { + color:#ff0000; + background-color:#eeeeee; + font-weight:bold; +} + +.comment { + color:#ffffff; + font-size:8pt; + font-family:verdana; + font-weight:normal; + font-style:italic; +} diff --git a/template.php b/template.php new file mode 100755 index 0000000..a979bb3 --- /dev/null +++ b/template.php @@ -0,0 +1,57 @@ + + + Plessa Poker + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + +


+ + + +