Login or Register to use this function"; $redirect_url = "m_profile.php"; include("checksec.php"); $template->set_filenames(array("body" => "m_profile.html")); /* Copyright Notice Web Site URL: http://www.ezonelink.co.uk Script Owner eMail: webmaster@ezonelink.co.uk Date: Oct, 2006 Script Name: eZonelink Photo Stock site Php Script Copyright Details: This script is not free. Do not Remove this Copy Right notice. */ include_once ("class/members.class.php"); $member = new Members(); if(isset($_POST['save'])) { //Check valid form $ok = 1; if (!isset($_POST["username"])|| strlen($_POST["username"])<4 || strlen($_POST["username"])>16) { $username_alert = " Username must be between 4 and 16 characters long"; $ok = 0; }else $username_alert = ""; if ($_POST["repass"] != $_POST["pass"]) { $repassword_alert = " Retype password doesn't match with password"; $ok = 0; }else { $repassword_alert = $password_alert = ""; } if (!isset($_POST["email"])|| $_POST["email"] == "" || !CheckEmail($_POST["email"])) { $email_alert = " Please enter a valid email address to continue"; $ok = 0; }else $email_alert = ""; if (!isset($_POST["firstname"])|| strlen($_POST["firstname"])<=0) { $firstname_alert = " Missing first name"; $ok = 0; }else $firstname_alert = ""; if (!isset($_POST["lastname"])|| strlen($_POST["lastname"])<=0) { $lastname_alert = " Missing last name"; $ok = 0; }else $lastname_alert = ""; if (!isset($_POST["addy1"])|| strlen($_POST["addy1"])<=0) { $addy1_alert = " Missing Address 1"; $ok = 0; }else $addy1_alert = ""; if (!isset($_POST["pemail"]) || $_POST["pemail"] == "" || !CheckEmail($_POST["pemail"])) { $pemail_alert = " Invalid paypal email address"; $ok = 0; }else $pemail_alert = ""; if (!isset($_POST["city"])|| strlen($_POST["city"])<=0) { $city_alert = " Missing city"; $ok = 0; }else $city_alert = ""; if (!isset($_POST["state"]) || $_POST["state"] == "") { $state_alert = " Missing state"; $ok = 0; }else $state_alert = ""; if (!isset($_POST["zip"])|| strlen($_POST["zip"])<=0) { $zip_alert = " Missing zip code"; $ok = 0; }else $zip_alert = ""; if (!isset($_POST["country"])|| strlen($_POST["country"])<=0) { $country_alert = " Please select one in list"; $ok = 0; }else $country_alert = ""; if (!isset($_POST["phone"])|| strlen($_POST["phone"])<=0) { $phone_alert = " Missing Phone number"; $ok = 0; }else $phone_alert = ""; // Update user profile //------------------------------------------------------ if ($ok == 1) { if ($member->CheckExistsEmail($_POST["email"]) != $_SESSION['suserid']) { $email_alert = " Email you entered is already in use. Please enter a different email address to continue"; $ok = 0; } if ($p_method != 2 && $member->CheckExistsPEmail($_POST["pemail"])) { $pemail_alert = " Paypal email is already in use."; $ok = 0; } if ($ok == 1) { //Save data //($sid, $email, $firstname, $lastname, $addy1, $addy2, $phone, $city, $state, $zip_code, $country, $paypalemail, $checkID) $member->Update($_SESSION['suserid'], $_POST['email'], $_POST['firstname'], $_POST['lastname'], $_POST["addy1"], $_POST["addy2"], $_POST["phone"], $_POST['city'], $_POST['state'], $_POST['zip'], $_POST['country'], $_POST['pemail'], $_POST['cemail']); //Update password if ($_POST["password"] != "") $member->UpdatePassword($_SESSION['suserid'], $_POST["password"]); $template->set_filenames(array("body" => "confirm.html")); $template->assign_vars(array( 'CONFIRM' => "MY PROFILE", 'CONFIRMMESS' => "Your profile was updated successfully!" )); $template->pparse("body"); } } if ($ok == 0) { $template->set_filenames(array("body" => "m_profile.html")); $country = ($_POST["country"] == "")?"": ""; $template->assign_vars(array( 'ERROR' => $error, 'USERNAME_ALERT' => $membername_alert, 'PASSWORD_ALERT' => $password_alert, 'EMAIL_ALERT' => $email_alert, 'FIRSTNAME_ALERT' => $firstname_alert, 'LASTNAME_ALERT' => $lastname_alert, 'ADDY1_ALERT' => $addy1_alert, 'CITY_ALERT' => $city_alert, 'STATE_ALERT' => $state_alert, 'ZIP_ALERT' => $zip_alert, 'COUNTRY_ALERT' => $country_alert, 'PHONE_ALERT' => $phone_alert, 'PEMAIL_ALERT' => $pemail_alert, 'CEMAIL_ALERT' => $cemail_alert, 'USERNAME'=> $_SESSION['username'], 'PASSWORD' => $_POST["password"], 'REPASSWORD' => $_POST["re_password"], 'EMAIL' => $_POST["email"], 'BACKEMAIL' => $_POST["backemail"], 'FIRSTNAME' => $_POST["firstname"], 'LASTNAME' => $_POST["lastname"], 'ADDY1' => $_POST["addy1"], 'ADDY2' => $_POST["addy2"], 'CITY' => $_POST["city"], 'STATE' => $_POST["state"], 'ZIP' => $_POST["zip"], 'COUNTRY' => $country, 'PHONE' => $_POST["phone"], 'PEMAIL' => $_POST["pemail"], 'CEMAIL' => $_POST["cemail"] )); $template->pparse("body"); } } else if(isset($_POST['cancel'])) { redirect("index.php"); } else { $row = mysql_fetch_array($member -> GetBySId($_SESSION['suserid'])); if (isset($row) && $row["sid"] == $_SESSION['suserid']) { $template->set_filenames(array("body" => "m_profile.html")); $country = ($row["country"] == "")?"": ""; $template->assign_vars(array( 'USERNAME' => $row["username"], 'EMAIL' => $row["email"], 'BACKEMAIL' => $row["email"], 'FIRSTNAME' => $row["firstname"], 'LASTNAME' => $row["lastname"], 'ADDY1' => $row["add1"], 'ADDY2' => $row["add2"], 'CITY' => $row["city"], 'STATE' => $row["state"], 'ZIP' => $row["zip_code"], 'COUNTRY' => $country, 'PHONE' => $row["phone"], 'PEMAIL' => $row["paypalemail"], 'CEMAIL' => $row["2checkID"] )); $template->pparse("body"); } } include("footer.php"); ?>