Здравейте, отново се мъча да измайсторя едно сайтче, но уви, зациклих до тук и не мога да го оправя, и затова се обръщам към вас ;р Ако може да помогнете :lol: :lol: Ето го и кода ;р
Код:
<?php
require "functions.php";
my_header("WoWCreativity - Vote");
include "include/left.php";
?>
<td valign="top">
<div id="content_top">Vote - WoWCreativity</div>
<div class="content_title">Vote Shop</div>
<div class="content_main">
<?php
functionConnect('summit_logon');
$GETUser = "SELECT acct,login,dp,vp,realm FROM accounts WHERE login=".$_SESSION[username]."";
$GETUser2 = mysql_select_query($GETUser) or die(mysql_error());
$a_user = mysql_fetch_assoc($GETUser2);
if (isset($_POST['action'])) {
if ($_POST['character'] == 'none') {
echo "<center><span class='alert'>You don't have any characters. Mail can't be sent.</span></center>";
}
$pieces = explode("-", $_POST['character']);
$char = $pieces[0];
$realm = $pieces[1];
if ($_POST['itemsgrup'] == '') {
echo "<center><span class='alert'>No item selected.</span></center>";
}
$pieces2 = explode("-", $_POST['itemsgrup']);
$cost = $pieces2[1];
$itemid = $pieces2[0];
$item_stack = $pieces2[2];
$dorv = htmlspecialchars($_POST['dorv']);
if ($dorv == '1') {
if ($a_user['dp'] >= $cost) {
$newpoints = $a_user['dp'] - $cost;
$delpoints = mysql_query("UPDATE accounts SET dp='" . $newpoints . "' WHERE login='" . $a_user['login'] . "'") or die(mysql_error());
} else {
echo "<center><span class='note'>You don't have enough points to buy that item.<br>You have " . $a_user['dp'] . " points and item costs " . $cost . " points.</span></center>";
}
} else if ($dorv == '2') {
if ($a_user['vp'] >= $cost) {
$newpoints = $a_user['vp'] - $cost;
$delpoints = mysql_query("UPDATE accounts SET vp='" . $newpoints . "' WHERE login='" . $a_user['login'] . "'") or die(mysql_error());
} else {
echo "<center><span class='note'>You don\'t have enough points to buy that item.<br>You have " . $a_user['vp'] . " points and item costs " . $cost . " points.</span></center>";
}
} else {
echo "<center><span class='alert'>Something went wrong with points...</span></center>";
}
if ($pieces[1] == '1') {
functionConnect('summit_creativity');
$realm1 = "SELECT * FROM realms WHERE id='$a_user[realm]'";
$realm2 = mysql_query($realm1) or die(mysql_error());
$realm3 = mysql_fetch_array($realm2);
$CharDB = $realm3['db_char'];
if ($CharDB == '') {
echo "<center><span class='alert'>RivaL WoW does not exist!</span></cneter>";
} else {
functionConnect($CharDB);
}
} else {
echo "<center><span class='alert'>This realm socket is not compatible with this web script, make sure admin know about this so he can update script!</span></center>";
}
$time = date("m-d-Y, h:i");
$subject = 'RivaL WoW Shop';
if ($dorv == '1')
$body = 'Enjoy your new reward! Thankyou for donating for WoWCreativity ! Item costed ' . $cost . ' vote/donation points. Time sent: ' . $time;
$additem = mysql_query("INSERT INTO mailbox_insert_queue (sender_guid, receiver_guid, subject, body, stationary, money, item_id, item_stack) VALUES ('" . $char . "', '" . $char . "', '" . $subject . "', '" . $body . "', '0', '0', '" . $itemid . "', '" . $item_stack . "')") or die(mysql_error());
echo "<center><span class='approved'>Item has been dispatched! It will arrive in next few minutes. Reloging is not required.</span></center>";
}
if ($_GET['points']) {
if ($_GET['points'] == '1') {
$ititle = "Online Item Shop";
$donateor = '1';
$heh = "Your account currently has <strong>" . $a_user['vp'] . "</strong> vote points stored.";
$hidden = '<input name="dorv" type="hidden" value="2" />';
} else if ($_GET['points'] == '2') {
$ititle = "Online Donation Item Shop";
$donateor = '0';
$heh = "Your account currently has <strong>" . $a_user['dp'] . "</strong> donation points stored.";
$hidden = '<input name="dorv" type="hidden" value="1" />';
} else {
exit;
}
?>
<form method="post" action="">
<table border="0" width="590" align="center" cellpadding="3" cellspacing="0">
<tr bgcolor="#3F3F3F">
<td colspan="2">Item Name</td>
<td>Description</td>
<td>Cost</td>
<td>Buy?</td>
</tr>
<?php
$query = mysql_query("SELECT * FROM shop WHERE donateorvote='" . $donateor . "' ORDER BY cat, sort ASC") or die(mysql_error());
while ($items = mysql_fetch_assoc($query)) {
if ($items['sep'] == '1') {
print "<tr><td colspan='4'>";
if ($a_user['gm'] == 'az') {
print '<a href="account/shop/vote/delete/' . $items['id'] . '/">[x]</a> «' . $items['cat'] . '-' . $items['sort'] . '» ';
}
print "<strong><i>" . $items['name'] . "</i></strong></td></tr>";
} else {
print '<tr onmouseover="this.style.backgroundColor = \'#3D5247\';" onmouseout="this.style.backgroundColor = \'transparent\'; ">';
print "<td>";
if ($a_user['gm'] == 'az') {
print '<a href="account/shop/vote/delete/' . $items['id'] . '/">[x]</a> «' . $items['cat'] . '-' . $items['sort'] . '» ';
}
if ($items['custom'] == '1') {
$cil = array(
'0' => 'gray',
'1' => 'white',
'2' => '#25FF16',
'3' => '#0070AC',
'4' => '#A335EE',
'5' => '#FF8000',
);
print "[c] <font color='" . $cil[$items['color']] . "'>[" . $items['name'] . "]</font></td>";
} else {
print "<a class='q" . $items['color'] . "' href='http://www.wowhead.com/?item=" . $items['itemid'] . "'>[" . $items['name'] . "]</a></td>";
}
if ($items['charges'] == '0' || $items['charges'] == '1') {
$charges = '';
} else {
$charges = 'x' . $items['charges'];
}
print "<td>" . $charges . "</td>";
print "<td>" . $items['description'] . "</td>";
print "<td>" . $items['cost'] . "</td>";
print '<td><input type="radio" name="itemsgrup" value="' . $items['itemid'] . '-' . $items['cost'] . '-' . $items['charges'] . '" />';
print'</td> </tr>';
}
}
?>
<tr><td colspan="4"><br />
Select Your Chracter: <select name="character">
<?php
$i = 0;
if ($CharDB <> '') {
functionConnect($CharDB);
$result = mysql_query("SELECT * FROM characters WHERE acct='" . $a_user['acct'] . "'") or die(mysql_error());
while ($char = mysql_fetch_assoc($result)) {
print "<option value='" . $char['guid'] . "-1'>" . $s1name . " - " . $char['name'] . " - Level " . $char['level'] . " </option>";
$i = $i + 1;
}
}
if ($i == '0') {
print "<option value='none'>You don't have any characters</option>";
}
print "</select>";
print $hidden;
?>
<input name="action" type="submit" value="Purchase!" />
<br />
<br />
Upon pressing purchase, this script will insert a mail message containing the item into the server's mailbox queue. It should be received ingame in a few minutes. There is no need to relog.<br /><br />[c] - Custom Item
</tr></td>
</table>
</form>
</div>
<div><img src="_html/theme0/image/main_footer.jpg" width="530px" height="14px" alt="Footer" /></div>
</td>
<?php
}
include "include/right.php";
footer();
PopUp();
?>