Hope someone knows the solution or how to fix
In a form I have put in at Submissions limit (in sec) 604800 (7 days)
The form can only be filled out once logged in.
If the users tays logged in, it wordks fine, but...........
When he logs out and directly logs in again, the form again can be filled out.....
In JOOMLA global settings
CACHE : No
Session time: 25 min
Sessionhandler: Database
In a form I have put in at Submissions limit (in sec) 604800 (7 days)
The form can only be filled out once logged in.
If the users tays logged in, it wordks fine, but...........
When he logs out and directly logs in again, the form again can be filled out.....
In JOOMLA global settings
CACHE : No
Session time: 25 min
Sessionhandler: Database
Hi SPABO,
What are you actually trying to do here?
I think that the Submissions limit is only intended for short delays of a few minutes to prevent spam flooding or repeated clicking. The info is stored in the session so is lost if the session is lost.
Bob
What are you actually trying to do here?
I think that the Submissions limit is only intended for short delays of a few minutes to prevent spam flooding or repeated clicking. The info is stored in the session so is lost if the session is lost.
Bob
Hey Bob
The form is ment a to register for a game, but to limit the number of "double registrations", I would like to have a timeslot of eg 7 workingdays.
I read in the menan time all the available tutorials, the solution could be to ceate and connect to a (form)table.
What do you think ?? Should this work ??
The form is ment a to register for a game, but to limit the number of "double registrations", I would like to have a timeslot of eg 7 workingdays.
I read in the menan time all the available tutorials, the solution could be to ceate and connect to a (form)table.
What do you think ?? Should this work ??
Hi SPABO,
Yes, connect the form to a table then check the table when the form is submitted. If they aren't logged in then you'll need to decide what to check, email address is usually good.
Bob
Yes, connect the form to a table then check the table when the form is submitted. If they aren't logged in then you'll need to decide what to check, email address is usually good.
Bob
Bob
This is not what I'm looking for as there several kinds of registrationsforms
FYI
Only is a user has logged is, he will see the forms
The frms are pre-loaded with data from Comm.Builder (I'm sure you remember my topics on this)
I understand, once the user has logged out, the "sumission limit counter" resets, in other words, when logged out and than logged in, the users can submit again.
May you have an idea how to "lock" a form for a users during x days, after submitting??
This is not what I'm looking for as there several kinds of registrationsforms
FYI
Only is a user has logged is, he will see the forms
The frms are pre-loaded with data from Comm.Builder (I'm sure you remember my topics on this)
I understand, once the user has logged out, the "sumission limit counter" resets, in other words, when logged out and than logged in, the users can submit again.
May you have an idea how to "lock" a form for a users during x days, after submitting??
Hi SPABO,
If they are logged in then create a little table with 'user_id', 'form_id', and 'date'.
Then in the Form HTML add a query to this table to check
Bob
If they are logged in then create a little table with 'user_id', 'form_id', and 'date'.
Then in the Form HTML add a query to this table to check
WHERE `user_id` = ".$user->id."AND `form_id` = '$form_id' AND DATEDIFF(`date`, CURDATE()) > 7 Done from memory so will be buggy, check the correct syntax carefully.Bob
Bob
Not sure what you are saying, a user to create a small table?
Or should this be added in the formrelated table?
Not sure what you are saying, a user to create a small table?
Or should this be added in the formrelated table?
Hi SPABO,
I'd probably use a separate table if starting from scratch but if you already have a form related table then all the info you need is probably there. Check cf_user_id and recordtime.
Bob
I'd probably use a separate table if starting from scratch but if you already have a form related table then all the info you need is probably there. Check cf_user_id and recordtime.
Bob
Indeed both are in the the table, so would it be like this on top in the HTML code?
<?php
WHERE `cf_user_id` = ".$user->id. " AND `form_id` = '$form_id' AND DATEDIFF(`recordtime`, CURDATE()) > 7
?>
PARSE ERROR
Parse error: syntax error, unexpected '`' in /home/xxxxx/domains/xxxxxxxxxxxxxxx.nl/public_html/components/com_chronocontact/chronocontact.html.php(180) : eval()'d code on line 2
Parse error: syntax error, unexpected '`' in /home/xxxxx/domains/xxxxxxxxxxxxxxx.nl/public_html/components/com_chronocontact/chronocontact.html.php(180) : eval()'d code on line 2
Bob,
Would it make sense to have a query in the Validation tab??
In the mean time I put this in, but I'm getting an unexpected T_STRING on line 5
Or I'm thinking in a totally wrong direction???
Would it make sense to have a query in the Validation tab??
In the mean time I put this in, but I'm getting an unexpected T_STRING on line 5
<?php
$user =& JFactory::getUser();
$db =& JFactory::getDBO('jos_chronoforms_JEUGD); //this is teh related table
$user_info = $db->loadObject();
$then = JFactory::getDate(JRequest::getString('recordtime'));//<<<<< ???????
$now = JFactory::getDate();
$diff = $then->toUnix() - $now->toUnix();
if ($diff < 7*24*60*60) { //// 7 is nbr of days
return '- Sorry, etc etc etc!';
}
?>
Or I'm thinking in a totally wrong direction???
Hi SPABO,
The error message is probably from the missing quote in line 3. But that said the code looks like a mess.
It needs to go into the Form HTML, not the server side validation tab as you want to check before the form is loaded.
Not tested and will need debugging
Bob
The error message is probably from the missing quote in line 3. But that said the code looks like a mess.
It needs to go into the Form HTML, not the server side validation tab as you want to check before the form is loaded.
<?php
if ( !$mainframe->isSite() ) { return; }
$user =& JFactory::getUser();
$db =& JFactory::getDBO();
$query = "
SELECT COUNT(*)
FROM `jos_chronoforms_JEUGD`
WHERE `cf_user_id` = '".$user->id."'
AND DATEDIFF(CURDATE(), CAST(`recordtime` AS DATE)) < 7 ;
";
$db->setQuery($query);
$check = $db->loadResult();
if ( $check) {
echo "Sorry, you have already registered in the last week";
return;
}
?>
// normal form htmlNot tested and will need debugging
Bob
Bob
I was just tryingπΆ
Debugging ???? It went exactly as what I had in my mind!π π
GREATT
Thanks very very much Bob !!!
I was just tryingπΆ
Debugging ???? It went exactly as what I had in my mind!π π
GREATT
Thanks very very much Bob !!!
This topic is locked and no more replies can be posted.
