Parašė jadze· 2012 Lie. 15 13:07:36
#9
Viskas lyk ir veikia, bet sugalvojnau truputi geriau, bet irgi nemoku pasidaryt, nors atrodo paprastas dalykas. Krc dabar visi uzdirbti pinigai keliauja i team.sql $suma1, o as nooriu kad keliautu i fusion_users $suma1. Gal galite man padėti tai padaryti? Nes kiek dedu aš tiek nesigauna.
Prisegu koda:
<?php
require_once "../../maincore.php";
require_once "../../subheader.php";
require_once "../../side_left.php";
$query = dbquery("SELECT name FROM teams WHERE treneris = '".$userdata['user_name']."' AND played >= 0");
while ($qwerty = dbarray($query)) {
$komanda = $qwerty['name'];
}
if($komanda){
if(isset($status) && $status != '') {
if($status == 'pateikta') { /*kazkas jeigu pridejo*/ }
elseif($status == 'atmesta') { /*Kazkas jei nepridejo*/}
}
if (isset($_POST['submit'])) {
$ip = $_SERVER['REMOTE_ADDR'];
$dal = dbarray(dbquery("SELECT * from teams WHERE treneris='".$userdata['user_name']."'"));
$suma1 = $dal['suma1'];
$_POST['komanda1'] = str_replace("\'", "", $_POST['komanda1']);
$_POST['komanda2'] = str_replace("\'", "", $_POST['komanda2']);
if($suma1 > $_POST['suma']) {
$result = dbquery("INSERT INTO pirkimai (busena, komanda1, suma, komanda2, zaidejas22, kada) VALUES ('Laukia', '".$_POST['ho_team']."', '".$_POST['suma']."', '".$_POST['aw_team']."', '".$_POST['zaidejas22']."', '".time()."')");
} else {
echo "Jums nepakanka pinigų.";
}
if($result) {
opentable('Žaidėjo pirkimas');
echo "<center><b>KAina už žaidėja pasiūlyta</b></center>";
closetable();
}
else { echo "Klaida."; }
}
else {
opentable('Žaidėjo pirkimas.');
$dal = dbquery("SELECT * from teams WHERE treneris='".$userdata['user_name']."'");
while ($q = dbarray($dal))
{
$namee = $q['name'];
$te_id = $q['id'];
$suma1 = $q['suma1'];
$played = $q['played'];
}
$teamsho = "";
$t1 = dbquery("SELECT id, name FROM teams WHERE name='{$_POST['komanda1']}'");
while ($q = dbarray($t1))
{
$teamsho .= "<option value=\"{$q['id']}\">{$q['name']}</option>";
}
$teamsaw = "";
$t2 = dbquery("SELECT id, name FROM teams WHERE name='{$_POST['komanda2']}'");
while ($q = dbarray($t2))
{
$teamsaw .= "<option value=\"{$q['id']}\">{$q['name']}</option>";
}
$ho_te_gavimas = dbquery("SELECT id from teams WHERE name='{$_POST['komanda1']}'");
while ($q = dbarray($ho_te_gavimas))
{
$home_idas = $q['id'];
}
$aw_te_gavimas = dbquery("SELECT id from teams WHERE name='{$_POST['komanda2']}'");
while ($q = dbarray($aw_te_gavimas))
{
$away_idas = $q['id'];
}
$playersho = "<option value=\"0\" selected=\"selected\">Pasirinkite žaidėją</option>";
$rez1 = dbquery("SELECT id, team_id, name FROM zaidejai WHERE team_id='$home_idas' order by id");
while ($q = dbarray($rez1)) {
$playersho .= "<option value=\"{$q['id']}\">{$q['name']}</option>";
}
$playersaw = "<option value=\"0\" selected=\"selected\">Pasirinkite žaidėją</option>";
$rez2 = dbquery("SELECT id, team_id, name FROM zaidejai WHERE team_id='$away_idas' order by id");
while ($q = dbarray($rez2)) {
$playersaw .= "<option value=\"{$q['id']}\">{$q['name']}</option>";
}
echo "<center><b>Žaidėjo pirkimas</b></center><br><br>
<center>
Tavo komanda - Perkamo žaidėjo komanda<br><br>
<form method='POST' action='".FUSION_SELF."'>
<select class='textbox' name='ho_team'style='width:200px;'>>
{$teamsho}
</select>
<select class='textbox' name='aw_team'style='width:200px;'>>
{$teamsaw}
</select>
<br>
<table border='0' width='100%'>
<tr>
<td><br><b><center>Siūloma kaina:</center></b></td>
<td><br><b><center>Zaidejas:</center></b></td>
</tr>
<td>
<select name='suma' class='textbox' style='width:265px;'>
<option value='500000'>500000$</option>
<option value='1000000'>1000000$</option>
<option value='1500000'>1500000$</option>
<option value='2000000'>2000000$</option>
<option value='2500000'>2500000$</option>
<option value='3000000'>3000000$</option>
<option value='3500000'>3500000$</option>
<option value='4000000'>4000000$</option>
<option value='4500000'>4500000$</option>
<option value='5000000'>5000000$</option>
<option value='5500000'>5500000$</option>
<option value='6000000'>6000000$</option>
<option value='6500000'>6500000$</option>
<option value='7000000'>7000000$</option>
<option value='7500000'>7500000$</option>
<option value='8000000'>8000000$</option>
<option value='8500000'>8500000$</option>
<option value='9000000'>9000000$</option>
<option value='9500000'>9500000$</option>
<option value='10000000'>10000000$</option>
<option value='11000000'>11000000$</option>
<option value='12000000'>12000000$</option>
<option value='13000000'>13000000$</option>
<option value='14000000'>14000000$</option>
<option value='15000000'>15000000$</option>
<option value='16000000'>16000000$</option>
<option value='17000000'>17000000$</option>
<option value='18000000'>18000000$</option>
<option value='19000000'>19000000$</option>
<option value='20000000'>20000000$</option>
</select>
<td><center>
<select class='textbox' name='zaidejas22'>$playersaw</select>
</center>
</td>
</tr>
</table>
<br><br>
<input type='submit' name='submit' value='Pirkti žaidėją'>
</form></center>"; }
} else {
opentable("STOP");
echo "<table><tr><td class='tbl1'><b>Tu nedalyvauji turnyre.</b></td></tr></table>";
}
closetable();
require_once BASEDIR."side_right.php";
require_once BASEDIR."footer.php";
?>
Redagavo jadze· 2012 Lie. 15 14:07:03