Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19
Protecting Files using PHP
Page 1 of 2 12 LastLast
Results 1 to 10 of 15

Thread: Protecting Files using PHP

  1. #1

    Protecting Files using PHP

    I have a script for me to browse the source code of my projects. I wrote the script in PHP so that I can have authentication working. I got the authentication part working. Very simple. However in my /var/www/htdocs/foo/

    I have foo.pl that I only want to be accessed if I logged in (authentication). But how do I make sure that if I type in the path to that file, it displays an error to log in rather than show the file ?

    I only want clients to see foo.pl if they have authentication.

    How can I do that?

    I would've searched google but I don't know how to search for this information.

    Any helps/hints are appreciated.

  2. #2

    Re:Protecting Files using PHP

    What are you using for authentication?

    You could always just type something like
    <?php exit("Go away" ?>
    at the top of the file, but that's a crappy fix

  3. #3

    Re:Protecting Files using PHP

    A simple way to do this would be by setting a cookie when the user logs in, and then in the script-needing-to-be-protected, check for that cookie, and if the cookie is not present, execute something like countach said above.

  4. #4

    Re:Protecting Files using PHP

    I thought he was using apache auth, I wonder if you can tell the server check sessions through the configs...

  5. #5

    Re:Protecting Files using PHP

    [quote author=Countach44 link=board=9;threadid=9920;start=0#msg89897 date=1098595368]
    I thought he was using apache auth, I wonder if you can tell the server check sessions through the configs...
    [/quote]

    I was just using a form: http://slack-er.mine.nu/tmp/form.html

    such as that.

    Chessforce, I'll try that thanks!

  6. #6

    Re:Protecting Files using PHP

    [quote author=Shebang link=board=9;threadid=9920;start=0#msg89904 date=1098626913]
    [quote author=Countach44 link=board=9;threadid=9920;start=0#msg89897 date=1098595368]
    I thought he was using apache auth, I wonder if you can tell the server check sessions through the configs...
    [/quote]

    I was just using a form: http://slack-er.mine.nu/tmp/form.html

    such as that.

    Chessforce, I'll try that thanks!
    [/quote]

    You are welcome!

    countach44: Do you mean like this?

  7. #7

    Re:Protecting Files using PHP

    I actually got it working through cookies! However, if I wanted an HTML file to check for the cookies, I'd need PHP for all of them, wouldn't I?

  8. #8

    Re:Protecting Files using PHP

    [quote author=Shebang link=board=9;threadid=9920;start=0#msg89918 date=1098642974]
    I actually got it working through cookies! However, if I wanted an HTML file to check for the cookies, I'd need PHP for all of them, wouldn't I?
    [/quote]

    You could use PHP to check for the cookies. However, I do not know whether it is the only way.

  9. #9

    Re:Protecting Files using PHP

    [quote author=chessforce link=board=9;threadid=9920;start=0#msg89921 date=1098655042]
    [quote author=Shebang link=board=9;threadid=9920;start=0#msg89918 date=1098642974]
    I actually got it working through cookies! However, if I wanted an HTML file to check for the cookies, I'd need PHP for all of them, wouldn't I?
    [/quote]

    You could use PHP to check for the cookies. However, I do not know whether it is the only way.
    [/quote]

    Well, I can always use Perl. However, I am using PHP since I'm developing a web based project in PHP, this is all practice for my project, which involves authentication to view stuff. Guess I'll just make all my files PHP.

    Thanks everyone for helping me out! karma++!

  10. #10

    Re:Protecting Files using PHP

    [quote author=chessforce link=board=9;threadid=9920;start=0#msg89912 date=1098640343]
    [quote author=Shebang link=board=9;threadid=9920;start=0#msg89904 date=1098626913]
    [quote author=Countach44 link=board=9;threadid=9920;start=0#msg89897 date=1098595368]
    I thought he was using apache auth, I wonder if you can tell the server check sessions through the configs...
    [/quote]

    I was just using a form: http://slack-er.mine.nu/tmp/form.html

    such as that.

    Chessforce, I'll try that thanks!
    [/quote]

    You are welcome!

    countach44: Do you mean like this?
    [/quote]
    nope, http://httpd.apache.org/docs/howto/auth.html

Similar Threads

  1. protecting root password
    By Ashutoshh in forum Linux - Hardware, Networking & Security
    Replies: 2
    Last Post: 03-17-2012, 11:07 AM
  2. DVD Files
    By sabkuchindia in forum Linux - Software, Applications & Programming
    Replies: 1
    Last Post: 04-20-2009, 05:38 PM
  3. Protecting from Attacks?
    By Wildheart in forum Linux - General Topics
    Replies: 5
    Last Post: 01-27-2006, 06:24 AM
  4. GCC Stack Protecting Patch
    By Ashcrow in forum Linux - General Topics
    Replies: 6
    Last Post: 12-23-2002, 02:24 AM
  5. .c files again
    By elovkoff in forum Linux - Hardware, Networking & Security
    Replies: 2
    Last Post: 05-21-2002, 07:15 PM

Bookmarks

Posting Permissions

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