Custom popup if entering protected directory directly?

Discussion in 'Pre-Sales Questions' started by nocturnal, Mar 7, 2004.

  1. nocturnal

    nocturnal Guest

    First off I just want to say this script is awesome: clean and lean, like Apache and not bloated like Mafiasoft IIS. I've been trying it for a few days now and just love it, but had some last, last minute questions before upgrading to pro version. Kudos to Alex and everyone helping to support this product.

    Question 1A:
    If a client entered a URL http://www.domain.com/protdir/somepic.jpg directly, could they get a custom popup that reads "You need to Login to continue. Please press OK to Login now." 2 buttons will be on the popup, OK and Cancel. Click OK, redirects them to Login page. Click Cancel, returns them to their original place.

    Question 1B:
    If the above is possible. Will it be file specific?
    http://www.domain.com/protdir/somepic.jpg
    http://www.domain.com/protdir/somepic.html
    http://www.domain.com/protdir/somepic.php
    http://www.domain.com/protdir/somepic.mp3
    http://www.domain.com/protdir/somepic.avi
    http://www.domain.com/protdir/somepic.asx
    http://www.domain.com/protdir/somepic.zip

    Question 2:
    I want to have a "Welcome, Visitor" at the top of the page, then have it change to "Welcome, Username" when a client logs in so they know they are logged in. Is this easily integrated into Amember?

    Thanks!
  2. abbeyvet

    abbeyvet New Member

    Joined:
    Feb 2, 2003
    Messages:
    135
    Question 1A:
    Would it not just be easier to direct them straight to the login page, with an explanation there and a 'Go Back' link too if required?
    One of the reasons I say that is because the use of pop-up blockers is so prevalent now - if it was me with that system I would never get to log-in and would think twice before disabling my pop-up blocker - something I do very seldom.

    Question 1B:
    I think you will need to put each into a different directory, if, that is, you want each to be a separate product.

    Question 2

    Add something like this to your member template:
    Hello {$smarty.session._amember_user.login}!

    I actually use this which prints a different greeting according to the time of day, in case you are interested in it:

    <SCRIPT language="javascript">
    <!-- hide javascript
    day = new Date();
    hr = day.getHours();
    if ((hr >= 1) && (hr <=11)) {
    t = "Good morning";}
    if ((hr >= 12) && (hr <=16)) {
    t = "Good afternoon";}
    if ((hr >= 17) && (hr <=21)) {
    t = "Good evening";}
    if ((hr >= 22) && (hr <=23)) {
    t = "Good night";}
    if (hr==0) {
    t = "Good night";}
    document.write(t);
    // done hiding -->
    </SCRIPT> {$smarty.session._amember_user.login}!
  3. alex

    alex aMember Pro Customer Staff Member

    Joined:
    Jan 24, 2004
    Messages:
    6,021
    1. It is possible to protect any type of files.
    There won't be popups, but HTML login form will be displayed if user is not logged-in and trying to access protected file (no matter if it is image or downloadable file, anyway - aMember will display HTML login form).

    2. Yes, it is possible and described in the Pro manual (customization Chapter).

Share This Page