function insertPlayer($fbid, $name, $email, $friendId) { $sql = "insert into players(facebook_id, username, email, friend_id) values(" . $fbid . ", '" . str_replace("'", "", $name) . "', "; if (isset($email)) { $sql .= "'" . $email . "', "; } else { $sql .= "null, "; } if (isset($friendId)) { $sql .= $friendId . ")"; } else { $sql .= "null)"; } $id = executeInsert($sql); return getPlayerFromId($id); }
<?php require_once 'svedka-config.php'; require_once 'include/sql.php'; require_once 'include/facebook.php'; $grandPrize = getGrandPrize($test_date); $redemptionCode = $_REQUEST['c']; $prizeSchedule = getPrizeScheduleFromCode($redemptionCode); if (!isset($prizeSchedule) || $prizeSchedule['status'] != 0) { exit; } if (isset($prizeSchedule['friend_id'])) { $friend = getPlayerFromId($prizeSchedule['friend_id']); } $player['facebook_id'] = $prizeSchedule['facebook_id']; // for share and feed posts $player['username'] = $prizeSchedule['username']; // for share and feed posts ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml"> <head> <script src="http://connect.facebook.net/en_US/all.js"></script> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Bot Prize Redeem Form</title> <link rel="stylesheet" type="text/css" href="reset.css" /> <link rel="stylesheet" type="text/css" href="style.css?v=1.8" /> <!--[if lt IE 8]> <link rel="stylesheet" type="text/css" href="ie.css" />