“Alabama”,
‘AK’ => “Alaska”,
‘AS’ => “American Samoa”,
‘AZ’ => “Arizona”,
‘AR’ => “Arkansas”,
‘AE’ => “Armed Forces Africa”,
‘AA’ => “Armed Forces Americas”,
‘AE’ => “Armed Forces Canada”,
‘AE’ => “Armed Forces Europe”,
‘AE’ => “Armed Forces Middle East”,
‘AP’ => “Armed Forces Pacific”,
‘CA’ => “California”,
‘CO’ => “Colorado”,
‘CT’ => “Connecticut”,
‘DE’ => “Delaware”,
‘DC’ => “District of Columbia”,
‘FM’ => “Federated States of Micronesia”,
‘FL’ => “Florida”,
‘GA’ => “Georgia”,
‘GU’ => “Guam”,
‘HI’ => “Hawaii”,
‘ID’ => “Idaho”,
‘IL’ => “Illinois”,
‘IN’ => “Indiana”,
‘IA’ => “Iowa”,
‘KS’ => “Kansas”,
‘KY’ => “Kentucky”,
‘LA’ => “Louisiana”,
‘ME’ => “Maine”,
‘MH’ => “Marshall Islands”,
‘MD’ => “Maryland”,
‘MA’ => “Massachusetts”,
‘MI’ => “Michigan”,
‘MN’ => “Minnesota”,
‘MS’ => “Mississippi”,
‘MO’ => “Missouri”,
‘MT’ => “Montana”,
‘NE’ => “Nebraska”,
‘NV’ => “Nevada”,
‘NH’ => “New Hampshire”,
‘NJ’ => “New Jersey”,
‘NM’ => “New Mexico”,
‘NY’ => “New York”,
‘NC’ => “North Carolina”,
‘ND’ => “North Dakota”,
‘MP’ => “Northern Mariana Islands”,
‘OH’ => “Ohio”,
‘OK’ => “Oklahoma”,
‘OR’ => “Oregon”,
‘PW’ => “Palau”,
‘PA’ => “Pennsylvania”,
‘PR’ => “Puerto Rico”,
‘RI’ => “Rhode Island”,
‘SC’ => “South Carolina”,
‘SD’ => “South Dakota”,
‘TN’ => “Tennessee”,
‘TX’ => “Texas”,
‘UT’ => “Utah”,
‘VT’ => “Vermont”,
‘VI’ => “Virgin Islands”,
‘VA’ => “Virginia”,
‘WA’ => “Washington”,
‘WV’ => “West Virginia”,
‘WI’ => “Wisconsin”,
‘WY’ => “Wyoming”);
function time_ago_mysql($mysql_time)
{
$time = strtotime($mysql_time);
$sec = time() – $time;
$str = null;
if (($num = floor($sec / (365*24*60*60))) > 0) $str = str_replace(‘ ‘, ‘ ‘, date(‘M d, Y’, $time));
else if (($num = floor($sec / (24*60*60))) > 0) $str = str_replace(‘ ‘, ‘ ‘, date(‘M d’, $time));
else if (($num = floor($sec / (60*60))) > 0) $str = $num.’h’;
else if (($num = floor($sec / 60)) > 0) $str = $num.’m’;
else $str = $sec.’s’;
return ““.$str.”“;
}
function print_signers($start_id = 0, $meta = false, $no_limit = false)
{
global $states, $my;
$query = mysqli_query($my, ‘SELECT id,name,state,comments,created FROM sessions_petition’.(!empty($start_id) ? ‘ WHERE id >= ‘.intval($start_id) : null).’ ORDER BY id DESC’.(!$no_limit ? ‘ LIMIT 100’ : null));
$last_id = 0;
$str = null;
while ($info = mysqli_fetch_assoc($query))
{
if (!$last_id)
{
$last_id = $info[‘id’];
}
$info[‘comments’] = trim($info[‘comments’]);
$str .= “
\n”;
if ($info[‘comments’])
{
$str .= “
$COMMENT_MAX = ($no_limit ? 1000 : 300); // NOT number of signers
if (strlen($info[‘comments’]) < $COMMENT_MAX)
{
$str .= htmlentities($info['comments'])."\n";
}
else
{
$str .= htmlentities(substr($info['comments'], 0, $COMMENT_MAX))."…
(More) \n”;
}
$str .= “
\n”;
}
}
if (!empty($meta) && !empty($str))
{
print time().”\t”.$last_id.”\t”;
}
print str_replace(“\t”, ‘ ‘, $str);
if (!$no_limit) print “
\n”;
}
if (!empty($_REQUEST[‘no_body’]))
{
if (isset($_REQUEST[‘signers’]))
{
print_signers($_REQUEST[‘signers’], !empty($_REQUEST[‘get_meta’]));
exit();
}
function do_fwrite($fp, $data)
{
fwrite($fp, $data);
$response = fgets($fp, 256);
/* print “Sending: “.htmlentities($data).”
\n”;
print “Response: “;
print htmlentities($response).”
\n”;
print “
\n”;*/
return $response;
}
function mail_remote($from, $to, $subject, $headers, $other_server = false)
{
$nl = “\n”;
$host = “fre.freedomwatchusa.org”;
$auth_code = ‘AGluZm9AbGlzdDQuZnJlZWRvbXdhdGNodXNhLm9yZwBBRFVjZ3U3OA==’;
if ($other_server)
{
$host = ‘lar.larryklayman.com’;
$auth_code = ‘AGluZm9AbGlzdDUuZnJlZWRvbXdhdGNodXNhLm9yZwBBRFVjZ3U3OA==’;
}
if (!($fp = fsockopen($host, 25, $errno, $errstr, 10)))
{
list($headers1, $headers2) = explode(“\n\n”, str_replace(“\r”, ”, $headers), 2);
mail($to, $subject, $headers2, $headers1);
}
else
{
fgets($fp, 256); // 220 […]
do_fwrite($fp, “EHLO list.freedomwatchusa.org”.$nl);
fgets($fp, 256); // 250-[…]
fgets($fp, 256); // 250-PIPELINING
fgets($fp, 256); // 250-SIZE 102400000
fgets($fp, 256); // 250-VRFY
fgets($fp, 256); // 250-ETRN
fgets($fp, 256); // 250-STARTTLS
fgets($fp, 256); // 250-AUTH PLAIN LOGIN
fgets($fp, 256); // 250-AUTH=PLAIN LOGIN
fgets($fp, 256); // 250-ENHANCEDSTATUSCODES
fgets($fp, 256); // 250-8BITMIME
/*fgets($fp, 256);*/ // 250 DSN
$response = do_fwrite($fp, “AUTH PLAIN “.$auth_code.$nl); // Taken from list4 config
if (!preg_match(‘/^235 /i’, $response))
{
fclose($fp);
$fp = null;
mail($to, $subject, null, $headers);
}
else
{
$data =
“To: “.addslashes($to).$nl.
“Subject: $subject”.$nl.
str_replace(“\n.”, “\n..”, $headers).”\n.\n”;
do_fwrite($fp, “MAIL FROM: <".$from.">“.$nl);
do_fwrite($fp, “RCPT TO: <".$to.">“.$nl);
do_fwrite($fp, “DATA”.$nl);
do_fwrite($fp, $data);
}
}
}
// Re-send email
if (!empty($_REQUEST[‘resend’]))
{
if (mysqli_num_rows($q = mysqli_query($my, ‘SELECT code FROM sessions_petition_pending WHERE email=”‘.mysqli_escape_string($my, $_REQUEST[‘resend’]).'”‘.(!empty($_REQUEST[‘pending_id’]) ? ‘ AND id=”‘.mysqli_escape_string($my, $_REQUEST[‘pending_id’]).'”‘ : null).’ LIMIT 1′)) > 0)
{
list($code) = mysqli_fetch_array($q);
$email_from = ‘info@list3.freedomwatchusa.org’;
$email_to = $_REQUEST[‘resend’];
$email_headers = str_replace(‘[CODE]’, $code, str_replace(‘[DATE_SENT]’, date(‘r’), file_get_contents(‘sessions_petition_email.txt’)));
$email_subject = ‘Please confirm your signature’;
mail_remote($email_from, $email_to, $email_subject, $email_headers, true);
}
die(‘OK’);
}
if ($_REQUEST[’email’] == ‘rushncap1@yahoo.com’) die();
$_REQUEST[’email’] = trim($_REQUEST[’email’]);
if (!preg_match(‘/^[\’\/a-z0-9.\-_]+@((?:[a-z0-9](?:[a-z0-9\-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9\-]*[a-z0-9])?)$/i’, $_REQUEST[’email’]))
{
die(‘EMAIL’);
}
if (mysqli_num_rows(mysqli_query($my, ‘SELECT 1 FROM sessions_petition WHERE name=”‘.mysqli_escape_string($my, $_REQUEST[‘name’]).'” AND email=”‘.mysqli_escape_string($my, $_REQUEST[’email’]).'” LIMIT 1′)) <= 0)
{
if (mysqli_num_rows($q = mysqli_query($my, 'SELECT id FROM sessions_petition_pending WHERE name="'.mysqli_escape_string($my, $_REQUEST['name']).'" AND email="'.mysqli_escape_string($my, $_REQUEST['email']).'" LIMIT 1')) <= 0)
{
$send_email = true;
if (mysqli_num_rows(mysqli_query($my, 'SELECT 1 FROM uranium_existing WHERE email="'.mysqli_escape_string($my, $_REQUEST['email']).'" LIMIT 1')) > 0)
{
$send_email = false;
}
$values =
‘”‘.mysqli_escape_string($my, $_REQUEST[‘name’]).'”,’.
‘”‘.mysqli_escape_string($my, $_REQUEST[’email’]).'”,’.
‘”‘.mysqli_escape_string($my, $_REQUEST[‘phone’]).'”,’.
‘”‘.mysqli_escape_string($my, $_REQUEST[‘address’]).'”,’.
‘”‘.mysqli_escape_string($my, $_REQUEST[‘city’]).'”,’.
‘”‘.mysqli_escape_string($my, $_REQUEST[‘state’]).'”,’.
‘”‘.mysqli_escape_string($my, $_REQUEST[‘zip’]).'”,’.
‘”‘.mysqli_escape_string($my, $_REQUEST[‘comments’]).'”,’.
‘”‘.mysqli_escape_string($my, $_REQUEST[‘opt_other’]).'”,’.
‘INET_ATON(“‘.mysqli_escape_string($my, !empty($_REQUEST[‘ip’]) ? $_REQUEST[‘ip’] : $_SERVER[‘REMOTE_ADDR’]).'”),’.
‘NOW()’.
($send_email ? ‘,”‘.mysqli_escape_string($my, $code = strrev(uniqid().’.’.md5(microtime().’xyzzy’.$_SERVER[‘REMOTE_ADDR’]))).'”‘ : null);
if (!mysqli_query($my, ‘INSERT INTO ‘.($send_email ? ‘sessions_petition_pending’ : ‘sessions_petition’).'(name,email,phone,address,city,state,zip,comments,opt_other,ip,created’.($send_email ? ‘,code’ : null).’) VALUES(‘.$values.’)’)) die(‘DB’.mysqli_error($my));
$_REQUEST[‘id’] = mysqli_insert_id($my);
if ($send_email)
{
$email_from = ‘info@list3.freedomwatchusa.org’;
$email_to = $_REQUEST[’email’];
$email_headers = str_replace(‘[CODE]’, $code, str_replace(‘[DATE_SENT]’, date(‘r’), file_get_contents(‘sessions_petition_email.txt’)));
$email_subject = ‘Please confirm your signature’;
mail_remote($email_from, $email_to, $email_subject, $email_headers);
}
else
{
$info = $_REQUEST;
// Send to Node.js (COPIED FROM u.php)
$curr_time = time();
$COMMENT_MAX = 300;
if (strlen($info[‘comments’]) < $COMMENT_MAX)
{
$comments = htmlentities($info['comments'])."\n";
}
else
{
$comments = htmlentities(substr($info['comments'], 0, $COMMENT_MAX))."…
(More) \n”;
}
$post_data = json_encode(array(
‘petition’ => ‘sessions’,
‘id’ => htmlentities($info[‘id’]),
‘time’ => time(),
‘name’ => htmlentities($info[‘name’]),
‘state’ => $states[$info[‘state’]],
‘ago’ => “0s“,
‘comments’ => $comments));
$cURL = curl_init();
curl_setopt($cURL, CURLOPT_URL, ‘http://localhost:2424/’);
curl_setopt($cURL, CURLOPT_CUSTOMREQUEST, “POST”);
curl_setopt($cURL, CURLOPT_POSTFIELDS, $post_data);
curl_setopt($cURL, CURLOPT_RETURNTRANSFER, true);
curl_setopt($cURL, CURLOPT_HTTPHEADER, array(‘Content-Type: application/json’, ‘Content-Length: ‘.strlen($post_data)));
/* curl_setopt($cURL, CURLOPT_AUTOREFERER, true);
curl_setopt($cURL, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($cURL, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($cURL, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($cURL, CURLOPT_ENCODING, ”);*/
curl_setopt($cURL, CURLOPT_TIMEOUT, 3);
$result = curl_exec($cURL);
die(‘DONE’);
}
}
else
{
list($_REQUEST[‘id’]) = mysqli_fetch_array($q);
}
}
else die(‘DUP’);
die(‘OK’.(!empty($_REQUEST[‘id’]) ? $_REQUEST[‘id’] : 0));
}
?>
\n”;
print_signers(0, false, true);
}
else
{
if (empty($_REQUEST[‘signed_petition’]))
{
?>
Once you are confirmed, your name and comments will appear publicly below.