require './ctsim.conf';
my $opt_d = 0;
-$ENV{'PATH'} = "$::bindir:$::lamrundir";
+$ENV{'PATH'} = "$::bindir:$::lamrundir:/bin";
my $fromhost = $ENV{'REMOTE_HOST'};
my $error = "";
+if ($::single_process_only > 0) {
+ my @processes = '/bin/ps -A';
+ my $running = 0;
+ foreach $p (@processes) {
+ if ($p ~= /ctsimtext/) {
+ $running = 1;
+ break;
+ }
+ if ($running > 0) {
+ $error .= "Another online simulation is currently running.<p>Click your browser's <i>Refresh</i> button to resubmit your simulation<br>";
+ exit(0);
+ }
+}
+
my $Phantom_Name = FilterMetaChars($in{'Phantom_Name'});
my $Phantom_Nx = FilterToNumber($in{'Phantom_Nx'});
my $Phantom_Ny = FilterToNumber($in{'Phantom_Ny'});
my $Phantom_NSample = FilterToNumber($in{'Phantom_NSample'});
$error .= "Phantom name must not be blank<br>" if ($Phantom_Name eq "");
-$error .= "Phantom NX and NY must be between 5 and 1024<br>" if ($Phantom_Nx < 5 || $Phantom_Nx > 1024 || $Phantom_Ny < 5 || $Phantom_Ny > 1024);
-$error .= "Phantom NSample must be between 1 and 10<br>" if ($Phantom_NSample < 1 || $Phantom_NSample > 10);
+$error .= "Phantom NX and NY must be between 5 and 512<br>" if ($Phantom_Nx < 5 || $Phantom_Nx > 512 || $Phantom_Ny < 5 || $Phantom_Ny > 512);
+$error .= "Phantom NSample must be between 1 and 5<br>" if ($Phantom_NSample < 1 || $Phantom_NSample > 5);
my $PJ_NDet = FilterToNumber($in{'PJ_NDet'});
my $PJ_NRot = FilterToNumber($in{'PJ_NRot'});
my $PJ_NRay = FilterToNumber($in{'PJ_NRay'});
my $PJ_RotAngle = FilterToNumber($in{'PJ_RotAngle'});
-$error .= "Projection NDet must be between 5 and 1800<br>" if ($PJ_NDet < 5 || $PJ_NDet > 1800);
-$error .= "Projection NRot must be between 5 and 2048<br>" if ($PJ_NRot < 5 || $PJ_NRot > 2048);
+$error .= "Projection NDet must be between 5 and 1000<br>" if ($PJ_NDet < 5 || $PJ_NDet > 1000);
+$error .= "Projection NRot must be between 5 and 1000<br>" if ($PJ_NRot < 5 || $PJ_NRot > 1000);
+$error .= "Projection NRay must be between 1 and 5<br>" if ($PJ_NRay < 1 || $PJ_NRay > 5);
$error .= "Projection RotAngle must be between 0.1 and 2<br>" if ($PJ_RotAngle < 0.1 || $PJ_RotAngle > 2);
#my $IR_Nx = FilterToNumber($in{'IR_Nx'});