Temos pavadinimas: WordPress, Shopify ir PHPFusion programuotojų bendruomenė :: Reikalinga pagalba dėl kodo

Parašė marqs· 2012 Lie. 14 14:07:11
#7


<?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'];
 
 
 
$_POST['komanda1'] = str_replace("\'", "", $_POST['komanda1']);
 
$_POST['komanda2'] = str_replace("\'", "", $_POST['komanda2']);
 
//+--------Tikrina, ar pakanka pinigų-----------------+//
 if($pinigu_suma >= $_POST['suma']) { //$pinigu_suma - čia reikia pažymėti to dalyvio, kuriam siūlysi parduoti žaidėją, turimų pinigų sumą. Ta  prasme išsitraukti 2-os komandos trenerio info ir pagal ją susieškoti pinigų atvaizdavimą.
   $result = dbquery("INSERT INTO pirkimai (busena, komanda1, suma,  komanda2, zaidejas22, kada) VALUES ('Nepatvirtintas', '".$_POST['ho_team']."', '".$_POST['suma']."',  '".$_POST['aw_team']."', '".$_POST['zaidejas22']."',  '".time()."')"); 
 } else {
   echo "Jums nepakanka pinigų.";
 }
//+-------------------------+//
 
if($result) {
 
	opentable('Atlikti keitima');
 
	echo "<center><b>Keitimas atliktas.</b></center>";
 
	closetable();
 
 }
 
 
 
else { echo "Klaida."; }
 
}
 
else {
 
opentable('Atlikti keitima');
 
$dal = mysql_query("SELECT * from teams WHERE treneris='".$userdata['user_name']."'");
 
while ($q = mysql_fetch_array($dal))
 
{
 
 
 
$namee = $q['name'];
 
$te_id = $q['id'];
 
$suma1 = $q['suma1'];
 
$played = $q['played'];
 
}
 
 
$teamsho = "";
 
$t1 = mysql_query("SELECT id, name FROM teams WHERE name='{$_POST['komanda1']}'");
 
while ($q = mysql_fetch_array($t1))
 
{
 
	$teamsho .= "<option value=\"{$q['id']}\">{$q['name']}</option>";
 
}
 
 
$teamsaw = "";
 
$t2 = mysql_query("SELECT id, name FROM teams WHERE name='{$_POST['komanda2']}'");
 
while ($q = mysql_fetch_array($t2))
 
{
 
	$teamsaw .= "<option value=\"{$q['id']}\">{$q['name']}</option>";
 
}
 
$ho_te_gavimas = mysql_query("SELECT id from teams WHERE name='{$_POST['komanda1']}'");
 
 
while ($q = mysql_fetch_array($ho_te_gavimas))
 
{
 
$home_idas = $q['id'];
 
}
 
 
$aw_te_gavimas = mysql_query("SELECT id from teams WHERE name='{$_POST['komanda2']}'");
 
 
while ($q = mysql_fetch_array($aw_te_gavimas))
{
 
$away_idas = $q['id'];
 
}
 
 
$playersho = "<option value=\"0\" selected=\"selected\">Pasirinkite žaidėją</option>";
 
$rez1 = mysql_query("SELECT id, team_id, name FROM zaidejai WHERE team_id='$home_idas' order by id");
 
while ($q = mysql_fetch_array($rez1)) {
 
	$playersho .= "<option value=\"{$q['id']}\">{$q['name']}</option>";
}
 
$playersaw = "<option value=\"0\" selected=\"selected\">Pasirinkite žaidėją</option>";
 
$rez2 = mysql_query("SELECT id, team_id, name FROM zaidejai WHERE team_id='$away_idas' order by id");
 
 while ($q = mysql_fetch_array($rez2)) {
	$playersaw .= "<option value=\"{$q['id']}\">{$q['name']}</option>";
 }
 
 
echo "<center><b>Atlikti keitima</b></center><br><br>
<center>
Komanda 1 - Komanda 2<br><br>
<form method='POST' action='".FUSION_SELF."'>
<select class='textbox' name='ho_team'>
{$teamsho}
</select>
&nbsp;
&nbsp;
<select class='textbox' name='aw_team'>
{$teamsaw}
</select>
<br>
<table border='0' width='100%'>
 <tr>
  <td><br><b><center>Suma:</center></b></td>
  <td><br><b><center>Zaidejai:</center></b></td>
 </tr>
  <td>
   <select name='suma' class='textbox' style='width:265px;'>
    <option value='500000'>500000</option>
    <option value='1000000'>1000000</option>
   </select>
  <td><center>
   <select class='textbox' name='zaidejas22'>$playersaw</select>
   </center>
  </td>
 </tr>
</table>
 <br><br>
<input type='submit' name='submit' value='Atlikti keitima'>
</form></center>"; }
 
} else {
 
opentable("STOP");
  echo "<table><tr><td class='tbl1'><b>Tu nedalyvauji turnyre, arba nesi sužaidęs pakankamai varžybų, kad galetum atlikti keitimą.</b></td></tr></table>";
}
 
closetable();
 
 
require_once BASEDIR."side_right.php";
require_once BASEDIR."footer.php";
 
?>


Jei reikia dar kokios pagalbos, kreipkis www.gravion.lt, tokius dalykus puikiai išmanom.

Redagavo marqs· 2012 Lie. 14 14:07:57