Browse code

fix for wrong using of +

Jimako authored on 2019/10/30 07:27:29
Showing 6 changed files
... ...
@@ -5,7 +5,7 @@ if(!defined("_CHARSET")) exit( );
5 5
 
6 6
 if (!empty($_COOKIE[$sitekey."_useruid"])  && !isset($_SESSION[$sitekey."_useruid"])) {
7 7
 	$userdata = dbassoc(dbquery("SELECT "._UIDFIELD." as uid, "._PENNAMEFIELD." as penname, "._EMAILFIELD." as email, "._PASSWORDFIELD." as password, ap.* FROM "._AUTHORTABLE." LEFT JOIN ".TABLEPREFIX."fanfiction_authorprefs as ap ON ap.uid = "._UIDFIELD." WHERE "._UIDFIELD." = '".$_COOKIE[$sitekey."_useruid"]."'"));
8
-	if($userdata && $userdata['level'] != -1 && $_COOKIE[$sitekey.'_pwd'] == md5($userdata['email']+$userdata['password'])) {
8
+	if($userdata && $userdata['level'] != -1 && $_COOKIE[$sitekey.'_pwd'] == md5($userdata['email'] . $userdata['password'])) {
9 9
 		define("USERUID", $userdata['uid']);
10 10
 		define("USERPENNAME", $userdata['penname']);
11 11
 		if(!isset($_SESSION[$sitekey."_skin"]) && !empty($userdata['userskin'])) $siteskin = $userdata['userskin'];
... ...
@@ -155,8 +155,8 @@ function random_string ($charset_string, $length)
155 155
 			$result = dbquery("UPDATE "._AUTHORTABLE." SET realname='".descript(strip_tags(escapestring($_POST['realname'])), $allowed_tags)."', email='$email', bio='".descript(strip_tags(escapestring($_POST['bio']), $allowed_tags))."', image='".($imageupload && !empty($_POST['image']) ? escapestring($_POST['image']) : "")."' WHERE uid = '$uid'");
156 156
 			if($result) { // only if the info actually got updated.
157 157
 				if($oldinfo['email'] != $email) { // Need to reset the session and cookies in this case.
158
-					$_SESSION[SITEKEY."_salt"] = md5($email+$encryptedpassword);
159
-					if(isset($_COOKIE[SITEKEY."_salt"])) setcookie(SITEKEY."_salt", md5($email+$encryptedpassword),  time()+60*60*24*30, "/");		
158
+					$_SESSION[SITEKEY."_salt"] = md5($email . $encryptedpassword);
159
+					if(isset($_COOKIE[SITEKEY."_salt"])) setcookie(SITEKEY."_salt", md5($email . $encryptedpassword),  time()+60*60*24*30, "/");		
160 160
 				}
161 161
 			}
162 162
 			$output .= write_message(_ACTIONSUCCESSFUL."  ".(isset($_GET['uid']) ? _BACK2ADMIN : _BACK2ACCT));
... ...
@@ -27,7 +27,7 @@ if(!defined("_CHARSET")) exit( );
27 27
 // To bridge to another program replace (or add to) this information with the bridge to your other script.  See examples in the includes/bridges/ folder.
28 28
 if (!empty($_COOKIE[$sitekey."_useruid"])) {
29 29
 	$userdata = dbassoc(dbquery("SELECT ap.*, "._UIDFIELD." as uid, "._PENNAMEFIELD." as penname, "._EMAILFIELD." as email, "._PASSWORDFIELD." as password FROM "._AUTHORTABLE." LEFT JOIN ".$tableprefix."fanfiction_authorprefs as ap ON ap.uid = "._UIDFIELD." WHERE "._UIDFIELD." = '".$_COOKIE[$sitekey."_useruid"]."'"));
30
-	if($userdata && $userdata['level'] != -1 && $_COOKIE[$sitekey.'_salt'] == md5($userdata['email']+$userdata['password'])) {
30
+	if($userdata && $userdata['level'] != -1 && $_COOKIE[$sitekey.'_salt'] == md5($userdata['email'] . $userdata['password'])) {
31 31
 		define("USERUID", $userdata['uid']);
32 32
 		define("USERPENNAME", $userdata['penname']);
33 33
 		if(!isset($_SESSION[$sitekey."_skin"]) && !empty($userdata['userskin'])) $siteskin = $userdata['userskin'];
... ...
@@ -42,7 +42,7 @@ if (!empty($_COOKIE[$sitekey."_useruid"])) {
42 42
 }
43 43
 if(!empty($_SESSION[$sitekey."_useruid"]) && !defined("USERUID")) {
44 44
 	$userdata = dbassoc(dbquery("SELECT ap.*, "._UIDFIELD." as uid, "._PENNAMEFIELD." as penname, "._EMAILFIELD." as email, "._PASSWORDFIELD." as password FROM "._AUTHORTABLE." LEFT JOIN ".$tableprefix."fanfiction_authorprefs as ap ON ap.uid = "._UIDFIELD." WHERE "._UIDFIELD." = '".$_SESSION[$sitekey."_useruid"]."'"));
45
-	if($userdata && $userdata['level'] != -1 && $_SESSION[$sitekey.'_salt'] == md5($userdata['email']+$userdata['password'])) {
45
+	if($userdata && $userdata['level'] != -1 && $_SESSION[$sitekey.'_salt'] == md5($userdata['email'] . $userdata['password'])) {
46 46
 		define("USERUID", $userdata['uid']);
47 47
 		define("USERPENNAME", $userdata['penname']);
48 48
 		if(!isset($_SESSION[$sitekey."_skin"]) && !empty($userdata['userskin'])) $siteskin = $userdata['userskin'];
... ...
@@ -46,12 +46,12 @@ if(!defined("_LOGINCHECK")) exit( );
46 46
 		}
47 47
 		if(isset($_POST['cookiecheck'])) {
48 48
 			setcookie($sitekey."_useruid",$passwd['uid'], time()+60*60*24*30, "/");
49
-			setcookie($sitekey."_salt", md5($passwd['email']+$encryptedpassword),  time()+60*60*24*30, "/");
49
+			setcookie($sitekey."_salt", md5($passwd['email'] . $encryptedpassword),  time()+60*60*24*30, "/");
50 50
 		}
51 51
 		if($passwd['password'] == $encryptedpassword) {
52 52
 			if(!isset($_SESSION)) session_start( );
53 53
 			$_SESSION[$sitekey."_useruid"] = $passwd['uid'];
54
-			$_SESSION[$sitekey."_salt"] = md5($passwd['email']+$encryptedpassword);
54
+			$_SESSION[$sitekey."_salt"] = md5($passwd['email'] . $encryptedpassword);
55 55
 		}
56 56
 
57 57
 		else { 
... ...
@@ -16,7 +16,7 @@ if(!defined("_LOGINCHECK")) exit( );
16 16
 		if($passwd['user_password'] == $encryptedpassword) {
17 17
 			if(!isset($_SESSION)) session_start( );
18 18
 			$_SESSION[$sitekey."_useruid"] = $passwd['user_id'];
19
-			$_SESSION[$sitekey."_salt"] = md5($passwd['user_email']+$encryptedpassword);
19
+			$_SESSION[$sitekey."_salt"] = md5($passwd['user_email'] . $encryptedpassword);
20 20
 			if(isset($_POST['cookiecheck'])) {
21 21
 				$cookie_exp = time() + 3600*24*30; } else { $cookie_exp = time() + 3600*3; 
22 22
 			}
... ...
@@ -27,7 +27,7 @@ if(!defined("_CHARSET")) exit( );
27 27
 // To bridge to another program replace (or add to) this information with the bridge to your other script.  See examples in the includes/bridges/ folder.
28 28
 if (!empty($_COOKIE[$sitekey."_useruid"])) {
29 29
 	$userdata = dbassoc(dbquery("SELECT ap.*, "._UIDFIELD." as uid, "._PENNAMEFIELD." as penname, "._EMAILFIELD." as email, "._PASSWORDFIELD." as password FROM "._AUTHORTABLE." LEFT JOIN ".TABLEPREFIX."fanfiction_authorprefs as ap ON ap.uid = "._UIDFIELD." WHERE "._UIDFIELD." = '".$_COOKIE[$sitekey."_useruid"]."'"));
30
-	if($userdata && $userdata['level'] != -1 && $_COOKIE[$sitekey.'_salt'] == md5($userdata['email']+$userdata['password'])) {
30
+	if($userdata && $userdata['level'] != -1 && $_COOKIE[$sitekey.'_salt'] == md5($userdata['email'] . $userdata['password'])) {
31 31
 		define("USERUID", $userdata['uid']);
32 32
 		define("USERPENNAME", $userdata['penname']);
33 33
 		// the following line fixes missing authorpref rows