prepare('SELECT * FROM committees_members'); $q->execute(); while ($r = $q->fetch(PDO::FETCH_ASSOC)) { $update_62_committee[] = $r; } } function db_update_62_post() { global $update_62_committee; global $config; foreach ($update_62_committee as $c) { list($fn, $ln) = split(' ', $c['name'], 2); $username = $c['email']; if ($config['committee_password_expiry_days'] > 0) { $passwordexpiry = "DATE_ADD(CURDATE(), INTERVAL {$config['committee_password_expiry_days']} DAY)"; } else { $passwordexpiry = 'NULL'; } $deleted = ($c['deleted'] == 'Y') ? 'yes' : 'no'; $q = "INSERT INTO users (`types`,`firstname`,`lastname`,`username`,`password`,`passwordexpiry`, `email`,`phonehome`,`phonework`,`phonecell`,`fax`,`organization`, `created`,`deleted`) VALUES ('committee',?,?,?, ?, ?, ?, ?, ?, ?, ?, ?, NOW(), ?)"; $stmt = $pdo->prepare($q); $stmt->execute([$fn,$ln,$username,$c['password'],$passwordexpiry,$c['email'],$c['phonehome'],$c['phonework'],$c['phonecell'],$c['fax'],$c['organization'],$deleted]); echo "$q\n"; $id = $pdo->lastInsertId(); $access_admin = ($c['access_admin'] == 'Y') ? 'yes' : 'no'; $access_config = ($c['access_config'] == 'Y') ? 'yes' : 'no'; $access_super = ($c['access_super'] == 'Y') ? 'yes' : 'no'; $displayemail = ($c['displayemail'] == 'Y') ? 'yes' : 'no'; $q = "INSERT INTO users_committee(`users_id`,`emailprivate`, `ord`,`displayemail`,`access_admin`,`access_config`, `access_super`) VALUES ( ?,?, ?, ?, ?, ?, ?)"; $stmt = $pdo->prepare($q); $stmt->execute([$id,$c['emailprivate'],$c['ord'],$displayemail,$access_admin,$access_config,$access_super]); echo "$q\n"; show_pdo_errors_if_any($pdo); /* Update committee links */ $q = "UPDATE committees_link SET users_id=? WHERE committees_members_id=?"; $stmt = $pdo->prepare($q); $stmt->execute([$id,$c['id']]); echo "$q\n"; } } ?>