Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    Regular Coder
    Join Date
    Jan 2007
    Posts
    142
    Thanks
    9
    Thanked 1 Time in 1 Post

    I can't get a line break

    Any idea why this line of code will end with a line break:

    PHP Code:
    $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?

    PHP Code:
    $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?

  • #2
    Senior Coder
    Join Date
    Sep 2005
    Posts
    1,791
    Thanks
    5
    Thanked 36 Times in 35 Posts
    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?
    My thoughts on some things: http://codemeetsmusic.com
    And my scrapbook of cool things: http://gjones.tumblr.com

  • #3
    Regular Coder
    Join Date
    Jan 2007
    Posts
    142
    Thanks
    9
    Thanked 1 Time in 1 Post
    Quote Originally Posted by GJay View Post
    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.
    Last edited by unrelenting; 02-25-2007 at 09:43 PM.

  • #4
    Senior Coder
    Join Date
    Jan 2007
    Posts
    1,648
    Thanks
    1
    Thanked 58 Times in 54 Posts
    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.)

  • #5
    Regular Coder
    Join Date
    Jan 2007
    Posts
    142
    Thanks
    9
    Thanked 1 Time in 1 Post
    Quote Originally Posted by aedrin View Post
    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.

  • #6
    Senior Coder
    Join Date
    Jan 2007
    Posts
    1,648
    Thanks
    1
    Thanked 58 Times in 54 Posts
    But you said it is part of an anti-leech script.

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

  • #7
    Regular Coder
    Join Date
    Jan 2007
    Posts
    142
    Thanks
    9
    Thanked 1 Time in 1 Post
    Quote Originally Posted by aedrin View Post
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •