-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
59 lines (51 loc) · 1.85 KB
/
index.php
File metadata and controls
59 lines (51 loc) · 1.85 KB
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
<?php
//http://localhost/WebProgramming/index.php?list=user&orderby=name&direction=asc
//echo $_GET['list'] . "<br>";
//echo $_GET['orderby'] . "<br>";
//echo $_GET['direction'] . "<br>";
//http://localhost/WebProgramming/index.php?list=user&order[by]=name&order[dir]=asc
//echo $_GET['order']['by'] . "<br>";
//echo $_GET['order']['dir'] . "<br>";
//get.php
if (!empty($_GET)){
var_dump($_GET);
echo $_SERVER['PHP_SELF'] . "<br>";
$data = "Max & Ruby" . "<br>";
echo "http://www.phparch.com/index.php?name="
. urlencode ($data);
}
//post.php
if (isset($_POST['login'])) {
var_dump($_POST);
if ($_POST['user'] == "admin" &&
$_POST['pass'] == "secretpassword") {
echo "Successful Login";
}
}
//post2.php
if (isset($_POST['languages'])) {
var_dump($_POST);
foreach ($_POST['languages'] as $language) {
switch ($language) {
case 'PHP' :
echo "PHP? Awesome! <br />";
break;
case 'Perl' :
echo "Perl? Ew. Just Ew. <br />";
break;
case 'Ruby' :
echo "Ruby? Can you say... 'bandwagon?' <br />";
break;
default:
echo "Unknown language!";
}
}
}
//fileupload.php
if (isset($_FILES['filedata']) && $_FILES['filedata']['error'] == UPLOAD_ERR_OK && $_FILES['filedata']['size'] != 0 && $_FILES['filedata']['tmp_name'] != 'none' && is_uploaded_file($_FILES['filedata']['tmp_name'])) {
$info = new SplFileInfo(basename($_FILES['filedata']['tmp_name']));
$serverFileName = '0.' . $info->getExtension();
$files = [$serverFileName => basename($_FILES['filedata']['tmp_name'])];
move_uploaded_file($_FILES['filedata']['tmp_name'], "C:\Users\\" . get_current_user(). "\\Desktop\\" . $serverFileName); //uses is_uploaded_file
var_dump($_FILES);
}