-
Notifications
You must be signed in to change notification settings - Fork 0
/
process.php
118 lines (85 loc) · 2.1 KB
/
process.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
<!DOCTYPE HTML>
<HTML LANG = "EN">
<BODY>
<div class = "main">
<img class = "img" src = "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTQZPS3qcb500ScF2XCPLMBUliOd4ItDhcg_S1Z2QGMdRztUxEVDA" align = "left">
<h1>
WELCOME TO DPS BOKARO IMAGE PORTAL .... MADE BY RDKSUPER ©;
</H1>
<p>
<div class = "box">
<?php
$id = $_POST['id'] ;
$path = 'http://dpsbokaro.net/sopanschool2.0/uploads/' ;
$ext = '.jpg' ;
//The resource that we want to download.
$fileUrl = "$path$id$ext";
//The path & filename to save to.
$saveTo = "$id.jpg";
//Open file handler.
$fp = fopen($saveTo, 'w+');
//If $fp is FALSE, something went wrong.
if($fp === false){
throw new Exception('Could not open: ' . $saveTo);
}
//Create a cURL handle.
$ch = curl_init($fileUrl);
//Pass our filehandle to cURL.
curl_setopt($ch, CURLOPT_FILE, $fp);
//Timeout if the file doesn't download after 20 seconds.
curl_setopt($ch, CURLOPT_TIMEOUT, 20);
//Execute the request.
curl_exec($ch);
//If there was an error, throw an Exception
if(curl_errno($ch)){
throw new Exception(curl_error($ch));
}
//Get the HTTP status code.
$statusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
//Close the cURL handler.
curl_close($ch);
if($statusCode == 200){
echo 'Downloaded!';
} else{
echo "Status Code: " . $statusCode;
}
echo '<img src="' . $saveTo . '">';
echo '<P>' ;
echo 'YOUR STUDENT ID IS ' . '<b>'.$id . '</b>' ;
echo 'your image has been downloaded to this server !!!' ;
echo 'right click save as to download' ;
?>
</div>
</div>
<style>
div.box {
padding-top:100px;
width:40%;
height:50%;
overflow:auto;
margin-left:auto ;
margin-right:auto;
text-align: center;
}
div.main H1 {
text-align: center;
text-decoration:bold underline ;
text-emphasis: none;
margin-left:auto;
margin-right:auto;
}
div.main {
border: 25px solid green ;
}
.img {
height:50%;
padding:30px 40px ;
}
div.box img {
width:300px ;
height:300px ;
border: 5px solid black ;
}
</style>
</BODY>
</HTML>