babfo adlı üyeden alıntı:
mesajı görüntüle
PHP bir yerde takıldım
14
●178
- 14-11-2021, 18:13:43
<?php $file = 'test.txt'; if(!file_exists($file)){ fopen($file,"w"); } $getFile = file_get_contents($file); if(isset($_POST['submit'])) { $filetmp = $_FILES["image"]["tmp_name"]; $filename = $_FILES["image"]["name"]; $checker = getimagesize($filetmp); if($checker !== false) { $output = "success"; move_uploaded_file($filetmp, $filename); file_put_contents($file, $filename); }else{ $output = "error"; } } ?> <html> <body> <?php if(!empty($getFile)){ ?> <img src="<?php echo file_get_contents($file); ?>"><br> <p><?php echo 'https://'.$_SERVER['SERVER_NAME'].'/'.file_get_contents($file); ?></p> <?php } ?> <?php if(isset($output)){ ?> <script> alert('<?php echo $output; ?>'); window.location.reload(); </script> <?php } ?> <form action="#" method="POST" enctype="multipart/form-data"> <input type="file" name="image"> <input type="submit" name="submit"> </form> </body> </html> - 14-11-2021, 18:31:55Üyeliği durdurulduçok çok teşekkür ederim emek verip yazmışınız ben kendi kullandığım şablona uyarlıyamadım onun üzerinden yardımcı olabilir misiniz?brown adlı üyeden alıntı: mesajı görüntüle
if (isset($_POST['playerlogoduzenle'])) { if ($_FILES['player_logo']['size']>1048576) { echo "Bu dosya boyutu çok büyük"; Header("Location:../player-ayarlar.php?durum=dosyabuyuk"); exit; } $izinli_uzantilar=array('jpg','gif','','png'); //echo $_FILES['ayar_logo']["name"]; $ext=strtolower(substr($_FILES['player_logo']["name"],strpos($_FILES['player_logo']["name"],'.')+1)); if (in_array($ext, $izinli_uzantilar) === false) { echo "Bu uzantı kabul edilmiyor"; Header("Location:../player-ayarlar.php?durum=formathata"); exit; } $uploads_dir = '../../dimg'; @$tmp_name = $_FILES['player_logo']["tmp_name"]; @$name = $_FILES['player_logo']["name"]; $benzersizsayi4=rand(20000,32000); $refimgyol=substr($uploads_dir, 6)."/".$benzersizsayi4.$name; $bos = "0"; @move_uploaded_file($tmp_name, "$uploads_dir/$benzersizsayi4$name"); if(!$name){ $duzenle=$db->prepare("UPDATE player SET player_logo=:logo"); $update=$duzenle->execute(array( 'logo' => $bos )); Header("Location:../player-ayarlar.php?durum=ok"); }else{ $duzenle=$db->prepare("UPDATE player SET player_logo=:logo"); $update=$duzenle->execute(array( 'logo' => $refimgyol )); if ($update) { $resimsilunlink=$_POST['eski_yol']; unlink("../../$resimsilunlink"); Header("Location:../player-ayarlar.php?durum=ok"); } else { Header("Location:../player-ayarlar.php?durum=no"); } } } - 14-11-2021, 18:39:27post normal veri için eğer fotoğraf yapacaksanız files kullanmanız gerekiyor.shingeki adlı üyeden alıntı: mesajı görüntüle
- 14-11-2021, 18:41:01Üyeliği durduruldubu örnekteki gibi değiştim hocam hiçbir şekilde istediğim dosyanın içine kaydetmiyor kodda sorun görünüyor mu?Tartaros adlı üyeden alıntı: mesajı görüntüle
<?php if (isset($_POST['playerlogoduzenle'])) { $dosya = fopen('player-ayarlari.php', 'w'); $icerik = '<?php $player_logo="'.$_FILES['player_logo'].'"; ?>'; fwrite($dosya, $icerik); fclose($dosya); header("refresh:0;player-ayarlar.php?kaydet=1"); } ?>