MINI SHELL

Server : Apache/2.2.2 (Fedora)
System : Linux App1.pathumtani.go.th 2.6.20-1.2320.fc5smp #1 SMP Tue Jun 12 19:40:16 EDT 2007 i686
User : apache ( 48)
PHP Version : 5.2.9
Disable Function : NONE
Directory :  /home/pathumthani_integration/integration/application/industry/engine/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //home/pathumthani_integration/integration/application/industry/engine/Copy of getdata.php
<?
include("../../../../../config/conndb_nonsession.inc.php");
$db_temp = "temp_pobec_import";

/**
* ----------------------------------------------------------------
*			XBase
*			test.php	
* 
*  Developer        : Erwin Kooi
*  released at      : Nov 2005
*  last modified by : Erwin Kooi
*  date modified    : Jan 2005
*                                                               
*  Info? Mail to info@cyane.nl
* 
* --------------------------------------------------------------
*
* Basic demonstration
* download the sample tables from:
* http://www.cyane.nl/phpxbase.zip
*
**/

	/* load the required classes */
	require_once "Column.class.php";
	require_once "Record.class.php";
	require_once "Table.class.php";
	
ini_set("memory_limit","64M") ;
function GetRandomString($length){
	$template = "1234567890abcdefghijklmnopqrstuvwxyz";  
	settype($length, "integer");
    settype($rndstring, "string");
    settype($a, "integer");
    settype($b, "integer");
      
    for ($a = 0; $a <= $length; $a++) {
    	$b = mt_rand(0, strlen($template) - 1);
        $rndstring .= $template[$b];
    }
       
    return $rndstring;
}

	
	/* create a table object and open it */
if($process=="execute"){

	$myfile = GetRandomString(7);
	while(is_file($myfile.".DBF")){
		$myfile = GetRandomString(7);
	}
	// เช็ค การ upload
		if(!copy($name,"../tmp_dbf/".$myfile.".DBF")){
						echo "					
						<script language=\"javascript\">
						alert(\"ไม่สามาราถ upload ไฟล์ได้ \");
						location.href='../browse.php';
						</script>
						";
		die;
	}else{
		//write log keyin
		chmod("../tmp_dbf/".$myfile.".DBF", 0777); 
	}
// end upload 
	$sfiletxt = $myfile.".DBF";
	
//	echo $sfiletxt."<br>";
//	echo "====".$process;die;

	$table = new XBaseTable("../tmp_dbf/$sfiletxt");
	$table->open();
	/* print some header info */
    echo "version: ".$table->version."<br />";
    echo "foxpro: ".($table->foxpro?"yes":"no")."<br />";
    echo "modifyDate: ".date("r",$table->modifyDate)."<br />";
    echo "recordCount: ".$table->recordCount."<br />";
    echo "headerLength: ".$table->headerLength."<br />";
    echo "recordByteLength: ".$table->recordByteLength."<br />";
    echo "inTransaction: ".($table->inTransaction?"yes":"no")."<br />";
    echo "encrypted: ".($table->encrypted?"yes":"no")."<br />";
    echo "mdxFlag: ".ord($table->mdxFlag)."<br />";
    echo "languageCode: ".ord($table->languageCode)."<br />";

    /* html output */
    
    /* print column names */
	$dbname_obec = "pobec_$getsiteid";	
	$sql_drop1 = "DROP TABLE $dbname_obec"; 
	mysql_db_query($db_temp,$sql_drop1);

	$sqlmaintb = "CREATE TABLE `pobec_".$getsiteid."` ( " ;
    foreach ($table->getColumns() as $i=>$c) {
		if($c->getType()=="C"){
			$typef = "varchar";
		}else if($c->getType()=="N"){
			$typef = "integer";
		}else if($c->getType()=="D"){
			$typef = "DATETIME";
		}else{
			$typef = "varchar";
		}	
		if(trim(strip_tags($sqltb)) > ""){ $sqltb .= ",";} // ใส่คอมมา
		if($typef == "DATETIME"){
			$sqltb .=  "  `".$c->getName()."` ".$typef." NOT NULL";
		}else{
			$sqltb .=  "  `".$c->getName()."` ".$typef."(".$c->getLength().") default NULL";
		}
    }

	$sqlresulttb = $sqlmaintb.$sqltb." )ENGINE=MyISAM DEFAULT CHARSET=tis620;" ;
	//echo "$sqlresulttb <hr>";
	mysql_db_query($db_temp,$sqlresulttb)or die(mysql_error()."______line :".__LINE__."_____");// query ข้อมูล
  
	
    /* print records */
    while ($record=$table->nextRecord()) {

	  	$sqlmain = $sql = $sqlresult = "";
		$sqlmain = "INSERT INTO `pobec_".$getsiteid."` SET "; 
	    foreach ($table->getColumns() as $i=>$c) {
			if(trim(strip_tags($sql)) > ""){ $sql .= ",";} // ใส่คอมมา
			$sql .= $c->getName()." = '".$record->getString($c)."'"; 
	    }

		$sqlresult .= $sqlmain.$sql.";";
		mysql_db_query($db_temp,$sqlresult)or die(mysql_error()."______line :".__LINE__."_____");
		//echo $sqlresult; echo "<br>";

    }

	/* close the table */
	$table->close();
	
	
#####impschool ########################################################################################################
		$myfile = GetRandomString(7);
	while(is_file($myfile.".DBF")){
		$myfile = GetRandomString(7);
	}
	// เช็ค การ upload
		if(!copy($name,"../tmp_dbf/".$myfile.".DBF")){
						echo "					
						<script language=\"javascript\">
						alert(\"ไม่สามาราถ upload ไฟล์ได้ \");
						location.href='../browse.php';
						</script>
						";
		die;
	}else{
		//write log keyin
		chmod("../tmp_dbf/".$myfile.".DBF", 0777); 
	}
// end upload 
	$sfiletxt = $myfile.".DBF";
	
//	echo $sfiletxt."<br>";
//	echo "====".$process;die;

	$table = new XBaseTable("../tmp_dbf/$sfiletxt");
	$table->open();
	/* print some header info */
    echo "version: ".$table->version."<br />";
    echo "foxpro: ".($table->foxpro?"yes":"no")."<br />";
    echo "modifyDate: ".date("r",$table->modifyDate)."<br />";
    echo "recordCount: ".$table->recordCount."<br />";
    echo "headerLength: ".$table->headerLength."<br />";
    echo "recordByteLength: ".$table->recordByteLength."<br />";
    echo "inTransaction: ".($table->inTransaction?"yes":"no")."<br />";
    echo "encrypted: ".($table->encrypted?"yes":"no")."<br />";
    echo "mdxFlag: ".ord($table->mdxFlag)."<br />";
    echo "languageCode: ".ord($table->languageCode)."<br />";

    /* html output */
    
    /* print column names */
	$dbname_school = "school_$getsiteid";

	$sql_drop2 = "DROP TABLE $dbname_school";
	mysql_db_query($db_temp,$sql_drop2);
	$sqlmaintb = "CREATE TABLE `school_".$getsiteid."` ( " ;
	
    foreach ($table->getColumns() as $i=>$c) {
		if($c->getType()=="C"){
			$typef = "varchar";
		}else if($c->getType()=="N"){
			$typef = "integer";
		}else if($c->getType()=="D"){
			$typef = "DATETIME";
		}else{
			$typef = "varchar";
		}	
		if(trim(strip_tags($sqltb)) > ""){ $sqltb .= ",";} // ใส่คอมมา
		if($typef == "DATETIME"){
			$sqltb .=  "  `".$c->getName()."` ".$typef." NOT NULL";
		}else{
			$sqltb .=  "  `".$c->getName()."` ".$typef."(".$c->getLength().") default NULL";
		}
    }

	$sqlresulttb = $sqlmaintb.$sqltb." )ENGINE=MyISAM DEFAULT CHARSET=tis620;" ;
	//echo "$sqlresulttb <hr>";
	mysql_db_query($db_temp,$sqlresulttb)or die(mysql_error()."______line :".__LINE__."_____");// query ข้อมูล
  
	
    /* print records */
    while ($record=$table->nextRecord()) {

	  	$sqlmain = $sql = $sqlresult = "";
		$sqlmain = "INSERT INTO `school_".$getsiteid."` SET "; 
	    foreach ($table->getColumns() as $i=>$c) {
			if(trim(strip_tags($sql)) > ""){ $sql .= ",";} // ใส่คอมมา
			$sql .= $c->getName()." = '".$record->getString($c)."'"; 
	    }

		$sqlresult .= $sqlmain.$sql.";";
		mysql_db_query($db_temp,$sqlresult)or die(mysql_error()."______line :".__LINE__."_____");
		//echo $sqlresult; echo "<br>";

    }

	/* close the table */
	$table->close();

	
	
} // end if(process == execute){
?>

Anon7 - 2021