예제 #1
0
파일: editUser.php 프로젝트: astrix37/seqas
        }
        if (strlen($email) == 0) {
            $errorTextEmail = "Please specify your email address.";
            $errorStyleEmail = "background-color:#F99;";
            $error = true;
        } else {
            $result = DBAccess::getUserByEmail($userName);
            $rows = count($result, 0);
            if ($rows > 0 && $result[0]['UserID'] != $targetUserID) {
                $error = true;
                $errorTextEmail = "Email is already in use.";
                $errorStyleEmail = "background-color:#F99;";
            }
        }
        if (!$error) {
            DBAccess::updateUser($targetUserID, $userName, null, $lastName, $firstName, $email, $activated, $position);
            //echo "DBAccess::updateUser(" . $targetUserID. ", " .$userName. ", " .null . ", " . $lastName . ", " . $firstName . ", " . $email . ", " . $activated . ", " . $position . " );";
            //die();
            header("Location: ./userDetails.php?userID=" . $targetUserID);
        } else {
            //echo 'An error has been detected in your input';
        }
    } else {
        header("Location: ./index.php?e7");
    }
}
/**************************************************************************
 *
 * Pre form data
 *
 **************************************************************************/
예제 #2
0
    if (strlen($current) == 0) {
        $errorTextCurrent = "Please enter your current password";
        $errorStyleCurrent = "background-color:#F99;";
        $error = true;
    } elseif ($response <= 0) {
        $error = true;
        $errorTextCurrent = "Invalid Password";
        $errorStyleCurrent = "background-color:#F99;";
    }
    if (strlen($new) == 0) {
        $errorTextNew = "Please enter a new password";
        $errorStyleNew = "background-color:#F99;";
        $error = true;
    } else {
        if ($new != $confirm) {
            $error = true;
            $errorTextNew = "Passwords don't match";
            $errorStyleNew = "background-color:#F99;";
        }
    }
    if (!$error) {
        DBAccess::updateUser($userID, null, $new, null, null, null, null, null);
        header("Location: ./account.php");
    } else {
        //echo 'An error has been detected in your input';
    }
}
$title = "User Details";
$head = "";
$content = "\n\n\n\n<div class=\"container\" style=\"width:925px; float:right;\">\n<h1>Change Password</h1>\n<form name=\"passwordChange\" action=\"changePassword.php\" method=\"POST\">\n\n\n<!--Previous Password-->\n<label class=\"formLabel\">Current Password</label>\n<input class=\"formField\" type=\"password\" style=\"" . $errorStyleCurrent . "\" name=\"current\" id=\"current\" />\n<label class=\"error\" type=\"text\" name=\"errorCurrent\" id=\"errorCurrent\" >" . $errorTextCurrent . "</label>\n<br />\n\n<!--New Password-->\n<label class=\"formLabel\">NewPassword</label>\n<input class=\"formField\" type=\"password\" style=\"" . $errorStyleNew . "\"  name=\"new\" id=\"new\" />\n<label class=\"error\" name=\"errorNew\" id=\"errorNew\" >" . $errorTextNew . "</label>\n<br />\n\n<!--New Password Confirm-->\n<label class=\"formLabel\">Confirm Password</label>\n<input class=\"formField\"  type=\"password\" style=\"" . $errorStyleConfirm . "\" name=\"confirm\" id=\"confirm\" /><br />\n<label class=\"error\" name=\"errorConfirm\" id=\"errorConfirm\" >" . $errorTextConfirm . "</label>\n<br />\n\n\n<!--Submit-->\n<input type=\"hidden\" name=\"Submitted\" value=\"submitted\">\n<input class=\"formLabel\" type=\"submit\" value=\"Update!\" />\n<br /><br />\n</form>\n\n</div><!--End info div -->";
require "../template/userTemplate.php";
예제 #3
0
파일: editUser.php 프로젝트: astrix37/seqas
            $error = true;
        }
        if (strlen($email) == 0) {
            $errorTextEmail = "Please specify your email address.";
            $errorStyleEmail = "background-color:#F99;";
            $error = true;
        } else {
            $result = DBAccess::getUserByEmail($userName);
            $rows = count($result, 0);
            if ($rows > 0 && $result[0]['UserID'] != $userID) {
                $error = true;
                $errorTextEmail = "Email is already in use.";
                $errorStyleEmail = "background-color:#F99;";
            }
        }
        if (!$error) {
            $id = DBAccess::updateUser($userID, null, null, $lastName, $firstName, $email, null, null);
            header("Location: ./account.php");
        } else {
            //echo 'An error has been detected in your input';
        }
    } else {
        header("Location: /");
    }
}
$result = DBAccess::getUserByUserID($userID);
$title = "User Details";
$head = "";
$content = "\n\n\n\n<div class=\"container\" style=\"width:925px; float:right;\">\n<h1>Edit Details of : " . $result[0]['FirstName'] . " " . $result[0]['LastName'] . "</h1>\n<form name=\"signup\" action=\"editUser.php\" method=\"POST\" onsubmit=\"return validateForm();\">\n\n<!--Username-->\n<label class=\"formLabel\">Username</label>\n<label class=\"formField\" >" . $userName . "</label>\n<label class=\"error\" name=\"errorUserName\" id=\"errorUserName\" >" . $errorTextUserName . "</label>\n<br />\n\n<!--First Name-->\n<label class=\"formLabel\">First Name</label>\n<input class=\"formField\" type=\"text\" value=\"" . $firstName . "\" style=\"" . $errorStyleFirst . "\"  name=\"first\" id=\"first\" />\n<label class=\"error\" name=\"errorFirst\" id=\"errorFirst\" >" . $errorTextFirst . "</label>\n<br />\n\n<!--Last Name-->\n<label class=\"formLabel\">Last Name</label>\n<input class=\"formField\" type=\"text\" value=\"" . $lastName . "\" style=\"" . $errorStyleLast . "\" name=\"last\" id=\"last\" />\n<label class=\"error\" type=\"text\" name=\"errorLast\" id=\"errorLast\" >" . $errorTextLast . "</label>\n<br />\n\n<!--Email-->\n<label class=\"formLabel\">Email Address</label>\n<input class=\"formField\"  type=\"text\" value=\"" . $email . "\" style=\"" . $errorStyleEmail . "\" name=\"email\" id=\"email\" /><br />\n<label class=\"error\" name=\"errorEmail\" id=\"errorEmail\" >" . $errorTextEmail . "</label>\n<br />";
$content .= "\n<!--Submit-->\n<input type=\"hidden\" name=\"Submitted\" value=\"submitted\">\n<input class=\"formLabel\" type=\"submit\" value=\"Update!\" />\n<br /><br />\n</form>\n\n</div><!--End info div -->";
require "../template/userTemplate.php";
예제 #4
0
        //Generate random password
        $newPassword = "";
        for ($i = 0; $i < 8; $i++) {
            $newPassword .= chr(rand(97, 123));
        }
        $from = "*****@*****.**";
        $to = $email;
        $subject = "SEQAS: Reset Password";
        $body = "\n\t\t<!DOCTYPE html>\t\n\t\t<html>\n\t\t<head>\n\t\t<style>\n\t\t\n\t\tbody{\t\t\n\t\t\tcolor:#FFF;\n\t\t\tbackground-color:#000;\n\t\t\tmargin: 0px;\n\t\t\tpadding: 0px;\n\t\t\tfont-family: arial;\n\t\t}\n\t\t\n\t\t#header{\n\t\t\tfont-weight:bold;\n\t\t\tmargin-bottom:10px;\n\t\t\tcolor:#FF0;\n\t\t\ttext-decoration:none;\n\t\t}\n\t\t\n\t\t#header .text{\n\t\t\tvertical-align:middle;\n\t\t\ttext-align:center;\n\t\t\tfloat:right;\n\t\t\t\n\t\t\twidth:78%;\n\t\t\tpadding:1%;\n\t\t\tfont-size:20px;\n\t\t\t\n\t\t}\n\t\t\n\n\t\t#header .image{\n\t\t\twidth:20%;\n\t\t\tfloat:left;\n\t\t}\n\t\t\n\t\t#content{\n\t\t\tpadding:1px;\n\t\t\tmargin:1% 0%;\n\t\t\twidth:69%;\n\t\t\tfloat:right;\n\t\t}\n\t\t\n\t\t#wrapper{\n\t\t\twidth:100%;\n\t\t\theight:100%;\n\t\t\n\t\t\tmargin:auto;\n\t\t\tpadding: 10px 10px 10px 10px;\n\t\t\tborder-radius: 15px;\n\t\t\n\t\t}\n\t\t\n\t\t#footer{\n\t\t\tclear:both;\n\t\t\tborder-top:1px solid #FFF;\n\t\t\ttext-align:center;\n\t\t}\n \n \n \n\t\t\n\t\t</style>\n\t\t\n\t\t</head>\n\t\t<body>\n\t\t\n\t\t\n\t\t<div id=\"wrapper\">\n\t\t\t<a href=\"http://www.seqas.org\" style=\"text-decoration:none;\">\n\t\t\t<div id=\"header\">\n\t\t\t\t<div class=\"image\">\n\t\t\t\t\n\t\t\t\t<img src=\"http://www.seqas.org/Images/SEQAS-LG.jpg\"  alt=\"Home\" />\n\t\t\t\t</div>\n\t\t\t\t<div class=\"text\">\n\t\t\t\tSEQAS\n\t\t\t\tSouth East Queensland Astronomical Society\n\t\t\t\t</div >\n\t\t\t</div>\n\t\t\t</a>\n\t\t\t<div id=\"content\">\n\t\t\tHello " . $userDetails[0]['FirstName'] . ",<br />\n\t\t\tYour password has been reset.<br />\n\t\t\t\n\t\t\t<b>Username:</b> " . $userDetails[0]['LoginName'] . "<br />\n\t\t\t<b>Password:</b> " . $newPassword . "<br />\n\t\t\n\t\t\tRegards,<br />\n\t\t\tThe SEQAS team.\n\n\t\t\t</div>\n\t\t\t<div id=\"footer\">\n\t\t\t\tAny email regarding this site can be sent to webmaster@seqas.org<br />\n\t\t\n\t\t\t\t<br />\n\t\t\t\tLast Updated: Friday 29th November 2013<br />\n\t\t\t\tThis site is &copy; SEQAS 2013, All Rights Reserved.<br />\n\t\t\t\tWebsite designed by Thura<br />\n\t\t\t</div>\n\t\n\t\t</div>\n\t\t</body>\n\t\t\n\t\t</html>\n\t\t";
        $host = "ssl://canary.flexihostings.net";
        $port = "465";
        $username = "******";
        //<> give errors
        $password = "******";
        $headers = array('From' => $from, 'To' => $to, 'Subject' => $subject, 'Reply-To' => '*****@*****.**', 'MIME-Version' => '1.0\\n', 'Content-type' => 'text/html; charset=iso-8859-1\\n');
        $smtp = Mail::factory('smtp', array('host' => $host, 'port' => $port, 'auth' => true, 'username' => $username, 'password' => $password));
        $result = DBAccess::updateUser($userDetails[0]['UserID'], null, $newPassword, null, null, null, null, null);
        $mail = $smtp->send($to, $headers, $body);
        if (PEAR::isError($mail)) {
            echo "<p>" . $mail->getMessage() . "</p>";
        } else {
            $feedBack = "PASSWORD RESET: CHECK YOUR EMAIL.";
        }
    } else {
        $feedBack = "An unknown error has occured";
    }
}
$title = "Forgot Password";
$head = "";
$content = "\n\n<div class=\"container\" style=\"width:600px; margin:auto;\">\n\n<form method=\"post\" class=\"signin\" action=\"/forgot-password/\" >\n\n\t<label class=\"error\" style=\"clear:left\" name=\"feedBack\" id=\"feedBack\" >" . $feedBack . "</label>\n\t\n\t<!--Email-->\n\t<label class=\"formLabel\">Email Address*</label>\n\t<input class=\"formField\" type=\"text\" style=\"" . $errorStyleEmail . "\"  name=\"email\" id=\"email\" placeholder=\"Email Address\" />\n\t<label class=\"formError\" name=\"errorUserName\" id=\"errorUserName\" >" . $errorTextEmail . "</label>\n\t\n\t<!--Submit-->\n\t<input type=\"hidden\" name=\"Submitted\" value=\"Submitted\">\n\t<input class=\"formLabel\" type=\"submit\" value=\"Reset\" />\n</form>\n\n<label class=\"formLabel\">* Required Field</label>\n\n<span style=\"clear: left; display: block;\"></span></div><!--End info div -->\n";
require $root . '/template/userTemplate.php';