I have forum v bulletin I need to redirect a visitor to example.php page .. automatically after a short delay,countdown  when he clicks the download attachment already upload at my server or external link posted in my forum . Is there any possible way to do that in a .htaccess (JavaScript) code or any thing ..

my site :  shneler.com/vb
example attachment URL : http://shneler.com/vb/attachment.php?attachmentid=2063&d=1380201538

Thank you 

Dani AI

Generated

Brief summary: wants clicks on forum attachments to land on a short “waiting” page (countdown) before the actual download starts. The forum already uses a vbAnonymizer hack that strips referer data; external links work but forum-hosted attachments do not. Suggestions to edit core files were raised by and a wrapper/meta-refresh idea by ; a jQuery timeout was proposed by but that client-side approach is brittle for file downloads.

Why client-side/meta approaches fail here: when attachment.php sends an immediate Content-Disposition attachment the browser often starts the download before any click-handler or delayed redirect can run, or download managers bypass in-page timers. A reliable solution should handle the flow server-side and not rely on the referrer header (which vbAnonymizer breaks).

Robust pattern (recommended)

  • Route attachment requests to a small server-side wrapper that: creates a short-lived one-time token, shows the waiting/countdown page, then lets the client request the real file using the token.
  • Serve the file efficiently from the webserver (X-Sendfile for Apache or X-Accel-Redirect for nginx) after verifying the token and permissions, rather than reading the file through PHP.
  • Avoid sleep() on the server; use a client-visible countdown and a token exchange so workers are not tied up.

Example (conceptual):

# Apache: send original attachment requests to a wrapper script
RewriteEngine On
RewriteCond %{QUERY_STRING} (?:^|&)attachmentid=([0-9]+)(?:&|$)
RewriteRule ^vb/attachment\.php$ /vb/attachment_wait.php?attachmentid=%1 [L,R=302]
# PHP: after token check, hand file to Apache
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="'.$filename.'"');
header('X-Sendfile: '.$fullpath);
exit;

Troubleshooting and practical notes: implement this as a plugin/hook rather than editing vBulletin core; check session/login handling so the wrapper preserves authentication; temporarily disable or adjust vbAnonymizer when debugging (it can interfere with any referer-based checks); use curl -I to inspect headers and server logs to trace redirects; make tokens short-lived and single-use to avoid hotlink or replay issues. This extends ’s wrapper idea while avoiding client-side timing issues flagged by and respects ’s point about using plugins instead of core edits.

Recommended Answers

All 11 Replies

What about using a Javascript timeout?

$('#element').click(function() {
    setTimeout(function() {
        window.location.href = 'http://website.com';
    }, 3000);
});

it is not working

    $('#element').click(function() {
    setTimeout(function() {
    window.location.href = '';
    }, 3000);
    });

not working .... is there any thig should i change and is this java for external link , attachment file uploaded in my server ?

put this in linked page

<meta http-equiv="refresh" content="5; url=http://example.com/">

redirect after 5 seconds .

a somewhat backwards approach maybe, to goto the example page and continue from there
current link to a particualar attachment may be
<a href='http://shneler.com/vb/attachment.php?attachmentid=2063&d=1380201538'>something to download</a>

different link
<a href=''>something to download</a>

and in /vb5test/index.php in the <head> somewhere

<?php 
if(isset($_GET['attachmentid'])) { 
echo "<meta http-equiv='refresh' content='5; url=/vb/attachment.php?attachmentid=$_GET['attachmentid']&d=$_GET['d']'>"; 
} ?>

plwase note
redirect to blank page see attached please

see attachment

Member Avatar for Member #120589

What are you trying to show with these screenshots?

Hello
first of all i m not programmer i have some information in php but i can execut what you ask me to do
let me clarification
1: in my forum i m using hack vbAnonymizer , This product will make all outgoing URL's have no referrer
i dont have problem in external links it is working well
my issue when the member ask to download the attachment upload in my root ,
can yo add rules in the attached file (product) to redirect any member ask to download attachment to redirect to my waiting page i m already use at external link
please use user: test and password: 123456 to allow see the attachment

*example
*example

the product

You cannot edit VB files like that, thats why they create plugins and templates to create something as you want. try asking product maker to edit file as you want

You didn't think to write, in the original question,
that you were f_ing with a functional system with some 'hack',
(badly) coded by some f_wit, to hide your referer.
the hack f_s up the system,
get the fix from the f_wit that wrote the hack, or,
remove the hack

there is one reason to hide the referer; malice. are you? :)

edit: read the source: badly written?;bohze moi,
so much wrong
there are vb anonymizers, that do work, try another

Member Avatar for Member #120589

Have a think about what you're actually asking for and read this: http://bit.ly/Dwebphp

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.