Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- * @ Pirate-Sky Crew :: PHP Decoder v2
- * @ Author: pLa$71k
- * @ Web: http://pirate-sky.com
- * @ Pirate-Sky Crew © 2008 - 2013
- */
- ob_start();
- include("../config.php");
- include("constants.php");
- $_SESSION = array();
- include("table.php");
- include("session.php");
- include("function.php");
- include("config_smarty_sub.php");
- require_once("../ups/upsavs.php");
- if ($_SESSION['submit'] == $strButton_update && $uid != "" && $_REQUEST['update_address_id']) {
- $user_sql = "UPDATE " . EDX_ADDRESS . " SET company = '" . $U_company . "', first_name = '" . $U_first_name . "', last_name = '" . $U_last_name . "', address1 = '" . $U_address1 . "', address2 = '" . $U_address2 . "', zip = '" . $U_zip . "', city = '" . $U_ship_city . "', state = '" . $U_ship_state . "', country = '" . $U_country . "', phone = '" . $U_phone . "', province = '" . $U_province . "' WHERE address_id = '" . $_REQUEST['update_address_id'] . "'";
- $user_result = mysql_query($user_sql);
- }
- echo "<!doctype html public \"-// W3C// DTD HTML 4.0 Transitional// EN\"><html><head><title>";
- print "{$strEdit}";
- echo " ";
- print "{$strAddress}";
- echo "</title><link rel=\"stylesheet\" type=\"text/css\" href=\"../";
- print "{$styles_dir}";
- echo "/frontend.css\" />";
- echo "<s";
- echo "cript language=\"JavaScript\"><!-- //function refreshParent() {window.opener.location.href = window.opener.location.href;}// --></script> </head><div class=\"bodytext\" align=\"center\">";
- echo "<s";
- echo "pan class=\"h5\" align=\"center\">EDIT SHIPPING ADDRESS</span> ";
- if ($_SESSION['feedback_sub'] != "") {
- print "<br /><span class=\"smallheadred\">" . $_SESSION['feedback_sub'] . "</span>";
- unset_var("feedback_sub");
- } else {
- print "<br /><img src=\"{$image_dir}/pixel.gif\" width=\"1\" height=\"5\" />";
- }
- echo "<br />Select the address to edit in the drop down, make modifications and click update.<br /><br /><form action=\"\" method=\"post\">";
- echo "<s";
- echo "elect class=\"forminputrequired\" name=\"U_address_id\" style=\"font-size:12px;\" onchange=\"submit();\"><option value=\"\">Please select an address to edit</option>";
- $ship_to_sql = "SELECT * FROM " . EDX_ADDRESS . " WHERE user_id = '" . $_REQUEST['uid'] . "' and delete_flag = 'N' ORDER BY first_name";
- $ship_to_result = mysql_query($ship_to_sql);
- if ($ship_to_result == 0 && $report == "Y") {
- report("Edit-X Address Select Failed", mysql_errno(), mysql_error(), $ship_to_sql, __FILE__, 56, "", "");
- }
- while ($ship_to_result_row = mysql_fetch_array($ship_to_result)) {
- if ($U_address_id == $ship_to_result_row['address_id'] || $_REQUEST['U_address_id'] == $ship_to_result_row['address_id']) {
- $selected = " selected";
- } else {
- $selected = "";
- }
- $address = $ship_to_result_row['first_name'] . " " . $ship_to_result_row['last_name'] . " " . $ship_to_result_row['address1'] . " " . $ship_to_result_row['address2'] . " " . $ship_to_result_row['city'] . " " . $ship_to_result_row['state'] . " " . $ship_to_result_row['zip'];
- $address = str_replace("South", "S.", $address);
- $address = str_replace("North", "N.", $address);
- $address = str_replace("East", "E.", $address);
- $address = str_replace("West", "W.", $address);
- $address = str_replace("Street", "St.", $address);
- $address = str_replace("Avenue", "Ave.", $address);
- $address = str_replace("Boulevard", "Blvd.", $address);
- print "<option value=\"" . $ship_to_result_row['address_id'] . "\"" . $selected . ">" . $address . "</option>";
- }
- echo "</select></form><br />";
- form_validate_open("formvalidate");
- form_validate("validform", "U_first_name", "{$strPleaseEnter} First Name");
- form_validate_add();
- form_validate("validform", "U_last_name", "{$strPleaseEnter} Last Name");
- form_validate_add();
- form_validate("validform", "U_address1", "{$strPleaseEnter} Address");
- form_validate_add();
- form_validate("validform", "U_ship_city", "{$strPleaseEnter} City");
- form_validate_add();
- form_validate("validform", "U_zip", "{$strPleaseEnter} Zip");
- form_validate_add();
- form_validate("validform", "U_country", "{$strPleaseEnter} Country");
- form_validate_add();
- print "if(document.validform.U_country.value==\"USA\") {";
- form_validate("validform", "U_ship_state", "Please Enter your state.");
- print "}";
- print "if(document.validform.U_country.value!=\"USA\") {";
- form_validate("validform", "U_province", "Please Enter your province.");
- print "}";
- form_validate_close();
- if ($_REQUEST['U_address_id'] != "") {
- $address_sql = "SELECT * FROM " . EDX_ADDRESS . " WHERE address_id = '" . $_REQUEST['U_address_id'] . "'";
- $address_result = mysql_query($address_sql);
- if ($address_result == 0 && $report == "Y") {
- report("Edit-X Address Select Failed", mysql_errno(), mysql_error(), $address_sql, __FILE__, 100, "", "");
- }
- $address_result_row = mysql_fetch_array($address_result);
- $U_address_id = $address_result_row['address_id'];
- $U_first_name = $address_result_row['first_name'];
- $U_last_name = $address_result_row['last_name'];
- $U_company = $address_result_row['company'];
- $U_address1 = $address_result_row['address1'];
- $U_address2 = $address_result_row['address2'];
- $U_phone = $address_result_row['phone'];
- $U_ship_city = $address_result_row['city'];
- $U_ship_state = $address_result_row['state'];
- $U_zip = $address_result_row['zip'];
- $U_country = $address_result_row['country'];
- $U_province = $address_result_row['province'];
- $addy_found = false;
- $addy_select = false;
- $addys = array();
- $error_array = array();
- if ($_SESSION['submit'] == $strButton_update && $update_address_id != "") {
- upsAvs();
- $avs = new $UN_10733098();
- $addys = $avs->avs($U_zip);
- if (isset($_REQUEST['avs_pair'])) {
- $pair = explode(";", $_REQUEST['avs_pair']);
- $U_ship_city = $pair[0];
- $U_ship_state = $pair[1];
- }
- foreach ($addys as $key => $val) {
- if (trim(strtolower($U_ship_city)) == trim(strtolower($key)) && trim(strtolower($U_ship_state)) == trim(strtolower($val))) {
- $address_sql = "INSERT INTO " . EDX_ADDRESS . " (user_id, first_name, last_name, company, address1, address2, phone, city, state, zip, country, province, active_flag) VALUES ('" . $uid . "', '" . $U_first_name . "', '" . $U_last_name . "', '" . $U_company . "', '" . $U_address1 . "', '" . $U_address2 . "', '" . $U_phone . "', '" . $U_ship_city . "', '" . $U_ship_state . "', '" . $U_zip . "', '" . $U_country . "', '" . $U_province . "', 'Y')";
- $address_sql_result = mysql_query($address_sql);
- if ($address_sql_result == 0 && $report == "Y") {
- report("Address Insert Failed", mysql_errno(), mysql_error(), $address_sql, __FILE__, 135, "", "");
- }
- unset($U_first_name);
- unset($U_last_name);
- unset($U_company);
- unset($U_address1);
- unset($U_address2);
- unset($U_phone);
- unset($U_ship_city);
- unset($U_ship_state);
- unset($U_zip);
- unset($U_country);
- unset($U_province);
- unset($submit);
- unset_var("submit");
- unset($change_submit);
- $_SESSION['feedback_sub'] .= " Address inserted.";
- $addy_found = true;
- break;
- }
- }
- if ($_SESSION['submit'] == $strButton_add && $addy_found == false) {
- $addy_select = true;
- $errors = true;
- $_SESSION['feedback_sub'] .= " The City/State does not match ZIP code.";
- $refresh = "Y";
- }
- if ($_SESSION['submit'] == $strButton_add && strlen($U_zip) < 5) {
- $addy_select = false;
- $errors = true;
- $_SESSION['feedback_sub'] .= " Please provide a valid ZIP code.";
- $refresh = "Y";
- }
- }
- if ($_SESSION['submit'] == $strButton_add && (strlen($U_first_name) < 2 || strlen($U_last_name) < 2)) {
- $_SESSION['feedback_sub'] .= " Please correct name fields.";
- $refresh = "Y";
- }
- if ($_SESSION['submit'] == $strButton_add && strlen($U_address1) < 2) {
- $_SESSION['feedback_sub'] .= " Please correct address field.";
- $refresh = "Y";
- }
- echo "<form name=\"validform\" action=\"\" method=\"post\" onsubmit=\"return formvalidate(this)\"><table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" align=\"center\"><tr><td valign=\"top\" class=\"bodytext\"><table border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr><td valign=\"top\"><div class=\"h5\">";
- print "{$strFirst}";
- echo " ";
- print "{$strName}";
- echo "</div><input class=\"forminput\" type=\"text\" name=\"U_first_name\" value=\"";
- print $U_first_name;
- echo "\" size=\"15\" /></td><td> </td><td valign=\"top\"><div class=\"h5\">";
- print "{$strLast}";
- echo " ";
- print "{$strName}";
- echo "</div><input class=\"forminput\" type=\"text\" name=\"U_last_name\" value=\"";
- print $U_last_name;
- echo "\" size=\"15\" /></td></tr></table><div class=\"h5\">Company</div><input class=\"forminput\" type=\"text\" name=\"U_company\" value=\"";
- print $U_company;
- echo "\" size=\"30\" /><div class=\"h5\">";
- print "{$strAddress}";
- echo "</div><input class=\"forminput\" type=\"text\" name=\"U_address1\" value=\"";
- print $U_address1;
- echo "\" size=\"30\" /><div class=\"h5\">";
- print "{$strAddress}";
- echo " 2</div><input class=\"forminput\" type=\"text\" name=\"U_address2\" value=\"";
- print $U_address2;
- echo "\" size=\"30\" /><div class=\"h5\">Phone</div><input class=\"forminput\" type=\"text\" name=\"U_phone\" value=\"";
- print $U_phone;
- echo "\" size=\"30\" /><table border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr><td valign=\"top\" class=\"bodytext\">";
- if ($addy_select == false) {
- echo "<div class=\"h5\">";
- print "{$strCity}";
- echo "</div><input class=\"forminput\" type=\"text\" name=\"U_ship_city\" value=\"";
- print $U_ship_city;
- echo "\" maxlength=\"25\" size=\"14\" /></td>";
- } else {
- echo "<div class=\"h5\">";
- print "{$strCity}, {$strState}";
- echo "</div>";
- echo "<s";
- echo "elect class=\"forminput\" name=\"avs_pair\">";
- foreach ($addys as $key => $val) {
- echo "<option value=\"";
- print $key . ";" . $val;
- echo "\">";
- print $key . ", " . $val;
- echo "</option>";
- }
- echo "</select>";
- }
- echo "<td> </td>";
- if ($addy_select == false) {
- echo "<td valign=\"top\"><div class=\"h5\">";
- print "{$strState}";
- echo "</div><input class=\"forminput\" type=\"text\" name=\"U_ship_state\" value=\"";
- print $U_ship_state;
- echo "\" maxlength=\"25\" size=\"3\" /></td>";
- } else {
- echo "<td> </td>";
- }
- echo "<td> </td><td valign=\"top\" class=\"bodytext\"><div class=\"h5\">";
- print "{$strZip}";
- echo "</div><input class=\"forminput\" type=\"text\" name=\"U_zip\" value=\"";
- print $U_zip;
- echo "\" size=\"6\" /></td></tr></table><div class=\"h5\">";
- print "{$strCountry}";
- echo "</div>";
- include("country_name_drop.php");
- echo "";
- $smarty->assign("U_country", $U_country);
- $smarty->display("country_name_drop." . TPL);
- echo "</td></tr></table><br />";
- }
- echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr>";
- if ($_REQUEST['U_address_id'] != "") {
- echo "<td><input type=\"hidden\" value=\"";
- echo $_REQUEST['U_address_id'];
- echo "\" name=\"update_address_id\" /><input type=\"hidden\" value=\"";
- echo $_REQUEST['uid'];
- echo "\" name=\"uid\" /><input class=\"forminput\" type=\"submit\" name=\"change_submit\" value=\"UPDATE\" onclick=\"refreshParent();\" /></form></td><td> </td>";
- }
- echo "<td><form method=\"post\" action=\"javascript:window.close();\"><input class=\"forminput\" type=\"submit\" name=\"change_submit\" value=\"CLOSE\" onclick=\"refreshParent();\" /></form></td><td> </td><td><form method=\"post\" action=\"\"><input class=\"forminput\" type=\"submit\" name=\"change_submit\" value=\"CANCEL\" /></form></td></tr></table></div></body></html>";
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement