\n"; } else { $output = $output."$row[title] $row[nickname] $row[last] ($row[party])
\n"; } $state = $row[legstate]; $id[] = $row[id]; } return $output; } function chooseMem ($array) { global $campaignid, $zip; while ($row = mysql_fetch_array($array)) { echo "select $row[title] $row[nickname] $row[last] ($row[party]) District $row[district]
\n"; } } $zip = $_GET["zip"] ? $_GET["zip"] : $_POST["zip"]; $zip4 = $_GET["zip4"] ? $_GET["zip4"] : $_POST["zip4"]; $campaignid = $_GET["campaignid"] ? $_GET["campaignid"] : $_POST["campaignid"]; $allRep = $_GET["allRep"] ? $_GET["allRep"] : $_POST["allRep"]; if ($zip4 == "") { $plus4query = "zip2dist.zip like '$zip'"; } else { $plus4query = "zip2dist.zip like '$zip' and zip2dist.plus4low <= '$zip4' and zip2dist.plus4high >= '$zip4'"; } $DBhost = "localhost"; $DBuser = "grassroots"; $DBpass = "tri11ian"; $DBName = "grassroots"; $db = mysql_connect($DBhost,$DBuser,$DBpass) or die("Unable to connect to database"); mysql_select_db("$DBName") or die("Unable to select database $DBName"); $campaignquery = " SELECT * FROM campaign WHERE id like '$campaignid'"; $campaign = mysql_query($campaignquery) or die ("Invalid Campaign Query"); while ($row = mysql_fetch_array($campaign)) { switch ($row[target]) { case "all": $hinc = 1; $sinc = 1; break; case "hall": $hinc = 1; $sinc = 0; break; case "sall": $hinc = 0; $sinc = 1; break; } $active = $row[active]; if (!$active) { $closing = $row[closing]; } else { $opt = $row[opt]; $subject = $row[subject]; $body1 = nl2br($row[body1]); $body_opt = $row[body_opt]; $body2 = nl2br($row[body2]); $cols = 50; $rows = substr_count(wordwrap($body_opt, $cols, "\n"), "\n"); } } if ($active) { $senatequery = " SELECT * FROM zip2dist, members WHERE zip2dist.zip like '$zip' and zip2dist.legstate like members.legstate and members.chamber like 'S' GROUP BY members.district"; $senate = mysql_query($senatequery) or die ("Invalid Senate Query"); $housequery = " SELECT * FROM zip2dist, members WHERE ".$plus4query." and zip2dist.legstate like members.legstate and zip2dist.district like members.district GROUP BY members.district"; $house = mysql_query($housequery) or die ("Invalid House Query"); $repcount = mysql_num_rows($house); ?>
"; break; case 1: echo ""; break; default: echo ""; break; } $mailcount = count($id); ?>
Zip Code not found. Please reenter.
"; if ($sinc == 1) echo showMem($senate, 0); if ($hinc == 1) echo showMem($house, 0); echo "

Your message will be sent to

"; //echo "President George W. Bush (R)
\n"; if ($sinc == 1) echo showMem($senate, 0); if ($hinc == 1) echo showMem($house, 0); echo "

Your message will be sent to

"; //echo "President George W. Bush (R)
\n"; if ($sinc == 1) echo showMem($senate, 0); if ($hinc == 1) { if ($allRep == 1) { chooseMem($house); } else { echo showMem($house, 1); echo "This isn't my Congressman"; } } echo "

Research has shown that Congressional offices pay more attention to personalized email actions. We strongly suggest that you enter a personal message to your representative in the box below.

 

 

*First Name:

*Last Name:

*Address 1:

Address 2:

*City:

State:

Zip:

*Email:

I would like to receive occasional updates about FAS activities in this area

Please click here to send us any feedback you may have about this petition.

Subject:

Dear [Decisionmaker],

$body1

"; } if ($body2 != "") { echo "

$body2

"; } ?>

Sincerely,

[Your name]
[Your address]
[City],

\n"; echo "\n"; echo "\n"; for ($n=0;$n<$mailcount;$n++) { echo "\n"; } } else { echo $closing; } ?>