Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class Register
- {
- private $dob = null,
- $gender = 'male',
- $username = 'Guest',
- $password = null,
- $email = null,
- $secCode = null,
- $minAge = 11,
- $maxAge = 100;
- private $step = 1,
- $errorMessage = null,
- $currentPage = null,
- $bgClass = null;
- public function __construct()
- {
- $this->currentPage = $_GET['page'];
- $this->_setData();
- $this->_findValidPage();
- }
- private function _setData()
- {
- if( $_SESSION )
- {
- foreach( $_SESSION as $key => $value )
- {
- $key = str_replace('bean_', '', $key);
- $this->$key = $value;
- }
- }
- }
- private function _findValidPage( )
- {
- switch( $this->grabSession('step') )
- {
- default:
- $this->setSession('step', 1);
- $this->redirect();
- break;
- case 1:
- if( $this->currentPage != 'start' )
- {
- if( !$this->grabData('dob') || $this->grabData('bean_gender') )
- {
- $this->redirect();
- }
- }
- $this->grabData('bgClass', 'background-agegate');
- $this->grabData('template', 'start');
- break;
- case 2:
- if( $this->currentPage != 'email_password' )
- {
- if( !$this->grabData('email') || !$this->grabData('password') )
- {
- $this->redirect('email_password');
- }
- }
- $this->grabData('bgClass', 'background-accountdetails-'.$this->grabData('gender') );
- break;
- }
- }
- private function redirect( $pageName = 'start' )
- {
- header('Location: /quickregister/' . $pageName );
- }
- public function grabSession( $key )
- {
- return ($_SESSION[$key] ? $_SESSION[$key] : false);
- }
- public function setSession( $key, $value = '' )
- {
- $_SESSION[$key] = $value;
- }
- public function grabData( $key, $value = '' )
- {
- if( $value )
- {
- $this->$key = $value;
- return $value;
- }
- else
- {
- return $this->$key ? $this->$key : false;
- }
- }
- }
Add Comment
Please, Sign In to add comment