![]() |
| Restiricting Website Access |
|
dgalfano
|
One of my clients wants to randomly restrict access to his website. So, for the % that get through, they'll get to see the page how it's intended. The blocked visitors will get to a page that says something like, the government has stopped you from viewing the material on this website, please come back later...
Is this possible (or anything close)? Thanks, Dan |
||||||||||||
|
|
|||||||||||||
|
loftboy
Forum Regular
|
come to the good side (coldfusion) and i'll show u!
if not look up http cgi variables and how to extract them in .net |
||||||||||||
|
|
|||||||||||||
|
Josh
Forum Regular
|
pfft coldfusion... if he wanted some slow and klunky java rewriter he'd have posted it in that forum
why in the WORLD would you randomly restrict access? lol... sure this is possible... it'd be pretty easy also. No CGI necessary. Just a subroutine run on the main page. what chance of being redirected does he want? 1 in 4, 1 in 100? |
||||||||||||
|
|
|||||||||||||
|
loftboy
Forum Regular
|
shhhhtttttttt
ua nd your glorified fp coder lol |
||||||||||||
|
|
|||||||||||||
|
bobum
Elvis Fanatic
![]()
|
You could do this really easily if he knows a little coding
For example... User hits page1 and it generates a random number (or just culls it from the session ID - my preferable method) That number is compared to a set % of allowable visits If it's within that % then direct them to the site and set something like a session variable to "ok for viewing" If not direct them away and flag them "not ok for viewing" for that session something like that...not too difficult to accomplish in any language, ASP, PHP, PERL what have you... |
||||||||||||
|
|
|||||||||||||
|
loftboy
Forum Regular
|
ask m$ they dont let me into their cruddy site lol
|
||||||||||||
|
|
|||||||||||||
| um |
|
dgalfano
|
Well, custom coding, no, I'm not so good, that's why I asked for help.
Josh, I'm not sure what percentage he'd want denied. Please tell me about this subroutine on the main page. Bobum, not too in to custom coding, can you elaborate on your post some? I'd be working in ASP. Thanks, Dan |
||||||||||||
|
|
|||||||||||||
|
Josh
Forum Regular
|
basically what I could do is exactly what Bobum said... it doesn't get any simpler than that.
|
||||||||||||
|
|
|||||||||||||
|
loftboy
Forum Regular
|
unless u use coldfusion
|
||||||||||||
|
|
|||||||||||||
|
bobum
Elvis Fanatic
![]()
|
Alright...here is an example for you...
It's pretty verbose, but that's to help you understand the logic... You will put this script ina file of it's own and include it at the beginning of each of your pages...it will check to see if the user is allowed in and if they are not redirect them away. If you decide to mark them as rejected by setting the session variable "pass" as false, then they will have to start a new session by clearing out their cookies, or shutting down their browser and waiting for their session to time out on the server. If you do not set them to rejected, then they can just sit there and hit refresh till they get in. I've commented out the actual redirects so that you can play with the script, without getting redirected all over the place everytime. Before you get ready to use the script, be sure to remove all the Respon.Writes I have in there and uncomment the redirects.
|
||||||||||||||
|
|
|||||||||||||||
| Thanks! |
|
dgalfano
|
for the example! I tried to test it, this is what I got:
I have an index.asp w/ info + include to this script (admit.asp) and goaway.asp. |
||||||||||||||
|
|
|||||||||||||||
|
Josh
Forum Regular
|
hm... the problem is that what Bobum provided for you is VBScript... you're using JScript on your site. BTW, is this Classic ASP or ASP.NET that you're using on your site?
|
||||||||||||
|
|
|||||||||||||
| Oops |
|
dgalfano
|
I don't know why I did that. I guess I was hastily making test pages. I changed it to VBSCRIPT and it worked.
Thanks Bobum and Josh! Dan |
||||||||||||
|
|
|||||||||||||
| Restiricting Website Access |
|
||
|



