Here. Some of it won't be relevant to the issue at hand, but I'll post it anyways.
<?php
// Purpose: Get the passed variables from dice script
// and parse them to readable data, then post
// to the thread.
mysql_connect("localhost", "dbuser", "dbpass");
mysql_select_db("superwad_invision");
$n = $_GET['n'];
$dx = $_GET['dx'];
$mod = $_GET['mod'];
$pm = $_GET['plusmin'];
$total = $_GET['total'];
$results = $_GET['results'];
$ipbcookie = $_COOKIE['invisionmember_id'];
$postTime = date("U");
// Place the results into an array for easier display.
$explodeResults = explode(",", $results);
// Set modifier variable
if ($pm == '0')
{
$plmi = "+";
}
elseif ($pm == '1')
{
$plmi = "-";
}
// Is the user a guest?
if ($ipbcookie == '0')
{
$guest = '1';
}
else
{
$guest = '0';
}
// Get username from cookie information if not a guest
if ($guest == '0')
{
$result = mysql_query("SELECT name from ibf_members WHERE id = $ipbcookie");
$row = mysql_fetch_row($result);
$userName = $row[0];
$postString = "$userName rolled ". $n ."d". $dx . " with a modifier of ". $plmi ."". $mod. " and the total was $total.";
for ($l = 0; $l < $n; $l++)
{
$res = $l + 1;
echo ("Dice $res was a $explodeResults[$l]<br>");
}
$result1 = mysql_query("SELECT posts FROM ibf_forums WHERE id = '16'");
$row1 = mysql_fetch_row($result1);
$posts1 = $row1[0];
$updatePosts1 = $posts1 + 1;
mysql_query("UPDATE `ibf_forums` SET `posts` = '$updatePosts1', `last_post` = '$postTime', `last_poster_id` = '10', `last_poster_name` = 'DiceBot', `last_title` = 'Rolling Thread', `last_id` = '31' WHERE `id` = '16'");
$result2 = mysql_query("SELECT posts,ip_address FROM ibf_members WHERE id = '10'");
$row2 = mysql_fetch_row($result2);
$posts2 = $row2[0];
$updatePosts2 = $posts2 + 1;
mysql_query("UPDATE `ibf_members` SET `posts` = '$updatePosts2', `ip_address` = '' WHERE `id` = '10'");
$result3 = mysql_query("SELECT posts FROM ibf_topics WHERE tid = '31'");
$row3 = mysql_fetch_row($result3);
$posts3 = $row3[0];
$updatePosts3 = $posts3 + 1;
mysql_query("UPDATE `ibf_topics` SET `posts` = '$updatePosts3', `last_poster_id` = '10', `last_post` = '$postTime', `last_poster_name` = 'DiceBot' WHERE `tid` = '31'");
mysql_query("INSERT INTO `ibf_posts` (`pid`, `append_edit`, `edit_time`, `author_id`, `author_name`, `use_sig`, `use_emo`, `ip_address`, `post_date`, `icon_id`, `post`, `queued`, `topic_id`, `forum_id`, `attach_id`, `attach_hits`, `attach_type`, `attach_file`, `post_title`, `new_topic`, `edit_name`) VALUES ('', '0', NULL, '10', 'DiceBot', '1', '1', '127.0.0.1', '$postTime', '0', '$postString', '0', '31', '16', '', '0', '', '', NULL, '0', NULL)");
}
else
{
echo ("Sorry, guests cannot use this feature. Please login in order to roll the dice.");
}
?>