I am trying to use the file_get_contents to check a variable in a different document however it's not checking the document (index.php) and then echo the result.

I am trying to use the file_get_contents to check a variable in a different document however it's not checking the document (index.php) and then echo the result.
PHP Code:<?php
$license = file_get_contents("index.php");
$license = "Copyright 2007, all rights reserved.";
if ($license == FALSE){
echo"You cannot remove the copyright disclaimer!";
}
else
{
}
?>
Good-bye signature, I love <NOT ALLOWED NAME AT ALL> despite the infraction his last name got me.
Free speech? Not anymore, you gotta' love this forum.
I dont see how that code would work...
Try thatPHP Code:<?php
$source = file_get_contents("index.php");
if (eregi('Copyright 2007, all rights reserved', $source)) {
print("Copyright present");
}
else{
print("Copyright not present");
}
?>
Works great, thanks Danny.
Good-bye signature, I love <NOT ALLOWED NAME AT ALL> despite the infraction his last name got me.
Free speech? Not anymore, you gotta' love this forum.
Is there anyway that it if the copyright is present that it will do nothing if not it will die and echo "Copyright not present"?
Good-bye signature, I love <NOT ALLOWED NAME AT ALL> despite the infraction his last name got me.
Free speech? Not anymore, you gotta' love this forum.
TherePHP Code:<?php
$source = file_get_contents("index.php");
if (!eregi('Copyright 2007, all rights reserved', $source)) {
exit("Copyright not present");
}
?>![]()
Many thanks again Danny.
Good-bye signature, I love <NOT ALLOWED NAME AT ALL> despite the infraction his last name got me.
Free speech? Not anymore, you gotta' love this forum.
Want to hide these adverts? Register an account for free!