Go Back   CodingForums.com > :: Client side development > General web building

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-03-2012, 08:04 AM   PM User | #1
john6
New Coder

 
Join Date: Sep 2012
Posts: 47
Thanks: 0
Thanked 0 Times in 0 Posts
john6 is an unknown quantity at this point
Security advice?

Hi all,

Is there anything I need to know to 'secure' my website/server after I have finished making my site?

I need to make sure that unauthorized people can't access the files on the server.

Also, I have a register/login/password user system - how can I ensure the wrong person can't login as someone else? How to ensure that data transmitted to the server is secure (via logins/registration)?

Would greatly appreciate any help!

J.
john6 is offline   Reply With Quote
Old 10-03-2012, 08:26 AM   PM User | #2
shyagrawal
New Coder

 
Join Date: Sep 2012
Posts: 22
Thanks: 0
Thanked 6 Times in 6 Posts
shyagrawal is an unknown quantity at this point
Create guest page and show if unauthorized user try to login.
shyagrawal is offline   Reply With Quote
Old 10-04-2012, 08:47 PM   PM User | #3
patryk
Regular Coder

 
patryk's Avatar
 
Join Date: Oct 2012
Location: /dev/couch
Posts: 395
Thanks: 2
Thanked 64 Times in 64 Posts
patryk is on a distinguished road
if you're afraid that passwords/usernames can be captured, then answer is simple: use ssl.
about preventing unauthorized access to files via http:
i do it this way: i keep files outside of server's directories and only way to retrieve them from cient's side is to call PHP.
for example if you use cookies for athentication, u do somethink like that:
Code:
if(!isset($_COOKIE['some_auth_cookie'])){
    die();
}
if($_COOKIE['some_auth_cookie'] != $expected_value){
    die();
}
$filename_with_path = '/path/to/your/files/' . $_GET['file'];
if(!file_exists($filename_with_path)){
   die();
}
header('Content-type: ' . mime_content_type($filename_with_path));
header('Content-Disposition: attachment; filename="'. $_GET['file'] .'"');
readfile($filename_with_path);
And then instead of linking files like you always do, you direct users to say example.com/download-script.php?file=some-file.pdf
this is not exact code u can use but gives u idea how to aproach this
patryk is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 01:07 AM.


Advertisement
Log in to turn off these ads.