forked from fotosentez/mutasyon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathedit.php
114 lines (108 loc) · 3.42 KB
/
edit.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
<?php
require_once('configs/config.php');
require_once('configs/pic_upload.php');
$page_name = "edit";
$smarty->assign("page_name", $page_name);
if($_SESSION['login']){
$admin_username = Check::getValue('admin_username');
$admin_name = Check::cleartag(Check::getValue('admin_name'));
$admin_password = Check::getValue('admin_password');
$password_again = Check::getValue('password_again');
$admin_email = Check::getValue('admin_email');
$admin_city = Check::getValue('admin_city');
$admin_old = Check::getValue('admin_old');
$id = Check::getValue('id');
$admin_id = $_SESSION["username"];
if($admin_password != "" and $admin_password != NULL)
{
$security = md5($admin_password);
if($admin_password == $password_again)
{
$admin_inf = $db->query("UPDATE admin SET
email='$admin_email',
username='$admin_username',
name_surname='$admin_name',
password='$security',
city='$admin_city',
old='$admin_old',
active = 1
WHERE email = '$admin_id'");
echo "Bilgiler başarıyla güncellendi!";
}//if password match check
else
{
$infpasswordnotsame = $smarty->getVariable('_inf_password_not_same');
echo $infpasswordnotsame."<script>$('input').removeClass('alert-danger');$('select').removeClass('alert-danger');$('input[name=admin_password]').addClass('alert-danger');$('input[name=password_again]').addClass('alert-danger');</script>";
echo "<script>return false</script>";
exit();
}
}
else if($admin_username)
{
$admin_inf = $db->query("UPDATE admin SET
email='$admin_email',
username='$admin_username',
name_surname='$admin_name',
city='$admin_city',
old='$admin_old',
active = 1
WHERE email = '$admin_id'");
$infupdate = $smarty->getVariable('_inf_update_success');
echo $infupdate;
}
//If upload a image
else if(@$_FILES['admin_pic']['name'])
{
$imagesize = $_FILES['admin_pic']['size'];
$imagetype = $_FILES['admin_pic']['type'];
if($imagesize > 512000)
{
$infmaxsize = $smarty->getVariable('_inf_maximum_size');
echo $infmaxsize;
echo "<script>return false</script>";
$vsize = 0;
exit();
}
else
{
$vsize = 1;
}
if($vsize == 1)
{
if($imagetype == "image/jpeg")
{
$vtype = 1;
}
else
{
$infimgtype = $smarty->getVariable('_inf_image_type');
echo $infimgtype."<script>return false</script>";
$vtype = 0;
exit();
}
}
if($vsize == 1 and $vtype == 1)
{
$type = "jpg";
$foo = new Upload(@$_FILES['admin_pic']);
if ($foo->uploaded) {
// resized to 250px wide
$foo->file_overwrite = true;
$foo->file_new_name_body = $id.'-user';
$foo->image_resize = true;
$foo->image_convert = $type;
$foo->image_x = 250;
$foo->image_ratio_y = true;
$foo->Process('img/');
if ($foo->processed) {
$foo->Clean();
}
}
$infaddentry = $smarty->getVariable('_inf_add_success');
echo $infaddentry;
}
}
}//login
else{
$smarty->display(theme_base.'login.html');
}