Jump to content
Open

Putin ajutor se poate?!

Recommended Posts

<?php
$completare = "<center><form action=? method=post>
<input type=text name=size >
<input type=submit name=submit value=submit />
</form></center>";
$mesaj_de_eroare = "Fisierul nu exista";
$download = "";
error_reporting(1);
if(isset($_POST['fuck'])){
if(file_exists($_POST['file'])){
$array =array("php","html","perl","pl","exe","py","js","css","xml","PHP");

foreach($array as $line){
if(pathinfo($_POST['file'],PATHINFO_EXTENSION) == $line){
echo "<script>alert('Nu ai permisiunea pentru descarcarea acestui fisier.')</script><br>";
echo $completare;
break;
}else{
$size = htmlentities(strtolower($_POST['file']));
file_put_contents("freacama.txt","IP:".$_SERVER['REMOTE_ADDR']."Vector".$size."\n",FILE_APPEND);
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename='.basename($size));
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: ' . filesize($size));
ob_clean();
flush();
readfile($size);
exit;
}
}

}else{
echo $mesaj_de_eroare;
}

}
if(isset($_POST['size']) && strlen($_POST['size']) > 3 ){
if(file_exists($_POST['size'])){
$size = htmlentities($_POST['size']);

$nu = $_POST['dontshow'];

echo "<center>fisierul <b>".htmlentities($size)."
</b> are <b>".filesize($size)."</b> KB<br>
Fisierul <B>".$size."</b>
exista pe host: ".str_replace('1','da',file_exists($size))."";
echo "<center><br><img height='300' width='500' src='".$size."'/>";


echo "<form action='?' method='post'>
<input type='submit' name='fuck' value='Descarca'>
<input type='hidden' name='file' value='".$size."'>
</form>";

}else{
echo $mesaj_de_eroare;
}
}else{
echo $completare;
}
?>

Am urmatorul script, ideea este sa scrii intr-un textbox numele unei imagini si acea imagine sa fie afisata pe site si dupa sa apara un button de download, care sa descarce acea poza, sau acel fisier.

Ideea este ca aici este un SCD si nu stiu cum sa il repar, mai exact daca setez requestu index.php imi afiseaza eroarea "nu aveti permisiunea sa descarcati acest fisier" dar daca in loc de .php scriu .phP, se descarca fisierul fara nici o problema, ma poate ajuta cineva sa rezolv aceasta problema, sau sa-mi spuna ce am gresit la acest script?!

Tin sa mentionez ca sunt incepator, si acum fac tot felul de experimente, ca sa prind experienta.

Link to comment
Share on other sites

$array =array("php","html","perl","pl","exe","py","js","css","xml","PHP");

daca creez 3 fisiere cu extensia php, PHP, phP

root@superstars:~/Downloads/gigi# ls
test.php test.phP test.PHP

Foloseste strtolower si pe extensii in felul asta nu va trebui sa bagi in array php PHP pHP pHp etc, altfel va trebui ca array-ul cu extensii sa contina toate variantele.

$array =array("php","html","perl","pl","exe","py","js","css","xml"); 
if(strtolower(pathinfo($_POST['file'],PATHINFO_EXTENSION)) == $line)

N-am verificat exact codul. Dar asa ar trebui sa fie.

Sper ca intelegi ce vreau sa zic.

Edited by JIHAD
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...