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.
Printable View
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 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.
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"?
There ;)PHP Code:<?php
$source = file_get_contents("index.php");
if (!eregi('Copyright 2007, all rights reserved', $source)) {
exit("Copyright not present");
}
?>
Many thanks again Danny.