<?php
include 'connect/cms-config.php' ;
include 'requires/function.php' ;

// 110.4.41.139
// 137.59.110.220
// 137.59.109.229

$listing = [
	[ 'host' => '137.59.110.220', 'database' => 'mrsb_systemnew',      		'username' => 'mrsb_systemnew', 			'password' => '7*YQ@@J?xTed' ],
	[ 'host' => '137.59.110.220', 'database' => 'mrsb_system2',        		'username' => 'mrsb_system2', 				'password' => 'G^WjC39%HumN' ],
	[ 'host' => '137.59.109.229', 'database' => 'seow_hrnew',          		'username' => 'seow_hrnew', 				'password' => 'its@123#ips'  ],
	[ 'host' => '110.4.41.139',   'database' => 'itssyste_ips2', 	   		'username' => 'itssyste_ips2', 				'password' => 'its@123#ips'  ],
	[ 'host' => '110.4.41.139',   'database' => 'itssystem_demoadvance', 	'username' => 'itssystem_demoadvance', 		'password' => 'its@123#ips'  ],
	[ 'host' => '137.59.110.220', 'database' => 'kindlemindcommy_hr',  		'username' => 'kindlemindcommy_hr',  		'password' => 'its@123#ips'  ],
	[ 'host' => '137.59.110.220', 'database' => 'kindlemindcommy_hr2', 		'username' => 'kindlemindcommy_hr2', 		'password' => 'its@123#ips'  ]
] ;


$html = '<table border="1">' ;


// staff_adjustmentwallet
// staff_wallet_movement
// setting_wallet

foreach ( $listing as $k => $v ){

	// request database
	$host 			= $v['host'] ;
	$username 		= $v['username'] ;
	$password 		= $v['password'] ;
	$database 		= $v['database'] ;
	$mysqli 		= new mysqli($host, $username, $password, $database) ;
	$mysqli->set_charset("utf8") ;
	date_default_timezone_set('Asia/Singapore') ;

	$success  		= 'no' ;
	if ( $mysqli->query( "ALTER TABLE `staff_leave` CHANGE `leave_type` `leave_type` ENUM('unpaid','annual','sick','maternity') CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL;" ) ){
		$success    = 'yes' ;
	}


	$html .= '
	<tr>
		<td>'.( $k+1 ).'</td>
		<td>'.$v['database'].'</td>
		<td>'.ucwords( $success ).'</td>
		<td>'.$mysqli->error.'</td>
	</tr>' ;

}


$html .= '</table>' ;

echo $html ;



