Hi Bob,
Thnx for the quick reply!
That looks like it. Im not realy a php script wizzard so I have to check if it works :wink:
I think this code solves a part of my problem. But its not an option to manualy add all the ip adresses that are already used. We will be expecting many voters. Is there a way automate this proces via database check or some ohter way?
Smedia
Hi Smedia,
Yes, you'll need to add a DB query (or a DB Multi Record Loader action) to get a list of saved IP addresses to check against.
Bob
Im aware the [ b ][ /b ] part of the code is wrong. Tried to highlite line 11.
Which Chronoforms version do you have ?
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Ok, let's change your code:
First a custom code action:
<?php
$form->data["user_ip"] = $_SERVER['REMOTE_ADDR'];
?>
Then a db record loader action with these settings:
Table: your table with data
Request param: user_ip
DB field: cf_ipaddress
Model: USERIP
Then another custom code action:
<?php
if(!empty($form->data["USERIP"])){
//redirect here, you may replace this code with a "custom server side validation" or "dynamic event switcher" with a redirect action
}
Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Hi Max,
Thnx for the help!
I copied all the scripts as you told me to do. But unfortunaltely with no working result.
The form still works the same as without the script.
Because I had a deadline on this form and I couldnt fix it, I decided to filter the data afterwards via the saved data.
It's not the way I wanted to do this, but in the long run the result will de the same.
I still want to solve this problem so I can make these forms work in future projects.
Do you have any other suggestions or changes in the code so it will work?
Regards,
Smedia
Hi Smedia,
You can add a "debugger" action after the "db record loader" and check the generated SQL statement, please post it here to make sure that it works as expected!
Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
He Bob and Max,
Sorry for the slow reply.
I will try the code, but I dont know exactly when. First I have some other priorities to coop with.
I will post the feedback when I tested it.
Regards,
Smedia
Hi Smedia,
If it works OK that's fine; the code looks as though it is pretty much the same but without using the Joomla! DB methods.
Bob