Wrox Programmer Forums
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old December 21st, 2004, 11:55 AM
Authorized User
Join Date: Jul 2003
Posts: 56
Thanks: 0
Thanked 0 Times in 0 Posts
Default Counting using a Session Variables?


Can anyone help me with the following problem?

At the moment I have a form where a customer can request a catalogue. On submission the info is inserted into a database and an email is sent to me so I can action their request. At the moment there is nothing stopping someone entering in their details x amount of times and in theory getting x amount of catalogues sent to them.

I would like to be able to put a limit of 3 catalogue requests per session so that, after the 3rd time, an email is not sent to me and a message appears on screen to say "you've had enough!".

Does anyone know how I would add this functionality into my existing code? At the moment the form is on one page, the info get submitted to a process page where the email is also sent out and they are redirected to a 'thank you page' afterwards.

I know that if a user closed down their browser and started again they could order more catalogues but i'm more interested in stopping the users from going this in one go.

Thanks in advance


Old December 21st, 2004, 11:37 PM
Authorized User
Join Date: Sep 2004
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts

Hi Lucy,

U can use a session variable for your problem.
take a session variable session("count") and assign it to 0 as soon as the user login.

As the user submit the request for catalogue increase the session("count") variable
then check
if session("count")>3 then
   Display your message
   send the mail

I hope this will work.
Let me know how it goes.

Old December 21st, 2004, 11:41 PM
Friend of Wrox
Join Date: Sep 2003
Posts: 363
Thanks: 0
Thanked 1 Time in 1 Post


  You create one more table with the fields userid, trdate, timessent

For every insert check these values. If not more than 3 insert info and update timessent.
Else display a message "Its Enough for today"

You can change this to u r requirement.


Old December 21st, 2004, 11:44 PM
Friend of Wrox
Join Date: Sep 2003
Posts: 363
Thanks: 0
Thanked 1 Time in 1 Post


  If you want to maintain per session means, rekha_jsr is correct.

Or if u want to maintain per day, use database based...


Similar Threads
Thread Thread Starter Forum Replies Last Post
Session Variables in C# shikha09 C# 1 November 28th, 2006 10:38 AM
Session Variables testsubject Visual Studio 2005 8 March 8th, 2006 04:26 PM
Is it possible for me using session variables into see07 ASP.NET 1.x and 2.0 Application Design 4 March 9th, 2005 07:46 PM
Session Variables flesh_god Dreamweaver (all versions) 7 November 11th, 2003 05:52 PM
session variables help face Classic ASP Databases 4 September 12th, 2003 03:57 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.