Jump to content

Recommended Posts

  • 2 weeks later...

As the first post mentioned, I found that all my tables have "latin1_swedish_c" which doesn't appear to be correct.

 

Now, none of the users can log into my site... And when I use my own tool to change the admin's password, the password even looks different than the others.

 

Other passwords are all lower case and numeric... something like:

sj42dweb15vf

 

Any new passwrd I create includes an * first, then all uppercase and numeric information. such as:

*DRI43KDLJ4

 

Please help, I am at a loss!

Link to post
Share on other sites

I did, and the TCH team was excellent!

 

Unfortunately, it had (I believe) nothing to do with the Collation. I am interested to hear what other people have, though.

 

On my PHPAdmin page, I show I use utf8_general_ci, but when I make a table, it uses latin1_swedish_ci. I am interested to know if this is going to affect any current or future databases. I still do not know about this at all.

 

But for those who have a user scheme on their website and you have used the SQL function of PASSWORD() to create password hashes, I hope I can help you. It was an easy fix:

 

Let me explain (quickly) what my problem was.

 

MySQL 4.0 used short (16 char) password hashing. This is what I used when creating my user records

MySQL 4.1 uses long (41 char) password hashing. This is the current scheme of TCH's MySQL.

The PASSWORD() function is NOT backwards compatible in the case with TCH.

 

The fix:

1) Lengthen your password field to 41.

2) Change your login script to something like:

 

>function login($username, $password)
{
  // Attempt to log user in with NEW password function
  //	  (This will become the new standard)
  $query = "SELECT * FROM user WHERE username = '$username' and 
				  passwd = password('$password') and active = '1'";
  $result = $this->QueryTheDB($query);
  if ( mysql_num_rows($result) > 0 )
  { return 1; }
  else
  {
	// Attempt to log user in with OLD password function
	//	 (This funtionality will become obselete after all have changed
	//	  to new style of password by simply logging in)
	$query = "SELECT * FROM user WHERE username = '$username' and 
				   passwd = old_password('$password') and active = '1'";
	$result = $this->QueryTheDB($query);
	if (mysql_num_rows($result)>0)
	{ 
	  // Save the user's password in the new format.
	  $query = "UPDATE user SET passwd = password('$password') WHERE 
					  username = '$username'";
	  $result = $this->QueryTheDB($query);	
	  return 1; 
	}
  }
  return 0; 
}

Note: "$this->QueryTheDB()" connects to the DB, and returns the mysql_query($query).

 

So what I have done is allow the user to log in no matter which scheme was being used before, and if their pass-hash was the old way, then store the exact password they use back into the DB in the NEW pass-hash format.

 

I hope I have helped someone else out there!

Link to post
Share on other sites
  • 5 weeks later...
Hi, all the mySQL databases for my domain are collated "latin1_swedish_c". Shouldn't it be "UTF8_general_ci" or something like that?

 

thanks,

Stefan

 

Same problem here, too. I guess TCH has upgraded MySQL to a version that supports collation?

 

Unfortunately all of my previously collation-less data now have been (mistakenly) labeled "latin1_swedish_c" (apparently rather arbitarily since MySQL is a Swedish company). This would all be academic except that I can no longer view or properly manipulate the data via PhpMyAdmin. It's all scrambled and I hope this is only a presentation issue and not indicative of data corruption.

 

Problem with "latin1_swedish_c":

 

1. My data are definitely not Latin1 encoded (they're UTF-8, to support English, Japanese, Chinese, and all sorts of multilingual data);

 

2. Not Swedish (but collation really doesn't matter to my apps);

 

3. Manually setting each field to, say, "utf8 byte" or "utf8 general_ci" has not made the problem go away. Worse, now the part of the site that pulled out the data now displays scrambed text. Apparently the data are now really treated as Latin!

 

If I come up with anything, I'll let you know. Sigh....

Link to post
Share on other sites

After noticing this thread today (for the first time) I thought it seemed familiar. So I checked.

Turns out all my databases, spread over 4 domains and 3 servers, are collated "latin1_swedish_c".

 

Everything seems to work fine.

 

Should I open help desk tickets?

Link to post
Share on other sites

Hello,

 

Your databases's will run just fine in latin1_swedish_c, so you only need to open a help desk ticket if its causing you problems or you just wish to have it in a different langauge.

 

JimE

Link to post
Share on other sites
If it ain't broke.................... :(

 

Isn't that the truth. I've caused myself so much headache because I've tried to "fix" things that worked when I started but didn't when I finished... :)

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...