Post Pacific  

Go Back   Post Pacific > Восстановленный архив > Темы без сохранившегося раздела
FAQ Community Calendar Today's Posts Search

Notices

 
 
Thread Tools Search this Thread Display Modes
Old 11.07.2007, 08:57   #1
NightSpirit
Архивный участник
 
Join Date: Jun 2007
Posts: 13
Default Помогите в php!

Всем Здрасте, поставил вот таку перед собой задачку в личном кабинете воткнуть просмотр инвенторя, написать то написал а вот незаработало вот теперь и ломаю голову, теория Жжёт, а практика отсутствует..... помогёте чем могёте...Я думаю в посте жёстка не будут ругать.... ибо новечёк есть Желание но мало знаний... Подскажите де че подправить ибо уже сил нету, к стати Зачем я хочу зделать просмотр инвенторя?, да думаю прикрутить аукцион от Ra1n0....

<tr>
<td class="ac">
<form name="sub" method="post" action="index.php?act=show_chars_info">
<input type="submit" name="subinfo" value="Вещи" style="width:60">
<!-- <input type="submit" name="subinfo" value="Умения" style="width:60"> -->
<input type="submit" name="subinfo" value="Список друзей" style="width:100">
<input type="submit" name="subinfo" value="Список врагов" style="width:100">
<input type="hidden" name="c_name" value="<?=$online_users[$x]['char_name']?>">
<input type="hidden" name="c_id" value="<?=$online_users[$x]['char_id']?>">
<input type="hidden" name="p_id" value="<?=$online_users[$x]['pledge_id']?>">
</form>
</td>
</tr>
</table>
</tr>
</td>
</table>
<table border="0" cellspacing="0" cellpadding="0">
<?=$sep?>
</table>
<? } ?>

<?
$subinfo = $_POST['subinfo'];
$c_name = $_POST['c_name'];
$c_id = $_POST['c_id'];
$p_id = $_POST['p_id'];

if ($subinfo !='')
{
echo '<table width="100%" border="0" cellpadding="0" cellspacing="0"><tr><td class="h-cell b-tblr">'.$c_name.': <span class="info">'.$subinfo.'</span></td></tr></table>';
switch($subinfo):
case 'Вещи':
$result=mssql_query ("
SELECT *
FROM user_item AS i
INNER JOIN la2info.dbo.items b ON i.item_type = b.id
INNER JOIN la2info.dbo.item_names c ON i.item_type = c.id
WHERE i.char_id = $c_id
ORDER BY warehouse");

$items=array();
for ($x=0;$items[$x]=mssql_fetch_assoc($result);$x++);
unset($items[count($items)-1]);
if (count($items) == 0) { ?>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<?=$sep?>
<tr>
<td class="n-cell b-tblr p-2 ac">У персонажа нет вещей</td>
</tr>
</table>
<? } else { ?>
<!--inventory-->
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<?=$sep?>
<tr>
<td class="b-cell b-tblr p-2 ac">Вещи в инвентаре и на самом персонаже</td>
</tr>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr class="h-cell">
<td width="32" class="b-bl"> </td>
<td class="b-bl">Название</td>
<td width="80" class="b-blr">Количество</td>
</tr>
<?
$items_found = false;
for ($i=0; $i<count($items); $i++)
{
if ($items[$i]['warehouse'] == 0)
{
$items_found = true;
?>
<tr class="n-cell">
<td class="b-bl ac"><img src="<?=$la2info_dir?>/images/icons/<?=$items[$i]['icon']?>" alt=""></td>
<td class="b-bl p-2 al"><?=$items[$i]['name']; if ($items[$i]['enchant'] != 0) echo '<span class="t-small info"> (+'.$items[$i]['enchant'].')</span>'?></td>
<td class="b-blr p-2 ar"><?=$items[$i]['amount']?></td>
</tr>
<?
}
}
if (!$items_found)
echo '<tr><td colspan="3" class="n-cell b-blr p-2 ac">Вещей нет</td></tr>';
?>
</table>
<!-- warhouse -->
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<?=$sep?>
<tr>
<td class="b-cell b-tblr p-2 ac">Вещи на личном складе</td>
</tr>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr class="h-cell">
<td width="32" class="b-bl"> </td>
<td class="b-bl">Название</td>
<td width="80" class="b-blr">Количество</td>
</tr>
<?
$items_found = false;
for ($i=0; $i<count($items); $i++)
{
if ($items[$i]['warehouse'] == 1)
{
$items_found = true;
?>
<tr class="n-cell">
<td class="b-bl ac"><img src="<?=$la2info_dir?>/images/icons/<?=$items[$i]['icon']?>" alt=""></td>
<td class="b-bl p-2 al"><?=$items[$i]['name']; if ($items[$i]['enchant'] != 0) echo '<span class="t-small info"> (+'.$items[$i]['enchant'].')</span>'?></td>
<td class="b-blr p-2 ar"><?=$items[$i]['amount']?></td>
</tr>
<?
}
}
if (!$items_found)
echo '<tr><td colspan="3" class="n-cell b-blr p-2 ac">Вещей нет</td></tr>'; ?>
</table>
<?
}
if ($p_id != 0)
{
$clan = array();
$result=mssql_query("
SELECT *
FROM pledge
WHERE (pledge_id = ".$p_id.")");
$clan=mssql_fetch_assoc($result);
if ($clan['ruler_id'] == $c_id && $clan['skill_level'] > 0)
{
$result=mssql_query ("
SELECT *
FROM user_item AS i
INNER JOIN la2info.dbo.items b ON i.item_type = b.id
INNER JOIN la2info.dbo.item_names c ON i.item_type = c.id
WHERE (i.char_id = $p_id) AND (i.warehouse = 2)
ORDER BY warehouse");

$items=array();
for ($x=0;$items[$x]=mssql_fetch_assoc($result);$x++);
unset($items[count($items)-1]); ?>
<!-- clan warehouse -->
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<?=$sep?>
<tr>
<td class="b-cell b-tblr p-2 ac">Вещи на клановом складе</td>
</tr>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr class="h-cell">
<td width="32" class="b-bl"> </td>
<td class="b-bl">Название</td>
<td width="80" class="b-blr">Количество</td>
</tr>
<?
$items_found = false;
for ($i=0; $i<count($items); $i++)
{
$items_found = true;
?>
<tr class="n-cell">
<td class="b-bl ac"><img src="<?=$la2info_dir?>/images/icons/<?=$items[$i]['icon']?>" alt=""></td>
<td class="b-bl p-2 al"><?=$items[$i]['name']; if ($items[$i]['enchant'] != 0) echo '<span class="t-small info"> (+'.$items[$i]['enchant'].')</span>'?></td>
<td class="b-blr p-2 ar"><?=$items[$i]['amount']?></td>
</tr>
<?
}
if (!$items_found)
echo '<tr><td colspan="3" class="n-cell b-blr p-2 ac">Вещей нет</td></tr>';
?>
</table>
NightSpirit is offline  
Old 11.07.2007, 09:10   #2
Ra1n0
Архивный участник
 
Join Date: Feb 2007
Posts: 139
Default

какую ошибку выдает?скрипт кстате не защищен..
фильтруй входные данные
Ra1n0 is offline  
Old 11.07.2007, 09:13   #3
NightSpirit
Архивный участник
 
Join Date: Jun 2007
Posts: 13
Default

Quote:
Originally Posted by Ra1n0 View Post
какую ошибку выдает?скрипт кстате не защищен..
фильтруй входные данные
В том то и дело что ничего не выдает такое ощущение что он к базе не прикручен проста тупо человек в личном кабинете нажимает "Вещи" и ему пишет что "Нету вещей в инвенторе".... хотя там фулл интвентарь... если рассудить логическе где то недописан или опрос непроходит, на счет защиты все норм, это кусок из всего .php документа...
NightSpirit is offline  
Old 11.07.2007, 10:08   #4
Ra1n0
Архивный участник
 
Join Date: Feb 2007
Posts: 139
Default

вместо for ($x=0;$items[$x]=mssql_fetch_assoc($result);$x++);
попробуй использовать
while($items=mssql_fetch_array($result)) {

можно еще исправить
$items_found = false;
for ($i=0; $i<count($items); $i++)
{
$items_found = true;

юзать просто if (empty($items)) {
echo '<tr><td colspan="3" class="n-cell b-blr p-2 ac">Вещей нет</td></tr>';
Ra1n0 is offline  
Old 11.07.2007, 10:17   #5
NightSpirit
Архивный участник
 
Join Date: Jun 2007
Posts: 13
Default

Quote:
Originally Posted by Ra1n0 View Post
вместо for ($x=0;$items[$x]=mssql_fetch_assoc($result);$x++);
попробуй использовать
while($items=mssql_fetch_array($result)) {

можно еще исправить
$items_found = false;
for ($i=0; $i<count($items); $i++)
{
$items_found = true;

юзать просто if (empty($items)) {
echo '<tr><td colspan="3" class="n-cell b-blr p-2 ac">Вещей нет</td></tr>';
Ra1n0 ткни пальцем или перепиши заного, (буду примного благодарен) у меня уже в глазах рябит 3 день ибусь.... закишие глаза, воняет из орта, зад затёк.....
NightSpirit is offline  
Old 11.07.2007, 10:18   #6
NightSpirit
Архивный участник
 
Join Date: Jun 2007
Posts: 13
Default

лана шас соображу, и буду мучаться....
NightSpirit is offline  
Old 11.07.2007, 10:27   #7
NightSpirit
Архивный участник
 
Join Date: Jun 2007
Posts: 13
Default

Quote:
Originally Posted by Ra1n0 View Post
вместо for ($x=0;$items[$x]=mssql_fetch_assoc($result);$x++);
попробуй использовать
while($items=mssql_fetch_array($result)) {

можно еще исправить
$items_found = false;
for ($i=0; $i<count($items); $i++)
{
$items_found = true;

юзать просто if (empty($items)) {
echo '<tr><td colspan="3" class="n-cell b-blr p-2 ac">Вещей нет</td></tr>';
Все нашел так только это заменить или весь аллгоритм прийдеться переписывать?
NightSpirit is offline  
Old 11.07.2007, 10:29   #8
Ra1n0
Архивный участник
 
Join Date: Feb 2007
Posts: 139
Default

почти весь..если делать через while то $items[$x]['enchant'] уже не нужно..просто ставишь $items['enchant'] и тд
Ra1n0 is offline  
Old 11.07.2007, 10:39   #9
NightSpirit
Архивный участник
 
Join Date: Jun 2007
Posts: 13
Default

аааааа обосраться) извените конечно за откровение....
NightSpirit is offline  
Old 11.07.2007, 10:51   #10
NightSpirit
Архивный участник
 
Join Date: Jun 2007
Posts: 13
Default

Quote:
Originally Posted by Ra1n0 View Post
почти весь..если делать через while то $items[$x]['enchant'] уже не нужно..просто ставишь $items['enchant'] и тд
А забыл еше спросить если аллгоритм переписывать нуно делать

while $items['enchant']? блин уже не варит череп.... эхххх
NightSpirit is offline  
Old 11.07.2007, 11:21   #11
Ra1n0
Архивный участник
 
Join Date: Feb 2007
Posts: 139
Default

нет...смотри аукцион там все понятно довольно..
Ra1n0 is offline  
Old 11.07.2007, 17:20   #12
nasso
Архивный участник
 
Join Date: Nov 2006
Posts: 118
Default

для примера возьми личный кабинет из l2info lite
на сторме лежат исходники
nasso is offline  
Old 13.07.2007, 10:33   #13
NightSpirit
Архивный участник
 
Join Date: Jun 2007
Posts: 13
Default

Quote:
Originally Posted by nasso View Post
для примера возьми личный кабинет из l2info lite
на сторме лежат исходники
Если нетрудно кинь ссылку на шторма....
NightSpirit is offline  
Old 13.07.2007, 13:24   #14
nasso
Архивный участник
 
Join Date: Nov 2006
Posts: 118
Default

http://l2storm.com/forums/index.php?showtopic=277
nasso is offline  
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 16:13.