Garry`s One Time URL PHP5 Script

Written by . Filed under PHP + mySQL. Tagged , , , , , , , , , , , , , , , . Bookmark the Permalink. Post a Comment. Leave a Trackback URL.


I open Requirements Specification for Advance One Time URL script.
You can see and help with ideas.

Hi,

I wrote little script + lib for one time url.
this script make MD5 hash string for one time using and redirect file.
the links looks like: http://garry-lachman.com/link/ce75f50f55bcedf0a72098a01764548bĀ and can be used one time only.

The url storing is based on PHP Sessions and link redirection on MOD_REWRITE but there is example
for non MOD_REWRITE using
Example of create of the link:

1
2
3
4
5
<?php
require_once("libs/one_time_url.lib.php");
$one_time_url = new one_time_url();
?>
<a href="<?php echo $one_time_url->make_url("http://www.garry-lachman.com"); ?>">This is one time URL to http://www.garry-lachman.com</a>

The code & example can be downloaded form here.
License: GNU/GPL (open source)

16 Comments

  1. Amar
    Posted August 1, 2011 at 11:17 am | Permalink

    the Using .htaccess MOD_REWRITE works for me, but the redirect example doesnt work.

    I am trying to generate the url on the server and then email/ SMS this unique link to a user. Any idea how I can get this to work?

  2. Posted August 27, 2011 at 11:15 am | Permalink

    Nice information, it worked for me thnks

  3. Posted November 13, 2011 at 9:05 am | Permalink

    I’m trying to implement secret links to ZIP file downloads and this looks like the perfect solution but I can’t get it to work.

    The .htaccess version just comes straight up with a 404 error and the non .htaccess version just stalls at a while page and never does anything (it seems).

    Does it work on Windows 2008 Shared hosting servers running PHP 5.2.17 or is it Linux only?

    My test page to try it out is here…
    http://www.godfreyb.com/_scripts3/test.php

    To see the PHP info for the hosting server see here…
    http://www.godfreyb.com/_scripts/test.php

  4. Posted November 13, 2011 at 10:51 am | Permalink

    hey Phil Tyler,
    1) for non MOD_REWRITE mode – i want to see the error, you can add this line to top of your php file:
    error_reporting(E_ALL);

    2) are you using APACHE or IIS?

    3) for MOD_REWRITE – you need to use APACHE with MOD_REWRITE module enabled.

    Thanks,
    Garry

  5. Posted June 2, 2012 at 5:52 pm | Permalink

    I tried to use your one time url library with flash combination to safeguard / protect images. It worked fine but within 24 hours, my host suspended my account for “site causing performance issue” due to zombie processes.

    Do you think your script can cause this problem ? It is the only change I made on my site during that week.

    I’m not complaining, just curious, what caused this problem…Just for information, some 20,000 visitors loaded that page around 50,000 times, within 24 hours or less…

    • Posted June 3, 2012 at 12:53 am | Permalink

      The script only hold url in session that regularly ends 20 min after the user close the browser.
      check out your time out settings in apache, many the sessions not expired….

      • hassan
        Posted June 3, 2012 at 5:22 am | Permalink

        what if I manually close the session using “session_destroy();” at end of my main page ? This will create and delete session on every page load…
        is it a good idea?

      • Posted June 3, 2012 at 8:35 am | Permalink

        You can do it but only after user execute the link…

  6. Posted October 11, 2012 at 12:43 am | Permalink

    What mod_rewrite rule needs to be set in order for that system to work? …or am I not understanding something here?

  7. teem
    Posted October 23, 2012 at 2:19 pm | Permalink

    pls i need to add the onetime url to my index.php so all the files on my website will be encoded, pls how do i go about it?

    thanks

  8. alxbob
    Posted November 5, 2012 at 5:38 pm | Permalink

    I want to make the basic url one time url and not the directories!For example http://www.%!FR#!!34143e13.whatever is that possible?

One Trackback

Post a Comment

Your email is never published nor shared.

You may use these HTML tags and attributes <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

*