-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathupdateuserinfo.php
87 lines (61 loc) · 2.34 KB
/
updateuserinfo.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
<?php
include "./config.php";
$valid_extensions = array('jpeg','jpg','png','gif','mp4', 'mp3' ,'jfif','aac','mpeg'); // valid extensions
$path = 'uploads/';
$img = $_FILES['tokenimage']['name'];
$tmp = $_FILES['tokenimage']['tmp_name'];
$ext = strtolower(pathinfo($img, PATHINFO_EXTENSION));
$final_image = rand(1000, 1000000) . $img;
$img2 = $_FILES['tokenimage1']['name'];
$tmp2 = $_FILES['tokenimage1']['tmp_name'];
$ext2 = strtolower(pathinfo($img2, PATHINFO_EXTENSION));
$final_image2 = rand(1000, 1000000) . $img2;
if($img=='' && $img2!=''){
if (in_array($ext2, $valid_extensions)){
$path2 = "uploads/" . strtolower($final_image2);
move_uploaded_file($tmp2, $path2);
$sql="UPDATE `nft_user` SET `coverphoto`='".$path2."' WHERE `Useraddress`='".$_POST['address']."'";
$data = mysqli_query($link,$sql);
}else{
echo "invalid banner";
}
}
if($img!='' && $img2==''){
if (in_array($ext, $valid_extensions)){
$path = "uploads/" . strtolower($final_image);
move_uploaded_file($tmp, $path);
$sql="UPDATE `nft_user` SET `Userimage`='".$path."' WHERE `Useraddress`='".$_POST['address']."'";
$data = mysqli_query($link,$sql);
}else{
echo "invalid image ";
}
}
if($img!='' && $img2!=''){
if (in_array($ext, $valid_extensions)){
if (in_array($ext2, $valid_extensions)){
$path = "uploads/" . strtolower($final_image);
$path2 = "uploads/" . strtolower($final_image2);
move_uploaded_file($tmp, $path);
move_uploaded_file($tmp2, $path2);
$sql="UPDATE `nft_user` SET `Userimage`='".$path."',`coverphoto`='".$path2."' WHERE `Useraddress`='".$_POST['address']."'";
$data = mysqli_query($link,$sql);
if ($data){
echo "Success";
}else{
echo "failed";
}
}else{
echo "invalid ";
}
}else{
echo "invalid banner";
}
}
$sql="UPDATE `nft_user` SET `Username`='".$_POST['Username']."', `Useremail`='".$_POST['Email']."', `Userbio`='".$_POST['Bio']."',`Userinstaname`='".$_POST['Instagram']."', `Usertwitname`='".$_POST['Twitter']."' WHERE `Useraddress`='".$_POST['address']."'";
$data = mysqli_query($link,$sql);
if ($data){
echo "Success";
}else{
echo "failed";
}
?>