";
}
echo "[".__line__."] filter_sanitize_email ... URL
";
unset($ID,$Percent,$Email,$Submission,$Voters);
#echo "[".__line__."] qc pre BrainbeesToDo_Class
";
fxBrainbees("BrainbeesToDo_Classes","","","");
#echo "[".__line__."] qc post BrainbeesToDo_Class ... pre-Whie
";
while ($row=mysqli_fetch_array($results)) { #revu all entries in BrainbeesToDo #ProcessBB_com
$CurrentDateTime=date("Y-m-d H:i:s"); #used below
fxBrainbees("BrainbeesToDo_Columns","single","",$fx." ".__line__); # case: ProcessBB_com echo option
if (!$BBLevel) die("154 No BBLevel"); #20220107
# Actionable
echo "[".__line__."] qc actionable
";
$Actionable=""; #default A criterion met to trigger BB processing
fxBrainbees("Actionable_Deadline","","","");
fxBrainbees("Actionable_Max","","","");
#Submitby
if ($Defaults==date("Y-m-d")) echo "[".__line__."] Actionable=$Actionable ... NextAction:$NextAction ... BBProcess: $BBProcess ... Max:$Max ... Classroom:$Classroom ... from $fx
";
if ($Actionable<>"Y") {
Continue;
}
if (substr($NextAction,0,7)=="Results") fxBrainbees("NextAction_Results_fxBrainbees_src","","","");
#elseif ($NextAction=="Ballots") fxBrainbees("NextAction_Ballot_fxBrainbees_src","","","");
else #Results #ProcessBB_com
{die ("187 Invalid DueToDo: DoToDo or NextAction: $NextAction");
}
echo "[".__line__."] qc pre-sleep
";
#sleep
#if($Defaults==date("Y-m-d")) sleep(1);
#echo "1826 sleep ".date("H:i:s")."
";
#die("1828 QC dbtable: $dbTable");
#sleep(1);
} # end while $row
#sleep #2
#fxBrainbees("ProcessBB_com","","",""); #Exit recursive
} # While Loops
die ("176 end fx: $fx");
break;
case "Actionable_Deadline":
if (($Votes_Deadline<=$CurrentDateTime) or ($Deadline<=$CurrentDateTime)) {
#if(($Nt=="ZZ") and ($echo=="Yes")) echo "[".__line__."] BBToDo: Votes_Deadline<=CurrentDateTime in fx:$fx
";
#if(($Nt=="ZZ") and ($echo=="Yes")) echo "[".__line__."] BBToDo: Max Votes ... Max:$Max in fx:$fx
";
if ($RowCount < $Min) die("361 Min not met"); #advertise more
$Actionable="Y";
// if ($Max) {
// if ($Defaults) echo "150 Max action:$Max
";
// $Actionable=""; #wait
// }
}
#echo "166 Actionable: $Actionable
";
break;
case "Actionable_Max":
if ($Max and !$Actionable){
#echo "166 qc Max
";
if(($Nt=="ZZ") and ($echo=="Yes")) echo "[".__line__." Max: $Max in fx: $fx
";
#echo "123 Max: $Max ... Min?
";
fxCommon("RowCount","","136 $fx","");
$HierarchyCount=$RowCount;
echo "[".__line__."] HierarchyCount: $HierarchyCount
";
# RowCount > Max allowed
if ($RowCount>=$Max) {
echo "---- RowCount($RowCount) >= Max($Max)";
$Actionable="Y";
$Submitters=$RowCount=$Max;
#if ($Defaults) echo ("136 adjusted ... if (Rowcount>Max): RowCount:$RowCount ... Submitters: $Submitters
");
}
# no action
// else{
// if(($Nt=="ZZ") and ($echo=="Yes")) echo "-- No Action ".__line__."
";
// #Actionable=""; # wait for max
// if ($Defaults) echo "147 No Actionable, wait for max or time.
";
// }
}
break;
case "Actionable_SubmitBy":
die ("210 incomplete $fx");
break;
case "Archive_Delete_BrainbeeToDo_entry":
#echo "[".__line__."] start $fx ... BB_ToDo_rec: $BB_ToDo_rec ... Classroom:$Classroom ".gettype($Classroom)." LastRec:$LastRec
";
#?? 2024-04-13 if(!$BBProcess) die (__line__." No BBProcess");
fxCommon("HostServer","BrainbeesToDo","","");
#echo "[".__line__."] qc Rec=$BB_ToDo_rec
";
$sql="INSERT INTO `Archive`
SELECT * FROM `Active` WHERE Rec=$BB_ToDo_rec";
mysqli_query($con,$sql) or die("".mysqli_error($con)." ".mysqli_errno($con))." [".__line__."]";
#echo "qc 167 BB_ToDo_rec: $BB_ToDo_rec
";
$sql="DELETE FROM `Active` WHERE Rec=$BB_ToDo_rec";
mysqli_query($con,$sql) or die("976 ".mysqli_error($con)." ".mysqli_errno($con));
#echo "qc 171 BB_ToDo_rec: $BB_ToDo_rec
";
#if ($BB_ToDo_rec==8) echo "[".__line__."] QC $Nt:$database.$dbBBToDo rec: $BB_ToDo_rec
";
#echo ("[".__line__."] exit fx:$fx for BB_ToDo_rec:$BB_ToDo_rec ... BBLevel:$BBLevel ... Classroom:$Classroom ".gettype($Classroom)."
");
break;
case "Ballot_Creation": #from BrainbeeToDo row with dbtable rows
#if($Ballot_Focus=="Feedback") echo "
Ballot Creation for $Ballot_Focus";
#Arg1: $dbSubmissions, $dbPrimary,dbFeedback
$database=$databaseBkup;
echo "
"; break; case "Ballot_Message": ################ Ballot Message ############################### # Message: To, From, Subject #if(($Nt=="ZZ") and ($echo=="Yes")) echo "[".__line__."] Ballot_Focus: $Ballot_Focus in $fx ... FeedbackEmail:$FeedbackEmail "; $Message.="From: Morality of More Time To: $EmailList Subject: "; switch ($Ballot_Focus){ # Subject line of email for Candidates, Issue? case "Candidates": case "Submissions": $Message.= "Brainbee for Candidate Revu: Objective, matter-of-fact reasons why candidate should not be elected. Subjective, profane, or falsehoods will result in cancellation of submitter's account. [needs email all ... top 49 reasons ... deadline: 3 days."; #if(($Nt=="ZZ") and ($echo=="Yes")) echo "[".__line__."] qc message Ballot_Focus: $Ballot_Focus ... $fx "; break; case "Primary": # Ballot Message $Message.= "Brainbee for Candidate Revu: Objective, matter-of-fact reasons why candidate should not be elected. Subjective, profane, or falsehoods will result in cancellation of submitter's account. [needs email all ... top 49 reasons ... deadline: 3 days."; #if(($Nt=="ZZ") and ($echo=="Yes")) echo "[".__line__."] qc message Ballot_Focus: $Ballot_Focus ... $fx "; break; case "Feedback": # in Ballot_Message #FirstName LastName $MemberEmail=$FeedbackEmail; #echo "[".__line__."] FeedbackEmail: $FeedbackEmail ... MemberEmail: $MemberEmail "; fxCommon("HostServer",$database,"",""); mysqli_select_db($con,$database); #$dbTable=$dbSubmissions; $dbTable=$dbFinalists; #echo "[".__line__."] $Nt:$database.$dbSubmissions ... MemberEmail: $MemberEmail "; #$sql="SELECT * FROM $dbFinalists WHERE MemberEmail=$MemberEmail"; $sql="SELECT * FROM $dbTable WHERE MemberEmail='$MemberEmail'"; #if(!mysqli_query($con,$sql)) die("x429 dbtable:$dbTable fx: $fx : " .mysqli_error($con)." ".mysqli_errno($con)); $results=mysqli_query($con,$sql); $row=mysqli_fetch_assoc($results); $Nt=$row['nt']; $MemberEmail=$row['MemberEmail']; $LastName=$row['LastName']; $FirstName=$row['FirstName']; $DNA=$row['DNA']; $ResumeURL=$row['ResumeURL']; $Message.="Feedback criticism of ".$row['FirstName']." ".$row['LastName']." (".strtolower($MemberEmail)." DNA:".$row['DNA']."% ... Profile, and Resume ... Rebuttal"; # #if(($Nt=="ZZ") and ($echo=="Yes")) echo ("[".__line__."] qc Ballot_Message: Ballot_Focus: Feedback "); break; case "Issue": # Ballot Message die("x408 die temp"); $Message.="Ballot for $Title ... Please vote by $Votes_Deadline (Guidelines) "; break; default: die("[".__line__."] Invalid Arg2: $Arg2 in Message of $fx"); } # Message: Submitted Items $Message.=" Submitted Items(Individual/Issue) from $Nt.$database.$Arg1 (Brainbee Level: #$BBLevel ... Classroom $Classroom)
$Message "; # Message: Voting form if(strpos($Defaults,"NoEcho_Ballot")){ if(($Nt=="ZZ") and ($echo=="Yes")) echo "[".__line__."] NoEcho_Ballot "; } else{ fxBrainbees("Ballot_Voting_Form","??","??",""); #echo $Message; } $Message.= " |
[".__line__."]
fx: $fx
$Nt:$database.$dbTable\r\n $Nt:$database.$dbBBToDo\r\n BBLevel:$BBLevel\r\n Row Value=$Row\r\n |
";
}
# not needed echo "exit Ballot Form_All_Emails
";
break;
case "Ballot_Message_header":
if(!$EmailHeader_From_To_Subject) die("404 no emailheader for ballot");
$Message=
"
$EmailHeader_From_To_Subject";
break;
case "BrainbeesToDo":
#echo " [".__line__."] BBToDo: start $fx... Loops:$Loops ... BBLevel: $BBLevel [".__line__."] $fx... Loops:$Loops ...
BBLevel: $BBLevel ... Classroom:$Classroom ... LastRec: $LastRec
"; } else { # BrainbeesToDos exist #prep variables: Reset,database, dbTable, NextAction fxBrainbees("Reset_Results_variables","","",""); $BB_ToDo_rec=$row_Active['Rec']; #Rec of BrainbeesToTo #echo "[".__line__."] BBToDo_rec: $BB_ToDo_rec 395 "; $NextAction=$row_Active['NextAction']; #if(!$NextAction) die(" No NextAction ".__line__); if(!$NextAction) $NextAction="Unk-P"; # get database and dbTable #echo "[".__line__."] databaseBkup: $databaseBkup "; ################################# BrainbeesToDo: Actionable determination ############################################# fxBrainbees("BrainbeesToDo_Columns","","srcLn611","e"); # case: BrainbeesToDo echo option ################################# BrainbeesToDo: Actionable determination ############################################# $Actionable=""; #default A criterion met to trigger BB processing fxBrainbees("Actionable_Deadline","","",""); fxBrainbees("Actionable_Max","","",""); #Submitby needed if($Actionable<>"Y"){ } else { #$Actionable=="Y" #Results w/Winner ################################################### BrainbeesToDo: Actionable=Y ############################################# #creates next ballot of winners #dbTable: dbSubmissions, dbPrimary, or ?? fxBrainbees("Results",$dbTable,"",""); #e.g., Results_Basic_DivBy7, final, runoff #echo "[".__line__."] qc fx: $fx "; ################################################### BrainbeesToDo: Actionable=Y ############################################# # if maxtime or maxnumber #if(($LastRec%(7**$BBLevel)==0) and ($Classroom%7==0)){ #in BrainbeesToDo, from Results_Grassroots if(($LastRec%(7**$BBLevel)==0) and ($Classroom==7)){ #in BrainbeesToDo, from Results_Grassroots $Trigger=substr(strstr($Hierarchy,"-",true),1); #echo "[".__line__."] pre-Hierarchy:$Hierarchy ... Triggered at $Trigger "; if($Trigger==$LastRec){ fxBrainbees("Hierarchy_Options","","",""); #PFV or higher BBLevels, or quit based on date & } else{ die ("x680 Add winner to new level ... Last"); $BBLevel+=1; #Next Level echo " [".__line__."] BBToDo Next BBLevel:$BBLevel Winners(7) of prior level LastRec:$LastRec Loop $Loop of $Loops Loops ... RowCount:$RowCount ********************** "; #@49-PFE #fxBrainbees("Ballot xxx Creation","Results","","creates next ballot of winners"); #} fxBrainbees("Brainbees ToDo","","",""); } echo " [".__line__."] Hierarchy_Options function link 599 $fx Submitters: $Submitters called from $Arg2
"; echo "x964 exit $fx "; break; #BrainbeesToDo _Insert_Ballot case "BrainbeesToDo_Startup_Values_with_Insert"; echo "[".__line__."[ start $fx ... BBProcess switch? "; $BBLevel="1"; #Startup $FirstRec=1; #$Max=$TestRecs; $Min=intVal($Max/2); $Deadline="2023-07-21"; $NextAction="Results"; fxBrainbees("NextLevel_Brainbee_Insert_BrainbeesToDo","","Results",""); #uses dbTable, COMMENT break; case "BrainbeesToDo_Update_NextAction": #All Results variations have Create Ballot. if(($Nt=="ZZ") and ($echo=="Yes")) { echo "
";
}
fxBrainbees("Results_VoteCycle_Parameters","","fx: $fx ".__line__,"");
fxBrainbees("Votes_Deadline","","832 fx: $fx","echo");
#echo "$fx ".__line__." ";
echo "filename, columns, email $Now Dear Brainbee Originator, $Originator_Of_BB: $Title is ready to use, click here. Put the above link on your webpage for others to use.
$MsgOriginator "; $xMsgOriginator=" $Now Dear Brainbee Originator, $Originator_Of_BB: $Title is ready to use, click here. Put the above link on your webpage for others to use. Originator: $Originator_Of_BB; Email:$MemberEmail; dirUpload: $dirUpload BB Summary: $BBSummary Maximum Submits: $MaxSubmits DeadLine to Submit Event Date Initial balloting date: ?? "; $Subject="SF Submission Confirmation for BB $Title $TS $dbTable"; mail($MemberEmail,$Subject,$MsgOriginator,$Headers); #CivilityBB_Msg_Originator break; # Msg Originator case "CivilityBB_OneTimeBB_Originator_Email": #Arg1=? if ($Showcase) echo $caseRed; fxCommon("COMMENT_of_Table","DetailsGet","",$dbTable); #$EmailCount=$EmailCount+"1"; $Subject="BB $Title $TS BB Decider $Title $dbTable"; $Message=" Action:$BBProcess (flSuffix: $flSuffix) ... Voting done dbTable: $dbTable
Results of a brainbee in which you are results manager: Please implement your goals with the results."; #fxBrainbeesTests("Table_Programmer","Results of Voting 729",$fx,""); $Message.=$ProgrammersInfo; if ($EmailDemcapu=="Y")$MemberEmail="demcapu@comcast.net"; mail($MemberEmail,$Subject,$Message,$Headers); #CivilityBB_OneTimeBB_Originator_Email $flSuffix="ERBDcdr"; $URL=$dbTable."_Results_".$flSuffix.".htm"; $Message=$ProgrammersInfo=""; break; #OneTimeBB_Originator_Email case "Classroom_rows_into_arrays_x2024_03_15": #if ($Arg1=="Items") $Items="
"; #if ($Arg1=="Items") { $Items.=" |
[".__line__."] start $fx ... BBProcess:$BBProcess ... $Nt:$Arg1.$Arg2
";
echo "Creating database table. Please wait about five seconds ... $Nt:$database.$dbSubmissions
";
$DefaultsGG=="Yes";
#echo "checklist ".__line__."
";
$database=$databaseBkup=$Arg1; # case: dbSubmissions_Create
#exist/no exist dbTable
#if(($Nt=="ZZ") and ($echo=="Yes")) echo "[".__line__."] $Nt:$database.$dbSubmissions ... fx:$fx
";
fxCommon("HostServer",$database,$dbSubmissions,""); #Service
mysqli_select_db($con, $database);
#if(($Nt=="ZZ") and ($echo=="Yes")) echo"-- [".__line__."] fx: $fx ... $Nt:$database.$dbSubmissions
";
#Does table exist?
$sql = "SELECT Rec FROM $dbSubmissions"; #submissions
$result = mysqli_query($con,$sql);
if (mysqli_errno($con)=="1146") {
#if(($Nt=="ZZ") and ($echo=="Yes")) echo "x1219 $dbSubmissions does not exist. Create Votes/Winners table
";
$sql="CREATE TABLE IF NOT EXISTS $dbSubmissions (
Rec int(4) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
nt char(2),
ID int(4) UNSIGNED NULL,
MemberEmail varchar(40),
Votes1 mediumint(3) Signed COMMENT '7', Winners1 char(6),
Votes2 mediumint(3) Signed COMMENT '49', Winners2 char(6),
Votes3 mediumint(3) Signed COMMENT '343', Winners3 char(6),
Votes4 mediumint(3) Signed COMMENT '2401', Winners4 char(6),
Votes5 mediumint(3) Signed COMMENT '16807', Winners5 char(6),
Votes6 mediumint(3) Signed COMMENT '117649', Winners6 char(6),
Votes7 mediumint(3) Signed COMMENT '823543', Winners7 char(6),
Votes8 mediumint(3) Signed COMMENT '5764801', Winners8 char(6),
Votes9 mediumint(3) Signed COMMENT '40353607', Winners9 char(6),
MD5 char(32),
Submission varchar(500),
DateTime TIMESTAMP DEFAULT CURRENT_TIMESTAMP
)";
mysqli_query($con,$sql) or die ("[".__line__."] ".mysqli_error($con)."
".mysqli_errno($con));
if(strstr(" Submissions",$Ballot_Focus)){
$sql="ALTER TABLE $dbSubmissions
ADD COLUMN LastName varchar(25) AFTER Votes9,
ADD COLUMN FirstName varchar(25) AFTER LastName,
ADD COLUMN DNA char(5) AFTER FirstName,
ADD COLUMN ResumeURL varchar(50) AFTER Submission";
mysqli_query($con,$sql) or die ("[".__line__."] ".mysqli_error($con)."
".mysqli_errno($con));
}
#indexing both Non-local/Local
$sql="CREATE UNIQUE INDEX ID ON $dbSubmissions(ID)";
mysqli_query ($con,$sql) or die("[".__line__."] ".mysqli_errno($con)." ".mysqli_error($con));
$sql="CREATE UNIQUE INDEX MemberEmail ON $dbSubmissions(MemberEmail)";
mysqli_query ($con,$sql) or die("[".__line__."] ".mysqli_errno($con)." ".mysqli_error($con));
if($Nt=="GG"){
$sql="CREATE INDEX nt ON $dbSubmissions(nt)";
mysqli_query($con,$sql) or die("[".__line__."] dbSubmissions:$dbSubmissions " .mysqli_error($con)." ".mysqli_errno($con)." ".__line__);
$sql="CREATE UNIQUE INDEX ntID ON $dbSubmissions(nt,ID)";
mysqli_query($con,$sql) or die("[".__line__."] dbSubmissions:$dbSubmissions " .mysqli_error($con)." ".mysqli_errno($con)." ".__line__);
}
#}
#Local_Postal
// if($Locale_Postal){ #non-persons
// $sql="CREATE INDEX LocalPost ON $dbSubmissions(Locale,Postal)";
// if(!mysqli_query($con,$sql)) die("dbSubmissions:$dbSubmissions fx: $fx : " .mysqli_error($con)." ".mysqli_errno($con)." ".__line__);
// }
// else{ #persons, no Locale or Postal
// $sql="ALTER TABLE $dbSubmissions DROP COLUMN Locale";
// if(!mysqli_query($con,$sql)) die("dbSubmissions:$dbSubmissions fx: $fx : " .mysqli_error($con)." ".mysqli_errno($con)." ".__line__);
// $sql="ALTER TABLE $dbSubmissions DROP COLUMN Postal";
// if(!mysqli_query($con,$sql)) die("dbSubmissions:$dbSubmissions fx: $fx : " .mysqli_error($con)." ".mysqli_errno($con)." ".__line__);
// }
#COMMENT
#$COMMENT="BBProcess=$BBProcess ".$COMMENT;
#echo "[".__line__."] pre-Comment checkpoint $fx ... $Nt:$database.$dbSubmissions
";
$Created=date("Y-m-d H:i:s");
$COMMENT="BBProcess=$BBProcess ... Hierarchy=$Hierarchy ...
Title=$Title ... Created=$Created ...
Rep=BBLevel? NoFirstName NoLastName";
$COMMENT=str_replace(" "," ",$COMMENT);
fxCommon("COMMENT_of_Table","put",$database,$dbSubmissions);
#echo "[".__line__."] mid-Comment checkpoint $fx ... $Nt:$database.$dbSubmissions
";
fxCommon("COMMENT_of_Table","get",$database,$dbSubmissions);
#echo "[".__line__."] post-Comment checkpoint $fx ... $Nt:$database.$dbSubmissions
";
#if(($Nt=="ZZ") and ($echo=="Yes")) echo "exit fx: $fx ... dbSubmission: $dbSubmissions ".__line__."
";
$Submitters=0;
}
$sql = "SELECT Rec FROM $dbSubmissions"; #submissions
$result = mysqli_query($con,$sql) or die("[".__line__."] ".mysqli_error($con)." ".mysqli_errno($con));
$Submitters = mysqli_num_rows($result);
# not here fxBrainbees("dbTable_Brainbee_Insert","","","");
#if($Arg3=="echo")
#if(($Nt=="ZZ") and ($echo=="Yes")) echo "[".__line__."] exit $fx ... Submitters: $Submitters ... $Nt:$database.$dbSubmissions
";
#die("x1232 Lastname?");
break;
case "dbTable_Brainbee_Insert":
#echo "1172 Close dbtable ifneeded ... $fx
";
#echo "1133 $fx
";
$AcctType=$AcctTypeBkup;
if($Locale_Postal){
echo "1133 Locale_Postal: $Locale_Postal
";
$Postal=strstr($$Locale_Postal,"_",true);
$Locale=substr(strstr($Locale_Postal,"_"),1);
}
$dbTable=str_replace("-","_",$dbTable);
if(!$Submission){
fxCommon("SoundBytes","Strip","",$SB);
$Submission=substr("Test ".$SB,0,500);
}
#Gender record
$G=$g="";
if($Gender<>"None"){
$G=substr($Gender,0,1);
$g=substr($dbTable,-1); #gender
#echo "1141 Gender:$G ... _g=$g
";
}
#if($DefaultsGG=="Yes")
echo "-- g:$g ... G:$G ... Gender: $Gender ... fx:$fx ".__line__."
";
#GG or Nt
if($Nt=="GG"){
echo "1142
";
if ($Locale_Postal){ #civilityBB, DisasterPrep
echo "1144
";
$sql="INSERT $dbTable
(nt,ID,Locale,Postal,MemberEmail,Submission)
VALUES
('$nt','$ID','$Postal','$Locale','$MemberEmail','$Submission')";
if(!mysqli_query($con,$sql)) die("$fx ... $Gender ... $Nt:$database.$dbTable: " .mysqli_error($con)." ".mysqli_errno($con)." ".__line__);
$last_id = mysqli_insert_id($con);
}
elseif ($Gender=="None"){
$sql="INSERT $dbTable
(nt,ID,MemberEmail,Submission)
VALUES
('$nt','$ID','$MemberEmail','$Submission')";
if(!mysqli_query($con,$sql)) die("$fx ... $Gender ... $Nt:$database.$dbTable: " .mysqli_error($con)." ".mysqli_errno($con)." ".__line__);
$last_id = mysqli_insert_id($con);
}
elseif ($g==$G) {
$sql="INSERT $dbTable
(nt,ID,MemberEmail,Submission)
VALUES
('$nt','$ID','$MemberEmail','$Submission')";
if(!mysqli_query($con,$sql)) die("$fx ... $Gender ... $Nt:$database.$dbTable: " .mysqli_error($con)." ".mysqli_errno($con)." ".__line__);
$last_id = mysqli_insert_id($con);
}
}
else{ #Nt=non-GG, a nation
if ($Locale_Postal){ #civilityBB, DisasterPrep
echo "-- Nt:$Nt ... Locale_Postal:$Locale_Postal ".__line__."
";
echo "-- Locale: $Locale ... len=".strlen($Locale)." ".__line__."
";
$sql="INSERT $dbTable
(ID,Postal,Locale,MemberEmail,Submission)
VALUES
('$ID','$Postal','$Locale','$MemberEmail','$Submission')";
if(!mysqli_query($con,$sql)) die("$fx ... $Gender ... $Nt:$database.$dbTable: " .mysqli_error($con)." ".mysqli_errno($con)." ".__line__);
#mysqli_query($con,$sql) or die("$fx ... $Gender ... $Nt:$database.$dbTable: " .mysqli_error($con)." ".mysqli_errno($con)." ".__line__);
$Submitters+=1;
$last_id = mysqli_insert_id($con);
}
elseif ($Gender=="None"){
#echo "1181 Nt:$Nt ... Gender: $Gender
";
$database=$databaseBkup;
$dbTable=$dbTableBkup;
echo
fxCommon("HostServer",$database,$dbTable,"");
#(ID,MemberEmail,Submission) was on 2023-09-09
$sql="INSERT $dbTable
(ID,MemberEmail,Submission)
VALUES
('$ID','$MemberEmail','$Submission')";
if(!mysqli_query($con,$sql)) die("$fx ... $Gender ... $Nt:$database.$dbTable: " .mysqli_error($con)." ".mysqli_errno($con)." ".__line__);
$Submitters+=1;
$last_id = mysqli_insert_id($con);
}
elseif ($g==$G) {
echo "1189 g:$g == G:$G";
$sql="INSERT $dbTable
(ID,MemberEmail,Submission)
VALUES
('$ID','$MemberEmail','$Submission')";
if(!mysqli_query($con,$sql)) die("$fx ... $Gender ... $Nt:$database.$dbTable: " .mysqli_error($con)." ".mysqli_errno($con)." ".__line__);
$Submitters+=1;
$last_id = mysqli_insert_id($con);
}
elseif ($g<>$G){
echo "1197 No input: $G<>$g
";}
}
#if(!mysqli_query($con,$sql)) die("$fx ... $Gender ... $Nt:$database.$dbTable: " .mysqli_error($con)." ".mysqli_errno($con)." ".__line__);
#if($Arg3=="Rows") echo "
";
break; #Grassroot_dbTables_Create_Insert"
case "dbTable_Comment_get_put": #must use dbTable COMMENT
#echo "-- $Nt:$database.$dbTable ... Arg3=$Arg3 ... $fx ".__line__."
";
$database=$databaseBkup;
$dbTable=$dbTableBkup;
if(($Nt=="ZZ") and ($echo=="Yes")) {
echo "BB $Nt:$databaseBkup.$dbTableBkup ... $fx ".__line__."
";
}
fxCommon("COMMENT_of_Table","get","",$fx);
if(($Nt=="ZZ") and ($echo=="Yes")) echo "COMMENT: $COMMENT ".__line__."
";
if($Arg1=="get")
{
#echo "1435 get RecToDo: $BBToDoRow
";
fxCommon("COMMENT_of_Table","ParameterGet","RecToDo","n.a.");
$BBToDoRow=$Parameter;
if (!$BBToDoRow) die("RecToDo is null in $fx ".__line__);
}
elseif($Arg1=="put")
{ #if($Arg3=="echo") echo "3253 put ToDoRec $fx
";
if (!$BBToDoRow) die ("1067 No RecToDo For RecToDo");
$COMMENT="RecToDo=$BBToDoRow ".$COMMENT;
fxCommon("COMMENT_of_Table","put",$database,$dbTable); #dbTable
echo "COMMENT: $COMMENT fx:$fx ".__line__."
";
}
else
die ("1071 bad Arg1: $Arg1 in $fx");
echo "exit $fx
";
break;
case "dbTable_Name": #BBProcess
#echo "start $fx
__ database:$database
__ BBProcess: $BBProcess
__ Actions: $Actions ".__line__."
";
#if (!$BBProcess) {fxCommon("Backup","You did not select a brainbee action(BBProcess):","Inform, Election, Payment or Ranking","");}
$BBProcess=$Action;
$Action=$BBProcess="Elect";
if (!$BBProcess) {
fxCommon("Backup","You did not select a brainbee action($BBProcess):",
"Inform, Election, Payment or Ranking",__line__);}
if (!substr_count($Actions,$BBProcess)){
fxCommon("Backup","Action ($BBProcess) is not valid in available Actions ($Actions)
of $Title","Select an applicable action","");
}
else { #Arg1: BC=civility ... BI=Idea BL=Level ... BS=SuperBrainbee
#Level= Level or Ideafolder
#echo "fx: $fx: Arg1: $Arg1 ... database: $database ... dbTable: $dbTable ... Level: $Level ... LocationCode: $LocationCode ".__line__."
";
$dbTable=$Arg1."_".$BBProcess."_";
if ($TestRecs) {
$x=substr("0000".$TestRecs,-5);
$dbTable=$dbTable.$x."_";
}
#Title on tail
if(strpos($Title,"(forced)")) {$dbTable.="ForcedWinner_";}
switch ($database){
case "Tests":
die("1190, test not needed?");
$dbTable.=date("ymd_");
break;
case "timismor_ZZ": $dbTable.=date("ymd"); break;
default: {
$titl = preg_replace('/[^a-zA-Z0-9\-\._]/','', $Title);
$dbTable.=date("Ymd_His_").$titl;
break;
}
}
$dbTable=$dbTableBkup=substr($dbTable,0,62);
#("825 dbTable: $dbTable ... database: $database
");
// echo "exit $fx
// __ database: $database
// __ dbTable: $dbTable
// __ Len(dbTable):".strlen($dbTable)."
// __ Title: $Title len:".strlen($Title)." ".__line__."
";
}
break;
#??????????????????????
switch ($BBProcess)
{
case "Election": #dbTable_Name
#$dbTable=$dbTable."_".$Level."_".$LocationCode."_";
#$dbTable="$Arg1_$Level_$LocationCode_";
#fxBrainbees("dbTable_Name_suffix_VoteCycle","","","");
break;
case "Idea":
die ("697 Idea $caseRed");
case "Inform": #dbTable_Name #check if email address for office, if not create timism.net
$dbTable=$dbTable."_Inform_".date("Ym");
break;
case "Payment": #dbTable_Name
#echo ("124 BBLevel: $BBLevel ... database: $database ... dbTable: $dbTable ... Title: $Title
");
chdir("/home/timismor/public_html/TimeClock");
#echo "131 LocationNm: $LocationNm ... LocationCode: $LocationCode ... PostalCode: $PostalCode
";
require 'TimeClock.php';
break;
case "Poll": # #dbTable_Name citilegs, ostracism, pardons, class actions, sunshine laws, igknowance tax/bill of responsibility
#$dbTable=$dbTable."_".$Level."_".$LocationCode."_";
#$dbTable="$Arg1_$Level_$LocationCode_";
#fxBrainbees("dbTable_Name_suffix_VoteCycle","","","");
break;
case "Rank": #dbTable_Name
#$dbTable=$dbTable."_".$Level."_".$LocationCode;
#fxBrainbees("dbTable_Name_suffix_VoteCycle","","","");
break;
default:
die("Invalid BBProcess: $BBProcess [715]");
}
break;
case "dbTable_Name_BBLevel":
#Arg1: SB=SuperBrainbee, CB=CivilityBrainbee, PB=PrivateBrainbee
switch ($Level) #Level Rights
{ case "Nation":
$database=$Arg1."_Nation";
break;
case ("State"):
$database=$Arg1."_$St";
break;
case ("District"):
$database=$Arg1."_$St"."_Districts";
break;
case ("PostalCode"):
$database=$Arg1."_$St"."_Postal";
break;
case ("HighSchool"):
#$database=$Arg1."_$St"."_HighSchool";
#$database=$St."_".$FedLo."_HighSchool";
$database=$St."_".$FedLo;
echo ("if new then HighSchoolLists[dist ricts vs states] and BBsToDo_Unique
");
echo("93 St: $St ... database: $database");
break;
case ("MiddleSchool"):
$database=$Arg1."_$St"."_MiddleSchool";
break;
case ("Elementary"):
die ("1388 $fx ... Level: $Level ... Arg1: $Arg1");
$database=$Arg1."_$St"."_ElementarySchool";
break;
case ("County"):
$database=$Arg1."_$St"."_County";
break;
case ("Municipality"):
$database=$Arg1."_$St"."_Municipality";
break;
case ("aTests"): #High school BBLevel?
#die ("2023-09-08");
$database="timismor_ZZ";
#echo "1270 dbTable: $dbTable
";
$x=strripos($dbTable,"_",0);
$dbTable=substr($dbTable,0,($x+5));
#echo "1272 Tests database truncated dbTable: $dbTable
";
break;
default:
die("1276 Invalid Level: $Level");
break;
}
die("fix database");
$databaseBkup=$database; # dbTable_Name_BBLevel
$dbTableBkup=$dbTable;
break;
case "dbTable_rows_iSubmits_or_Winners": #based on BBLevel and IS NOT NULL
if (!$BBLevel) die("905 no BBLevel");
$database=$databaseBkup;
$dbTable=$dbTableBkup;
if(($Nt=="ZZ") and ($echo=="Yes")) {
echo "
$fx ".__line__." temp definitions: $database ... $dbTable $Nt:$database.$dbTable called from $Arg2 ".__line__." "; } fxCommon("HostServer",$database,$dbTable,"1335 $fx "); #echo "-- $Nt:$database.$dbTable ".__line__." "; #if ($xArg1){ #create ballots for votelevel if ("1"=="2"){ #create ballots for votelevel echo "--- 896 VotesColumn(Arg2)=$Arg1 "; die ("897 $fx"); } elseif($BBLevel=="1") { #Initial Ballots $sql="SELECT * FROM $dbTable"; #use #if ($Arg3=="echo") echo "if BBLevel=1 ?? ... $fx ".__line__." "; } elseif ($BBProcess=="Rank") { $VotesColumn="Votes".$BBLevel; $WinnersColumn="Winners".($BBLevel-1); #if ($Defaults) echo "920 Rank: Winning rows from $VotesColumn "; if ($database=="Tests") {echo "Rank BBProcess ... BBLevel: $BBLevel ... WinnersColumn: $WinnersColumn ";} $sql="SELECT * FROM $dbTable WHERE $WinnersColumn"; } else{ $WinnersColumn="Winners".($BBLevel-"1"); #if ($Arg3=="echo") {echo "911 default BBLevel: $BBLevel ... WinnersColumn: $WinnersColumn fx: $fx ";} $sql="SELECT * FROM $dbTable WHERE $WinnersColumn IS NOT NULL"; #dbTable_rows_iSubmits_or_Winners } if (($Arg1) and ($Arg1<>"ZeroOk"))#qualification { echo "3055 sql: $sql "; echo "$Arg1: $Arg1 "; $sql.=$Arg1; echo "3058 sql: $sql "; } $Submitters_Rows=mysqli_query($con,$sql) or die("1006 ".mysqli_error($con)); $Submitters=mysqli_num_rows($Submitters_Rows); if($BBLevel==1) $iSubmits=$Submitters; if ((!$Submitters) and ($Arg1<>"ZeroOk")) {die("No Submitters(Rowcount) [".__line__."]");} if(($Nt=="ZZ") and ($echo=="Yes")) { echo " |
";
}
break;
case "dbTable_Submission_Replacement":
if ($Defaults) echo "1281 dbTable: $dbTable
";
echo "1282 1 MemberEmail: $MemberEmail?? ID: $ID
";
die ("temp 492");
$sql="SELECT * from $dbTable order by ID LIMIT 1";
$results = mysqli_query($con, $sql) or die("