Example #1
0
function panel_email()
{
    global $logged;
    if (!isset($_POST['update'])) {
        $Temp = new Template();
        $Temp->dir = $logged['dskin'];
        $Temp->file = "cpanel_email.tpl";
        $Temp->tp(__LINE__, __FILE__);
        $Temp->tr(array('E' => $logged['email']));
        return $Temp->html;
    } else {
        if (empty($_POST['password'])) {
            pageerror("Profile Error", "Something went wrong", "Looks like you left the password field blank please go back and fix it.");
        }
        if (empty($_POST['e1']) || empty($_POST['e2'])) {
            pageerror("Profile Error", "Something went wrong", "In order to change your email, you must provide both new email fields with a new email to update email.");
        }
        if (md5($logged['salt'] . $_POST['password']) != $logged['password']) {
            pageerror("Profile Error", "Something went wrong", "Sorry, but your password was incorrect, please fix this error.");
        }
        if ($_POST['e1'] != $_POST['e2']) {
            pageerror("Profile Error", "Something went wrong", "Email fields didn't match please go back to make them match.");
        }
        $email = htmlspecialchars($_POST['e1']);
        $sql = mysql_query("UPDATE `users` SET `email` = '" . $email . "' WHERE `username` = '" . $logged['username'] . "'");
        if (!$sql) {
            pageerror("Profile Error", "Something went wrong", "There was a problem updating sql: " . mysql_error());
        }
        return imessage("Profile Updated Sucessfully!", "", "Thank you, now your profile is updated!", "index.php?act=Cpanel&option=email", true);
    }
}
Example #2
0
function pageerror($cat, $catdesc, $message)
{
    global $logged;
    imessage($cat, $catdesc, $message);
    include "footer.php";
    exit(0);
}