Ok... I am going to show you simple code that will mean nothing to you... but it is an example of the kind of code is running this ride. What you want to look for are the "if" statements. On FJ, the number of "if" and "elseif" statements are going to be over the top... This is for safety and testing. Once they see WHY the machines are showing errors and shutting down, they will either widen the latitude of the if/elseif statements, or remove them completely if they decide it isn't a serious factor. If this or any of the latest rides shut down, it is because something didn't answer the "if" clause the way that it should. Look for the if/elseif/else statements. Sorry to get technical...
# if we're continuing to rel, set curtype and step=0 for step++ below
if($rel) {
#warn "have rel";
$curtype=6;
$step=0;
} elsif($wish) {
#warn "have wish";
$curtype=7;
$step=0;
} else {
#warn "no more";
# if no more options, set curtype back to main flow and
# current step to two before last page - category selection
$curtype=$rtype;
$step=$rtmax-2 if $rtype!=8;
}
}
if($lasttmpl=~/hathor/) {
#warn "rel";
if($args{'name'}) {
$args{'name'}=~s/\'/\\\'/g;
$sql="insert into relhist (uid,date,name) values ($uid,now(),'$args{name}')";
$sth=$dbh->prepare($sql);
$sth->execute;
$sql="select last_insert_id()";
$sth=$dbh->prepare($sql);
$sth->execute;
my $id=$sth->fetchrow_array;
$extra=",rel=$id";
$rel=$id;
} else {
$rel="-1";
$extra=",rel=$rel";
warn "sid $sid: no rel name given";
}
if($wish) {
#warn "rel have wish";
$curtype=7;
$step=0;
} else {
#warn "rel no more";
$curtype=$rtype;
$step=$rtmax-2;
if($rtype==8) {
# last step of trial -- now jump to login page
@tmpl=$C->parseincludes('success.tmpl');
$sql="select username,password from users where id=$uid";
$sth=$dbh->prepare($sql);
$sth->execute;
my ($u,$p)=$sth->fetchrow_array;
my $tmpl=join('',@tmpl);
$tmpl=~s/__USERNAME__/$u/;
$tmpl=~s/__PASSWORD__/$p/;
print $tmpl;
exit;
}
}
}
if($lasttmpl=~/wish/) {
#warn "wish";
if($args{'wish'} && $args{'wish'} ne 'Type your wish here...') {
$args{'wish'}=~s/\'/\\\'/g;
$sql="insert into wishes (uid,date,wish) values ($uid,now(),'$args{wish}')";
$sth=$dbh->prepare($sql);
$sth->execute;
$sql="select last_insert_id()";
$sth=$dbh->prepare($sql);
$sth->execute;
my $id=$sth->fetchrow_array;
$extra=",wish=$id";
$wish=$id;
} else {
$wish="-1";
$extra=",wish=$wish";
warn "sid $sid: no wish entered";
}
# no more options, so set as above
#warn "wish no more";
$curtype=$rtype;
$step=$rtmax-2 if $rtype!=8;
}
if($lasttmpl=~/options/) {
# skip the whole thing if they don't want any extra services
if($args{'rel'} || $args{'wish'} || $args{'spell'} || $args{'report'}) {
my $upd='';
$upd.='rel=1,' if $args{'rel'};
$upd.='wish=1,' if $args{'wish'};
$upd.='spell=1,' if $args{'spell'};
$upd.='report=1,' if $args{'report'};
chop $upd;
if($upd) {
$sql="update sessions set $upd where sid=$sid";
$sth=$dbh->prepare($sql);
$sth->execute;
}
$sql='';
# report is special -- no page to display, just a flag to set
# do in reverse order to make sure only first selected one gets set
if($args{'wish'}) {
$sql="update sessions set step=1,curtype=7 where sid=$sid";
$curtype=7;
}
if($args{'rel'}) {
$sql="update sessions set step=1,curtype=6 where sid=$sid";
$curtype=6;
}
if($args{'spell'}) {
$sql="update sessions set step=1,curtype=5 where sid=$sid";
$curtype=5;
}
if($sql) {
$sth=$dbh->prepare($sql);
$sth->execute;
$step=0; # 0 so step++ below is still valid (really want 1)
}
}
}