<?php 

require_once('scripts/sb_functions.php');

$ENABLE_USER_SIGNUP = true;

global $logged_in;
if ($ENABLE_USER_SIGNUP){
  $logged_in = logged_in( false, true );
} 
else{
  $logged_in = logged_in( true, true );
}

if ( !session_id() ) {
  session_start();
}

read_config();	
sb_language( 'signup' );

html_header('',false);



function page_content() {
  global $lang_string,$logged_in;


   if ($_POST['signup']){
     if (isset($_POST['user'])){
       if (isset($_POST['pass'])){
	 if ($logged_in){
	   echo '<h2>';
	   echo create_user($_POST['user'],$_POST['pass']);
	   echo '</h2>';
	 }
	 else{
	   signup_request ($_POST['user'],$_POST['pass']);
	 }
       }
     }
   }
   else{

    ?>
<h2><?php echo( $lang_string[ 'title' ] ); ?></h2>
<?php echo( $lang_string[ 'instructions' ] ); ?><p />
		
<div class="hr"><hr /></div>

<form enctype="multipart/form-data" action="signup.php" method="post">


		
<label for="user"><?php echo( $lang_string[ 'username' ] ); ?></label><br />
<input type="text" name="user" size="40" /><br /><br />
			
<label for="pass"><?php echo( $lang_string[ 'password' ] ); ?></label><br />
<input type="password" name="pass" size="40" /><br />
			
<div class="hr"><hr /></div>
			
<input type="submit" name="signup" value="<?php echo( $lang_string[ 'submit_btn' ] ); ?>" />
</form>
<?php


   }
}


theme_pagelayout();
html_footer();

?>
