Hacked By AnonymousFox

Current Path : C:/AppServ/www/th/controlweb/manage/mod_intro/
Upload File :
Current File : C:/AppServ/www/th/controlweb/manage/mod_intro/bannerexchange.php

<? 
include("../lib/session.php"); 
include("../lib/config.php");
include("../lib/connect.php");
include("../lib/function.php");
?>
<html>
<head>
<title> <?=$System_Variable_Title?>
</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-874">
<link href="../css/mystyle.css" rel="stylesheet" type="text/css">
<link href="../../css/style.css" rel="stylesheet" type="text/css">
<link href="../../css/css.css" rel="stylesheet" type="text/css">
</head>

<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%" height="100%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#000000">
  <tr valign="top"> 
    <td width="77%" align="center" valign="top" bgcolor="#FFFFFF">
      <table width="100%" height="100%" border="0" cellpadding="2" cellspacing="0">
        <tr> 
          <td align="center" valign="top" >
            <? 
//# Assign Database Table ###################################
include("config.php");
$SystemModuleKey = "banner";
#########################################################
if ($action=="addnew") { 

if ($bannerType=="Graphics") {
/////////// insert type = Graphics

		if($inputWidth=="") { $inputWidth=0; }
		if($inputHeight=="") { $inputHeight=0; }

		// Check to create module data directory. ---------
		if(!is_dir($System_RelativePath_Upload."/".$SystemModuleKey)) { mkdir($System_RelativePath_Upload."/".$SystemModuleKey,0777); }
		if(!is_dir($myModule_Path_ThumbnailPicture)) { mkdir($myModule_Path_ThumbnailPicture,0777); }
		if(!is_dir($myModule_Path_HTMLFiles)) { mkdir($myModule_Path_HTMLFiles,0777); }
		if(!is_dir($myModule_Path_ImageLibrary)) { mkdir($myModule_Path_ImageLibrary,0777); }
		// ------------------------------------------------

		$sql = "INSERT INTO ".$myModule_Table."(".$myModule_Table."_ModuleKey,"
		.$myModule_Table."_Title,"
		.$myModule_Table."_URL,"
		.$myModule_Table."_HTMLCode,"
		.$myModule_Table."_BannerType,"
		.$myModule_Table."_PictureFileType,"
		.$myModule_Table."_Width,"
		.$myModule_Table."_Height,"
		.$myModule_Table."_CreateByID,"
		.$myModule_Table."_CreateBy,"
		.$myModule_Table."_CreateDate,"
		.$myModule_Table."_LastUpdate ,"
		.$myModule_Table."_Status)"
		." VALUES( "
		."'$SystemModuleKey','$inputTitle','$inputURL','','$bannerType','$inputImageType','$inputWidth','$inputHeight',"
		."'$System_Session_User_ID','$System_Session_UserName',NOW(),NOW(),'Enable')"; 
		$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
	
		$sql = "SELECT MAX(".$myModule_Table."_ID) FROM ".$myModule_Table;
		$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
		$Row=MYSQL_FETCH_ARRAY($Query);
		$MaxID = $Row[0];

		srand(make_seed());
		$myrand = rand(1111,9999);

		if(is_file($inputGraphic)) {

			$ThumbnailPictureName = "intro-$MaxID-$myrand.$inputImageType";
			if(file_exists($myModule_Path_ThumbnailPicture."/".$ThumbnailPictureName)) {
				unlink($myModule_Path_ThumbnailPicture."/".$ThumbnailPictureName);
			}
			if(copy($inputGraphic,$myModule_Path_ThumbnailPicture."/".$ThumbnailPictureName)) {
				chmod($myModule_Path_ThumbnailPicture."/".$ThumbnailPictureName,0777);
			}
			$sql = "UPDATE ".$myModule_Table." SET ".$myModule_Table."_PictureFile='$ThumbnailPictureName' WHERE ".$myModule_Table."_ID=".$MaxID;
			$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
		}
		
}elseif($bannerType="HTML"){
/////////// insert type = HTML
		$sql = "INSERT INTO ".$myModule_Table."("
		.$myModule_Table."_ModuleKey,"
		.$myModule_Table."_Title,"
		.$myModule_Table."_URL,"
		.$myModule_Table."_HTMLCode,"
		.$myModule_Table."_BannerType,"
		.$myModule_Table."_PictureFileType,"
		.$myModule_Table."_Width,"
		.$myModule_Table."_Height,"
		.$myModule_Table."_CreateByID,"
		.$myModule_Table."_CreateBy,"
		.$myModule_Table."_CreateDate,"
		.$myModule_Table."_LastUpdate ,"
		.$myModule_Table."_Status)"
		." VALUES( "
		."'$SystemModuleKey','$inputTitle','$inputURL','$inputHTMLCode','$bannerType','$inputImageType','$inputWidth','$inputHeight',"
		."'$System_Session_User_ID','$System_Session_UserName',NOW(),NOW(),'Enable')"; 
		$Query=MYSQL_DB_QUERY($System_DataBase_Name,$sql) OR DIE("Error: เกิดความผิดพลาด <br>$sql<br>\n");
			}
		?>
            <form action="?" method="post" name="myForm" id="myForm">
              <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>">
              <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
              <input name="action" type="hidden" id="action" value="close">
            </form>
            <script language="JavaScript" type="text/JavaScript"> document.myForm.submit(); </script> 
            <? 
} elseif($action=="" ) { 
?>
            <table width="98" border="0" cellpadding="0" cellspacing="1" class="table_header">
              <form action="?" method="post" name="myReturnForm" id="myReturnForm">
                <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>">
                <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
                <input name="action" type="hidden" id="action" value="">
              </form>
              <form action="?" method="post" enctype="multipart/form-data" name="myForm" id="myForm">
                <input name="SystemModuleKey" type="hidden" id="SystemModuleKey" value="<?=$SystemModuleKey?>">
                <input name="SystemMenuID" type="hidden" id="SystemMenuID" value="<?=$SystemMenuID?>">
                <input name="action" type="hidden" id="action" value="addnew">
                <tr> 
                  <td bgcolor="#FFFFFF"> <table width="83%" border="0" cellpadding="2" cellspacing="1" bgcolor="#F4F4F4">
                      <tr bgcolor="#0066CC"> 
                        <td height="24" colspan="2" align="center" ><strong><font color="#FFFFFF">แลกลิงค์กับเรา</font></strong></td>
                      </tr>
                      <tr> 
                        <td height="26" colspan="2" bgcolor="#DFDFDF" >&nbsp;&nbsp;<img src="../images/bullet/box21.gif" width="11" height="11">&nbsp;<strong>กรุณานำ 
                          HTML โค๊ดด้านล่างไปใส่ในเว็บของท่านเพื่อลิงค์มายังเว็บเรา</strong></td>
                      </tr>
                      <tr> 
                        <td height="26" colspan="2" > <div align="center"> 
                            <textarea name="textarea" cols="70" rows="4" class="input_textarea" id="textarea" readonly><a href="http://www.familynetwork.or.th" target="_blank"><img src="http://www.familynetwork.or.th/cgi-bin/banner/logo1.jpg" width="88" height="32" border="0" alt="Family Network"></a></textarea>
                            <br>
                            <br>
                          </div></td>
                      </tr>
                      <tr> 
                        <td height="26" colspan="2" bgcolor="#DFDFDF" >&nbsp;&nbsp;<img src="../images/bullet/box21.gif" width="11" height="11">&nbsp;<strong>ข้อมูลเว็บไซต์ท่าน</strong></td>
                      </tr>
                      <tr> 
                        <td width="120" height="22" align="right" >Title&nbsp; 
                        </td>
                        <td height="22" > <input name="inputTitle" type="text" class="input_left" id="inputTitle" size="50" maxlength="200"></td>
                      </tr>
                      <tr> 
                        <td width="120" height="22" align="right" >URL&nbsp; </td>
                        <td height="22" > <input name="inputURL" type="text" class="input_left" id="inputURL" size="50" maxlength="300"></td>
                      </tr>
                      <tr bgcolor="#DFDFDF"> 
                        <td height="26" colspan="2" ><input name="bannerType" type="radio" class="form_checkbox" value="Graphics" checked>
                          <img src="../../images/list.gif" width="10" height="10"> 
                          &nbsp;ภาพแบนเนอร์</td>
                      </tr>
                      <tr> 
                        <td height="80" colspan="2" align="center" valign="middle" > 
                          <div  style="height:80;width:570;overflow:off" align="center" valign="middle"> 
                            <table width="100%" height="80" border="0" cellpadding="0" cellspacing="0">
                              <tr> 
                                <td width="52%"> <table width="100%" border="0">
                                    <tr> 
                                      <td width="88" height="22" align="right" >เลือกภาพ&nbsp; 
                                      </td>
                                      <td width="198" height="22" ><input name="inputGraphic" type="file" class="input_left" id="inputGraphic" size="10" accept="application/msexcel" onChange="
myfile = this.value;
if(myfile!='') {
	myfile = myfile.toLowerCase();
	Temp = myfile.charAt(myfile.length-4) + myfile.charAt(myfile.length-3) + myfile.charAt(myfile.length-2) + myfile.charAt(myfile.length-1);
	if(Temp=='.jpg' || Temp=='.gif' || Temp=='.swf' || Temp=='jpeg') {
		if(Temp=='.jpg') { document.myForm.inputImageType.value='jpg'; }
		if(Temp=='.gif') { document.myForm.inputImageType.value='gif'; }
		if(Temp=='jpeg') { document.myForm.inputImageType.value='jpg'; }
		if(Temp=='.swf') { document.myForm.inputImageType.value='swf'; }
		if(Temp=='.swf') {
			document.getElementById('ImagePreviewTable').style.display='none';
			document.getElementById('FlashPreviewTable').style.display='';
			document.myForm.inputWidth.value='';
			document.myForm.inputHeight.value='';
		} else {
			document.getElementById('PreviewImage').src=myfile;
			document.myForm.inputWidth.value=document.getElementById('PreviewImage').width;
			document.myForm.inputHeight.value=document.getElementById('PreviewImage').height;
			document.getElementById('ImagePreviewTable').style.display='';
			document.getElementById('FlashPreviewTable').style.display='none';
		}
	} else {
		document.getElementById('ImagePreviewTable').style.display='none';
		document.getElementById('FlashPreviewTable').style.display='none';
		alert('System allow to upload image files only.');
		document.myForm.inputWidth.value='';
		document.myForm.inputHeight.value='';
		this.focus();
	}
}
" onMouseOut="
if(document.getElementById('PreviewImage').width>1 && document.getElementById('PreviewImage').height>1) {
		document.myForm.inputWidth.value=document.getElementById('PreviewImage').width;
		document.myForm.inputHeight.value=document.getElementById('PreviewImage').height;
}
"> <input name="inputImageType" type="hidden" id="inputImageType"></td>
                                    </tr>
                                    <tr> 
                                      <td width="88" height="22" align="right" >กว้าง 
                                        x ยาว&nbsp; </td>
                                      <td height="22" ><input name="inputWidth" type="text" class="input_center" id="inputWidth" size="3" maxlength="10"> 
                                        <strong> x </strong> <input name="inputHeight" type="text" class="input_center" id="inputHeight" size="3" maxlength="10">
                                        pixel </td>
                                    </tr>
                                    <tr> 
                                      <td width="88" height="41" align="right" >&nbsp;</td>
                                      <td height="41">กรุณาเลือกภาพที่เป็น .jpg 
                                        .jpeg .gif .swf เท่านั้น</td>
                                    </tr>
                                  </table></td>
                                <td width="48%"><table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
                                    <tr> 
                                      <td height="61" align="center" valign="middle"><table border="0" cellpadding="4" cellspacing="0" id="ImagePreviewTable" style="display:none">
                                          <tr> 
                                            <td align="center" valign="middle"><img src="../images/blank.gif" name="PreviewImage" id="PreviewImage"></td>
                                          </tr>
                                        </table>
                                        <table border="0" cellpadding="4" cellspacing="0" id="FlashPreviewTable" style="display:none">
                                          <tr> 
                                            <td align="center" valign="middle"><font color="#666666">Not 
                                              support to live preview .swf file.</font></td>
                                          </tr>
                                        </table></td>
                                    </tr>
                                  </table></td>
                              </tr>
                            </table>
                          </div></td>
                      </tr>
                      <tr bgcolor="#DFDFDF"> 
                        <td height="26" colspan="2" ><input name="bannerType" type="radio" class="form_checkbox" value="HTML">
                          <img src="../../images/list.gif" width="10" height="10">&nbsp;&nbsp;ใส่ 
                          HTML โค๊ดของเว็บไซต์ท่าน</td>
                      </tr>
                      <tr> 
                        <td height="22" colspan="2" align="center" >&nbsp; <textarea name="inputHTMLCode" cols="60" rows="4" class="input_textarea" id="inputHTMLCode"></textarea></td>
                      </tr>
                    </table>
                    <table width="100%" height="24" border="0" cellpadding="3" cellspacing="0">
                      <tr align="right"> 
                        <td height="30" colspan="4" align="center" bgcolor="#DFDFDF" > 
                          <table width="300" border="0" cellspacing="0" cellpadding="2">
                            <tr align="center"> 
                              <td> <script language="JavaScript" type="text/JavaScript">
function isBlank(myObj) { if(myObj.value=='') { return true; } return false; }
function isNumber(myObj) { if(!isNaN(myObj.value*1)) { return true; } return false; }
function verifySubmit() {

	with(document.myForm) {
		if(isBlank(inputTitle)) {	inputTitle.focus(); return false; }
		if(isBlank(inputURL)) {	inputURL.focus(); return false; }		
		if(document.myForm.bannerType[0].checked==true){
				
				if(isBlank(inputGraphic)) {	
						alert("คุณยังไม่ได้เลือกภาพ กรุณาเลือกภาพด้วยครับ");
						inputGraphic.focus(); 
						return false; 
				}else{
						test = 0;
				}
		}

		if(document.myForm.bannerType[1].checked==true){
				
				if(isBlank(inputHTMLCode)) {	
						alert("คุณยังไม่ได้ใส่ข้อมูล HTML code กรุณาใส่ด้วย");
						inputHTMLCode.focus(); 
						return false; 
				}else{
						test = 0;
				}
		}
		test = 0;
		
		myfile = inputGraphic.value;
		if(myfile!='') {
			myfile = myfile.toLowerCase();
			Temp = myfile.charAt(myfile.length-4) + myfile.charAt(myfile.length-3) + myfile.charAt(myfile.length-2) + myfile.charAt(myfile.length-1);
			// if image file
			if(Temp=='.jpg' || Temp=='.gif' || Temp=='.swf' || Temp=='jpeg') {
				if(Temp=='.jpg') { inputImageType.value='jpg'; }
				if(Temp=='.gif') { inputImageType.value='gif'; }
				if(Temp=='jpeg') { inputImageType.value='jpg'; }
				if(Temp=='.swf') { inputImageType.value='swf'; }
				// if flash file type
				if(Temp=='.swf') {
					document.getElementById('ImagePreviewTable').style.display='none';
					document.getElementById('FlashPreviewTable').style.display='';
					if(isBlank(inputWidth)) { alert('Please input flash width pixel in numberic.'); inputWidth.focus(); return false; }
					if(!isNumber(inputWidth)) { 
						alert('Please input flash width pixel in numberic.'); 
						inputWidth.value='';
						inputWidth.focus(); 
						return false; 
					}
					if(isBlank(inputHeight)) { alert('Please input flash height pixel in numberic.'); inputHeight.focus(); return false; }
					if(!isNumber(inputHeight)) { 
						alert('Please input flash height pixel in numberic.');
						inputHeight.value='';
						inputHeight.focus(); 
						return false; 
					}
				// if image file type
				} else {//ที่ไม่ใช้.swf
					document.getElementById('PreviewImage').src=myfile;
					inputWidth.value=document.getElementById('PreviewImage').width;
					inputHeight.value=document.getElementById('PreviewImage').height;
					document.getElementById('ImagePreviewTable').style.display='';
					document.getElementById('FlashPreviewTable').style.display='none';
				}
			// if not image file hidden preview image
			} else {
				document.getElementById('ImagePreviewTable').style.display='none';
				document.getElementById('FlashPreviewTable').style.display='none';
				alert('System allow to upload image files only.');
				inputWidth.value='';
				inputHeight.value='';
				inputGraphic.focus();
				return false; 
			}
		}
	if (test==0){
				document.myForm.submit();
	}						 
	

	}
}
						</script> <input name="btAdd" type="button" class="button_80" id="btAdd" value="Add" onClick="verifySubmit();"> 
                              </td>
                              <td> <input name="btCalcel" type="button" class="button_80" id="btCalcel" onClick="
if(confirm('ยกเลิก?')) {
	document.myReturnForm.submit();
}
						" value="Back"> </td>
                            </tr>
                          </table></td>
                      </tr>
                    </table></td>
                </tr>
              </form>
            </table>
            <? 
}elseif($action=="close" ) { 
//########################################################
?>
            <p>&nbsp;</p>
            <p>&nbsp;</p>
            <p>&nbsp;</p>
            <p>&nbsp;</p>
            <table width="400" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#F4F4F4" class="system_boder_all">
              <tr> 
                <td height="23" bgcolor="#0066CC"><strong><font color="#FFFFFF">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img src="../../images/ico491.gif" width="14" height="15">&nbsp;บันทึกข้อมูลเรีบยร้อยแล้ว</font></strong> 
                </td>
              </tr>
              <tr> 
                <td height="150"> <div align="center"> 
                    <table width="90%" border="0" cellpadding="0" cellspacing="0">
                      <tr> 
                        <td height="70" colspan="3"> &nbsp;&nbsp;&nbsp;เราได้ทำการจัดเก็บแบนเนอร์ของท่านเรียบร้อยแล้ว 
                          ทางเว็บไซต์ www.familynetwork.or.th จะช่วยแนะนำเว็บไซต์ท่านโดยแสดงแบนเนอร์ของท่านผ่านทางหน้าแรกของทางเว็บไซต์ 
                          www.familynetwork.or.th</td>
                      </tr>
                      <tr> 
                        <td width="61%" height="10"><div align="right"></div></td>
                        <td width="36%"><div align="center"><strong><font color="#FF9900">ขอบคุณที่ใช้บริการ</font></strong><br>
                            <font color="#660000"><strong>www.familynetwork.or.th</strong></font></div></td>
                        <td width="3%">&nbsp;</td>
                      </tr>
                    </table>
                    <br>
                    <input name="btClose" type="button"  id="btClose2" value="     Close     " onClick="window.close(); " Style="cursor:hand">
                  </div></td>
              </tr>
            </table> </td>
        </tr>
        <tr> 
          <td height="22" align="center" valign="top" > <table border="0" cellpadding="2" cellspacing="0">
              <tr> 
                <td width="30">&nbsp;</td>
              </tr>
            </table></td>
        </tr>
      </table></td>
  </tr>
</table>
</body>
</html>
<? }
include("../lib/disconnect.php");
?>

Hacked By AnonymousFox1.0, Coded By AnonymousFox