php sets the index.php file as a read only method

  • 2020-05-30 19:42:09
  • OfStack

After setting the read-only property for the index.php file, the Trojan will not be able to give you the right to add ads to the end of the file.
Let's look at the code, index.php read only:


<?php
function set_writeable($file_name)
{
if(@chmod($file_name,0555))
{
  echo " Modify the index.php The file read-only property succeeded ";
}
else
{
  echo " Modify the index.php File read only property failed, space quotient does not support this operation! ";
}
}
set_writeable("index.php");
?> 

Save the above as setread.php, then upload to the space, and browse the address directly to the browser to set it to read only.
However, after setting this read-only property, you will not have the right to delete index.php by ftp yourself. If you want to delete or override index.php, please use the following code to set the read and write permission of index.php.
Here is the code to set index.php to read and write:


<?php
function set_writeable($file_name)
{
if(@chmod($file_name,0777))
{
  echo " Modify the index.php The file read and write property succeeded ";
}
else
{
  echo " Modify the index.php File read and write property failed, space quotient does not support this operation! ";
}
}
set_writeable("index.php");
?> 

Save setwrite.php, and you can set read and write access via your browser.


Related articles: