sql_query($sql)) ) {
message_die(GENERAL_MESSAGE, 'Cash Table Not Found');
} else {
$row = $db->sql_fetchrow($sresult);
$board_config['points_name'] = $row[0];
$db->sql_freeresult($sresult);
}
$sql="SELECT cash_dbfield FROM nuke_bbcash";
if ( !($sresult = $db->sql_query($sql)) ) {
message_die(GENERAL_MESSAGE, 'Cash Table Not Found');
} else {
$row = $db->sql_fetchrow($sresult);
$cash_field = $row[0];
$db->sql_freeresult($sresult);
}
//
// Start page Variables
//
$colordropdown = '
';
//
// End page variables
//
//start of special shop display
if (($_REQUEST['action'] == "specialshop") || (empty($_REQUEST['action'])))
{
$template->set_filenames(array(
'body' => 'shop_body.tpl')
);
if ( !$userdata['session_logged_in'] )
{
$redirect = "shop.$phpEx&action=specialshop";
$redirect .= ( isset($user_id) ) ? '&user_id=' . $user_id : '';
header('Location: ' . append_sid("login.$phpEx?redirect=$redirect", true));
}
$shoparray = explode("ß", $board_config['specialshop']);
$shoparraycount = count ($shoparray);
$shopstatarray = array();
for ($x = 0; $x < $shoparraycount; $x++)
{
$temparray = explode("Þ", $shoparray[$x]);
$shopstatarray[] = $temparray[0];
$shopstatarray[] = $temparray[1];
}
//start checks for first visit
if (strlen($userdata['user_privs']) < 2) {
$sql = "update " . USERS_TABLE . " set user_effects='ßnoÞ0ßnoÞ0ßnoÞ0', user_privs='ßnoÞ0ßnoÞ0ßnoÞ0' where username='{$userdata['username']}'";
if ( !($db->sql_query($sql)) ) { message_die(GENERAL_MESSAGE, 'Fatal Error Fixing User!'); }
if (strlen($userdata['user_custitle']) < 2) {
$sql = "update " . USERS_TABLE . " set user_custitle='ßoffÞ0ßoffÞ0ßoffÞ0ßoffÞ0ßoffÞ0' where username='{$userdata['username']}'";
if ( !($db->sql_query($sql)) ) { message_die(GENERAL_MESSAGE, 'Fatal Error Fixing User!'); }
}
header("Location: shop_effects.php");
}
//end first visit checks
$usereffects = explode("ß", $userdata['user_effects']);
$userprivs = explode("ß", $userdata['user_privs']);
$userctitle = explode("ß", $userdata['user_custitle']);
$userbs = array();
$usercount = count($userprivs);
for ($x = 0; $x < $usercount; $x++) { $temppriv = explode("Þ", $userprivs[$x]); $userbs[] = $temppriv[0]; $userbs[] = $temppriv[1]; }
$usercount = count($usereffects);
for ($x = 0; $x < $usercount; $x++) { $temppriv = explode("Þ", $usereffects[$x]); $userbs[] = $temppriv[0]; $userbs[] = $temppriv[1]; }
$usercount = count($userctitle);
for ($x = 0; $x < $usercount; $x++) { $temppriv = explode("Þ", $userctitle[$x]); $userbs[] = $temppriv[0]; $userbs[] = $temppriv[1]; }
//check enabled
if ($shopstatarray[3] != "enabled") { message_die(GENERAL_MESSAGE, 'Effects store is not Enabled!'); }
if (($shopstatarray[6] == on) || ($shopstatarray[8] == on) || ($shopstatarray[10] == on))
{
if (($userbs[2] == no) || ($userbs[2] == off)) { $avatarbs = "Buy"; } else { $avatarbs = "Remove"; $avatarowned = "Yes"; }
if (($userbs[4] == no) || ($userbs[4] == off)) { $sigbs = "Buy"; } else { $sigbs = "Remove"; $sigowned = "Yes"; }
if (($userbs[6] == no) || ($userbs[6] == off)) { $titlebs = "Buy"; } else { $titlebs = "Remove"; $titleowned = "Yes"; }
$shopinfo .= ' | Privileges |
';
$shopinfo .= 'Privileges | Cost |
|
| Owned |
';
if ($shopstatarray[6] == on)
{
$shopinfo .= '';
}
if ($shopstatarray[8] == on)
{
$shopinfo .= '';
}
if ($shopstatarray[10] == on)
{
$shopinfo .= '';
}
}
if (($shopstatarray[12] == on) || ($shopstatarray[14] == on) || ($shopstatarray[16] == on))
{
$shopinfo .= 'Name Effects |
';
$shopinfo .= 'Effects | Cost | Colors |
| Owned |
';
if (($userbs[10] == no) || ($userbs[10] == off)) { $colorbs = "Buy"; } else { $colorbs = "Remove"; $colorowned = "Yes"; }
if (($userbs[12] == no) || ($userbs[12] == off)) { $shadowbs = "Buy"; } else { $shadowbs = "Remove"; $shadowowned = "Yes"; }
if (($userbs[14] == no) || ($userbs[14] == off)) { $glowbs = "Buy"; } else { $glowbs = "Remove"; $glowowned = "Yes"; }
if ($shopstatarray[12] == on)
{
$shopinfo .= '';
}
if ($shopstatarray[14] == on)
{
$shopinfo .= '';
}
if ($shopstatarray[16] == on)
{
$shopinfo .= '';
}
}
if (($shopstatarray[18] == on) || ($shopstatarray[20] == on) || ($shopstatarray[22] == on))
{
$shopinfo .= "Title Effects |
";
$shopinfo .= "Effects | Cost | Colors |
| Owned |
";
if (($userbs[18] == no) || ($userbs[18] == off)) { $tcolorbs = "Buy"; } else { $tcolorbs = "Remove"; $tcolorowned = "Yes"; }
if (($userbs[20] == no) || ($userbs[20] == off)) { $tglowbs = "Buy"; } else { $tglowbs = "Remove"; $tglowowned = "Yes"; }
if (($userbs[22] == no) || ($userbs[22] == off)) { $tshadowbs = "Buy"; } else { $tshadowbs = "Remove"; $tshadowowned = "Yes"; }
if ($shopstatarray[18] == on)
{
$shopinfo .= '';
}
if ($shopstatarray[20] == on)
{
$shopinfo .= '';
}
if ($shopstatarray[22] == on)
{
$shopinfo .= '';
}
}
if (($shopstatarray[24] == on) || ($shopstatarray[26] == on))
{
$shopinfo .= "Custom Changes |
";
$shopinfo .= "Type | Cost | Change to |
| Owned/Name |
";
if ((($userbs[24] == no) || ($userbs[24] == off)) || ($userbs[26] == on)) { $ctitlebs = "Buy"; } else { $ctitlebs = "Remove"; $ctitleowned = "Yes"; }
if ($shopstatarray[24] == on)
{
$shopinfo .= '';
}
if ($shopstatarray[26] == on)
{
$shopinfo .= '';
}
if ($shopstatarray[28] == on)
{
$shopinfo .= '';
}
}
if ($shopstatarray[12] == "on" || $shopstatarray[14] == "on" || $shopstatarray[16] == "on" || $shopstatarray[18] == "on" || $shopstatarray[20] == "on" || $shopstatarray[22] == "on") {
$shopinfo .= 'Test Effects |
';
$shopinfo .= 'Type | Colors |
';
$shopinfo .= '';
}
if ($_REQUEST['viewname'] == "true") {
if ($_REQUEST['color'] != "none") { $testcolor = ''; }
if ($_REQUEST['gcolor'] != "none") { $testglow = '; filter:glow(color=#'.$_REQUEST['gcolor'].', strength=5)'; }
if ($_REQUEST['scolor'] != "none") { $testshadow = '; filter:shadow(color=#'.$_REQUEST['scolor'].', strength=5)'; }
if (!preg_match("/^[a-zA-Z0-9 ]*$/", $testtext)) { $text = $userdata['username']; }
elseif (strlen($testtext) < 2) { $text = $userdata['username']; }
else { $text = $testtext; }
$shopinfo .= ''.$testcolor.''.$text.' |
';
}
$page_title = 'Permissions and Effects Store';
$title = $shopstatarray[5];
$shoplocation = ' -> '.$shopstatarray[5].' Abilities';
if (strlen($shopinfo) > 3) { $shoptablerows = 5; }
else { $shoptablerows = 1; $shopinforow = 'There are currently no effects or privlages for sale in this shop. |
'; }
// start of personal information
$personal = 'Your Inventory | '.$userdata[$cash_field].' '.$board_config['points_name'].' |
';
if (strlen($userdata['user_specmsg']) > 2) {
$personal .= ''.$userdata['user_specmsg'].' |
';
$personal .= 'Clear Messages |
';
}
//end of personal information
$template->assign_vars(array(
'SHOPPERSONAL' => $personal,
'SHOPLOCATION' => $shoplocation,
'L_SHOP_TITLE' => $title,
'SHOPTABLEROWS' => $shoptablerows,
'SHOPLIST' => $shopinfo,
'SHOPINFOROW' => $shopinforow,
));
$template->assign_block_vars('', array());
}
//start of buy & sell sepcials
elseif ($_REQUEST['action'] == "bsspecial")
{
if ( !$userdata['session_logged_in'] )
{
$redirect = "shop.$phpEx&action=bsspecial&type=".$_REQUEST['type']."&bs=".$_REQUEST['bs']."&color=".$_REQUEST['color'];
$redirect .= ( isset($user_id) ) ? '&user_id=' . $user_id : '';
header('Location: ' . append_sid("login.$phpEx?redirect=$redirect", true));
}
$template->set_filenames(array( 'body' => 'shop_body.tpl'));
$usereffects = explode("ß", $userdata['user_effects']);
$userprivs = explode("ß", $userdata['user_privs']);
$usercustitle = explode("ß", $userdata['user_custitle']);
$userbs = array();
$usercount = count($userprivs);
for ($x = 0; $x < $usercount; $x++) { $temppriv = explode("Þ", $userprivs[$x]); $userbs[] = $temppriv[0]; $userbs[] = $temppriv[1]; }
$usercount = count($usereffects);
for ($x = 0; $x < $usercount; $x++) { $temppriv = explode("Þ", $usereffects[$x]); $userbs[] = $temppriv[0]; $userbs[] = $temppriv[1]; }
$usercount = count($usercustitle);
for ($x = 0; $x < $usercount; $x++) { $temppriv = explode("Þ", $usercustitle[$x]); $userbs[] = $temppriv[0]; $userbs[] = $temppriv[1]; }
$shoparray = explode("ß", $board_config['specialshop']);
$shoparraycount = count ($shoparray);
$shopstatarray = array();
for ($x = 0; $x < $shoparraycount; $x++)
{
$temparray = explode("Þ", $shoparray[$x]);
$shopstatarray[] = $temparray[0];
$shopstatarray[] = $temparray[1];
}
if ($_REQUEST['bs'] == "Buy") {
if ((($_REQUEST['type'] == "ctitle") && ($shopstatarray[24] == "on")) || (($_REQUEST['type'] == "cutitle") && ($shopstatarray[28] == "on"))) {
$tsql = "select * from " . RANKS_TABLE . " where rank_title='{$_REQUEST['newtitle']}'";
if ( !($tresult = $db->sql_query($tsql)) ) { message_die(GENERAL_MESSAGE, 'Fatal Error Rank Info!'); }
$trow = mysql_fetch_array($tresult);
if (mysql_num_rows($tresult) > 0) { message_die(GENERAL_MESSAGE, 'That Rank has already been assigned!'); }
elseif ((!preg_match("/^[a-zA-Z0-9 ]*$/", $_REQUEST['newtitle'])) || (strlen($_REQUEST['newtitle']) < 2)) { message_die(GENERAL_MESSAGE, 'That Rank is Invalid, it must only contain characters A-Z, a-z and 1-0. For more specific titles talk to an admin.'); }
if (($_REQUEST['type'] == "cutitle") && ($shopstatarray[28] == "on")) {
if ($userdata['username'] == $tchangename) { message_die(GENERAL_MESSAGE, 'If you want to change your title, do it with the proper field!'); }
$sql = "select * from " . USERS_TABLE . " where username='{$_REQUEST['tchangename']}'";
if ( !($result = $db->sql_query($sql)) ) { message_die(GENERAL_MESSAGE, 'Fatal Error Checking Username!'); }
$ucrow = mysql_fetch_array($result);
if ((($ucrow['user_level'] == 1) || ($ucrow['user_level'] == 2)) && ($userdata['user_level'] != 1)) { message_die(GENERAL_MESSAGE, 'You cannot change the rank of Admins or Moderators!'); }
if (strlen($ucrow['username']) < 2) { message_die(GENERAL_MESSAGE, 'No such user exists!'); }
else { $specialcost = $shopstatarray[29]; }
}
else { $specialcost = $shopstatarray[25]; }
}
if (($_REQUEST['type'] == cusername) && ($shopstatarray[26] == "on")) {
$sql = "select * from " . USERS_TABLE . " where username='{$_REQUEST['newname']}'";
if ( !($result = $db->sql_query($sql)) ) { message_die(GENERAL_MESSAGE, 'Fatal Error Checking Username!'); }
if (mysql_num_rows($result) > 0) { message_die(GENERAL_MESSAGE, 'That name is already in use, go back and pick another one!'); }
elseif ((!preg_match("/^[a-zA-Z0-9 ]*$/", $_REQUEST['newname'])) || (strlen($_REQUEST['newname']) < 2)) { message_die(GENERAL_MESSAGE, 'Invalid name, Characters must be A-Z & a-z. If you wish a different type of name change contact an admin.'); }
else { $specialcost = $shopstatarray[27]; }
}
if (($_REQUEST['type'] == 'tcolor') && ($shopstatarray[18] == 'on')) { $specialcost = $shopstatarray[19]; }
if (($_REQUEST['type'] == 'tglow') && ($shopstatarray[20] == 'on')) { $specialcost = $shopstatarray[21]; }
if (($_REQUEST['type'] == 'tshadow') && ($shopstatarray[22] == 'on')) { $specialcost = $shopstatarray[23]; }
if (($_REQUEST['type'] == 'avatar') && ($shopstatarray[6] == 'on')) { $specialcost = $shopstatarray[7]; }
if (($_REQUEST['type'] == 'sig') && ($shopstatarray[8] == 'on')) { $specialcost = $shopstatarray[9]; }
if (($_REQUEST['type'] == 'title') && ($shopstatarray[10] == 'on')) { $specialcost = $shopstatarray[11]; }
if (($_REQUEST['type'] == 'color') && ($shopstatarray[12] == 'on')) { $specialcost = $shopstatarray[13]; }
if (($_REQUEST['type'] == 'shadow') && ($shopstatarray[16] == 'on')) { $specialcost = $shopstatarray[17]; }
if (($_REQUEST['type'] == 'glow') && ($shopstatarray[14] == 'on')) { $specialcost = $shopstatarray[15]; }
if (!is_numeric($specialcost)) { message_die(GENERAL_MESSAGE, 'Shop Function not Enabled or Error in Cost!'); }
if (($_REQUEST['type'] == 'color') || ($_REQUEST['type'] == 'shadow') || ($_REQUEST['type'] == 'glow') || ($_REQUEST['type'] == 'tglow') || ($_REQUEST['type'] == 'tcolor') || ($_REQUEST['type'] == 'tshadow'))
{
if (substr_count($colordropdown, '