...

View Full Version : I can't get a line break



unrelenting
02-25-2007, 06:29 PM
Any idea why this line of code will end with a line break:


$fdata=sprintf("%s%s%s%s%s%s%s%s%s%s%s%s","<b>Referer:</B> ",$_SERVER['HTTP_REFERER'],"<b> Wanted:</B> ",$serve,"<b> At:</B> ",$serverdate," <B>Remote Address:</B> ",$_SERVER['REMOTE_ADDR']," <B>Status:</B> ",$status,"<BR>","\n");

But this line doesn't?


$fdata=sprintf("%s%s%s%s%s%s%s%s%s%s%s%s","<b>Referer:</B><a href='",$_SERVER['HTTP_REFERER'],"'>",$_SERVER['HTTP_REFERER'],"</a><b> Wanted:</B> ",$serve,"<b> At:</B> ",$serverdate," <B>Remote Address:</B> ",$_SERVER['REMOTE_ADDR']," <B>Status:</B> ",$status,"<BR>","\n");

All I did was add the anchor tag for the referrer. Can anyone help me make this code line break after it is written?

GJay
02-25-2007, 06:44 PM
is there a reason you're using sprintf for that? it makes reading it very difficult, so I didn't, but if you've added an argument, did you add a %s to go with it?

unrelenting
02-25-2007, 09:36 PM
is there a reason you're using sprintf for that? it makes reading it very difficult, so I didn't, but if you've added an argument, did you add a %s to go with it?

I don't understand all that. It is part of a anti leech script. It is the part that writes to a file all the sites that triggered the script. In the first one is writes all of the info and then skips down 2 lines and begins the next there but if I add the a anchor tag to the HTTP_REFERER display to make it clickable then it stops the line break at the end. I have tried all sorts of other ways at the end to make it break but it just won't do it.

EDIT:

OK, I see what you mean. I added one more %s to that string and it worked. I have no idea what all that means but I added it up and it have 12 %s's and 12 commas after that so I counted the commas in my edited line and got 13. I added one and it works fine now.

Thanks.

aedrin
02-26-2007, 03:24 PM
Why not use simple string concatenation? This is hard to read.

And how would this make it anti-leech?

You can simply check the referrer and if it is not in your domain, return 404. Or replace it with a standard image (great fun can be had with this.)

unrelenting
02-27-2007, 12:15 AM
Why not use simple string concatenation? This is hard to read.

And how would this make it anti-leech?

You can simply check the referrer and if it is not in your domain, return 404. Or replace it with a standard image (great fun can be had with this.)

My files are in a hidden folder. It has more to do with that than keeping other sites from linking to the files. My path to the file is http://mysite.com/download.php?nameofmyfile.wmv. This script works near perfectly for hiding the location of video and audio files even while streaming them.

aedrin
02-27-2007, 05:04 PM
But you said it is part of an anti-leech script.

The easiest way to prevent leeching is to check the referrer.

unrelenting
02-28-2007, 01:03 AM
But you said it is part of an anti-leech script.

The easiest way to prevent leeching is to check the referrer.

Correct. The part that I was having the output issue with is the part that writes info to an html file IF someone posted a direct link to that file elsewhere. It serves no purpose other than that.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum