Menu
Forums
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Trending
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Upgrades
Log in
Register
What's new
Search
Search
Search titles only
By:
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Software Development
Programming
Programming Q&A
PHP echo help
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="Weasel" data-source="post: 303718" data-attributes="member: 9520"><p>I agree with you on the text part, missed that out in the hurry. However, it would do the same thing as normal PHP in a page as your script.</p><p>[PHP]</p><p>public function errorCheck($text = null)</p><p>{</p><p> $displayErrorsTo = array('127.0.0.1', '12.34.56.78', '000.000.000.000');</p><p></p><p> if (in_array($_SERVER['REMOTE_ADDR'], $displayErrorsTo) && !is_null($text))</p><p> {</p><p> $error = "System error: " . $text . "<br />";</p><p> $error .= "Text: " . $text;</p><p> }</p><p> else</p><p> {</p><p> $error = "Out site has encountered an error we are trying to fix it as much as we can.";</p><p> }</p><p></p><p> return $error;</p><p>}[/PHP]</p><p></p><p>Unless you specifically call the function with the $text var in the call, it will return the else. If you do add a message in the call, it will call the error.</p><p></p><p>Example:</p><p>$class->errorCheck(); will return the else</p><p>$class->errorCheck($errortext); will return the detailed message</p></blockquote><p></p>
[QUOTE="Weasel, post: 303718, member: 9520"] I agree with you on the text part, missed that out in the hurry. However, it would do the same thing as normal PHP in a page as your script. [PHP] public function errorCheck($text = null) { $displayErrorsTo = array('127.0.0.1', '12.34.56.78', '000.000.000.000'); if (in_array($_SERVER['REMOTE_ADDR'], $displayErrorsTo) && !is_null($text)) { $error = "System error: " . $text . "<br />"; $error .= "Text: " . $text; } else { $error = "Out site has encountered an error we are trying to fix it as much as we can."; } return $error; }[/PHP] Unless you specifically call the function with the $text var in the call, it will return the else. If you do add a message in the call, it will call the error. Example: $class->errorCheck(); will return the else $class->errorCheck($errortext); will return the detailed message [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Software Development
Programming
Programming Q&A
PHP echo help
Top