unidox Posted May 27, 2008 Share Posted May 27, 2008 I have this script: $url = "http://www.site.com/license.php?key=" . SITE_LIC . "&ref=" . $_SERVER["SERVER_NAME"] . ""; $lic = @fopen($url, "r+"); $lic = @fread($lic, 8192); if ($lic == "0") { header("Location: http://www.site.com/index.php?p=lic_invalid&site=" . $_SERVER["SERVER_NAME"] . ""); exit(); } fclose($lic); If I type the url in my address bar, it outputs 1 as desired. But when I try to echo $lic, nothing even outputs. Whats wrong? Quote Link to comment Share on other sites More sharing options...
haku Posted May 27, 2008 Share Posted May 27, 2008 You are having some errors somewhere. Take away the '@' sign, as this suppresses errors and just skips over them. This may tell you what your problem is. Using the '@' sign is almost always sloppy programming, and should only ever be used a very small number of situations. Quote Link to comment Share on other sites More sharing options...
The Little Guy Posted May 27, 2008 Share Posted May 27, 2008 I don't know of any situation where it is needed, that is what if/else is for. Quote Link to comment Share on other sites More sharing options...
haku Posted May 27, 2008 Share Posted May 27, 2008 I found one when working with gd image functions a while back. I can't remember the exact details, but it returned an error when nothing was found, instead of a -1 or something that I could have used. In that one situation it was preferable to use the '@' symbol, but I have never found any other situations. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.