-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaccount.php
164 lines (150 loc) · 4.5 KB
/
account.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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
<?php
error_reporting(E_ALL ^ E_NOTICE);
require_once("models/config.php");
if (!securePage($_SERVER['PHP_SELF'])){die();}
$target_dir = "documents/".$loggedInUser->username."/";
if (!file_exists($target_dir)) {
mkdir($target_dir, 0777, true);
}
if($_POST['submit']){
$target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]);
$uploadOk = 1;
$imageFileType = pathinfo($target_file,PATHINFO_EXTENSION);
// Check if image file is a actual image or fake image
if(isset($_POST["submit"])) {
$check = getimagesize($_FILES["fileToUpload"]["tmp_name"]);
if($check !== false) {
$uploadOk = 1;
} else {
echo "File is not an image.";
$uploadOk = 0;
}
}
// Check if file already exists
if (file_exists($target_file)) {
echo "Sorry, file already exists.";
$uploadOk = 0;
}
// Check file size
if ($_FILES["fileToUpload"]["size"] > 500000) {
echo "Sorry, your file is too large.";
$uploadOk = 0;
}
// Allow certain file formats
if($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg"
&& $imageFileType != "gif" ) {
echo "Sorry, only JPG, JPEG, PNG & GIF files are allowed.";
$uploadOk = 0;
}
// Check if $uploadOk is set to 0 by an error
if ($uploadOk == 0) {
echo "Sorry, your file was not uploaded.";
// if everything is ok, try to upload file
} else {
if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) {
} else {
echo "Sorry, there was an error uploading your file.";
}
}
}
$dirname = $target_dir;
$images = glob($dirname."*.jpg");
foreach($images as $image) {
echo '<center><img id="acc_p" src="'.$image.'" /></center><br />';
}
?>
<!DOCTYPE html>
<head>
<title><?php echo $loggedInUser->username." - ColonyCollab"; ?></title>
<link rel="stylesheet" type="text/css" href="assets/css/main.css">
<style>
#acc_p{
align-items: center;
width: 200px;
height: 200px;
border-radius: 50%;
background-color: grey;
margin-left: 85px;
margin-top: 20px;
}
#regbox{
margin-top: 100px;
}
#error{
padding-top: 25px;
text-align: center;
color: red;
overflow: hidden;
}
body{
color: #000;
}
#error li{
list-style: none;
}
h2{
padding-left: 20px;
}
form{
margin-top: 20px;
}
#ip{
width: 400px;
margin-top: 20px;
margin-bottom: 20px;
}
</style>
</head>
<body>
<body class="subpage">
<!-- Header -->
<header id="header">
<div class="inner">
<a href="index.php" class="logo">Colony</a>
<nav id="nav">
<a href="home.php">Home</a>
<a href="add_event.php">Add a event</a>
<a href="account.php"><?php echo $loggedInUser->username; ?></a>
<a href="user_settings.php">Update Profile</a>
<a href="logout.php">Logout</a>
</nav>
<a href="#navPanel" class="navPanelToggle"><span class="fa fa-bars"></span></a>
</div>
</header>
<div>
<center><form action="account.php" method="post" enctype="multipart/form-data">
Upload your image:
<input type="file" name="fileToUpload" id="fileToUpload">
<input type="submit" value="Upload Image" name="submit">
</form>
<h2>Username: <?php echo " ".$loggedInUser->username; ?></h2>
<h2>Email: <?php echo " ".$loggedInUser->email; ?></h2>
<?php
$sql123 = "SELECT * FROM send_request WHERE to_id='$loggedInUser->user_id'";
$result123 = mysqli_query($mysqli, $sql123);
while($rows = mysqli_fetch_assoc($result123)){
$sent = $rows['sent'];
$accepted = $rows['accepted'];
$naccepted = $rows['not_accepted'];
$prid = $rows['proj_id'];
$from = $rows['from_user'];
$_SESSION["prid"] = $prid;
$_SESSION["from"] = $from;
if($sent == '1' && $accepted == '0' && $naccepted == '0'){
echo "<h2 style='color: green;'>Notifications: Join Request from <b style='color: green;'>".$from."</b><br /><a href='acc.php'> Accept</a><a style='color: red;' href='del.php'> Delete</a></h2>";
}
else{
echo "<h2 style='color: green;'>Notifications: No New Request</h2>";
}
}
?>
</center>
</div>
<!-- Scripts -->
<script src="assets/js/jquery.min.js"></script>
<script src="assets/js/skel.min.js"></script>
<script src="assets/js/util.js"></script>
<script src="assets/js/main.js"></script>
<script src="assets/js/reg.js"></script>
</body>
</html>