X-Git-Url: http://git.hcoop.net/clinton/MarylandElectronicPetitionSignature.git/blobdiff_plain/a06ba9d87b5492f0cef8246ce50c52cbc670ada0..cfac735343ae3eac5ebd21b799af96f9b33ea529:/is_the_information_correct.php diff --git a/is_the_information_correct.php b/is_the_information_correct.php index bd9d219..9b95e92 100644 --- a/is_the_information_correct.php +++ b/is_the_information_correct.php @@ -19,70 +19,89 @@ if ($web_first_name != '' && $web_last_name != '' && $web_house_number != '' && // V2 API - Remote include_once('api/maryland_voter.php'); -$month = $_COOKIE['web_dob_month']; -$day = $_COOKIE['web_dob_year']; -$year = $_COOKIE['web_dob_day']; +$month = date('m',strtotime($DOB)); +$day = date('d',strtotime($DOB)); +$year = date('Y',strtotime($DOB)); $error = 'Based on what you entered, we were unable to find any information.'; -$sbe_response = md_voter_lookup($web_first_name,$web_last_name,$month,$day,$year,$web_zip_code,'',''); -$pos = strpos($sbe_response, $error); -if ($pos !== false) { - slack_general_admin("Voter API v2 Fail: ($web_first_name,$web_last_name,$month,$day,$year,$web_zip_code) $error",'md-petition-api'); - //meps_mail('mdpetition@gmail.com',$sbe_response,'Voter API v2 Fail: '.$error); -} $error2 = 'MISSING NAME'; -$pos = strpos($sbe_response, $error2); -if ($pos !== false) { - slack_general_admin("Voter API v2 Fail: ($web_first_name,$web_last_name,$month,$day,$year,$web_zip_code) $error2",'md-petition-api'); - // meps_mail('mdpetition@gmail.com',$sbe_response,'Voter API v2 Fail: '.$error2); -} $error3 = 'My Voter Registration Record'; -$pos = strpos($sbe_response, $error3); +$error4 = 'Your search cannot be processed at this time'; +$sbe_response = md_voter_lookup($web_first_name,$web_last_name,$month,$day,$year,$web_zip_code,'',''); +$pos = strpos($sbe_response, $error4); if ($pos !== false) { - slack_general_admin("Voter API v2 Success: ($web_first_name,$web_last_name,$month,$day,$year,$web_zip_code) $error3",'md-petition-api'); - // meps_mail('mdpetition@gmail.com',$sbe_response,'Voter API v2 Success: '.$error3); + slack_general_admin("Voter API v2 Block: $web_first_name,$web_last_name,$month,$day,$year,$web_zip_code $error4",'md-petition-api'); +}else{ + $pos = strpos($sbe_response, $error); + if ($pos !== false) { + slack_general_admin("Voter API v2 Fail: $web_first_name,$web_last_name,$month,$day,$year,$web_zip_code $error",'md-petition-api'); + } + $pos = strpos($sbe_response, $error2); + if ($pos !== false) { + slack_general_admin("Voter API v2 Fail: $web_first_name,$web_last_name,$month,$day,$year,$web_zip_code $error2",'md-petition-api'); + } + $pos = strpos($sbe_response, $error3); + if ($pos !== false) { + slack_general_admin("Voter API v2 Success: $web_first_name,$web_last_name,$month,$day,$year,$web_zip_code $error3",'md-petition-api'); + } } -// V1 API - Local -$q = "select * from VoterList where LASTNAME = '$web_last_name' and FIRSTNAME = '$web_first_name' and HOUSE_NUMBER = '$web_house_number' and RESIDENTIALZIP5 = '$web_zip_code'"; +// v3 update to VoterList +$q = "select * from VoterList2 where LASTNAME = '$web_last_name' and FIRSTNAME = '$web_first_name' and HOUSE_NUMBER = '$web_house_number' and RESIDENTIALZIP5 = '$web_zip_code'"; $r = $petition->query($q); $d = mysqli_fetch_array($r); if ($d['VTRID'] != ''){ - $VTRID = $d['VTRID']; - $FIRSTNAME = $d['FIRSTNAME']; - $MIDDLENAME = $d['MIDDLENAME']; - if ($MIDDLENAME == ''){ - slack_general_admin("WARN: Blank Middle Name Detected",'md-petition-signed'); - } - $LASTNAME = $d['LASTNAME']; - $pos = strpos($LASTNAME, '-'); - if ($pos !== false) { - slack_general_admin("WARN: Hyphen in Last Name Detected",'md-petition-signed'); - } - $ADDRESS = $d['ADDRESS']; - $RESIDENTIALCITY = $d['RESIDENTIALCITY']; - $COUNTY = $d['COUNTY']; - $RESIDENTIALZIP5 = $d['RESIDENTIALZIP5']; - // set cookies for hard_copy.php - setcookie("pCOUNTY", $COUNTY); - if ($MIDDLENAME == ''){ - setcookie("pNAME", "$FIRSTNAME $LASTNAME"); + slack_general_admin("VoterList2 Search Found",'md-petition-api'); + $VoterList_table = 'VoterList2'; +}else{ + $q = "select * from VoterList where LASTNAME = '$web_last_name' and FIRSTNAME = '$web_first_name' and HOUSE_NUMBER = '$web_house_number' and RESIDENTIALZIP5 = '$web_zip_code'"; + $r = $petition->query($q); + $d = mysqli_fetch_array($r); + if ($d['VTRID'] != ''){ + slack_general_admin("VoterList Search Found",'md-petition-api'); + $VoterList_table = 'VoterList'; }else{ - setcookie("pNAME", "$FIRSTNAME $MIDDLENAME $LASTNAME"); + slack_general_admin("VoterList and VoterList2 Search Not Found",'md-petition-api'); + //slack_general('MISS: Is the information correct ('.$web_first_name.' '.$web_last_name.' '.$PHONE.') ('.$_COOKIE['invite'].')','md-petition'); + setcookie("signature_status", 'notfound'); + header('Location: warning_not_found.php'); + die(); } - setcookie("pADDRESS", "$ADDRESS $RESIDENTIALCITY $RESIDENTIALZIP5"); - setcookie("pADDRESS1", "$ADDRESS"); - setcookie("pADDRESS2", "$RESIDENTIALCITY MD $RESIDENTIALZIP5"); - setcookie("pVTRID", $VTRID); - setcookie("signature_status", 'verified'); - slack_general("API v1: SUCCESS ($web_first_name,$web_last_name,$month,$day,$year,$web_zip_code) ($_COOKIE['invite'])",'md-petition-api'); +} +setcookie("VoterList_table", $VoterList_table); +$q = "select * from $VoterList_table where LASTNAME = '$web_last_name' and FIRSTNAME = '$web_first_name' and HOUSE_NUMBER = '$web_house_number' and RESIDENTIALZIP5 = '$web_zip_code'"; +$r = $petition->query($q); +$d = mysqli_fetch_array($r); +$VTRID = $d['VTRID']; +$FIRSTNAME = $d['FIRSTNAME']; +$MIDDLENAME = $d['MIDDLENAME']; +if ($MIDDLENAME == ''){ + slack_general_admin("WARN: Blank Middle Name Detected",'md-petition-signed'); +} +$LASTNAME = $d['LASTNAME']; +$pos = strpos($LASTNAME, '-'); +if ($pos !== false) { + slack_general_admin("WARN: Hyphen in Last Name Detected",'md-petition-signed'); +} +$ADDRESS = $d['ADDRESS']; +$RESIDENTIALCITY = $d['RESIDENTIALCITY']; +$COUNTY = $d['COUNTY']; +$RESIDENTIALZIP5 = $d['RESIDENTIALZIP5']; +// set cookies for hard_copy.php +setcookie("pCOUNTY", $COUNTY); +if ($MIDDLENAME == ''){ + setcookie("pNAME", "$FIRSTNAME $LASTNAME"); }else{ - slack_general("API v1: FAIL ($web_first_name,$web_last_name,$month,$day,$year,$web_zip_code) ($_COOKIE['invite'])",'md-petition-api'); - setcookie("signature_status", 'notfound'); - header('Location: warning_not_found.php'); + setcookie("pNAME", "$FIRSTNAME $MIDDLENAME $LASTNAME"); } +setcookie("pADDRESS", "$ADDRESS $RESIDENTIALCITY $RESIDENTIALZIP5"); +setcookie("pADDRESS1", "$ADDRESS"); +setcookie("pADDRESS2", "$RESIDENTIALCITY MD $RESIDENTIALZIP5"); +setcookie("pVTRID", $VTRID); +setcookie("signature_status", 'verified'); +slack_general('MATCH: Is the information correct ('.$FIRSTNAME.' '.$LASTNAME.' '.$RESIDENTIALCITY.') ('.$_COOKIE['invite'].')','md-petition'); $qX = "select * from website_text where id = '6'"; - $rX = $petition->query($qX); - $dX = mysqli_fetch_array($rX); +$rX = $petition->query($qX); +$dX = mysqli_fetch_array($rX); ?>