-
Notifications
You must be signed in to change notification settings - Fork 0
/
profilel.html
137 lines (124 loc) · 5.11 KB
/
profilel.html
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
<?php
session_start();
include_once 'php_connection.php';
include "handf/header_forms.php";
error_reporting(0);
if($_SESSION['l_id']){
include "handf/slideL.php";
}elseif ($_SESSION['i_id']) {
include "handf/slideI.php";
}elseif ($_SESSION['a_id']) {
include "handf/slideA.php";
}else {
echo "invalid login details";
}
?>
<!--------------------profile picture-------------------------------------->
<head>
<style>
#div{
background-color: gray;
height: 270px;
width: 700px;
}
</style>
</head>
<?php
if(isset($_POST['submit11'])){
include_once 'php_connection.php';
//echo $_SESSION['l_id']."---------------------<br>";
//echo $_FILES['file']['name'];
/*$s="insert into profilel (l_id,image) values ( '".$_SESSION['l_id']."','".$_FILES['file']['name']."')";*/
/*----------------------------------------------------*/
$sql2 = mysqli_query($conn,"SELECT * FROM `profilel`");
while($row = mysqli_fetch_assoc($sql2)){
if($row['l_id']!=$_SESSION['l_id']){
/*--------------------------------------------------*/
error_reporting(0);
if($_SESSION['l_id']){
$iid=$_SESSION['l_id'];
$s="insert into profilel (l_id,image) values ( '$iid','".$_FILES['file']['name']."')";
}elseif ($_SESSION['i_id']) {
$iid=$_SESSION['i_id'];
$s="insert into profilel (i_id,image) values ( '$iid','".$_FILES['file']['name']."')";
}elseif ($_SESSION['a_id']) {
$iid=$_SESSION['a_id'];
$s="insert into profilel (a_id,image) values ( '$iid','".$_FILES['file']['name']."')";
}else {
echo "invalid login details";
}
/*--------------------------------------------------*/
$q = mysqli_query($conn,$s);
$r=move_uploaded_file($_FILES['file']['tmp_name'],"profile/".$_FILES['file']['name']);
if(!$q && !$r) {
// echo "Server Error!!!";
}else {
// echo "Updated :)";
}
}else {
/*------------------------------------------------------*/
error_reporting(0);
if($_SESSION['l_id']){
$iid=$_SESSION['l_id'];
$s="update profilel set image='".$_FILES['file']['name']."' where l_id='$iid'";
}elseif ($_SESSION['i_id']) {
$iid=$_SESSION['i_id'];
$s="update profilel set image='".$_FILES['file']['name']."' where i_id='$iid'";
}elseif ($_SESSION['a_id']) {
$iid=$_SESSION['a_id'];
$s="update profilel set image='".$_FILES['file']['name']."' where a_id='$iid'";
}else {
echo "invalid login details";
}
/*------------------------------------------------------*/
$q = mysqli_query($conn,$s);
move_uploaded_file($_FILES['file']['tmp_name'],"profile/".$_FILES['file']['name']);
if(!$q) {
// echo "Server Error!!!";
}else {
// echo "Updated :)";
}
}
}}
?>
<body>
<br><br><br><br>
<div id="div">
<form action="profilel.php" method="post" enctype="multipart/form-data">
<div class="container">
<div class="col-md-6">
<input type="file" name="file">
<button type="submit" name="submit11">upload</button>
</div>
</div>
</form>
<?php
include_once 'php_connection.php';
/*-------------------------------------------------*/
error_reporting(0);
if($_SESSION['l_id']){
$iid=$_SESSION['l_id'];
$q = mysqli_query($conn,"SELECT image FROM `profilel` where l_id='$iid'");
}elseif ($_SESSION['i_id']) {
$iid=$_SESSION['i_id'];
$q = mysqli_query($conn,"SELECT image FROM `profilel` where i_id='$iid'");
}elseif ($_SESSION['a_id']) {
$iid=$_SESSION['a_id'];
$q = mysqli_query($conn,"SELECT image FROM `profilel` where a_id='$iid'");
}else {
echo "invalid login details";
}
/*-------------------------------------------------*/
while($row = mysqli_fetch_assoc($q)){
if(!$row['image']){
// echo "mmmmmmmmmmmmmmmmmmmmmmmm";
echo "<br><br><div class='container'><img width='100' height='100' src='profile/default.png' alt='Default Profile Pic'></div>";
} else {
// echo "hhhhhhhhhhhhhhhhhhhhhhhh";
echo "<br><br><div class='container'><img width='100' height='100' src='profile/".$row['image']."' alt='Profile Pic'></div>";
}
echo "<br>";
}
?></div>
<?php include "handf/footer_forms.php";?>
</body>