Jump to content

Cherif

Members
  • Content Count

    5
  • Joined

  • Last visited

  1. Hello everybody, A simple question which is haunting me for a couple of days now. I have a table MEMBERS (where all my members are listed with different info. Most importantly there is one field: MemberUntil (Date Time Value) How is it possible for me to NOT allow a member to log in if the date is greater than the date under the field: MemberUntil? I have tried on VIEWS but the whole logic doesn't work. AND >> Members_MemberUntil >> Greater >> (then I have to manually input a date). I would like to be able to
  2. Thanks a lot ! When you say " Every time a FreeUser logs in: -stamp his UserID in the UserID field - stamp the current datetime in the "logindatetime" field. Everytime a FreeUser completes a search -Increase the SearchCount with an increment of 1 " Do you mean that I will have to do that manually everytime?
  3. Hey there. So tried to do it. I created my table, but I do not know where to input the Javascript ... :S
  4. Hey there!

     

    Thanks a lot for your reply on my  Limit the number of search by user?  post.

     

    Just a quick question. When you say:

     

    ==

    Every time a FreeUser logs in:

    - stamp the datetime in the "logindatetime" field.

     

    Everytime a FreeUser completes a search 

    -Increase the SearchCount with an increment of 1

     

    ==

     

    Do you mean that I have to do it manually everytime? Is there no way for it to be done automatically ?

    1. Show previous comments  3 more
    2. TWIRED

      TWIRED

      In the first Search submission page,

      you would have  a script - something like this in the footer

      -------------------------------------------------------------------------------------

      <script>

      var maxsearchesallowed=5;


      var searchdate=[@authfield:A1_DUMMY_USER_AUTH_INFO_TABLE_DummyUserSearchDate*];

      var counter=0;
      var counter="[@authfield:A1_DUMMY_USER_AUTH_INFO_TABLE_DummyCount#]";

      var paiduser="[@authfield:A1_DUMMY_USER_AUTH_INFO_TABLE_DummyPaidUser]";

      var today = new Date();
      //alert(today);
      var dd = today.getDate();
      //alert("todays date= " + dd);
      var mm = today.getMonth()+1; //January is 0!
      //alert("todays month= " + mm);

      var yyyy = today.getFullYear();
      if(dd<10){
          dd='0'+dd;

      if(mm<10){
          mm='0'+mm;

      var today = mm+'/'+dd+'/'+yyyy;

      today=new Date(today);
      searchdate=new Date(searchdate);

      counter=Number(counter)+1;

      //alert("received today= " +today);
      //alert("counter=" + counter);
      //alert("received searchdate= " +searchdate);

       

      function checkvalid() {

      if((today > searchdate) && (paiduser=="No" && Number(counter) < Number(maxsearchesallowed) ) )
      {
      alert("allow to search");


      document.getElementById("[@authfield:A1_DUMMY_USER_AUTH_INFO_TABLE_DummyUserSearchDate*]").value=today;

      document.getElementById("[@authfield:A1_DUMMY_USER_AUTH_INFO_TABLE_DummyCount#]").value=counter;
      //alert("counter="+counter);

      else
      {
      alert("sorry, you have exceeded your quota!");
      window.location("REDIRECT_URL_to_Anotherpage.html");
      return false;
      }
      }

      checkvalid();
      </script>

    3. TWIRED

      TWIRED

      Updated code that works...

      based on setup

       

      <script>

      var maxsearchesallowed=5;

      var counter=0;
      var counter="[@field:DummyCount#]";

      var paiduser="[@authfield:A1_DUMMY_USER_AUTH_INFO_TABLE_DummyPaidUser]";
      alert("paiduser= "+paiduser);

      //----------------------today date format---

      var today = new Date();
      //alert(today);
      var dd = today.getDate();
      //alert("todays date= " + dd);
      var mm = today.getMonth()+1; //January is 0!
      //alert("todays month= " + mm);

      var yyyy = today.getFullYear();
      if(dd<10){
          dd='0'+dd;

      if(mm<10){
          mm='0'+mm;

      var today = mm+'/'+dd+'/'+yyyy;

      //today=new Date(today);

      var searchdate=document.getElementById("EditRecordDummyUserSearchDate").value;

      alert("today=  "+today);
      alert("searchdate= " + searchdate);


      //test
      //today=searchdate;

      function myFunction() 
      {
      if((today => searchdate) && (paiduser=="No" && Number(counter) < Number(maxsearchesallowed) ) )
      {
      alert("allow to search");
      document.getElementById("EditRecordDummyUserSearchDate").value=today;

      //counter=Number(counter)+1;
      document.getElementById("EditRecordDummyCount").value=Number(counter)+1;
      //alert("counter="+counter);

      else
      {
      alert("sorry, you have exceeded your quota!");
      window.location("http://www.tripatwork.com/sa-test-pages---2.html");

      }
      }
      document.getElementById("caspioform").onsubmit=myFunction; 

      </script>

    4. TWIRED

      TWIRED

      Heres a working model that works

       

      http://www.tripatwork.com/test-searchsubmit-page.html

       

      user: cherif@cherif.com

      pass : cherif

  5. Thanks a lot !! I will try that and let you know how it goes !
  6. Hello, I have set up a search form with Caspio. Lets assume there are 2 types of users: those who pay and those who use the service for free. Is there any way to limit the daily number of searches which the free user can run (say to 3 or 5 searches per day), while the users who are paying can run as many searches as they want daily, Thanks for your help !
×
×
  • Create New...