[Help] Проблем с код на маркет

Holder

New Member
Joined
Dec 27, 2010
Messages
434
Reaction score
43
Значи в маркет-а слагаш предмети за определени кредити и ако някой реши, че му е изгодно го купува този предмет, проблема е, че като се опиташ да купиш предмет дава тази грешка:
Code:
You need minimum 21 votes or 1 SMS to use this function
намерих от къде идва, това е малка част от кода, но от тук идва проблема, 2 функции долната е функцията за купуване, някой ако може да каже как да я оправя, така че да добави предмета в инвентара.

Code:
		if ($memb_credits[active] == 1 || $votetop[broivotes] >20|| $sms_log[smscount] >0) {
			$option = ($item['username'] == $_COOKIE['username']) ? "<img style='cursor:pointer' src='images/delete.png' alt='Remove from market' title='Remove from market' OnClick=\"var delll = confirm('Are you sure you want to delete this item?!'); if (delll!=false) { ajax('market&d=$item[id]') }   \">" : "<img style='cursor:pointer' src='images/buy.png' alt='Buy this item' title='Buy this item' OnClick=\"var buy = confirm('Are you sure you want to buy this item?!'); if (buy!=false) { ajax('market&it=$item[id]') }\">";	
			}
			else {
			$option = ($item['username'] == $_COOKIE['username']) ? "<img style='cursor:pointer' src='images/delete.png' alt='Remove from market' title='Remove from market' OnClick=\"var delll = confirm('Are you sure you want to delete this item?!'); if (delll!=false) { ajax('market&d=$item[id]') }   \">" : "<img style='cursor:pointer' src='images/buy.png' alt='Buy this item' title='Buy this item' OnClick=\"alert ('You need minimum 21 votes or 1 SMS to use this function.') \">";
 
  • Like
Reactions: kiko_234
Е не можеш ли просто да преправиш >20 и >0 на <999?
 
Би ли показал $memb_credits,$votetop,$sms_log query ?
Едит1: Прочетох поста на MeMos и моя съвет е същия. Ако използваш COOKIE ще си имаш сериозен проблем с "хакерите". Използвай SESSION.
 
Last edited:
ехаа, та тва е само 1 if, а ти си тръгнал да си правиш маркет така ли?
и вземи се научи да обесняваш, не може да се разбере какво искаш, никъде не виждам къде използваш тея get-ове които ги даваш от тоя код
 
един съвет от мен не ползвай $_COOKIE[] и дай повече информация
 
Еми значи това е целият код на файла, който ми прави проблем, дефакто в него има тояред 21 дето трябва да се направи, така че да не иска 21 ами да купува предмета.. опитах се на няколко пъти, но все дава грешка.. А до $_COOKIE[] с него какво да правя ?

Code:
<?php 
if(!$_GET['a'])
{

	$page = (int) $_GET['page'];
	if($page == '') { $page = 1; }
	$RowPerPage = 100;
	$startRows = ($page-1)*$RowPerPage+0;
	//1 day True/Fasle
	if ($pcw['market']['days'] == True) 
	{ 
		if(isset($_GET['usersearch'])) 
		{
			$usernametofind=$_GET[searchuser];
			
			//Plasmen code
			$get_seller_acccc_name = mssql_query("SELECT TOP 1 Name,AccountID FROM [Character] where Name = '".$usernametofind."' order by gresets desc, Resets desc");
			$get_seller_acccc_name = mssql_fetch_row($get_seller_acccc_name);

			$check = mssql_query("SELECT TOP 1 Name,AccountID FROM [Character] where AccountID = '".$get_seller_acccc_name[1]."' order by gresets desc, Resets desc, cLevel desc");
			$check = mssql_fetch_row($check);

			if($get_seller_acccc_name[0] == $check[0])  {$user=$get_seller_acccc_name[1];}
			else {$user="";}
			//Plasmen code end

			$items = mssql_query("SELECT * FROM SMarket WHERE ((opt = 1) AND ((buyer is null) OR buyer='') AND (username='$user') ) ORDER BY timer DESC");
		}
		elseif(isset($_GET['itemsearch'])) 
		{
			$itemnametofind=$_GET[searchitem];
			
			
			$items = mssql_query("SELECT * FROM SMarket WHERE 
			(((opt = 1) AND ((buyer is null) OR buyer=''))
			and 
			
			(
			
			(exists 
			( SELECT * FROM WebShop WHERE  ( (name like '%".$itemnametofind."%') 
			and (SMarket.cat_id=WebShop.type) and (SMarket.item_id=WebShop.id)   and (SMarket.sticklevel=WebShop.stickLevel)  ) )
			) 
						
			or
			(exists 
			(SELECT * FROM WebShop WHERE  ((name like '%".$itemnametofind."%') 
			and (SMarket.cat_id=WebShop.type) and (SMarket.item_id=WebShop.id)   and (WebShop.stickLevel=0)
			)))
			)
			)
			 ORDER BY timer DESC");
		}
		elseif(isset($_GET['showsold'])) 
		{
			$items = mssql_query("SELECT * FROM SMarket WHERE ((opt = 1) AND ((buyer is not null) or buyer!='' ) AND username='".secure($_COOKIE['username'])."') ORDER BY timer DESC");
		}
		else {$items = mssql_query("SELECT * FROM SMarket WHERE ((opt = 1) AND ((buyer is null) OR buyer='')) ORDER BY timer DESC");}
	}
	elseif ($pcw['market']['days'] == False){ $items = mssql_query("SELECT * FROM SMarket WHERE timer > ".(time()-86400)." AND opt = 1 ORDER BY timer DESC"); }
	$num_of_rows = mssql_num_rows($items);
	@mssql_data_seek($items,$startRows);
	$total_pages = ceil($num_of_rows/$RowPerPage);

	//Show market list if not adding item
	
	

	echo "
	<form method='request'>";

//Променливи
$acc = $_COOKIE['username'];

//Заявки
$query=mssql_query("SELECT * FROM MEMB_CREDITS WHERE memb___id='$acc'");
$memb_credits=mssql_fetch_array($query);

$query=mssql_query("SELECT * from votetop where userche='$acc'");
$votetop=mssql_fetch_array($query);


$query=mssql_query("SELECT * from SMS_LOG where memb___id='$acc'");
$sms_log=mssql_fetch_array($query);


	 echo "<input type='submit' name='Add' value='Add new item in market' OnClick=\"ajax('market&a=true')\"  >&nbsp;&nbsp;&nbsp;"; 
	

	echo "<input type='submit' name='showsold' id='showsold' value='Show my sold items' OnClick=\"ajax('market&showsold=true&'+doc('searchitem'))\">
</form>

	<form method='request'>
Search items from user : <input type='text' maxlength='10' name='searchuser' id='searchuser'>
<input type='submit' value='Search' name='usersearch'  OnClick=\"ajax('market&usersearch=true&'+doc('searchuser'))\"  >
</form>
<form method='request'>
Search items by item name : <input type='text' maxlength='50' name='searchitem' id='searchitem' >
<input type='submit'  value='Search' name='itemsearch'    OnClick=\"ajax('market&itemsearch=true&'+doc('searchitem'))\"     >
</form>

	";
	if ($pcw['market']['add_item'] == 0) echo "";
		else echo"	<br />Every offer requre <span>".$pcw['market']['add_item']." credits</span> to show in market list<br /><br />";
		
		if(isset($_GET['itemsearch'])) 
		{
			echo "<br><span align='center' style='color:orange; ' >Results for items containing: <font color=red>".$itemnametofind."</font></span><br>";
		}
		
		echo " <table>
		<tr>
			<td width='80'>By</td>
			<td width='400'>Item</td>
			<td>Credits</td>
			<td width='50' align='right'>";
			
		if(isset($_GET['showsold'])) {echo "Buyer";}
		else {echo "Buy";}
		echo "</td></tr>";
		$total=0;
		for($i=0; $i<$RowPerPage; $i++) 
		{
			$item = mssql_fetch_array($items);
			$it = ItemInfo($item['itemhex'],true);
			if(!$item){ break; }
			$rank = $i + $startRows+1;
			
			$admin = (in_array($_COOKIE['username'],explode(',',$pcw['config']['admins']))) ? " OnClick = \"var dell = confirm('Are you sure you want to delete this item?!'); if (dell!=false) { ajax('market&ad=$item[id]') }\"" : "";
				

		if ($memb_credits[active] == 1 || $votetop[broivotes] >20|| $sms_log[smscount] >0) {
			$option = ($item['username'] == $_COOKIE['username']) ? "<img style='cursor:pointer' src='images/delete.png' alt='Remove from market' title='Remove from market' OnClick=\"var delll = confirm('Are you sure you want to delete this item?!'); if (delll!=false) { ajax('market&d=$item[id]') }   \">" : "<img style='cursor:pointer' src='images/buy.png' alt='Buy this item' title='Buy this item' OnClick=\"var buy = confirm('Are you sure you want to buy this item?!'); if (buy!=false) { ajax('market&it=$item[id]') }\">";	
			}
			else {
			$option = ($item['username'] == $_COOKIE['username']) ? "<img style='cursor:pointer' src='images/delete.png' alt='Remove from market' title='Remove from market' OnClick=\"var delll = confirm('Are you sure you want to delete this item?!'); if (delll!=false) { ajax('market&d=$item[id]') }   \">" : "<img style='cursor:pointer' src='images/buy.png' alt='Buy this item' title='Buy this item' OnClick=\"alert ('You need minimum 21 votes or 1 SMS to use this function.') \">";	
			}
			//Plasmen code
			$get_seller_acccc_name = mssql_query("SELECT TOP 1 Name,AccountID FROM [Character] where Name = '".$item[username]."' order by gresets desc, Resets desc");
			$get_seller_acccc_name = mssql_fetch_row($get_seller_acccc_name);

			$check = mssql_query("SELECT TOP 1 Name,AccountID FROM [Character] where AccountID = '".$item[username]."' order by gresets desc, Resets desc, cLevel desc");
			$check = mssql_fetch_row($check);

			if($get_seller_acccc_name[0] == $check[0])  {$user=$get_seller_acccc_name[1];}
			else {$user="";}
			//Plasmen code end
		$total = $total + $item[credits];
			if(isset($_GET['showsold'])) {
				echo "
				<tr>
					<td>".($check[0])."</td>
					<td><span style='cursor:pointer;color:$it[color]' $it[nfo]$admin>$it[name]$it[hp]</span></td>
					<td>$item[credits]</td>
					<td align='center'>$item[buyer]</td>
				</tr>";}
			else {
				echo "
				<tr>
					<td>".($check[0])."</td>
					<td><span style='cursor:pointer;color:$it[color]' $it[nfo]$admin>$it[name]$it[hp]</span></td>
					<td>$item[credits]</td>
					<td align='center'>$option</td>
				</tr>";}
		}
		if(isset($_GET['showsold'])) {
				echo "
				<tr>
					<td></td>
					<td><center>Total:</span></td>
					<td>$total</td>
					<td align='center'></td>
				</tr>";}
		echo "</table><br />".rankings($page,$num_of_rows,$total_pages,$startRows,$rank,"market&page=")."";
}
else
{
	//Adding Items from Warehouse
	mssql_query("declare @items varbinary(1920); set @items = (SELECT [items] FROM [warehouse] WHERE [AccountId]='".secure($_COOKIE['username'])."'); print @items;");
	$current_items 	= mssql_get_last_message();
	$user_items	= substr($current_items,2);
	echo "<span align='center' style='color:orange; cursor:pointer' OnClick=\"ajax('market&a=true')\">Refresh warehouse</span><br />To put item(s) for sell item must be in your warehouse and account to be offline.<br />";
	if ($pcw['market']['add_item'] == 0) echo"";
	else echo "
	Every offer requre <span>".$pcw['market']['add_item']." credits</span> to show in market list<br />";
		$i = -1;
		while($i<119)
		{
		$item = ItemInfo(substr($user_items,(32*$i),32));
			if(@$item['name'])
			{
			echo "<img OnClick=\"prom('$i')\" src='$item[thumb]'$item[nfo]>";
			}
		$i++;
		}
		
			//Adding Items from WebWare
	$cur_item = mssql_query("SELECT [hex] FROM [SBank] WHERE [username]='".secure($_COOKIE['username'])."'");
	
	echo "<span align='center' style='color:orange; cursor:pointer' OnClick=\"ajax('market&a=true')\"><br>Refresh web warehouse</span><br />To put item(s) for sell item must be in your warehouse and account to be offline.<br />";
	if ($pcw['market']['add_item'] == 0) echo"";
	else echo "
	Every offer requre <span>".$pcw['market']['add_item']." credits</span> to show in market list<br />";
				
		for($iWebWare=0; $iWebWare<mssql_num_rows($cur_item) ; $iWebWare++)
		{
		$cur_item_out = mssql_fetch_array($cur_item);
		$item = ItemInfo($cur_item_out[0]);
		$hexofitem = $cur_item_out[0];
		
			if(@$item['name'])
			{
			echo "<img OnClick=\"promWebWare('$hexofitem')\" src='$item[thumb]'$item[nfo]>";
			}
		}
		
}

?>
 
Еми значи това е целият код на файла, който ми прави проблем, дефакто в него има тояред 21 дето трябва да се направи, така че да не иска 21 ами да купува предмета.. опитах се на няколко пъти, но все дава грешка.. А до $_COOKIE[] с него какво да правя ?

Code:
<?php 
if(!$_GET['a'])
{

	$page = (int) $_GET['page'];
	if($page == '') { $page = 1; }
	$RowPerPage = 100;
	$startRows = ($page-1)*$RowPerPage+0;
	//1 day True/Fasle
	if ($pcw['market']['days'] == True) 
	{ 
		if(isset($_GET['usersearch'])) 
		{
			$usernametofind=$_GET[searchuser];
			
			//Plasmen code
			$get_seller_acccc_name = mssql_query("SELECT TOP 1 Name,AccountID FROM [Character] where Name = '".$usernametofind."' order by gresets desc, Resets desc");
			$get_seller_acccc_name = mssql_fetch_row($get_seller_acccc_name);

			$check = mssql_query("SELECT TOP 1 Name,AccountID FROM [Character] where AccountID = '".$get_seller_acccc_name[1]."' order by gresets desc, Resets desc, cLevel desc");
			$check = mssql_fetch_row($check);

			if($get_seller_acccc_name[0] == $check[0])  {$user=$get_seller_acccc_name[1];}
			else {$user="";}
			//Plasmen code end

			$items = mssql_query("SELECT * FROM SMarket WHERE ((opt = 1) AND ((buyer is null) OR buyer='') AND (username='$user') ) ORDER BY timer DESC");
		}
		elseif(isset($_GET['itemsearch'])) 
		{
			$itemnametofind=$_GET[searchitem];
			
			
			$items = mssql_query("SELECT * FROM SMarket WHERE 
			(((opt = 1) AND ((buyer is null) OR buyer=''))
			and 
			
			(
			
			(exists 
			( SELECT * FROM WebShop WHERE  ( (name like '%".$itemnametofind."%') 
			and (SMarket.cat_id=WebShop.type) and (SMarket.item_id=WebShop.id)   and (SMarket.sticklevel=WebShop.stickLevel)  ) )
			) 
						
			or
			(exists 
			(SELECT * FROM WebShop WHERE  ((name like '%".$itemnametofind."%') 
			and (SMarket.cat_id=WebShop.type) and (SMarket.item_id=WebShop.id)   and (WebShop.stickLevel=0)
			)))
			)
			)
			 ORDER BY timer DESC");
		}
		elseif(isset($_GET['showsold'])) 
		{
			$items = mssql_query("SELECT * FROM SMarket WHERE ((opt = 1) AND ((buyer is not null) or buyer!='' ) AND username='".secure($_COOKIE['username'])."') ORDER BY timer DESC");
		}
		else {$items = mssql_query("SELECT * FROM SMarket WHERE ((opt = 1) AND ((buyer is null) OR buyer='')) ORDER BY timer DESC");}
	}
	elseif ($pcw['market']['days'] == False){ $items = mssql_query("SELECT * FROM SMarket WHERE timer > ".(time()-86400)." AND opt = 1 ORDER BY timer DESC"); }
	$num_of_rows = mssql_num_rows($items);
	@mssql_data_seek($items,$startRows);
	$total_pages = ceil($num_of_rows/$RowPerPage);

	//Show market list if not adding item
	
	

	echo "
	<form method='request'>";

//Променливи
$acc = $_COOKIE['username'];

//Заявки
$query=mssql_query("SELECT * FROM MEMB_CREDITS WHERE memb___id='$acc'");
$memb_credits=mssql_fetch_array($query);

$query=mssql_query("SELECT * from votetop where userche='$acc'");
$votetop=mssql_fetch_array($query);


$query=mssql_query("SELECT * from SMS_LOG where memb___id='$acc'");
$sms_log=mssql_fetch_array($query);


	 echo "<input type='submit' name='Add' value='Add new item in market' OnClick=\"ajax('market&a=true')\"  >&nbsp;&nbsp;&nbsp;"; 
	

	echo "<input type='submit' name='showsold' id='showsold' value='Show my sold items' OnClick=\"ajax('market&showsold=true&'+doc('searchitem'))\">
</form>

	<form method='request'>
Search items from user : <input type='text' maxlength='10' name='searchuser' id='searchuser'>
<input type='submit' value='Search' name='usersearch'  OnClick=\"ajax('market&usersearch=true&'+doc('searchuser'))\"  >
</form>
<form method='request'>
Search items by item name : <input type='text' maxlength='50' name='searchitem' id='searchitem' >
<input type='submit'  value='Search' name='itemsearch'    OnClick=\"ajax('market&itemsearch=true&'+doc('searchitem'))\"     >
</form>

	";
	if ($pcw['market']['add_item'] == 0) echo "";
		else echo"	<br />Every offer requre <span>".$pcw['market']['add_item']." credits</span> to show in market list<br /><br />";
		
		if(isset($_GET['itemsearch'])) 
		{
			echo "<br><span align='center' style='color:orange; ' >Results for items containing: <font color=red>".$itemnametofind."</font></span><br>";
		}
		
		echo " <table>
		<tr>
			<td width='80'>By</td>
			<td width='400'>Item</td>
			<td>Credits</td>
			<td width='50' align='right'>";
			
		if(isset($_GET['showsold'])) {echo "Buyer";}
		else {echo "Buy";}
		echo "</td></tr>";
		$total=0;
		for($i=0; $i<$RowPerPage; $i++) 
		{
			$item = mssql_fetch_array($items);
			$it = ItemInfo($item['itemhex'],true);
			if(!$item){ break; }
			$rank = $i + $startRows+1;
			
			$admin = (in_array($_COOKIE['username'],explode(',',$pcw['config']['admins']))) ? " OnClick = \"var dell = confirm('Are you sure you want to delete this item?!'); if (dell!=false) { ajax('market&ad=$item[id]') }\"" : "";
				

		if ($memb_credits[active] == 1 || $votetop[broivotes] >20|| $sms_log[smscount] >0) {
			$option = ($item['username'] == $_COOKIE['username']) ? "<img style='cursor:pointer' src='images/delete.png' alt='Remove from market' title='Remove from market' OnClick=\"var delll = confirm('Are you sure you want to delete this item?!'); if (delll!=false) { ajax('market&d=$item[id]') }   \">" : "<img style='cursor:pointer' src='images/buy.png' alt='Buy this item' title='Buy this item' OnClick=\"var buy = confirm('Are you sure you want to buy this item?!'); if (buy!=false) { ajax('market&it=$item[id]') }\">";	
			}
			else {
			$option = ($item['username'] == $_COOKIE['username']) ? "<img style='cursor:pointer' src='images/delete.png' alt='Remove from market' title='Remove from market' OnClick=\"var delll = confirm('Are you sure you want to delete this item?!'); if (delll!=false) { ajax('market&d=$item[id]') }   \">" : "<img style='cursor:pointer' src='images/buy.png' alt='Buy this item' title='Buy this item' OnClick=\"alert ('You need minimum 21 votes or 1 SMS to use this function.') \">";	
			}
			//Plasmen code
			$get_seller_acccc_name = mssql_query("SELECT TOP 1 Name,AccountID FROM [Character] where Name = '".$item[username]."' order by gresets desc, Resets desc");
			$get_seller_acccc_name = mssql_fetch_row($get_seller_acccc_name);

			$check = mssql_query("SELECT TOP 1 Name,AccountID FROM [Character] where AccountID = '".$item[username]."' order by gresets desc, Resets desc, cLevel desc");
			$check = mssql_fetch_row($check);

			if($get_seller_acccc_name[0] == $check[0])  {$user=$get_seller_acccc_name[1];}
			else {$user="";}
			//Plasmen code end
		$total = $total + $item[credits];
			if(isset($_GET['showsold'])) {
				echo "
				<tr>
					<td>".($check[0])."</td>
					<td><span style='cursor:pointer;color:$it[color]' $it[nfo]$admin>$it[name]$it[hp]</span></td>
					<td>$item[credits]</td>
					<td align='center'>$item[buyer]</td>
				</tr>";}
			else {
				echo "
				<tr>
					<td>".($check[0])."</td>
					<td><span style='cursor:pointer;color:$it[color]' $it[nfo]$admin>$it[name]$it[hp]</span></td>
					<td>$item[credits]</td>
					<td align='center'>$option</td>
				</tr>";}
		}
		if(isset($_GET['showsold'])) {
				echo "
				<tr>
					<td></td>
					<td><center>Total:</span></td>
					<td>$total</td>
					<td align='center'></td>
				</tr>";}
		echo "</table><br />".rankings($page,$num_of_rows,$total_pages,$startRows,$rank,"market&page=")."";
}
else
{
	//Adding Items from Warehouse
	mssql_query("declare @items varbinary(1920); set @items = (SELECT [items] FROM [warehouse] WHERE [AccountId]='".secure($_COOKIE['username'])."'); print @items;");
	$current_items 	= mssql_get_last_message();
	$user_items	= substr($current_items,2);
	echo "<span align='center' style='color:orange; cursor:pointer' OnClick=\"ajax('market&a=true')\">Refresh warehouse</span><br />To put item(s) for sell item must be in your warehouse and account to be offline.<br />";
	if ($pcw['market']['add_item'] == 0) echo"";
	else echo "
	Every offer requre <span>".$pcw['market']['add_item']." credits</span> to show in market list<br />";
		$i = -1;
		while($i<119)
		{
		$item = ItemInfo(substr($user_items,(32*$i),32));
			if(@$item['name'])
			{
			echo "<img OnClick=\"prom('$i')\" src='$item[thumb]'$item[nfo]>";
			}
		$i++;
		}
		
			//Adding Items from WebWare
	$cur_item = mssql_query("SELECT [hex] FROM [SBank] WHERE [username]='".secure($_COOKIE['username'])."'");
	
	echo "<span align='center' style='color:orange; cursor:pointer' OnClick=\"ajax('market&a=true')\"><br>Refresh web warehouse</span><br />To put item(s) for sell item must be in your warehouse and account to be offline.<br />";
	if ($pcw['market']['add_item'] == 0) echo"";
	else echo "
	Every offer requre <span>".$pcw['market']['add_item']." credits</span> to show in market list<br />";
				
		for($iWebWare=0; $iWebWare<mssql_num_rows($cur_item) ; $iWebWare++)
		{
		$cur_item_out = mssql_fetch_array($cur_item);
		$item = ItemInfo($cur_item_out[0]);
		$hexofitem = $cur_item_out[0];
		
			if(@$item['name'])
			{
			echo "<img OnClick=\"promWebWare('$hexofitem')\" src='$item[thumb]'$item[nfo]>";
			}
		}
		
}

?>

ами не използвай бисквитки, пример !$_POST['username']
 
Просто премахни проверката дали има пратен смс или е гласувано.

Кода

Code:
if ($memb_credits[active] == 1 || $votetop[broivotes] >20|| $sms_log[smscount] >0) {
			$option = ($item['username'] == $_COOKIE['username']) ? "<img style='cursor:pointer' src='images/delete.png' alt='Remove from market' title='Remove from market' OnClick=\"var delll = confirm('Are you sure you want to delete this item?!'); if (delll!=false) { ajax('market&d=$item[id]') }   \">" : "<img style='cursor:pointer' src='images/buy.png' alt='Buy this item' title='Buy this item' OnClick=\"var buy = confirm('Are you sure you want to buy this item?!'); if (buy!=false) { ajax('market&it=$item[id]') }\">";	
			}
			else {
			$option = ($item['username'] == $_COOKIE['username']) ? "<img style='cursor:pointer' src='images/delete.png' alt='Remove from market' title='Remove from market' OnClick=\"var delll = confirm('Are you sure you want to delete this item?!'); if (delll!=false) { ajax('market&d=$item[id]') }   \">" : "<img style='cursor:pointer' src='images/buy.png' alt='Buy this item' title='Buy this item' OnClick=\"alert ('You need minimum 21 votes or 1 SMS to use this function.') \">";

замести само с
Code:
$option = ($item['username'] == $_COOKIE['username']) ? "<img style='cursor:pointer' src='images/delete.png' alt='Remove from market' title='Remove from market' OnClick=\"var delll = confirm('Are you sure you want to delete this item?!'); if (delll!=false) { ajax('market&d=$item[id]') }   \">" : "<img style='cursor:pointer' src='images/buy.png' alt='Buy this item' title='Buy this item' OnClick=\"var buy = confirm('Are you sure you want to buy this item?!'); if (buy!=false) { ajax('market&it=$item[id]') }\">";
 
Ами аз се пробвах да го направя преди да постя и като цъкнех купи предмет, ме пита да потвърдя натискам "да искам да го купя" и го купувам предмета изчезва от маркета, обаче не ми отива във Волта нито в Инвентара ;/
 
ми ти сляп ли си, не виждаш ли, че никъде няма update
 
Аз виждам, че няма Update, но преди да видя поста ти не знаех, че на кода му липсва Update..
 
Аз виждам, че няма Update, но преди да видя поста ти не знаех, че на кода му липсва Update..

ето ти пример
PHP:
$update_vault= $GLOBALS['db']->Execute("Update warehouse set items=0x".$item_new." where accountid=?",array($_POST['mu_account']));
 
ето ти пример
PHP:
$update_vault= $GLOBALS['db']->Execute("Update warehouse set items=0x".$item_new." where accountid=?",array($_POST['mu_account']));


Само дето това са 10% от кода за добавяне на предмет...

@Holder Виж в webshopa модула itemadder.php, за да добиеш по-ясна представа...
 
Демек тоя Market дето е в шопа е започнат и е завършен до някъде.. , значи ще по търся нещо друго, като отделен модул
 
Защо да не използва $_COOKIE[]?
 
Защото могат да се променят от потребителя.

И да се променят нищо няма да се постигне...
Трябват ти просто 2 бисквитки една с username и една с password и си правиш една функция която проверява в ДБ дали съответния username и password си отговарят и ако е така = TRUE, иначе = FALSE...
 
Е, ако има проверки - не е проблем, отстрана на сигурност на сайта. Но иначе за логин е по-надеждно да се използва $_SESSION.
 
  • Like
Reactions: MeMoS
Е, ако има проверки - не е проблем, отстрана на сигурност на сайта. Но иначе за логин е по-надеждно да се използва $_SESSION.

Защо?