2, 'portability' => DB_PORTABILITY_ALL ); $conn = DB::connect(getDSN(), $options); if(DB :: isError($conn)) { echo $conn->toString(); set_response_code(500); echo $crypt->json_encode_and_encrypt(array('error' => 'Could not connect to DB')); die(); } $conn->setFetchMode(DB_FETCHMODE_ASSOC); if( !defined("CLI_SERVER_NAME") || !defined('CLI_SCHEME')) { echo "CLI_SERVER_NAME or CLI_SCHEME is not configured. Check snapporder/config.php\n"; die(1); } if(PHP_SAPI !== 'cli') { echo "Not allowed. Run this on the command line.\n"; die(1); } if($argc < 2) { echo "Invalid number of arguments.\n"; die(1); } if( !is_numeric($argv[1]) ) { echo "User ID is not a number.\n"; die(1); } $user = get_user($argv[1]); if( $user == NULL ) { echo "User with user ID $argv[1] not found.\n"; die(1); } /* Add register url */ if($user['registration_status'] !== "partial") { echo "User ".$user['memberid']." has invalid registration status '".$user['registration_status']."' (not partial).\n"; die(1); } $server_name = CLI_SERVER_NAME; $scheme = CLI_SCHEME; $user['registration_url'] = generate_registration_url($user, SECRET_KEY); /* Send email */ send_activation_email(array(), $user); echo "Email sent to ". $user['email'].".\n";