/var/www/hkosl.com/litedemo/webadmin/header_modify.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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
<?php
include 'config.php';

// Check if the user is logged in

if ((!isSet($_SESSION['loginname'])) || ($loggin <> '1'))
{
header("Location: login.php");
exit;
}
require(
"configure.php");
 
$hafid             htmlspecialchars($_POST["hafid"],ENT_QUOTES);
$hafgoogleana    htmlspecialchars($_POST["hafgoogleana"],ENT_QUOTES);
$haffblink        htmlspecialchars($_POST["haffblink"],ENT_QUOTES);

$nowdate date("Y-m-d H:i:s");
//print_r($_POST);

// Upload File
if ($_FILES['haflogoen']['name'] <> '')
{
    if ((
$_FILES["haflogoen"]["type"] == "image/bmp") || ($_FILES["haflogoen"]["type"] == "image/BMP") || ($_FILES["haflogoen"]["type"] == "image/gif") || ($_FILES["haflogoen"]["type"] == "image/GIF") || ($_FILES["haflogoen"]["type"] == "image/jpg") || ($_FILES["haflogoen"]["type"] == "image/JPG") || ($_FILES["haflogoen"]["type"] == "image/jpeg") || ($_FILES["haflogoen"]["type"] == "image/JPEG") || ($_FILES["haflogoen"]["type"] == "image/pjpeg") || ($_FILES["haflogoen"]["type"] == "image/PJEG") || ($_FILES["haflogoen"]["type"] == "image/png") || ($_FILES["haflogoen"]["type"] == "image/x-png") || ($_FILES["haflogoen"]["type"] == "image/PNG") || ($_FILES["haflogoen"]["type"] == "image/X-PNG"))
    {
        
move_uploaded_file ($_FILES['haflogoen']['tmp_name'], "../images/logo_en_".$_FILES['haflogoen']['name']) 
            or die (
"Could not copy the file: logo");
        
        
$haflogoen "logo_en_".$_FILES['haflogoen']['name'];
      }
    else
      {
      
// upload error
      
?>
        <script language="javascript">
        alert("Files must be BMP, JPEG, GIF, or PNG");
        history.back();
        </script>
     <?php
     
exit;
     }

}
else
{
    
$haflogoen "";
}

if (
$_FILES['haflogotc']['name'] <> '')
{
    if ((
$_FILES["haflogotc"]["type"] == "image/bmp") || ($_FILES["haflogotc"]["type"] == "image/BMP") || ($_FILES["haflogotc"]["type"] == "image/gif") || ($_FILES["haflogotc"]["type"] == "image/GIF") || ($_FILES["haflogotc"]["type"] == "image/jpg") || ($_FILES["haflogotc"]["type"] == "image/JPG") || ($_FILES["haflogotc"]["type"] == "image/jpeg") || ($_FILES["haflogotc"]["type"] == "image/JPEG") || ($_FILES["haflogotc"]["type"] == "image/pjpeg") || ($_FILES["haflogotc"]["type"] == "image/PJEG") || ($_FILES["haflogotc"]["type"] == "image/png") || ($_FILES["haflogotc"]["type"] == "image/x-png") || ($_FILES["haflogotc"]["type"] == "image/PNG") || ($_FILES["haflogotc"]["type"] == "image/X-PNG"))
    {
        
move_uploaded_file ($_FILES['haflogotc']['tmp_name'], "../images/logo_tc_".$_FILES['haflogotc']['name']) 
            or die (
"Could not copy the file: logo");
        
        
$haflogotc "logo_tc_".$_FILES['haflogotc']['name'];
      }
    else
      {
      
// upload error
      
?>
        <script language="javascript">
        alert("Files must be BMP, JPEG, GIF, or PNG");
        history.back();
        </script>
     <?php
     
exit;
     }

}
else
{
    
$haflogotc "";
}

if (
$_FILES['haflogosc']['name'] <> '')
{
    if ((
$_FILES["haflogosc"]["type"] == "image/bmp") || ($_FILES["haflogosc"]["type"] == "image/BMP") || ($_FILES["haflogosc"]["type"] == "image/gif") || ($_FILES["haflogosc"]["type"] == "image/GIF") || ($_FILES["haflogosc"]["type"] == "image/jpg") || ($_FILES["haflogosc"]["type"] == "image/JPG") || ($_FILES["haflogosc"]["type"] == "image/jpeg") || ($_FILES["haflogosc"]["type"] == "image/JPEG") || ($_FILES["haflogosc"]["type"] == "image/pjpeg") || ($_FILES["haflogosc"]["type"] == "image/PJEG") || ($_FILES["haflogosc"]["type"] == "image/png") || ($_FILES["haflogosc"]["type"] == "image/x-png") || ($_FILES["haflogosc"]["type"] == "image/PNG") || ($_FILES["haflogosc"]["type"] == "image/X-PNG"))
    {
        
move_uploaded_file ($_FILES['haflogosc']['tmp_name'], "../images/logo_sc_".$_FILES['haflogosc']['name']) 
            or die (
"Could not copy the file: logo");
        
        
$haflogosc "logo_sc_".$_FILES['haflogosc']['name'];
      }
    else
      {
      
// upload error
      
?>
        <script language="javascript">
        alert("Files must be BMP, JPEG, GIF, or PNG");
        history.back();
        </script>
     <?php
     
exit;
     }

}
else
{
    
$haflogosc "";
}

// Modify 
$sql "update headandfoot set hafgoogleana='$hafgoogleana', haffblink='$haffblink', modifyday='$nowdate', cmsloginid='".$_SESSION['cmsloginid']."' ";
if (
$haflogoen <> '')
    
$sql .= ", haflogoen='$haflogoen' ";
if (
$haflogotc <> '')
    
$sql .= ", haflogotc='$haflogotc' ";
if (
$haflogosc <> '')
    
$sql .= ", haflogosc='$haflogosc' ";
$sql .= " where hafid="$hafid ." ";
mysql_query($sql);

if( 
mysql_errno() > ){
    echo 
'Modify Header Error:<br />'mysql_error() .'<br />SQL: '$sql;
    exit;
}

mysql_close($dbh);

header("Location: header_modifyform.php?id='".$hafid."'&msg=Modify Successful");
?>