From cbb0169690bbf1f34f63fbb2b899412d08a655c4 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Wed, 21 Dec 2005 18:50:11 +0100 Subject: [PATCH] allow user to change his email --- backend.php | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/backend.php b/backend.php index 81cddf867..264c00001 100644 --- a/backend.php +++ b/backend.php @@ -2951,6 +2951,23 @@ print "Unknown option: $pref_name"; } + } else if ($subop == "Change e-mail") { + + if (WEB_DEMO_MODE) { + header("Location: prefs.php"); + return; + } + + $email = db_escape_string($_GET["email"]); + $active_uid = $_SESSION["uid"]; + + if ($email) { + db_query($link, "UPDATE ttrss_users SET email = '$email' + WHERE id = '$active_uid'"); + } + + header("Location: prefs.php"); + } else if ($subop == "Change password") { if (WEB_DEMO_MODE) { @@ -3040,7 +3057,7 @@ if (!SINGLE_USER_MODE) { - $result = db_query($link, "SELECT id FROM ttrss_users + $result = db_query($link, "SELECT id,email FROM ttrss_users WHERE id = ".$_SESSION["uid"]." AND (pwd_hash = 'password' OR pwd_hash = 'SHA1:".sha1("password")."')"); @@ -3078,6 +3095,27 @@ $_SESSION["prefs_op_result"] = ""; + print "
"; + + print ""; + print ""; + + $result = db_query($link, "SELECT email FROM ttrss_users + WHERE id = ".$_SESSION["uid"]); + + $email = db_fetch_result($result, 0, "email"); + + print ""; + print ""; + + print "

Personal data

E-mail
"; + + print ""; + + print "

"; + print ""; print "";