X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;ds=sidebyside;f=modules%2Fregister.php;h=331f61874b0b876c52078d1e70d80e58fb99ceb6;hb=2d89ec936167033886ae76b153605d7ccf19bc20;hp=c53a45682252666b523686e74e5800ba83179aa5;hpb=00ba8a742be0cfc70eef7c6aaaccebe7134ec087;p=platal.git diff --git a/modules/register.php b/modules/register.php index c53a456..331f618 100644 --- a/modules/register.php +++ b/modules/register.php @@ -71,7 +71,7 @@ class RegisterModule extends PLModule SELECT m.uid, m.sender, 0 FROM register_marketing AS m WHERE m.hash - ON DUPLICATE KEY sender = VALUES(sender), success = VALUES(success)', + ON DUPLICATE KEY UPDATE sender = VALUES(sender), success = VALUES(success)', $subState->s('hash')); } } @@ -328,6 +328,7 @@ class RegisterModule extends PLModule // // Create the user account. // + XDB::startTransaction(); XDB::execute("UPDATE accounts SET password = {?}, state = 'active', registration_date = NOW(), email = NULL @@ -343,6 +344,7 @@ class RegisterModule extends PLModule XDB::execute("INSERT INTO aliases (uid, alias, type) VALUES ({?}, {?}, 'alias')", $uid, $emailXorg2); } + XDB::commit(); // Add the registration email address as first and only redirection. require_once 'emails.inc.php'; @@ -369,11 +371,11 @@ class RegisterModule extends PLModule $r = XDB::query('SELECT id FROM groups WHERE diminutif = {?}', $yearpromo); if ($r->numRows()) { $asso_id = $r->fetchOneCell(); - XDB::execute('INSERT INTO group_members (uid, asso_id) - VALUES ({?}, {?})', + XDB::execute('INSERT IGNORE INTO group_members (uid, asso_id) + VALUES ({?}, {?})', $uid, $asso_id); - $mmlist = new MMList($uid, S::v('password')); - $mmlist->subscribe("promo" . S::v('promo')); + $mmlist = new MMList($user); + $mmlist->subscribe("promo" . $yearpromo); } break; case 'nl':