.htaccess - Use htaccess and PHP Sessions to restrict direct access to swf files -
i have several flash presentations, restrict access logged in users. have log in form sets session variable each presentation indicates if logged in user has access particular presentation.
// user's access stored in db other account info, , sessions set when logged in $_session['mfg'] = 'yes'; $_session['product'] = 'no'; in case user should able access 'mfg' presentation, not 'product' presentation.
cookies set follows:
setcookie('mfg', $_session['mfg'], time() + (60 * 60 * 24 * 7)); setcookie('product', $_session['product'], time() + (60 * 60 * 24 * 7)); this works great direct access presentation, set index file in /mfg/ directory example check if $_session['mfg'] set 'yes'. if is, presentation loads, if not user gets redirected elsewhere.
the problem
regardless of whether or not logged in , session/cookie set 'yes', if visit /mfg/swf/slide1.swf directly can view slide in browser. can cycle through presentation visiting /mfg/swf/slide2.swf, etc...
i somehow use .htaccess file in /mfg/swf/ folder check if $_session['mfg'] (or cookie 'mfg'??) set 'yes'. if is, should allow person view slides, if not should redirected log in form (/login.php).
the bigger problem
i don't know how write htaccess file. know possibility few searches sounded written in language.
Comments
Post a Comment