-=[ Mr. Bumblebee ]=-
_Indonesia_

Path : /var/www/html/inc.bk/class/
File Upload :
Current File : /var/www/html/inc.bk/class/function.script.php

<?php

###########################################
// script
###########################################

	function script_array ( $array , $begin_idx = '' , $end_idx = '' , $is_blank_title = '' ) # begin_idx : ½ÃÀÛŰ , end_idx : Á¾·áŰ
	{
		$return = array() ;
		if ( !empty($is_blank_title)) $return[] = " new Option('$is_blank_title','') " ;
		$loop = false ;
		if ( empty($begin_idx)) $loop = true ;
		if ( is_array($array)) {
			$i = 0 ;
			foreach ( $array as $key=>$val )
			{
				if ( $i == $begin_idx && $loop === false ) $loop = true ;
				if ( $loop ) {
					$return[] = " new Option('$val' , '$key') " ;
				}
				if ( !empty($end_idx) && $i == $end_idx ) break ;
				$i++;
			}
		}
		$return = " new Array ( " . implode(',',$return) . " ) " ;

		return $return ;
	}

	function script_array_option ( $name , $array , $begin_idx = '' , $end_idx = '' ) # begin_idx : ½ÃÀÛŰ , end_idx : Á¾·áŰ
	{
		$return = " $name = new Array ; " . chr(13) ;
		$loop = false ;
		if ( empty($begin_idx)) $loop = true ;
		foreach ( $array as $key=>$val )
		{
			if ( $key == $begin_idx && $loop === false ) $loop = true ;
			if ( $loop ) {
				$return.= " {$name}[{$name}.length] = new Option('$val' , '$key') ; " . chr(13) ;
			}
			if ( $key == $end_idx && !empty($end_idx) ) break ;
		}
		return $return ;
	}

	function script_go ( $url = '' , $msg = '' , $script = '' )
	{
		$str = ' <script language="javascript"> ' ;
		if ( !empty($script)) $str.= $script ;
		if ( !empty($msg)) $str.= ' alert(\'' . $msg . '\'); ' ;
		if ( !empty($url)) $str.= ' location.href = \'' . $url . '\'; ' ;
		$str.= '</script>' ;
		echo $str ;
		exit ;
	}

	function script_bk ( $msg = '' , $go = -1 )
	{
		$str = ' <script language="javascript"> ' ;
		if ( !empty($msg)) $str.= ' alert(\'' . $msg . '\'); ' ;
		$str.= ' history.go(' . $go . '); ' ;
		$str.= '</script>' ;
		echo $str ;
		exit ;
	}

	function script_re ( $url = '' , $msg = '' , $script = '' )
	{
		$str = ' <script language="javascript"> ' ;
		if ( !empty($script)) $str.= $script ;
		if ( !empty($msg)) $str.= ' alert(\'' . $msg . '\'); ' ;
		if ( !empty($url)) $str.= ' location.replace(\'' . $url . '\'); ' ;
		$str.= '</script>' ;
		echo $str ;
		exit ;
	}

	function script_close ( $msg = '' )
	{
		$str = ' <script language="javascript"> ' ;
		if ( !empty($msg)) $str.= ' alert(\'' . $msg . '\'); ' ;
		$str.= ' self.close(); ' ;
		$str.= '</script>' ;
		echo $str ;
		exit ;
	}

	function msg_box ( $msg )
	{
		echo ' <script> alert(\'' . $msg . '\'); </script> ' ;
	}

	function use_error ( $msg , $url = 'back' )
	{
	}

	function script_post( $method , $action , $elements ) {
		$tmp_formname = str_rand( 5 , 'A1') ;
		$str = '<html><head></head><body><form name="form_' . $tmp_formname . '" action="' . $action . '" method="' . $method . '">' ;
		foreach ( $elements as $key=>$val ) {
			$str.= '<input type="hidden" name="' . $key . '" value="' . $val . '">' ;
		}
		$str.= '</form>
		<script language="javascript"> document.getElementId(\'' . $tmp_formname . '\').submit(); </script>
		</body></html>
		' ;
	}


?>

Copyright © 2017 || Recoded By Mr.Bumblebee