\n"); #print_r($_POST); #print_r($_GET); echo("\n"); $username="lazarus_toomey"; $password="wizzb"; $database="lazarus_legislation"; $forminput = $_POST['formaction']; connectAndSelectDB($username,$password,$database); #runNameIDConversion("Representative"); #makeSpecificUpdates(); switch ($state) { case "input_rep": $type = "Representative"; drawHeader("Input ".$type); handleFormAction($forminput, $type); drawInputLegForm($type); drawExistingLegislators($type); drawFooter(); break; case "input_sen": $type = "Senator"; drawHeader("Input ".$type); handleFormAction($forminput, $type); drawInputLegForm($type); drawExistingLegislators($type); drawFooter(); break; case "list_all_requests": drawHeader("All Current Requests"); drawAllRequests("Representative"); drawAllRequests("Senator"); drawFooter(); break; case "build_email": drawHeader("".(returnSimpleLink("add_by_leg&legid=".$legid,getNameByID($legid)))." -> Build Email"); handleFormAction($forminput,''); echo "
"; buildEmailForm($legid); echo "
"; drawFooter(); break; case "add_by_leg": drawHeader(getNameByID($legid)); handleFormAction($forminput,''); echo "
"; drawAddCosponsorForm($legid); drawAddAideForm($legid); drawExisting($legid,"aides","aide_boss","aide_num","Aide","aide_fname","aide_lname","aide_title",''); drawExisting($legid,"requests","req_sponsor","req_num","Request","req_refile","req_new","req_status",1); drawBuildEmailForm($legid); drawPreviousBillsByLegislator($legid); echo "
"; drawFooter(); break; case "": drawHeader(""); drawLinks(); drawCosponsorLegislators("Representative"); drawCosponsorLegislators("Senator"); drawFooter(); } mysql_close(); function handleFormAction($t_forminput,$t_type) { switch ($t_forminput) { case "Add Name": enterLegislatorInfo($t_type); break; case "Add Request": enterRequestInfo($_GET['legid']); break; case "Add Aide": enterAideInfo(); break; case "Invitations Received": checkReceived($_POST['legid']); break; case "Delete Entry": deleteEntry($_POST['del_table'],$_POST['del_index'],$_POST['del_num']); break; case "Click to Add": enterRequestInfo($_POST['refile_sponsor']); break; case "Mark as Sent": markAsSent($_GET['legid']); break; } } function drawAllRequests($t_type) { $query = "SELECT * FROM legislators WHERE leg_type = '$t_type' ORDER BY leg_lname ASC"; $result=retrieveFromDatabase($query); $num_rows = mysql_num_rows($result); echo ""; echo "

"; echo "

"; echo ""; echo ""; echo ""; echo "
"; echo "
"; echo "Legislator Name"; echo "
"; echo "
"; echo "09/10 Cosponsored"; echo ""; echo "07/08 Cosponsored"; echo "
"; if ($num_rows > 0) { while($row = mysql_fetch_array($result)) { $temp_legid = $row['leg_num']; drawBillsByLegislator($temp_legid); } } } function drawBillsByLegislator($t_legid) { echo "
"; echo ""; echo ""; echo ""; echo ""; echo "
"; $t_name = getNameByID($t_legid); echo "
"; drawLink("add_by_leg&legid=".$t_legid,$t_name); echo "
"; echo "
"; drawRequestsSimple($t_legid); echo ""; drawCosponsoredSimple($t_legid); echo "
"; echo "
"; } function drawRequestsSimple($t_legid) { $query2 = "SELECT * FROM requests WHERE req_sponsor = '$t_legid' ORDER BY req_refile ASC"; $result2=retrieveFromDatabase($query2); $num_rows2 = mysql_num_rows($result2); if ($num_rows2 > 0) { while($row = mysql_fetch_array($result2)) { $temp_reqid = $row['req_num']; $temp_refile = $row['req_refile']; $temp_new = $row['req_new']; echo "
"; if ($temp_refile == 0) { echo $temp_new; } else { drawBillSimple($temp_refile); } echo "
"; } } } function drawCosponsoredSimple($t_legid) { $arrCOS = getCosponsoredList($t_legid); foreach ($arrCOS as $key => $val) { echo "
"; drawBillSimple($key); echo "
"; } } function drawBuildEmailForm($legid) { ?>
To:
From:
$value) { addRadioToForm("toname",$key,$key,$key); } } function getLegislatorTitle($t_legid) { $query = "SELECT * FROM legislators WHERE leg_num = '$t_legid' LIMIT 1"; $result=mysql_query($query); $row = mysql_fetch_array($result); return $row['leg_type']; } function getAideList($t_legid) { $tempARR = array(); $query = "SELECT * FROM aides WHERE aide_boss = '$t_legid'"; $result=retrieveFromDatabase($query); $num_rows = mysql_num_rows($result); if ($num_rows > 0) { while($row = mysql_fetch_array($result)) { $aidefname=$row['aide_fname']; $tempARR[$aidefname] = 1; } } return $tempARR; } function drawPreviousBillsByLegislator($t_legid) { echo "
"; echo "07/08 All Sponsored Bills"; $arrCOS = getCosponsoredList($t_legid); $query = "SELECT * FROM allbills WHERE bill_sponsorid = '$t_legid'"; $result=retrieveFromDatabase($query); $num_rows = mysql_num_rows($result); echo ""; if ($num_rows > 0) { while($row = mysql_fetch_array($result)) { $bill_num=$row['bill_num']; $bill_sponsorid=$row['bill_sponsorid']; $already_requested = checkIfPresent($bill_num,"requests","req_refile"); echo ""; $billtype = ""; if ($arrCOS[$bill_num]) { $billtype = "cosponsored"; } drawBillInTable($bill_num,$billtype); echo ""; } } echo "
"; if ($already_requested > 0) { echo "
"; echo "Already Requested"; echo "
"; } else { echo "
"; drawClickToAdd($bill_sponsorid,$bill_num); echo "
"; } echo "
"; echo "
"; } function getCosponsoredList($t_legid) { $query = "SELECT * FROM cosponsored"; $arrCOS = array(); $result=retrieveFromDatabase($query); $num_rows = mysql_num_rows($result); if ($num_rows > 0) { while($row = mysql_fetch_array($result)) { $bill_num=$row['bill_num']; $query2 = "SELECT * FROM allbills WHERE bill_num = '$bill_num'"; $result2=retrieveFromDatabase($query2); $row2 = mysql_fetch_array($result2); $bill_sponsorid=$row2['bill_sponsorid']; if ($bill_sponsorid == $t_legid) { $arrCOS[$bill_num] = 1; } } } return $arrCOS; } function getBillLink($t_billnum) { $str = "http://www.mass.gov/legis/bills/house/185/ht0"; $str = $str.(floor($t_billnum/1000)); $str = $str."/ht0".(leadingZeros($t_billnum,4)).".htm"; return $str; } function drawPreviousCosponsored($t_legid) { echo "
"; echo "07/08 Cosponsored Bills"; $query = "SELECT * FROM cosponsored"; $arrCOS = array(); $result=retrieveFromDatabase($query); $num_rows = mysql_num_rows($result); echo ""; if ($num_rows > 0) { while($row = mysql_fetch_array($result)) { $bill_num=$row['bill_num']; $query2 = "SELECT * FROM allbills WHERE bill_num = '$bill_num'"; $result2=retrieveFromDatabase($query2); $row2 = mysql_fetch_array($result2); $bill_sponsorid=$row2['bill_sponsorid']; if ($bill_sponsorid == $t_legid) { $already_requested = checkIfPresent($bill_num,"requests","req_refile"); echo ""; drawBillInTable($bill_num,$billtype); echo ""; } } } echo "
"; if ($already_requested > 0) { echo "
"; echo "Already Requested"; echo "
"; } else { echo "
"; drawClickToAdd($bill_sponsorid,$bill_num); echo "
"; } echo "
"; echo "
"; } function drawClickToAdd($t_sponsor,$t_billnum) { ?>
"; echo ""; echo $b_num; echo ""; echo ""; echo ": ".$b_title; } function drawBillInTable($t_billnum,$t_billtype) { $query = "SELECT * FROM allbills WHERE bill_num = '$t_billnum'"; $result=retrieveFromDatabase($query); $row = mysql_fetch_array($result); $b_num=$row['bill_num']; $b_title=$row['bill_title']; echo ""; echo ""; echo $b_num; echo ""; echo ""; if ($t_billtype == "cosponsored") { echo "
"; } echo $b_title; if ($t_billtype == "cosponsored") { echo "
"; } echo ""; } function checkIfPresent($t_bill_num,$t_table,$t_match) { $query = "SELECT * FROM $t_table WHERE $t_match = '$t_bill_num' LIMIT 1"; $result=retrieveFromDatabase($query); $row = mysql_fetch_array($result); $num_rows = mysql_num_rows($result); return $num_rows; } function makeSpecificUpdates() { updateBillSponsorID("Bradley H. Jones, Jr.", 125); updateBillSponsorID("Harold P. Naughton, Jr.", 152); updateBillSponsorID("Carl M. Sciortino, Jr.", 184); updateBillSponsorID("George N. Peterson, Jr.", 161); updateBillSponsorID("Jennifer L. Flanagan", 20); updateBillSponsorID("James B. Eldridge", 18); updateBillSponsorID("William G. Greene, Jr.", 114); updateBillSponsorID("Timothy J. Toomey, Jr.", 202); updateBillSponsorID("F. Jay Barrows", 59); updateBillSponsorID("Thomas A. Golden, Jr.", 112); updateBillSponsorID("Angelo J. Puppolo, Jr.", 167); updateBillSponsorID("Donald F. Humason, Jr.",124); } function updateBillSponsorID($name, $id) { $query = "UPDATE allbills SET bill_sponsorid = '$id' WHERE bill_sponsor = '$name'"; echo $query; mysql_query($query); } function runNameIDConversion($t_type) { $query = "SELECT * FROM legislators WHERE leg_type = '$t_type' ORDER BY leg_lname ASC"; $arrLEGS = array(); $result=retrieveFromDatabase($query); $num_rows = mysql_num_rows($result); if ($num_rows > 0) { while($row = mysql_fetch_array($result)) { $temp_lname=$row['leg_lname']; $temp_fname=$row['leg_fname']; $temp_legid = $row['leg_num']; $arrLEGS[$temp_legid] = $temp_fname." ".$temp_lname; } } #print_r($arrLEGS); $query = "SELECT * FROM allbills ORDER BY bill_num ASC"; $arrBILLS[0] = "Bills"; $result=retrieveFromDatabase($query); $num_rows = mysql_num_rows($result); if ($num_rows > 0) { while($row = mysql_fetch_array($result)) { $temp_name=$row['bill_sponsor']; $temp_id = $row['bill_num']; $arrBILLS[$temp_id] = $temp_name; } } #print_r($arrBILLS); $loopmax = 200; $loopnum = 0; $arrLEGIDS = array(); foreach ($arrLEGS as $key => $value) { if ($loopnum < $loopmax) { #echo "Key: $key; Value: $value
\n"; $loopnum = $loopnum+1; #echo $value."
\n"; foreach ($arrBILLS as $bkey => $bvalue) { similar_text($value,$bvalue,$p); if ($p > 80) { #echo $bvalue.": ".$p."
\n"; $arrLEGIDS[$bkey] = $key; } } #echo "
\n"; } else { break; } } foreach ($arrLEGIDS as $billnum => $legnum) { $query = "UPDATE allbills SET bill_sponsorid = '$legnum' WHERE bill_num = '$billnum' LIMIT 1"; mysql_query($query); } } function drawAddAideForm($t_legid) { ?>
First Name:
Last Name:
Title:
".$name.""; ?>
Refile Number:
- Or -
New Bill Title:
"; echo $text.""; } function getNameByID($t_legid) { $query = "SELECT * FROM legislators WHERE leg_num = '$t_legid' LIMIT 1"; $result=mysql_query($query); $row = mysql_fetch_array($result); return $row['leg_lname'].", ".$row['leg_fname']; } function getLastNameByID($t_legid) { $query = "SELECT * FROM legislators WHERE leg_num = '$t_legid' LIMIT 1"; $result=mysql_query($query); $row = mysql_fetch_array($result); return $row['leg_type']." ".$row['leg_lname']; } function enterLegislatorInfo($t_type) { $fname = verifyInput($_POST['fname']); $lname = verifyInput($_POST['lname']); $err = ""; if ($fname == "") $err = $err."Error: First name not entered"; if ($lname == "") $err = $err."Error: Last name not entered"; if ($err) { redAlert($err); } else { addLegToDatabase($t_type,$fname,$lname); redAlert("Added Name: ".$fname." ".$lname); } } function addLegToDatabase($t_type,$f_name,$l_name) { $query = "INSERT INTO legislators VALUES ('','$t_type','$f_name','$l_name','','0')"; mysql_query($query); } function drawCosponsorLegislators($t_type) { echo "
"; $query = "SELECT * FROM legislators WHERE leg_type = '$t_type' ORDER BY leg_lname ASC"; $result=retrieveFromDatabase($query); $num_rows = mysql_num_rows($result); echo "Select a ".$t_type." to add a request from:"; echo ""; if ($num_rows > 0) { while($row = mysql_fetch_array($result)) { echo ""; } } else { echo "No ".$t_type."s in records."; } echo "
"; $temp_lname=$row['leg_lname']; $temp_fname=$row['leg_fname']; $temp_received = $row['leg_received']; $temp_legid = $row['leg_num']; $temp_emailed = $row['leg_email']; $t_name = $temp_lname.", ".$temp_fname; $num_of_requests = getNumberOfEntries("requests","req_sponsor",$temp_legid); $num_of_aides = getNumberOfEntries("aides","aide_boss",$temp_legid); if ($temp_emailed == 1) { echo "
"; } elseif ($num_of_requests + $num_of_aides == 0) { echo "
"; } else { echo "
"; } echo $num_of_requests." Requests, ".$num_of_aides." Aides"; echo "
"; #if ($temp_received == 0) { # drawReceived($temp_legid); #} else { # echo "Invitations Received"; #} echo "
"; echo "
"; drawLink("add_by_leg&legid=".$temp_legid,$t_name); echo "
"; echo "
"; echo "
"; } function getNumberOfEntries($table,$match,$legid) { $query = "SELECT * FROM $table WHERE $match = '$legid'"; $result=retrieveFromDatabase($query); $num_rows = mysql_num_rows($result); return $num_rows; } function drawReceived($t_legid) { ?>
"; $arrCOS = getCosponsoredList($legid); $query = "SELECT * FROM $table WHERE $match = '$legid' ORDER BY $info1 ASC"; $result=retrieveFromDatabase($query); $num_rows = mysql_num_rows($result); echo "Current ".$name."s (".$num_rows."):"; echo ""; if ($num_rows > 0) { while($row = mysql_fetch_array($result)) { $temp_1=$row[$info1]; $temp_2=$row[$info2]; $temp_3=$row[$info3]; $num = $row[$id]; echo ""; } else { $billtype = ""; if ($arrCOS[$temp_1]) { $billtype = "cosponsored"; } drawBillInTable($temp_1,$billtype); } } else { echo ""; } echo ""; echo ""; echo ""; } } else { echo "No ".$name."s in records."; } echo "
"; echo "
"; if ($isbill) { if ($temp_1 == '0') { echo "
NEW?"; echo $temp_2; echo "".$temp_1." ".$temp_2.", ".$temp_3; echo ""; drawDeleteButton($table,$id,$num); echo "
"; echo ""; } function drawDeleteButton($t_table,$t_index,$t_num) { ?>
"; $query = "SELECT * FROM legislators WHERE leg_type = '$t_type' ORDER BY leg_lname ASC"; $result=retrieveFromDatabase($query); $num_rows = mysql_num_rows($result); echo "Current ".$t_type."s (".$num_rows."):"; if ($num_rows > 0) { while($row = mysql_fetch_array($result)) { $temp_lname=$row['leg_lname']; $temp_fname=$row['leg_fname']; echo "
"; echo $temp_lname.", ".$temp_fname; echo "
"; } } else { echo "No ".$t_type."s in records."; } echo ""; } function verifyInput($text) { $input = $text; $input = htmlspecialchars($input); if (get_magic_quotes_gpc()) { // if magic quotes is enabled, get rid of those // pesky slashes $input = stripslashes($input); } $input = mysql_real_escape_string($input); return $input; } function redAlert($alert_text) { echo "
"; echo $alert_text; echo "
"; } function drawInputLegForm($type) { echo "
"; echo "

".$type." Input Form

"; ?>
First Name:
Last Name:
"; } function drawLinks() { echo "
"; drawLink("input_rep","Input Representative Form"); drawLink("input_sen","Input Senator Form"); drawLink("list_all_requests","List All Cosponsored Bills"); echo "

"; echo "
"; } function drawLink($function,$text) { echo "
"; echo ""; echo $text; echo ""; echo "
"; } function returnSimpleLink($function,$text) { return "".$text.""; } function drawHeader($t_crumb) { echo "
"; echo ""; echo "Home"; echo ""; if ($t_crumb) { echo "
"; echo " -> ".$t_crumb; echo "
"; } echo "
"; echo "
"; } function drawFooter() { ## end mainbody_wrapper echo "
"; echo "
"; echo "
"; } function retrieveFromDatabase($query) { $result=mysql_query($query); #$result = stripslashes($result); return $result; } function leadingZeros($value, $places){ // Function written by Marcus L. Griswold (vujsa) // Can be found at http://www.handyphp.com // Do not remove this header! if(is_numeric($value)){ for($x = 1; $x <= $places; $x++){ $ceiling = pow(10, $x); if($value < $ceiling){ $zeros = $places - $x; for($y = 1; $y <= $zeros; $y++){ $leading .= "0"; } $x = $places + 1; } } $output = $leading . $value; } else{ $output = $value; } return $output; } function drawIntro($to_name,$l_name,$numrows) { $plural = ""; if ($numrows == 1) { $plural = "bill"; } else { $plural = "bills"; } echo "Rep. Toomey would like to cosponsor ".$numrows." ".$plural." filed by ".$l_name; echo "

"; echo "Hi ".$to_name.",

"; echo "Representative Toomey would like to cosponsor the following ".$plural." from your office:

"; } function drawSignature($from_name) { echo "
"; echo "Please let our office know if you need any other information or have any questions.
"; echo "Thank you,

"; echo $from_name."
"; echo "Legislative Aide for Representative Tim Toomey
"; echo "617.722.2692"; } function getBillTitle($t_billnum) { $query = "SELECT * FROM allbills WHERE bill_num = '$t_billnum'"; $result=retrieveFromDatabase($query); $row = mysql_fetch_array($result); $b_num=$row['bill_num']; $b_title=$row['bill_title']; return $b_title; } function buildEmailForm($t_legid) { $query = "SELECT * FROM requests WHERE req_sponsor = '$t_legid' ORDER BY req_refile ASC"; $result = retrieveFromDatabase($query); $num_rows = mysql_num_rows($result); $lname = getLastNameByID($t_legid); drawIntro($_POST['toname'],$lname,$num_rows); $billcount = 1; while($row = mysql_fetch_array($result)) { $temp_num=$row['req_num']; $temp_new = $row['req_new']; $temp_refile=$row['req_refile']; if ($temp_new) { echo $billcount.") ".$temp_new."
"; } else { echo $billcount.") ".getBillTitle($temp_refile)." (Refile of H".$temp_refile."), "."
"; } $billcount = $billcount+1; } drawSignature($_POST['fromname']); buildSentForm($t_legid); } function buildSentForm($t_legid) { ?>
Export your travel map to any Web page travel map.Find and buy used Dodge srt 4 dealers.2008 Chevrolet TrailBlazer Video chevy truck.Ford F150 need to replace ring & pinion 98 4x4 4.6 xlt.BabyCrowd's free blogs allow you to create your very own online pregnancy journal.Mom and son makeout for Tickets to Nascar race mom son.Office Gadgets on Coolest Gadgets a href=http://gadgettoolls.com/hardware-round-up-hottest-gadgets-of-2008.html rel=dofollow>office gadgets.Offer inbound travel tour.Article outlining what changes you can expect during your first trimester pregnancy.Suzuki's website for ATVs, dealers and newssuzuki.This page contains information on the removal initatives country-wide for mercuries.Used 2005 Dodge Neon srt 4 dealership.Ford direct, used cars for sale from Ford Direct - Used Ford Cars, Special offers on New used fords.The official site of the Harley-Davidson Motor Company. View Harley-Davidson motorcycleszara retail outlets zara retail outlets- A study published chat tampico chat tampico- On a third occasion australian grasslands food web australian grasslands food web- expanded on these and other drink recipe bfk drink recipe bfk- He would seek winchester bullet trajectories winchester bullet trajectories- dealing with particular tienda ropa hym tienda ropa hym- if in the long pedo lolitas pedo lolitas- aware of this brandy diddler brandy diddler- meat rub tube famous nvq 4 hsc help and guidance nvq 4 hsc help and guidance- women season solution saigon go fo girls bars saigon go fo girls bars- pulmonology quince cake recipe quince cake recipe- grow study still learn tube8 litle lupe tube8 litle lupe- time of inquiry hillcrest plumbing vancouver hillcrest plumbing vancouver- From the outset pro touring 2nd generation camaro frames pro touring 2nd generation camaro frames- true beliefs amounted jena jenson jena jenson- that one's response health food and herbal supplies health food and herbal supplies- of wide dynamic venison pepperoni recipes venison pepperoni recipes- depicting Russian muddy creek outfitters wyoming muddy creek outfitters wyoming- of popular joking faith extreme naturals faith extreme naturals- has been a reflection healthy sugar free granola bar recipe healthy sugar free granola bar recipe- was one avon swot avon swot- size vary settle speak libreria gandhi libreria gandhi- both Christian hockey pockey song hockey pockey song- such beliefs pictures of jonathan wexler pictures of jonathan wexler- The islands' human used snowcats for sale used snowcats for sale- evening condition feed sexo fiesta sexo fiesta- and never having calamba national hichschool calamba national hichschool- grow study still learn trimax portland oregon trimax portland oregon- verification practices marie calendar pie recipes marie calendar pie recipes- duck instant market video de mujer masturbandose video de mujer masturbandose- effect electric james lapham tax fraud james lapham tax fraud- include divide syllable felt model of lithium atom model of lithium atom- however some emit paula and jaimie dean s goulash recipe paula and jaimie dean s goulash recipe- and were only ophra christmas list ophra christmas list- personal experiences locate address and phone number canada locate address and phone number canada- human history pelican esprit 100 dsl kayak pelican esprit 100 dsl kayak- The islands' human fan lighting led kit ceiling fan lighting led kit ceiling- local authority area mcafee crack rapidshare mcafee crack rapidshare- suit current lift sajak cinta sajak cinta- in which Kurt visco pathfinder visco pathfinder- as something beyond brown sweet and sour sauce recipe brown sweet and sour sauce recipe- after a contested election decisions in paradise paper decisions in paradise paper- change and as the most radish cake recipe radish cake recipe- a science of body systems beverly hills 90210 stream beverly hills 90210 stream- not to recognise propagating persimmon trees propagating persimmon trees- Nuttall's book Bomb russian prelolita russian prelolita- the idea that a belief asstraffic com password asstraffic com password- with still better results jobs at winco foods jobs at winco foods- own page actress lina santos actress lina santos- but false for another triumph daytona 1200 1995 triumph daytona 1200 1995- suit current lift balian house christmas lights balian house christmas lights- branch match suffix posher scale model cars posher scale model cars- to an annoyance meaning of wolf counselor meaning of wolf counselor- Journal of Conflict pwf foundations guide manual pwf foundations guide manual- the writer's name bullet lube recipe bullet lube recipe- be back to normal soon shoks shoks- predicated of the persons rollercoaster tycoon 2 mega trainer rollercoaster tycoon 2 mega trainer- and government hanger 9 rc piper cub hanger 9 rc piper cub- related emotions guitar knit dishcloth patterns guitar knit dishcloth patterns- of Nature in which massage with happy ending in ottawa massage with happy ending in ottawa- usual young ready mountain resort in laguna philippines mountain resort in laguna philippines- unique way of life kelley cadillac chattanooga kelley cadillac chattanooga- with still better results foods to avoid a gallbladder attack foods to avoid a gallbladder attack- It is no explanation carrieland pics carrieland pics- James also argued