/home/banprang/domains/plai.go.th/public_html/coremain/module/footer/add_footer.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<?php
if($_SESSION[admin_web]!="admin")    {    
    
permission_fail();
}
$navig['manage_footer']="จัดการข้อมูลลิงค์";
$navig['add_footer']="เพิ่มลิงค์";
navigator($navig);
echo 
"<br>";
bar_header("เพิ่มลิงค์"); // Bar_Header
fieldset_top("");


import_request_variables('pG''p_');
if(
$p_add!="")                            {  $add=trim($p_add);                                            }
if(
$p_topic!="")                            {  $topic=trim($p_topic);                                        }
if(
$p_link_url!="")                        {  $link_url=trim($p_link_url);                                }
if(
$p_id_group!="")                    {  $id_group=trim($p_id_group);                            }
$userfile1_name=trim($_FILES['userfile1']['name']);

// add topic link
if($add=="1" and $topic!="")
{

// Create_Filename
if($userfile1_name!="")    {    
// เช็คไฟล์ว่าถูกต้องหรือไม่
        
if($userfile1_name!="")            {    check_pic($userfile1_name,1);    }

        
$name1=create_filename($userfile1_name);        
        
$dlink="$_SESSION[web_name]/mainfile/".$name1;
        
upload_file_to_server($dlink,$_FILES['userfile1']);        

        list(
$width$height$type$attr) = getimagesize("$_SESSION[web_name]/mainfile/$name1");
            
check_pic_height($height,$name1);
            
check_pic_width($width,$name1);


    
$sql="INSERT INTO `cms_footer` (`id_footer` ,`name_file` ,`name_title` ,`url` ,`status`) VALUES (NULL , '$name1', '$topic', '$link_url','1')";
    
$result=mysql_query($sql);    
    echo
"<br><br><center>ข้อมูลได้ถูกเพิ่มแล้ว<br><br></enter>";
    echo 
"<meta http-equiv='refresh' content='1; url=index.php?mod=manage_footer&path=footer'>" ;
}else{
?>


<table width="550" border="0" align="center" cellpadding="1" cellspacing="3">
<form  name="add" action="index.php?mod=add_footer&path=footer&add=1" method="post" onSubmit="return checkadd()" enctype="multipart/form-data">

  <tr height='35'>
     <td width=5%></td>     
     <td width=25%><div align="left"><img src='coremain/images/marker.gif'> ชื่อลิงค์</div></td> 
     <td width=65%><div align="left"><input name="topic" type="text" size="40"></td> 
  </tr>

  <tr height='35'>
     <td width=5%></td>     
     <td width=25%><div align="left"><img src='coremain/images/marker.gif'> URL</div></td> 
     <td width=65%><div align="left"><input name="link_url" type="text" size="40" value="http://"></td> 
  </tr>

  <tr height='35' valign=top>
     <td width=5%></td>     
     <td width=25%><div align="left"><img src='coremain/images/marker.gif'> Upload รูปแบนเนอร์</div></td> 
     <td width=65%><div align="left"><input name="userfile1" type="file" size="40"><br>- รูปที่เหมาะสม กว้างไม่เกิน 150 pixel<br>- สูงไม่เกิน 50 Pixel</td> 
  </tr>

    <tr height='35'>
     <td width=5%></td>     
     <td width=15%></td> 
     <td width=80%><div align="left">       
            <input type="submit" name="Submit" value="เพิ่มข้อมูล" onmouseover=this.style.cursor='hand'>
</td> 
  </tr>

</form> 
</table>

<?php }
fieldset_down();
?>

<script language="javascript">
function checkadd() {
if(document.add.topic.value=="") {
alert("กรุณากรอก ชื่อลิงค์!") ;
document.add.topic.focus() ;
return false ;
}
else if(document.add.link_url.value=="http://") {
alert("กรุณากรอก URL ให้ถูกต้อง!") ;
document.add.link_url.focus() ;
return false ;
}
else 
return true ;
}
</script>