Skip to content

About

Hiding image, pdf etc url in the site in browser source code and browser's development mode.

Resources

Contributing

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

Β 

History

16 Commits

Folders and files

Repository files navigation

πŸ”’ Hidden URL - Secure File Access System

PHP Version License GitHub Stars GitHub Forks Live Demo Interactive Demo

Hash-based URL system for secure file access - Protect PDFs, images, videos and other files from direct access.

πŸš€ Features

  • πŸ” Secure Access: Protect your files with hash-based URLs
  • 🌐 Referer Control: Allow access only from specific domains
  • πŸ“ Multi-Format Support: PDF, images, videos and other file types
  • ⚑ Fast & Lightweight: Maximum performance with minimal PHP code
  • πŸ›‘οΈ Security: Prevent direct file access
  • πŸ”§ Easy Integration: Easily integrate into existing projects

πŸ“‹ Requirements

  • PHP 7.4 or higher
  • Web server (Apache, Nginx, etc.)
  • File read permissions

πŸ› οΈ Installation

  1. Clone the project:
git clone https://github.com/byrmstf/hidden-url.git
cd hidden-url
  1. Copy files to your web server's root directory

  2. Place your files in the documents/ folder

  3. Update hash values in img.php file:

$file_config = array(
    'your-file-hash' => array(
        'file' => 'your-file.pdf',
        'type' => 'application/pdf',
        'size' => 123456
    ),
);

πŸ“– Usage

Basic Usage

// Define file hashes in img.php file
$file_config = array(
    '05edd57091ad570303df856c652a7a174554a148' => array(
        'file' => 'sample.pdf',
        'type' => 'application/pdf',
        'size' => 433994
    ),
);

HTML Usage

<object data="/img.php?h=05edd57091ad570303df856c652a7a174554a148" 
        type="application/pdf" width="100%" height="800px">
    <embed width="100%" height="1000px" 
           src="/img.php?h=05edd57091ad570303df856c652a7a174554a148"/>
</object>

Security Settings

// Referer control (optional)
$allowed_domains = ['yourdomain.com', 'www.yourdomain.com'];
$referer = $_SERVER['HTTP_REFERER'] ?? '';
$is_allowed = false;

foreach ($allowed_domains as $domain) {
    if (strpos($referer, $domain) !== false) {
        $is_allowed = true;
        break;
    }
}

if (!$is_allowed) {
    http_response_code(403);
    die('Access denied');
}

πŸ”§ Advanced Features

Hash Generation

// Generate secure hash for file
$filename = 'document.pdf';
$hash = hash('sha1', $filename . time() . 'your-secret-salt');

Multiple File Support

// Different file types
$file_config = array(
    'pdf-hash' => array(
        'file' => 'document.pdf',
        'type' => 'application/pdf',
        'size' => 123456
    ),
    'img-hash' => array(
        'file' => 'image.jpg',
        'type' => 'image/jpeg',
        'size' => 78901
    ),
    'vid-hash' => array(
        'file' => 'video.mp4',
        'type' => 'video/mp4',
        'size' => 2345678
    ),
);

πŸ›‘οΈ Security

  • Referer Control: Access only from specific domains
  • Hash-Based Access: Hide file names
  • Direct Access Prevention: Restrict folder access
  • SSL Support: Optimized for HTTPS connections
  • File Validation: Size and existence checks
  • Security Headers: XSS and clickjacking protection

πŸ“ Project Structure

hidden-url/
β”œβ”€β”€ index.php              # Main page
β”œβ”€β”€ img.php                # File service script
β”œβ”€β”€ documents/             # Files storage folder
β”‚   └── sample.pdf         # Sample PDF file
β”œβ”€β”€ .github/
β”‚   └── workflows/
β”‚       └── ci.yml         # CI/CD pipeline
β”œβ”€β”€ README.md              # This file
β”œβ”€β”€ CONTRIBUTING.md        # Contribution guide
β”œβ”€β”€ LICENSE                # MIT License
β”œβ”€β”€ composer.json          # Dependencies
└── .gitignore            # Git ignore file

πŸš€ Quick Start

  1. Download and extract the files
  2. Upload to your web server
  3. Add your files to the documents/ folder
  4. Update the hash configuration in img.php
  5. Test the system by accessing index.php

🌐 Live Demo

Online Demo

Local Demo

# Clone the project
git clone https://github.com/byrmstf/hidden-url.git
cd hidden-url

# Start PHP server
php -S localhost:8000

# Open in browser
# http://localhost:8000

Demo Features

  • πŸ”’ Secure File Access - See how hash-based URLs work
  • πŸ“ PDF Viewer - Test with sample PDF file
  • 🌐 Referer Control - Understand domain restrictions
  • ⚑ Performance - Experience fast file delivery

🀝 Contributing

  1. Fork the project
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

For more details, see CONTRIBUTING.md

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ‘¨β€πŸ’» Developer

Mustafa Bayram

⭐ Star This Project

If you like this project, please give it a star! ⭐

πŸ› Bug Reports

If you find a bug or have a suggestion, please report it on the Issues page.

πŸ“Š Statistics

GitHub stars GitHub forks GitHub issues GitHub pull requests

🎯 Try It Now

🌐 Online Demos

πŸ’» Local Testing

# Quick start
git clone https://github.com/byrmstf/hidden-url.git
cd hidden-url && php -S localhost:8000
# Visit: http://localhost:8000

πŸ”— Quick Links

πŸ”— Related Projects

πŸ“š Documentation


⭐ If you like this project, don't forget to give it a star!

About

Hiding image, pdf etc url in the site in browser source code and browser's development mode.

Resources

Contributing

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages