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','$fn', '$ln', '$username', '".$c['password']."', $passwordexpiry, '{$c['email']}', '{$c['phonehome']}', '{$c['phonework']}', '{$c['phonecell']}', '{$c['fax']}', '".$c['organization']."', NOW(), '$deleted')"; $stmt = $pdo->prepare($q); $stmt->execute(); 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 ( '$id', '{$c['emailprivate']}', '{$c['ord']}', '$displayemail', '$access_admin', '$access_config', '$access_super')"; $stmt = $pdo->prepare($q); $stmt->execute(); echo "$q\n"; echo $pdo->errorInfo(); /* Update committee links */ $q = "UPDATE committees_link SET users_id='$id' WHERE committees_members_id='{$c['id']}'"; $stmt = $pdo->prepare($q); $stmt->execute(); echo "$q\n"; } } ?>