Results 1 to 9 of 9

Thread: Getting 'acces denied'

  1. #1
    Join Date
    Sep 2011
    Posts
    25
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Exclamation Getting 'acces denied'

    Hi,
    I am getting access denied error when i run this code -
    PHP Code:
    <?php
    if($_GET['pass'] != 'password') die('access denied');
    error_reporting(E_ALL);
    if(!
    is_dir('thumbs')) mkdir('thumbs') or die('can\'t create thumbs directory');
    $file_list = array();

    if (
    $handle opendir('.')) {
       while (
    false !== ($file readdir($handle))) {
          if (
    strtolower(array_pop(explode('.',$file))) == 'jpg') {
             
    $file_list[] = $file;
          }
       }
       
    closedir($handle);
    }

    $count 0;
    $total count($file_list);
    foreach(
    $file_list as $file) {
       
    $save_path getcwd().'/thumbs/';
       
    $im imagecreatefromjpeg($file);
       
    $new_x imagesx($im) / 10;
       
    $new_y imagesy($im) / 10;
       
    $small imagecreatetruecolor($new_x,$new_y);
       
    imagecopyresampled($small,$im,0,0,0,0,$new_x,$new_y,imagesx($im),imagesy($im));
       
    imagejpeg($small,$save_path.$file,85);
       
    imagedestroy($im);
       
    imagedestroy($small);
       
    usleep(100);
       
    set_time_limit(90);
       
    $count++;
       echo 
    "Working on file {$count} / {$total}<br>\n";
       
    flush();
    }
    ?>
    It basically tries to create a thumbnail gallery.Do i need some .jpeg images in the same folder where the php file is located?
    Pls help

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    PHP Code:
    if($_GET['pass'] != 'password') die('access denied'); 
    Looks to me like you didn't have the "password". Either remove this line, or type the URL like this:
    your-website.com/somewhere/page.php?pass=password

    Whoever created that script used that as a security precaution so no one else could modify the images. But of course if you don't want it, it's not necessary for the rest of the script.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. The Following User Says Thank You to djr33 For This Useful Post:

    megha (09-20-2012)

  4. #3
    Join Date
    Sep 2011
    Posts
    25
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Default

    Thanks now it works!!

  5. #4
    Join Date
    Mar 2011
    Posts
    2,144
    Thanks
    59
    Thanked 116 Times in 113 Posts
    Blog Entries
    4

    Default

    If this thread is finished, please set it to resolved.
    You can do this by editing the first post within the thread - Pressing go advanced - Then where it says no prefix, selecting resolved then save.

  6. #5
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    Quote Originally Posted by djr33 View Post
    Whoever created that script used that as a security precaution ...
    of course, it's not *much* of a security precaution.

    if your site doesn't have a user login system (and since you're checking for a password directly in this script, I'm assuming it doesn't), then it will be an easy guess that the password should be in the query string. and "password" (along with "secret", "123456", "qwerty", and "f***") is probably the first password a malicious user will try.

    A much, much better solution would be to *remove* this script from your server once you're done using it.
    If you need to use it regularly, you should work out a better security measure.

  7. #6
    Join Date
    Mar 2011
    Posts
    2,144
    Thanks
    59
    Thanked 116 Times in 113 Posts
    Blog Entries
    4

    Default

    Quote Originally Posted by traq View Post
    if your site doesn't have a user login system (and since you're checking for a password directly in this script, I'm assuming it doesn't), then it will be an easy guess that the password should be in the query string. and "password" (along with "secret", "123456", "qwerty", and "f***") is probably the first password a malicious user will try.
    Who tries f*** as a password?

  8. #7
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    words of a, shall we say, "uncouth" nature? are common as passwords.
    it's pretty easy to remember, after all - often the first utterance after multiple failed login attempts.

  9. #8
    Join Date
    May 2012
    Location
    Hitchhiking the Galaxy
    Posts
    1,013
    Thanks
    46
    Thanked 139 Times in 139 Posts
    Blog Entries
    1

    Default

    According to the password bible, made after the playstation network's password databases were breached, the most common password was:
    "Seinfeld"
    Followed by:
    "Purple"
    "Princess"
    "Abc123
    "Most good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program." - Linus Torvalds
    Anime Views Forums
    Bernie

  10. #9
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    of course, it's not *much* of a security precaution.

    if your site doesn't have a user login system (and since you're checking for a password directly in this script, I'm assuming it doesn't), then it will be an easy guess that the password should be in the query string. and "password" (along with "secret", "123456", "qwerty", and "f***") is probably the first password a malicious user will try.

    A much, much better solution would be to *remove* this script from your server once you're done using it.
    If you need to use it regularly, you should work out a better security measure.
    This is all true. But... it does provide some security-- if people don't know this page exists, and they don't know to try a password in the address bar... they just won't have access, regardless of how weak the password is. Note that "pass" is also acting as a sort of password-- they'd have to try other combinations like password=password and p=password also, not to mention password=pass, etc.
    But, the fatal problem here is that it gives you a hint about what's wrong. This script should show NOTHING if there's an error, or better yet give a (fake) 404.

    Regardless, it's not doing much here anyway. Removing it from the server is a good idea. Or you could just add "exit;" to the top of the page-- disable it for everyone, including yourself-- edit it later if you need to use it.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

Similar Threads

  1. session_start() Permission denied
    By TwitterRooms in forum PHP
    Replies: 1
    Last Post: 02-02-2012, 04:59 PM
  2. acces DB asp&wml...sound bad aaa?:)
    By sasha hantz in forum MySQL and other databases
    Replies: 1
    Last Post: 05-19-2007, 10:41 AM
  3. Denied Access
    By boogyman in forum MySQL and other databases
    Replies: 6
    Last Post: 04-13-2007, 12:20 AM
  4. Access denied.
    By madkidd in forum JavaScript
    Replies: 5
    Last Post: 10-20-2006, 03:16 PM
  5. Access Denied Problem
    By mahathi in forum ASP
    Replies: 5
    Last Post: 08-09-2006, 04:06 AM

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
  •