Item not sent

03/18/2018 13:12 sparking1#1
Hi guys I have the exact same problem as this guy :

[Only registered and activated users can see links. Click Here To Register...]

But there is no exact answer in the thread so please if someone know the answer , answer me.

My problem :
When I buy an item in my webshop it doesn't work. I receive an error that says
"This item could not be sent."



I'll give a reward to the guy that will make this work

Here is a screenshot of the error

[Only registered and activated users can see links. Click Here To Register...]

and the code of the "shop.php" :

Code:
<?php if (!defined('access')) {die("Die gesuchte Ressource wurde entfernt oder umbenannt, oder sie steht vorübergehend nicht zur Verfügung.");} ?>
<div class="panel panel-primary">
	<div class="panel-heading"><i class="fa fa-shopping-cart"></i> Item shop</div>
	<div class="panel-body panel-body-info panel-nostyle">
		<div class="box">	
			<?php
			if(in_array($_SESSION['user'], $_CONFIG['allg_svr_admins']) OR $_CONFIG['donate_shop_enable']) {

				$toggleDisplays = array(
					'subCategories' => '',
					'itemDetails' => '',
					'itemList' => ''
				);
				$strMainCategoryQuery = '
					SELECT	    [mid], [name]
					FROM	    [' . $_CONFIG['db_databases']['web'] . '].dbo.[SHOP_CATEGORIES_MAIN]
					WHERE       [active] = 1
					ORDER BY    [mid] ASC
				';
				$resMainCategoryQuery = [MENTION=311501]ODB[/MENTION]c_exec($odbc_connect, $strMainCategoryQuery);

				if(is_numeric($_GET['sid']) OR is_numeric($_GET['iid'])) {
					$intActiveSubCategoryID = $_GET['sid'];

					if(is_numeric($_GET['iid'])) {
						$toggleDisplays['itemDetails'] = 'display: block;';
						$strItemdetailsQuery = '
							SELECT	main.[name] AS "mainCatName",
									sub.[sid] AS "subCatID",
									sub.[name] AS "subCatName",
									itemlist.[mid],
									itemlist.[itemid],
									itemlist.[name],
									itemlist.[description],
									itemlist.[priceDP],
									itemlist.[priceVP],
									itemlist.[count],
									itemlist.[icon],
									itemlist.[effects]
							FROM	[' . $_CONFIG['db_databases']['web'] . '].dbo.[SHOP_ITEMLIST] AS itemlist
								LEFT JOIN [' . $_CONFIG['db_databases']['web'] . '].dbo.[SHOP_CATEGORIES_SUB] AS "sub" ON sub.[sid] = itemlist.[category]
								LEFT JOIN [' . $_CONFIG['db_databases']['web'] . '].dbo.[SHOP_CATEGORIES_MAIN] AS "main" ON main.[mid] = sub.[mid]
							WHERE   sub.[active] = 1 AND main.[active] = 1 AND itemlist.[mid] = ' . $_GET['iid'] . '
							ORDER BY main.[mid] ASC, sub.[sid] ASC
						';
						$resItemdetailsQuery = [MENTION=311501]ODB[/MENTION]c_exec($odbc_connect, $strItemdetailsQuery);
						$intActiveSubCategoryID = [MENTION=311501]ODB[/MENTION]c_result [MENTION=311501]ODB[/MENTION]c_exec($odbc_connect, $strItemdetailsQuery), 'subCatID');
					}

					$toggleDisplays['subCategories'] = 'display: block;';
					$intActiveMainCategoryID = [MENTION=311501]ODB[/MENTION]c_result [MENTION=311501]ODB[/MENTION]c_exec($odbc_connect, 'SELECT [mid] FROM [' . $_CONFIG['db_databases']['web'] . '].dbo.[SHOP_CATEGORIES_SUB] WHERE [sid] = ' . $intActiveSubCategoryID . ' AND [active] = 1'), 'mid');
					$strSubCategoryQuery = '
						SELECT	    [sid], [name]
						FROM	    [' . $_CONFIG['db_databases']['web'] . '].dbo.[SHOP_CATEGORIES_SUB]
						WHERE       [active] = 1 AND [mid] = ' . $intActiveMainCategoryID . '
						ORDER BY    [sid] ASC
					';
					$resSubCategoryQuery = [MENTION=311501]ODB[/MENTION]c_exec($odbc_connect, $strSubCategoryQuery);

					$toggleDisplays['itemList'] = 'display: block;';
					$strItemlistQuery = '
						SELECT	    [mid],
									[name],
									[icon],
									[count],
									[priceDP],
									[priceVP]
						FROM	    [' . $_CONFIG['db_databases']['web'] . '].dbo.[SHOP_ITEMLIST] AS itemlist
						WHERE       [category] = ' . $intActiveSubCategoryID . '
						ORDER BY    [mid] ASC
					';
					$resItemlistQuery = [MENTION=311501]ODB[/MENTION]c_exec($odbc_connect, $strItemlistQuery);
				}

				if(!empty($_SESSION['user'])) {
					if((isset($_POST['shopBuyItem']) OR isset($_POST['shopGiftItem'])) AND !empty($_POST['sendItemToCharacter']) AND !empty($_POST['sid']) AND !empty($_POST['iid']) AND isset($_POST['currency'])) {

						$strErrorArray =  array();
						$resSelectedItemDetailsArray = [MENTION=311501]ODB[/MENTION]c_exec($odbc_connect, 'SELECT * FROM [' . $_CONFIG['db_databases']['web'] . '].dbo.[SHOP_ITEMLIST] WHERE [mid] = ' . cleanSqlInput($_POST['iid']) . ' AND [category] = ' . cleanSqlInput($_POST['sid']) . '');
						$resSelectCharacter = [MENTION=311501]ODB[/MENTION]c_exec($odbc_connect, 'SELECT [m_idPlayer], [account] FROM [' . $_CONFIG['db_databases']['chr'] . '].[dbo].[CHARACTER_TBL] WHERE [m_szName] = \'' . cleanSqlInput($_POST['sendItemToCharacter']) . '\'');

						$mixedSelectedItemDetailsArray = [MENTION=311501]ODB[/MENTION]c_fetch_array($resSelectedItemDetailsArray);
						$intCharacterID = [MENTION=311501]ODB[/MENTION]c_result($resSelectCharacter, 'm_idPlayer');
						$intCharactersAccount = [MENTION=311501]ODB[/MENTION]c_result($resSelectCharacter, 'account');

						if($_POST['currency'] == 0) {
							$intGetCurrentCurrency = 0;
							$intWorthColumnHelper = 'priceDP';
							$intCurrentBalance = [MENTION=311501]ODB[/MENTION]c_result [MENTION=311501]ODB[/MENTION]c_exec($odbc_connect, 'SELECT [cash] FROM [' . $_CONFIG['db_databases']['acc'] . '].[dbo].[ACCOUNT_TBL] WHERE [account] = \'' . cleanSqlInput($_SESSION['user']) . '\''), 'cash');
							$blnItemCharacterBound = FALSE;

							$strUpdateBalance = '
									UPDATE [' . $_CONFIG['db_databases']['acc'] . '].[dbo].[ACCOUNT_TBL]
									SET [cash] = [cash] - ' . $mixedSelectedItemDetailsArray[$intWorthColumnHelper] . '
									WHERE [account] = \'' . cleanSqlInput($_SESSION['user']) . '\'
							';
						}
						else {
							$intGetCurrentCurrency = 1;
							$intWorthColumnHelper = 'priceVP';
							$intCurrentBalance = [MENTION=311501]ODB[/MENTION]c_result [MENTION=311501]ODB[/MENTION]c_exec($odbc_connect, 'SELECT [votepoints] FROM [' . $_CONFIG['db_databases']['acc'] . '].[dbo].[ACCOUNT_TBL] WHERE [account] = \'' . cleanSqlInput($_SESSION['user']) . '\''), 'votepoints');
							$blnItemCharacterBound = TRUE;

							$strUpdateBalance = '
									UPDATE [' . $_CONFIG['db_databases']['acc'] . '].[dbo].[ACCOUNT_TBL]
									SET [votepoints] = [votepoints] - ' . $mixedSelectedItemDetailsArray[$intWorthColumnHelper] . '
									WHERE [account] = \'' . cleanSqlInput($_SESSION['user']) . '\'
							';
						}

						if(isSpamming($_POST['inputCheckTimestamp'], $_POST['inputCheckKey'], $_SESSION['inputCheckKey'])) {
							$strErrorArray[] = $_LANG['error_spam'];
						}
						if [MENTION=311501]ODB[/MENTION]c_num_rows($resSelectedItemDetailsArray) < 1) {
							$strErrorArray[] = $_LANG['error_item_does_not_exist'];
						}
						if [MENTION=311501]ODB[/MENTION]c_num_rows($resSelectCharacter) < 1) {
							$strErrorArray[] = $_LANG['error_no_character_with_that_name'];
						}
						if(!is_numeric($_POST['currency']) OR $_POST['currency'] > 1 OR $_POST['currency'] < 0 OR $mixedSelectedItemDetailsArray[$intWorthColumnHelper] <= 0) {
							$strErrorArray[] = $_LANG['error_currency_changed'];
						}
						if($mixedSelectedItemDetailsArray[$intWorthColumnHelper] > $intCurrentBalance) {
							$strErrorArray[] = $_LANG['error_balace_too_low'];
						}
						if(count($strErrorArray) > 0) {
							echo createMessage($strErrorArray, 'fail');
						}
						else {
							if(isset($_POST['shopBuyItem'])) {
								if( [MENTION=311501]ODB[/MENTION]c_exec($odbc_connect, $strUpdateBalance)
									AND
									 [MENTION=311501]ODB[/MENTION]c_exec($odbc_connect, '
											INSERT INTO [' . $_CONFIG['db_databases']['web'] . '].dbo.[LOG_PURCHASES] (
												item,
												itemname,
												itemcount,
												itemcurrency,
												itemworth,
												account,
												datetime
											) VALUES (
												' . cleanSqlInput($mixedSelectedItemDetailsArray['itemid']) . ',
												\'' . cleanSqlInput($mixedSelectedItemDetailsArray['name']) . '\',
												' . cleanSqlInput($mixedSelectedItemDetailsArray['count']) . ',
												' . $intGetCurrentCurrency . ',
												' . cleanSqlInput($mixedSelectedItemDetailsArray[$intWorthColumnHelper]) . ',
												\'' . cleanSqlInput($_SESSION['user']) . '\',
												\''. date($_CONFIG['web_date_format']['dbDatetime']) .'\'
											)
										')
									AND
										send_item($intCharacterID, $mixedSelectedItemDetailsArray['itemid'], $mixedSelectedItemDetailsArray['count'])
								) {
									echo createMessage($_LANG['success_item_bought'], 'success');
								}
								else {
									echo createMessage($_LANG['error_item_could_not_be_sent'], 'fail');
								}
							}
							elseif(isset($_POST['shopGiftItem'])) {
								if( [MENTION=311501]ODB[/MENTION]c_exec($odbc_connect, $strUpdateBalance)
									AND
								 [MENTION=311501]ODB[/MENTION]c_exec($odbc_connect, '
										INSERT INTO [' . $_CONFIG['db_databases']['web'] . '].dbo.[LOG_GIFTS] (
											item,
											itemname,
											itemcount,
											itemcurrency,
											itemworth,
											accfrom,
											accto,
											charto,
											datetime
										) VALUES (
											' . cleanSqlInput($mixedSelectedItemDetailsArray['itemid']) . ',
											\'' . cleanSqlInput($mixedSelectedItemDetailsArray['name']) . '\',
											' . cleanSqlInput($mixedSelectedItemDetailsArray['count']) . ',
											' . $intGetCurrentCurrency . ',
											' . cleanSqlInput($mixedSelectedItemDetailsArray[$intWorthColumnHelper]) . ',
											\'' . cleanSqlInput($_SESSION['user']) . '\',
											\'' . $intCharactersAccount . '\',
											\'' . cleanSqlInput($_POST['sendItemToCharacter']) . '\',
											\''. date($_CONFIG['web_date_format']['dbDatetime']) .'\'
										)
									')
									AND
										send_item($intCharacterID, $mixedSelectedItemDetailsArray['itemid'], $mixedSelectedItemDetailsArray['count'])
								) {
									echo createMessage($_LANG['success_item_gifted'], 'success');
								}
								else {
									echo createMessage($_LANG['error_item_could_not_be_sent'], 'fail');
								}
							}
						}
					}

					$intCurrentCash = [MENTION=311501]ODB[/MENTION]c_result [MENTION=311501]ODB[/MENTION]c_exec($odbc_connect, 'SELECT [cash] FROM [' . $_CONFIG['db_databases']['acc'] . '].dbo.[ACCOUNT_TBL] WHERE [account] = \'' . cleanSqlInput($_SESSION['user']) . '\''), 'cash');
					$intCurrentVotepoints = [MENTION=311501]ODB[/MENTION]c_result [MENTION=311501]ODB[/MENTION]c_exec($odbc_connect, 'SELECT [votepoints] FROM [' . $_CONFIG['db_databases']['acc'] . '].dbo.[ACCOUNT_TBL] WHERE [account] = \'' . cleanSqlInput($_SESSION['user']) . '\''), 'votepoints');

					echo '
					<p class="center">
						' . $_LANG['shop_your_funds'] . ' <img src="images/icons/shop/price.png" alt="' . $_CONFIG['web_currencies']['donate']['name'] . '"/> ' . $intCurrentCash . ' ' . $_CONFIG['web_currencies']['donate']['symbol'] . '
						& <img src="images/icons/shop/votepoints.png" alt="' . $_CONFIG['web_currencies']['vote']['name'] . '"/> ' . $intCurrentVotepoints . ' ' . $_CONFIG['web_currencies']['vote']['symbol'] . '
					</p>
					<hr />';
				}





				if [MENTION=311501]ODB[/MENTION]c_num_rows($resMainCategoryQuery) > 0) {
					echo '
			<p id="categoryMainContainer" class="center">';
					while($strMainCategory = [MENTION=311501]ODB[/MENTION]c_fetch_array($resMainCategoryQuery)) {
						if(is_numeric($intActiveMainCategoryID)) {
							$strCategoryMainActiveClass = '';
							if($intActiveMainCategoryID == $strMainCategory['mid']) {
								$strCategoryMainActiveClass = 'active';
							}
						}
						echo ' <a class="categoryMain contentButton ' . $strCategoryMainActiveClass . '" uid="' . $strMainCategory['mid'] . '" href="#">' . $strMainCategory['name'] . '</a> ';
					}
					echo '
			</p>';
				}
						echo '
			<div id="categorySubNav" class="center" style="' . $toggleDisplays['subCategories'] . '">
				<p id="categorySubContainer">';
				if(is_numeric($intActiveMainCategoryID)) {
					while($strSubCategory = [MENTION=311501]ODB[/MENTION]c_fetch_array($resSubCategoryQuery)) {
						$strCategorySubActiveClass = '';
						if($intActiveSubCategoryID == $strSubCategory['sid']) {
							$strCategorySubActiveClass = 'active';
						}
						echo ' <a class="categorySub contentButton ' . $strCategorySubActiveClass . '" uid="' . $strSubCategory['sid'] . '" href="#">' . $strSubCategory['name'] . '</a> ';
					}
				} echo '
				</p>
			</div>
			<div id="itemDetails" class="shopBorder" style="' . $toggleDisplays['itemDetails'] . '">
				<div id="itemDetailsContainer">';
				if(is_numeric($_GET['iid']) AND [MENTION=311501]ODB[/MENTION]c_num_rows($resItemdetailsQuery) > 0) {


					while($strItemDetails = [MENTION=311501]ODB[/MENTION]c_fetch_array($resItemdetailsQuery)) {
						echo '
					<p>
						<img src="images/icons/shop/'.$strItemDetails['icon'].'" class="itemDetailsIcon" alt="'.$strItemDetails['name'].'" />
					</p>
					<div class="itemDetails">
						<div>' . $_LANG['name'] . ': <span>' . $strItemDetails['name'] . '</span><p class="clear"></p></div>
						<div>' . $_LANG['price'] . ': <span>' . getShopCurrencyHTML($strItemDetails['priceDP'], $strItemDetails['priceVP'], true) . '</span></div>
						<div>' . $_LANG['amount'] . ': <span><img src="images/icons/shop/count.png" alt=""/> ' . $strItemDetails['count'] . '</span></div>';
						if(!empty($strItemDetails['effects']) AND strlen($strItemDetails['effects']) > 1) {
							$strItemDetails['effects'] = explode("\r\n", $strItemDetails['effects']);
							echo '
						<div>' . $_LANG['effects'] . ':
							<ul>';
							foreach($strItemDetails['effects'] as $listItem) {
								echo '<li>' . $listItem . '</li>';
							}
							echo '
							</ul>
							<div class="clear"></div>
						</div>';
						}
						echo'
						<div>' . $_LANG['category'] . ': <span><a href="index.php?site=shop&sid=' . $strItemDetails['subCatID'] . '">' . $strItemDetails['mainCatName'] . ' &raquo; ' . $strItemDetails['subCatName'] . '</a></span></div>
						<div>' . $_LANG['directItemlink'] . ': <span><a href="index.php?site=shop&iid=' . $strItemDetails['mid'] . '">' . $strItemDetails['name'] . '</a></span></div>
					</div>';
						if(!empty($strItemDetails['description']) AND strlen($strItemDetails['description']) > 1) {
							echo '
					<div class="itemDescription">
						<span class="px140 bold">' . $_LANG['description'] . ':</span><br />' . nl2br($strItemDetails['description']) . '
					</div>';
						}
						echo '
					<div class="clear"></div>';
						if(isset($_SESSION['user'])) {
							$strCharacterArray = getAccountsCharacters(cleanSqlInput($_SESSION['user']));

							echo '
				<div class="buy">
					<form method="post" action="index.php?site=shop&iid=' . $strItemDetails['mid'] . '">
						<input type="hidden" name="inputCheckTimestamp" value="' . time() . '" />
						<input type="hidden" name="inputCheckKey" value="' . random_string() . '" />
						<input type="hidden" name="sid" value="'.$strItemDetails['subCatID'].'" />
						<input type="hidden" name="iid" value="'.$strItemDetails['mid'].'" />
						' . checkForMultipleCurrencies($strItemDetails['priceDP'], $strItemDetails['priceVP']) . '
						<select name="sendItemToCharacter" class="voteitem" required="required">
							<option selected="selected" value=""></option>';
							foreach($strCharacterArray AS $m_szName) {
								echo '<option value="' . $m_szName . '">' . $m_szName . '</option>';
							}
							echo '	</select><br />
						<input type="submit" name="shopBuyItem" value="' . $_LANG['buy'] . '"/>
					</form>
				</div>';
							if($_CONFIG['donate_shop_gift_enabled']) {
								echo '
				<div class="gift">
					<form method="post" action="index.php?site=shop&iid=' . $strItemDetails['mid'] . '">
						<input type="hidden" name="inputCheckTimestamp" value="' . time() . '" />
						<input type="hidden" name="inputCheckKey" value="' . random_string() . '" />
						<input type="hidden" name="sid" value="'.$strItemDetails['subCatID'].'" />
						<input type="hidden" name="iid" value="'.$strItemDetails['mid'].'" />
						' . checkForMultipleCurrencies($strItemDetails['priceDP'], $strItemDetails['priceVP']) . '
						<input type="text" name="sendItemToCharacter" class="account" required="required" placeholder="' . $_LANG['placeholder_please_enter_character_name'] . '"/><br />
						<input type="submit" name="shopGiftItem" value="' . $_LANG['gift'] . '"/>
					</form>
				</div>';
							}
							echo '<div class="clear"></div>';
						}
					}
				} echo '
				</div>
			</div>
			<div id="itemList" class="shopBorder" style="' . $toggleDisplays['itemList'] . '">
				<div id="itemListContainer">';
				if(is_numeric($intActiveMainCategoryID)) {
					while($strItemArray = [MENTION=311501]ODB[/MENTION]c_fetch_array($resItemlistQuery)) {

						if(!empty($_SESSION['user'])) {
							if(checkItemBuyable($strItemlist['priceDP'], $intCurrentCash, $strItemlist['priceVP'], $intCurrentVotepoints)) {
								$class = 'buy';
							}
							else {
								$class = 'nobuy';
							}
						}
						else {
							$class = 'none';
						}

						echo '
								<div class="singleItem ' . $class . '" uid="' . $strItemArray['mid'] . '">
									<p>' . $strItemArray['name'] . '</p>
									<div class="itemShortDesc">
										<img class="itemIcon" src="images/icons/shop/'.$strItemArray['icon'].'" alt="' . $strItemArray['name'] . '"/>
										<p>' . getShopCurrencyHTML($strItemArray['priceDP'], $strItemArray['priceVP']) . '</p>
										<p><img src="images/icons/shop/count.png" alt=""/> ' . $strItemArray['count'] . 'x</p>
									</div>
								</div>';
					}
				} echo '
					<div class="clear"></div>
				</div>
			</div>';
			}
			else {
				echo createMessage($_LANG['error_shop_disabled'], 'hint');
			}
			?>
			<hr />
			<p class="center">
				| <img src="/images/icons/shop/votepoints.png" alt="<?php echo $_CONFIG['web_currencies']['vote']['name'];?> (<?php echo $_CONFIG['web_currencies']['vote']['symbol'];?>)"/> <?php echo $_CONFIG['web_currencies']['vote']['name'];?> (<?php echo $_CONFIG['web_currencies']['vote']['symbol'];?>)
				| <img src="/images/icons/shop/price.png" alt="<?php echo $_CONFIG['web_currencies']['donate']['name'];?> (<?php echo $_CONFIG['web_currencies']['donate']['symbol'];?>)"/> <?php echo $_CONFIG['web_currencies']['donate']['name'];?> (<?php echo $_CONFIG['web_currencies']['donate']['symbol'];?>)
				| <img src="/images/icons/shop/count.png" alt="<?php echo $_LANG['shop_amount_of_item']; ?>"/> <?php echo $_LANG['shop_amount_of_item']; ?>
				|
			</p>
		</div>
	</div>
</div>
03/18/2018 17:39 KingKeesie#2
Search for the send_item function. normally the query adds a line to ITEM_SEND_TBL. check if the line got added. But the send_item could also use a procedure in database.
03/18/2018 22:19 sparking1#3
Where do I search this line please ?

EDIT : if you mean a .php file I have another one called xinc_shop.php

Here is the code


For the database name I don't have SEND_ITEM_TBL
03/19/2018 09:18 KingKeesie#4
What website files do u use?
03/19/2018 16:25 sparking1#5
My website was made by Dude & xBlubbs
03/22/2018 18:55 sparking1#6
Help please :(