function create_player($send_name, $params = array()) { $sql = new DBAccess(); $send_email = $params['send_email']; $send_pass = $params['send_pass']; $send_class = $params['send_class']; $preconfirm = (int) $params['preconfirm']; $confirm = (int) $params['confirm']; $referred_by = $params['referred_by']; $headers = "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; $headers .= "From: " . SYSTEM_MESSENGER_NAME . " <" . SYSTEM_MESSENGER_EMAIL . ">\r\n"; $headers .= "Reply-To: " . SUPPORT_EMAIL_FORMAL_NAME . " <" . SUPPORT_EMAIL . ">\r\n"; // Create the initial player row. $playerCreationQuery = "INSERT INTO players\n\t\t (uname, pname, health, strength, gold, messages, kills, turns, confirm, confirmed,\n\t\t email, class, level, status, member, days, ip, bounty, clan, clan_long_name, created_date)\n\t\t VALUES\n\t\t ('{$send_name}','{$send_pass}','150','5','100','','0','180','{$confirm}','{$preconfirm}',\n\t\t '{$send_email}','{$send_class}','1','1','0','0','','0','','', now())"; // *** Inserts the choices and defaults into the player table. Status defaults to stealthed. *** $sql->Insert($playerCreationQuery); // *** Sends out the confirmation email to the chosen email address. *** $_to = "{$send_email}"; $_subject = "NinjaWars Account Sign Up"; $_body = render_template('signup_email_body.tpl', array('send_name' => $send_name, 'confirm' => $confirm, 'send_class' => $send_class, 'WEB_ROOT' => WEB_ROOT, 'SUPPORT_EMAIL' => SUPPORT_EMAIL)); $_from = "{$headers}"; // *** Create message object. $message = new Nmail($_to, $_subject, $_body, $_from); if (DEBUG) { $message->dump = true; } $sent = false; // By default, assume failure. $sent = $message->send(); // TODO: Need an in-game error logging. return $sent; }