Jump to content

[SOLVED] fread


unidox

Recommended Posts

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.