-
Notifications
You must be signed in to change notification settings - Fork 3
/
main.php
39 lines (34 loc) · 1.11 KB
/
main.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
<?php
session_start();
if (isset($_POST['idtoken']) && ($_POST['idtoken']) != null) {
$_SESSION['username'] = 'user';
if (isset($_SESSION['username'])) {
echo 'Welcome, ' . $_SESSION['username'];
if (isset($_POST["try_another_image"])) {
foreach (glob('uploads/*') as $file) {
if (basename($file) != '.gitignore.txt')
unlink($file);
// empties uploads folder after use
}
}
}
} else {
echo 'Please ensure you\'re authenticated with Google to view this page.';
die();
}
?>
<br>
<br>
<form action="upload.php" method="post" enctype="multipart/form-data">
Select an image to upload:
<input type="hidden" name="idtoken" value="<?php echo $_POST['idtoken'] ?>" />
<input type="file" name="fileToUpload" id="fileToUpload">
<input type="submit" value="Upload Image" name="submit">
</form>
<?php echo "<br><center><a href='weather.php?idtoken=$_POST[idtoken]'>Check out today's weather!</a></center>"; ?>
<br>
<br>
<br>
<form action="logout.php" method="POST">
<input type="submit" value="Logout" required />
</form>