<?php
$must_login        = false ;
$require_path      = '../../' ;
$require_sub       = '../' ;
require( $require_sub.'header.php' ) ;

$username          = $array['username'] ;
$name              = $array['name'] ;
$mobile            = $array['mobile'] ;
$email             = $array['email'] ;
$password          = $array['password'] ;
$token             = $array['token'] ;

$status            = '300' ;

if ( $username    != '' && $name != '' && $mobile != '' && $email != '' && $password != '' ){
	$status        = '289' ;

	$mysqli_staff  = $mysqli->query( "SELECT staff_id, staff_idno, staff_name, staff_shortname, staff_username, staff_email, staff_mobileno, staff_image, job_position_id, job_section_id, staff_point_achievement, staff_point, staff_wallet, staff_tier, staff_achievement, staff_star FROM staff
                                     WHERE deleted_at IS NULL AND staff_username = '".$username."' LIMIT 1" ) ;
	if ( $mysqli_staff->num_rows == 0 ){
		$status    = '200' ;

        $password  = passwordEncrypt( $password ) ;
        $mysqli->query( "INSERT INTO staff
                         ( staff_name, staff_username, staff_email, staff_mobileno, staff_password, staff_date_resigned, staff_run_away ) VALUES
                         ( '".$name."', '".$username."', '".$email."', '".$mobile."', '".$password."', '".TODAYDAY."', 'yes' )" ) ;

	}

}

require( $require_sub.'footer.php' ) ;
?>