Include A File With Error Reporting

Started on the old forum in March 2008 · view the original in the archive · old links redirect here

7 replies · 803 views · started 18 years ago · 1 min read

4 participants
blackhowk Senior · 411 posts #1

<?php

$includefile="YOURFILE.php"; //using fopen to verify file. the third parameter triggers include_path search $handle = fopen($includefile, "r", 1); if ($handle) { fclose($handle); include ($includefile); } else { echo "file: $includefile not found in path"; echo "handle is: $handle"; }

?>

alesh Lead · 604 posts #2

dnt really understand wht this do......?

eeeeerrr....

Ghost Senior · 366 posts #3

dnt really understand wht this do......?

by the looks of this.. it trys to locate the GIVEN file and if it does not find the file specified it will show an error report saying file was not found..

lol but i maybe wrong..

<?php include ('Ghost'); if ($Post == true) { echo ' ![](http://destrukt.dk/ico/phpdeveloper.jpg) alt='coding-talk.com!!' />'; echo 'Sharing Is Caring!'; } else { echo ' ![](http://img98.imageshack.us/img98/6476/av3ro4.jpg) alt='the username GHOST has been comprimised!' />'; echo 'OMG SOMEBODY HELP ME!!'; } ?>
blackhowk Senior · 411 posts #4

by the looks of this.. it trys to locate the GIVEN file and if it does not find the file specified it will show an error report saying file was not found..

lol but i maybe wrong..

yes,yes.

chatabox Senior · 361 posts #5

You can also do this very erasily in .htaccess and just point to a page/s

ErrorDocument 400 [url]http://wap2ftp.com/index.php?act=error&bug=400[/url]
ErrorDocument 401 [url]http://wap2ftp.com/index.php?act=error&bug=401[/url]
ErrorDocument 402 [url]http://wap2ftp.com/index.php?act=error&bug=402[/url]
ErrorDocument 403 [url]http://wap2ftp.com/index.php?act=error&bug=403[/url]
ErrorDocument 404 [url]http://wap2ftp.com/index.php?act=error&bug=404[/url]
ErrorDocument 500 [url]http://wap2ftp.com/index.php?act=error&bug=500[/url]
ErrorDocument 501 [url]http://wap2ftp.com/index.php?act=error&bug=501[/url]
ErrorDocument 502 [url]http://wap2ftp.com/index.php?act=error&bug=502[/url]
ErrorDocument 503 [url]http://wap2ftp.com/index.php?act=error&bug=503[/url]
blackhowk Senior · 411 posts #6

You can also do this very erasily in .htaccess and just point to a page/s

ErrorDocument 400 http://wap2ftp.com/index.php?act=error&bug=400
ErrorDocument 401 http://wap2ftp.com/index.php?act=error&bug=401
ErrorDocument 402 http://wap2ftp.com/index.php?act=error&bug=402
ErrorDocument 403 http://wap2ftp.com/index.php?act=error&bug=403
ErrorDocument 404 http://wap2ftp.com/index.php?act=error&bug=404
ErrorDocument 500 http://wap2ftp.com/index.php?act=error&bug=500
ErrorDocument 501 http://wap2ftp.com/index.php?act=error&bug=501
ErrorDocument 502 http://wap2ftp.com/index.php?act=error&bug=502
ErrorDocument 503 http://wap2ftp.com/index.php?act=error&bug=503

yes and if the page have some email scripts inside you will receive emails with errors...

chatabox Senior · 361 posts #7

yes and if the page have some email scripts inside you will receive emails with errors...

Yeah not a bad idea, though you would probably end up with many 404 emails.

blackhowk Senior · 411 posts #8

Yeah not a bad idea, though you would probably end up with many 404 emails.

yes, but if you add in email some data useful? like: user agent, ip, date, carrier, phone, etc

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close