tags:

views:

37

answers:

0

Hello

I am using a salted sha1 string to store activation strings. PHP is generating the strings correctly, but I have a problem storing them. Using varchar or char and field length from 64 up to 180, mysql is removing the last character regardless.

Does anyone know why that would happen?

edit:

CREATE TABLE `users` (
  `id` int(6) NOT NULL AUTO_INCREMENT,
  `email` char(50) NOT NULL,
  `password` char(180) NOT NULL,
  `member_key` char(180) NOT NULL,
  `type` int(2) NOT NULL,
  `first_name` char(40) NOT NULL,
  `last_name` varchar(60) NOT NULL,
  `departure` varchar(10) NOT NULL COMMENT 'departure date',
  `emailkey` char(180) NOT NULL,
  `emaillist` int(1) NOT NULL,
  `emailoffer` int(1) NOT NULL,
  `emailon` int(1) NOT NULL DEFAULT '0',
  `gueston` int(1) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=29 ;

php:

$link = sha1(SMISC.$email);

        mysql_query ("INSERT into ".TUSER." (email, password, type, first_name, last_name, departure, emailkey, emaillist, emailoffer) VALUES ('$email', '$password', '1', '$firstname', '$lastname', '$departure', '$link', '$list', '$offer')");

Please note I've corrected the question to storing activation keys, which I'm creating and storing in an identical manner. Since I've not implemented login yet I can't test the password but I expect the same problem.

php to set the email link:

$link = SITE.'?e='.$link;