Need help with protecting php,Html files.

Discussion in 'Programming' started by ajf7688, Apr 4, 2008.

  1. #1
    Ok heres my problem.

    i have domain http://www.xxx.com

    i got php file http://www.xxx.com/1.php

    i got html file http://www.xxx.com/1.html

    www.xxx.com/1.php when loaded in the browser loads 1.html.

    now i dont want both these files to be accesed directly thru browser at and wen accesed to dispaly a error message.

    but i want 1.php to be only loaded from 1 certain external domain eg stormpay.com

    Is there a way i do that i can use hotlinking to block direct access to the files and redirect ti to an error page or back to main page. But how do i access the page from a certain domain?

    Can any1 help me?
     
    ajf7688, Apr 4, 2008 IP
  2. it career

    it career Notable Member

    Messages:
    3,562
    Likes Received:
    155
    Best Answers:
    0
    Trophy Points:
    270
    #2
    php file cannot be copied , encrypt html files using javascript may be.
     
    it career, Apr 6, 2008 IP
  3. PowerExtreme

    PowerExtreme Banned

    Messages:
    2,118
    Likes Received:
    75
    Best Answers:
    0
    Trophy Points:
    0
    #3
    u can use reffer check to check whether the site is bieng accessed via which domain...
     
    PowerExtreme, Apr 6, 2008 IP
  4. ajf7688

    ajf7688 Active Member

    Messages:
    719
    Likes Received:
    2
    Best Answers:
    1
    Trophy Points:
    85
    #4
    hey m nt talkin bout downloading em. m talkin bout dirct access thru a browser.
     
    ajf7688, Apr 7, 2008 IP
  5. Xtrm2Matt

    Xtrm2Matt Active Member

    Messages:
    129
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    58
    #5
    htaccess? Deny the file '1.html' to be accessed by anyone, but allow the servers own IP address to access it.

    This will allow it to still be called through 1.php, but not accessed by anyone manually.

    .htaccess:
    <Files 1.html>
    Order deny,allow
    allow from [enter servers IP here]
    Deny from all
    </Files>
    Code (markup):
     
    Xtrm2Matt, Apr 7, 2008 IP
  6. ajf7688

    ajf7688 Active Member

    Messages:
    719
    Likes Received:
    2
    Best Answers:
    1
    Trophy Points:
    85
    #6
    Well for 'enter server ip here' can v put d domain naem i want access from??
     
    ajf7688, Apr 7, 2008 IP
  7. Xtrm2Matt

    Xtrm2Matt Active Member

    Messages:
    129
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    58
    #7
    I don't think so, sorry.
     
    Xtrm2Matt, Apr 7, 2008 IP
  8. Rob Whisonant

    Rob Whisonant Well-Known Member

    Messages:
    156
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    110
    #8
    Put this on the php page.

    if (!eregi("stormpay.com", $_SERVER['HTTP_REFERER'])) {
    die ("You can't access this file directly...");
    }

    Re's
    Rob Whisonant
     
    Rob Whisonant, Apr 8, 2008 IP
  9. Rob Whisonant

    Rob Whisonant Well-Known Member

    Messages:
    156
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    110
    #9
    You could also set in .htaccess to parse php in html files and add something similar to the html page so it only loads if called from a particular page.

    Re's
    Rob Whisonant
     
    Rob Whisonant, Apr 8, 2008 IP
  10. ajf7688

    ajf7688 Active Member

    Messages:
    719
    Likes Received:
    2
    Best Answers:
    1
    Trophy Points:
    85
    #10
    Damn jus wat i wanted ^^^ ur freakin amazin ill try that! ill keep ya posted if anything goes wrong!
     
    ajf7688, Apr 8, 2008 IP