Have an idea?

Visit Sawtooth Software Feedback to share your ideas on how we can improve our products.

Track and restrict the duplicate IP address

Hi Team,

We have a requirement where we need to restrict duplicate Ip address( People answering multiple times from same IP address).
And we were able to work out the same in the earlier projects for both 8.4.8 and Lighthouse studio version.

But due to recent upgrade in studio version we were not able to execute our old script, such that we have made few adjustments accordingly to the below code and placed in the studio version in order to make them work out. But it seems below dbh query is not working and we are unable to connect the same. It would be great if you could have a look and let us know any solution or thoughts on the same. Thank you!

Begin Unverified Perl
#!/usr/bin/perl
use DBI;
use strict;

my $databaseName = '[REDACTED]';
my $databaseHost = '[REDACTED]';
my $databaseUser = '[REDACTED]';
my $databasePass = '[REDACTED]';

my $dbh = DBI->connect('dbi:mysql:' . $databaseName . ':' . $databaseHost, $databaseUser, $databasePass) or die $DBI::errstr;

my $pr=IPADDRESS();

my $sys_RespStatus;
my $Count;

my $sth = $dbh->prepare("SELECT Count(*),sys_RespStatus FROM MSLSTEST_data1 WHERE sys_IPAddress='".$pr."';");
$sth->execute();

while (my $row = $sth->fetchrow_arrayref()) {
    if((VALUE("SoftPanel")==1 || VALUE("SoftPanel")==2) && ($row->[1]==5 || $row->[1]==4 || $row->[1]==2) && $row->[0]>1) #This condition is for two panels remove SoftPanel==2 when there is only one panel.
    {
        ADD("PanelSkip",1);
    }
}
$dbh->disconnect();
End Unverified
asked Oct 29, 2018 by anonymous
edited Oct 29, 2018 by Zachary
For security reasons, I have edited this question to remove potentially sensitive database credentials.
Where are you hosting?  What error message do you get?

Your answer

Please only use this to answer the original question. Otherwise please use comments.
Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:

To avoid this verification in future, please log in or register.
...