| | |
cannot write file
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
•
•
Join Date: Mar 2008
Posts: 70
Reputation:
Solved Threads: 1
[code] target.php:
xas xjahs dajdh ajdhjas da d xxxx na dh ada hd
[code] main.php:
<?php
// removal malicious script by forzadraco
$filename="target.php";
$existfile=@fopen($filename,"w");
if($existfile){
echo "file berhasil dibaca \n\n";
}else{
echo "file gagal dibaca \n\n";
}
if( false == ($str=file_get_contents( $filename )))
echo "Could not read file.";
else
echo "File contents: ".htmlspecialchars($str);
$hsl=preg_replace("/xxxx/i","draco",$str);
echo "<hr />".htmlspecialchars($hsl);
fwrite($existfile,$hsl);
fclose($existfile);
?>
why is not work ? and why target.php become empty file..?
thanks
xas xjahs dajdh ajdhjas da d xxxx na dh ada hd
[code] main.php:
<?php
// removal malicious script by forzadraco
$filename="target.php";
$existfile=@fopen($filename,"w");
if($existfile){
echo "file berhasil dibaca \n\n";
}else{
echo "file gagal dibaca \n\n";
}
if( false == ($str=file_get_contents( $filename )))
echo "Could not read file.";
else
echo "File contents: ".htmlspecialchars($str);
$hsl=preg_replace("/xxxx/i","draco",$str);
echo "<hr />".htmlspecialchars($hsl);
fwrite($existfile,$hsl);
fclose($existfile);
?>
why is not work ? and why target.php become empty file..?
thanks
http://www.duniaislam.site50.net
Others Social Bookmarking http://www.bisnis-indonesia.org
Business Web Directory
http://www.bisnis-indonesia.biz
Others Social Bookmarking http://www.bisnis-indonesia.org
Business Web Directory
http://www.bisnis-indonesia.biz
php Syntax (Toggle Plain Text)
<?php // removal malicious script by forzadraco $filename="target.php"; $existfile=fopen($filename,"a+"); if($existfile){ echo "file berhasil dibaca \n\n"; }else{ echo "file gagal dibaca \n\n"; } if( false == ($str=file_get_contents( $filename ))) echo "Could not read file."; else echo "File contents: ".htmlspecialchars($str); $hsl=preg_replace("/xxxx/i","draco",$str); echo "<hr />".htmlspecialchars($hsl); fwrite($existfile,$hsl); fclose($existfile); ?>
Ignorance is definitely not bliss!
*PM asking for help will be ignored*
*PM asking for help will be ignored*
I have read the script and if you are using php5 then the following might be better with the functions file_get_contents and file_put_contents.
Note: It's good to see you made an attempt at adding the opening code tags but next time try to add the closing code tags too.
php Syntax (Toggle Plain Text)
<?php // removal malicious script by forzadraco $filename="target.php"; $existfile=file_get_contents($filename); if($existfile){ echo "file berhasil dibaca \n\n"; }else{ echo "file gagal dibaca \n\n"; } if( false == ($str=file_get_contents( $filename ))) { echo "Could not read file."; } else { echo "File contents: ".htmlspecialchars($str); } $hsl=preg_replace("/xxxx/i","draco",$str); echo "<hr />".htmlspecialchars($hsl); file_put_contents($hsl,$existfile); ?>
Try not to bump 10 year old threads as it can be really annoying.
http://syntax.cwarn23.net/
My favourite PC. - Oopy Doopy Do 2U2!
http://syntax.cwarn23.net/
Smilies: ^_* +_+ v_v -_- *~*` My favourite PC. - Oopy Doopy Do 2U2!
![]() |
Similar Threads
- Write to a file in C++ (C++)
- Read/write to same file > once, Help (C++)
- write in file and screen? (C++)
- Write to a file (C)
- line up JTextField GUI java & write to file (Java)
Other Threads in the PHP Forum
- Previous Thread: Record with image upload script/ help?
- Next Thread: nl2br question
| Thread Tools | Search this Thread |
Tag cloud for PHP
.htaccess access ajax apache api array beginner binary broken cakephp checkbox class cms code cron curl database date directory display download dynamic echo email encode error fcc file files folder form forms function functions google howtowriteathesis href htaccess html image images include insert integration ip java javascript joomla ldap limit link login loop mail menu methods mlm mod_rewrite multiple multipletables mysql oop open parse paypal pdf php problem query radio random recursion regex remote script search server sessions sms soap source space speed sql structure syntax system table template tutorial update upload url validation validator variable video web xml youtube






