GitList
Repositories
Help
Report an Issue
blackjack
Code
Commits
Branches
Tags
Search
Tree:
d7b0224
Branches
Tags
master
blackjack
UI
name.php
initial commit
Dev Ghai
commited
d7b0224
at 2014-04-17 16:55:27
name.php
Blame
History
Raw
<?php namespace Blackjack\UI; require_once '../Config/Config.php'; require_once '../Objects/Player.php'; use Blackjack\Objects\Player as Player; use Blackjack\Config\Config as Config; $errorString=''; if(array_key_exists('btnSave', $_REQUEST)) { $config = new Config(); $name = trim(urldecode($_REQUEST['playerName'])); $nameLength = strlen($name); if($nameLength > $config->maxNameLength || $nameLength == 0) { $errorString = "Please enter a name that is max ".$config->maxNameLength." characters long."; } else { session_start(); session_regenerate_id(true); $_SESSION['player'] = new Player($config, $name); header('Location: table.php'); exit(); } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <title>Blackjack | Get Name</title> <link type="text/css" rel="stylesheet" href="style/bjstyles.css"></link> </head> <body class="themeBasic"> <form action="name.php"> <p>Please enter your name here:</p> <input type='text' name='playerName' id='playerName' value='' maxlength="15" /> <input type='submit' name='btnSave' id='btnSave' value='Save' /> <p class="error"> <?php echo $errorString; ?> </p> </form> </body> </html>