-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathresult.php
99 lines (72 loc) · 1.87 KB
/
result.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
<!DOCTYPE html>
<head>
<title>IITM 544 Cloud</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link href="design.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="page">
<div class="titre">
ITM 544 CLOUD
</div>
<?php
session_start ();
$_SESSION['login'] = $_POST['login'];
$_SESSION['email'] = $_POST['email'];
$_SESSION['cellphone'] = $_POST['cellphone'];
$uploaddir = '/var/www/uploads/';
$uploadfile = $uploaddir . basename($_FILES['userfile']['name']);
echo '<pre>';
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
echo "File is valid, and was successfully uploaded.\n";
} else {
echo "Possible file upload attack!\n";
}
//echo 'Here is some more debugging info:';
//print_r($_FILES);
print "</pre>";
// Include the SDK using the Composer autoloader
require 'vendor/autoload.php';
use Aws\S3\S3Client;
$client = S3Client::factory();
$bucket = uniqid("php-arthurma4-", true);
//echo "Creating bucket named {$bucket}\n";
$result = $client->createBucket(array(
'Bucket' => $bucket
));
// Wait until the bucket is created
$client->waitUntilBucketExists(array('Bucket' => $bucket));
$key = $uploadfile;
//echo "Creating a new object with key {$key}";
//echo "<br />";
$result = $client->putObject(array(
'ACL' => 'public-read',
'Bucket' => $bucket,
'Key' => '$key',
'SourceFile' => $uploadfile
));
//echo $result['ObjectURL'] . "<br />";
//echo "<br />";
$url = $result['ObjectURL'];
?>
<div class="element2">
<div class="form2";">
<p><h2>
<?php
echo "Hello {$_SESSION['login']} !";
echo "<br />";
echo "Email : {$_SESSION['email']}";
echo "<br />";
echo "Cellphone : {$_SESSION['cellphone']}";
echo "<br />";
?>
</p></h2>
<br>
<center><img src="<?php echo $url; ?>" alt="picture"></center>
</div>
<footer>
Arthur CLOUET - ITM 544 CLOUD
</footer>
</div>
</body>
</html>