include_once "pagebody.php"; pageHeader(); $pageTitle="นำเข้าข้อมูลนักศึกษา"; ?>
echo $pageTitle; ?> |
if ($method=="import"){ include_once "clsUser.php"; include_once "clsUmUser.php"; include_once "clsStudentT.php"; $oC = new clsConnection($GLOBALS['HOST'], $GLOBALS['DB'], $GLOBALS['USER'], $GLOBALS['PASSWORD']); $oC1 = new clsConnection($dbHost, $dbName, $dbUserName, $dbPassword); $oUs = new clsUser(); $oUm = new umuser($oC); $oS = new StudentT($oC1); $oS->RSStudent(); $oC->BeginTrans(); echo "
นักศึกษา | ดำเนินการ |
---|---|
$oS->studentCode :: $oS->studentNameSurname | "; echo ""; $oUm->searchByUserLogin($oS->studentCode); //หาตามรหัสนิสิต if (!$oUm->GetRecord()){ //ถ้าไม่มีใน um $oU->addNewUser($oS->studentCode, $oS->studentNameSurname, 6, 7, $oS->studentCode, $oS->studentCode); echo "เพิ่มใหม่ "; }else{ //มีใน um if ($oS->studentStatus<>7){ //สถานะ อยู่ $sql = "update umuser set UsPassword='" . md5("O]O".$oS->studentCode."O[O") . "', UsName='$oS->studentNameSurname', UsActive=1 where UsLogin='$oS->studentCode'"; $oC->Execute($sql); echo "ปรับปรุงสถานะเป็น active"; }else{ //สถานะ ไม่อยู่ ออก กะเสียน $sql = "update umuser set UsPassword='" . md5("O]O".$oS->studentCode."O[O") . "', UsName='$oS->studentNameSurname', UsActive=0 where UsLogin='$oS->studentCode'"; $oC->Execute($sql); echo "ปรับปรุงสถานะเป็น No active"; } } $i++; echo " |
จำนวนทั้งสิ้น $i รายการ |