Treceți la conținutul principal

o aplicatie complexa php fotbal clasamente code

//tabel.php

     <html>
<title>TABEL MECIURI</title> 
 <head>
 <script src="sorttable.js"></script>
<script src="dragtable.js"></script>




 <link rel="stylesheet" type="text/css" href="stdtheme.css" />
</head>

<hr>
<center><H1>Liga I 2011-2012 TABEL</H1>
<hr>

  
 
  
<? 
      include("meniuFotbal.php");           
//CONNECT
mysql_connect("localhost", "root", "");
mysql_select_db("fotbal");

   $sqlEE = "SELECT * FROM echipe ORDER BY ID ASC";
$resursaEE = mysql_query($sqlEE);
  
  PRINT '<br><TABLE><TR><TH>LOGO</TH>';
  
WHILE($rowEE = mysql_fetch_array($resursaEE))
{
PRINT '<TH >';
  $adresaimagine = "LOGO/".$rowEE['ID'].".jpeg";
     if(file_exists($adresaimagine)) { 
     print '<A HREF="meciuriEchipa.php?id='.$rowEE['ID'].'"><img src="'.$adresaimagine.'" width="20px" height="20px"></a></TH>';
             }
}
  

 PRINT '</TR>';

  FOR($I=1;$I<=18;$I++){
    $sqlE = "SELECT * FROM echipe WHERE ID=".$I." ORDER BY ID ASC";
    $resursaE = mysql_query($sqlE);
    $rowE = mysql_fetch_array($resursaE);

PRINT '<TR><TD  class="ESR">';

  $adresaimagine = "LOGO/".$rowE['ID'].".jpeg";
     if(file_exists($adresaimagine)) { 
     print '<A HREF="meciuriEchipa.php?id='.$rowE['ID'].'">';
      print '<img src="'.$adresaimagine.'" width="20px" height="20px"></a></TD>';
             }
    
  FOR($J=1;$J<=18;$J++){
    $sqlES = "SELECT * FROM meciuri WHERE GAZDA=".$I." AND OASPETE=".$J." ORDER BY GAZDA ASC";
    $resursaES = mysql_query($sqlES);
    $rowES = mysql_fetch_array($resursaES);
                  
      if($I==$J)
      {
      PRINT '<TD> x </TD>';
      }
      else
      {
      if($rowES){
      PRINT '<TD >'.$rowES['GG'].'-'.$rowES['GO'].'</TD>';
      }
      else
      {
      PRINT '<TD class="ESR">'.$rowES['GG'].' '.$rowES['GO'].'</TD>';
      }
      } 
    
  }       
      PRINT '</TR>';
}
    PRINT '</TABLE>';
?>
<hr>
<p> Copyright 2012-2020 by Tralsbro Sibiu, Romania. All Rights Reserved.</P>
   </center></body>
 </html>


//sorttable.js

/*
  SortTable
  version 2
  7th April 2007
  Stuart Langridge, http://www.kryogenix.org/code/browser/sorttable/
                      
                      
                      \Bsortabledraggable\B
                      
                      
  Instructions:
  Download this file
  Add <script src="sorttable.js"></script> to your HTML
  Add class="sortable" to any table you'd like to make sortable
  Click on the headers to sort
  
  Thanks to many, many people for contributions and suggestions.
  Licenced as X11: http://www.kryogenix.org/code/browser/licence.html
  This basically means: do what you want with it.
*/

 
var stIsIE = /*@cc_on!@*/false;

sorttable = {
  init: function() {
    // quit if this function has already been called
    if (arguments.callee.done) return;
    // flag this function so we don't do the same thing twice
    arguments.callee.done = true;
    // kill the timer
    if (_timer) clearInterval(_timer);
    
    if (!document.createElement || !document.getElementsByTagName) return;
    
    sorttable.DATE_RE = /^(\d\d?)[\/\.-](\d\d?)[\/\.-]((\d\d)?\d\d)$/;
    
    forEach(document.getElementsByTagName('table'), function(table) {
      if (table.className.search(/\bsortabledraggable\b/) != -1) {
        sorttable.makeSortable(table);
      }
    });
    
  },
  
  makeSortable: function(table) {
    if (table.getElementsByTagName('thead').length == 0) {
      // table doesn't have a tHead. Since it should have, create one and
      // put the first table row in it.
      the = document.createElement('thead');
      the.appendChild(table.rows[0]);
      table.insertBefore(the,table.firstChild);
    }
    // Safari doesn't support table.tHead, sigh
    if (table.tHead == null) table.tHead = table.getElementsByTagName('thead')[0];
    
    if (table.tHead.rows.length != 1) return; // can't cope with two header rows
    
    // Sorttable v1 put rows with a class of "sortbottom" at the bottom (as
    // "total" rows, for example). This is B&R, since what you're supposed
    // to do is put them in a tfoot. So, if there are sortbottom rows,
    // for backwards compatibility, move them to tfoot (creating it if needed).
    sortbottomrows = [];
    for (var i=0; i<table.rows.length; i++) {
      if (table.rows[i].className.search(/\bsortbottom\b/) != -1) {
        sortbottomrows[sortbottomrows.length] = table.rows[i];
      }
    }
    if (sortbottomrows) {
      if (table.tFoot == null) {
        // table doesn't have a tfoot. Create one.
        tfo = document.createElement('tfoot');
        table.appendChild(tfo);
      }
      for (var i=0; i<sortbottomrows.length; i++) {
        tfo.appendChild(sortbottomrows[i]);
      }
      delete sortbottomrows;
    }
    
    // work through each column and calculate its type
    headrow = table.tHead.rows[0].cells;
    for (var i=0; i<headrow.length; i++) {
      // manually override the type with a sorttable_type attribute
      if (!headrow[i].className.match(/\bsorttable_nosort\b/)) { // skip this col
        mtch = headrow[i].className.match(/\bsorttable_([a-z0-9]+)\b/);
        if (mtch) { override = mtch[1]; }
       if (mtch && typeof sorttable["sort_"+override] == 'function') {
         headrow[i].sorttable_sortfunction = sorttable["sort_"+override];
       } else {
         headrow[i].sorttable_sortfunction = sorttable.guessType(table,i);
       }
       // make it clickable to sort
       headrow[i].sorttable_columnindex = i;
       headrow[i].sorttable_tbody = table.tBodies[0];
       dean_addEvent(headrow[i],"click", function(e) {

          if (this.className.search(/\bsorttable_sorted\b/) != -1) {
            // if we're already sorted by this column, just 
            // reverse the table, which is quicker
            sorttable.reverse(this.sorttable_tbody);
            this.className = this.className.replace('sorttable_sorted',
                                                    'sorttable_sorted_reverse');
            this.removeChild(document.getElementById('sorttable_sortfwdind'));
            sortrevind = document.createElement('span');
            sortrevind.id = "sorttable_sortrevind";
            sortrevind.innerHTML = stIsIE ? '&nbsp<font face="webdings">5</font>' : '&nbsp;&#x25B4;';
            this.appendChild(sortrevind);
            return;
          }
          if (this.className.search(/\bsorttable_sorted_reverse\b/) != -1) {
            // if we're already sorted by this column in reverse, just 
            // re-reverse the table, which is quicker
            sorttable.reverse(this.sorttable_tbody);
            this.className = this.className.replace('sorttable_sorted_reverse',
                                                    'sorttable_sorted');
            this.removeChild(document.getElementById('sorttable_sortrevind'));
            sortfwdind = document.createElement('span');
            sortfwdind.id = "sorttable_sortfwdind";
            sortfwdind.innerHTML = stIsIE ? '&nbsp<font face="webdings">6</font>' : '&nbsp;&#x25BE;';
            this.appendChild(sortfwdind);
            return;
          }
          
          // remove sorttable_sorted classes
          theadrow = this.parentNode;
          forEach(theadrow.childNodes, function(cell) {
            if (cell.nodeType == 1) { // an element
              cell.className = cell.className.replace('sorttable_sorted_reverse','');
              cell.className = cell.className.replace('sorttable_sorted','');
            }
          });
          sortfwdind = document.getElementById('sorttable_sortfwdind');
          if (sortfwdind) { sortfwdind.parentNode.removeChild(sortfwdind); }
          sortrevind = document.getElementById('sorttable_sortrevind');
          if (sortrevind) { sortrevind.parentNode.removeChild(sortrevind); }
          
          this.className += ' sorttable_sorted';
          sortfwdind = document.createElement('span');
          sortfwdind.id = "sorttable_sortfwdind";
          sortfwdind.innerHTML = stIsIE ? '&nbsp<font face="webdings">6</font>' : '&nbsp;&#x25BE;';
          this.appendChild(sortfwdind);

         // build an array to sort. This is a Schwartzian transform thing,
         // i.e., we "decorate" each row with the actual sort key,
         // sort based on the sort keys, and then put the rows back in order
         // which is a lot faster because you only do getInnerText once per row
         row_array = [];
         col = this.sorttable_columnindex;
         rows = this.sorttable_tbody.rows;
         for (var j=0; j<rows.length; j++) {
           row_array[row_array.length] = [sorttable.getInnerText(rows[j].cells[col]), rows[j]];
         }
         /* If you want a stable sort, uncomment the following line */
         //sorttable.shaker_sort(row_array, this.sorttable_sortfunction);
         /* and comment out this one */
         row_array.sort(this.sorttable_sortfunction);
         
         tb = this.sorttable_tbody;
         for (var j=0; j<row_array.length; j++) {
           tb.appendChild(row_array[j][1]);
         }
         
         delete row_array;
       });
     }
    }
  },
  
  guessType: function(table, column) {
    // guess the type of a column based on its first non-blank row
    sortfn = sorttable.sort_alpha;
    for (var i=0; i<table.tBodies[0].rows.length; i++) {
      text = sorttable.getInnerText(table.tBodies[0].rows[i].cells[column]);
      if (text != '') {
        if (text.match(/^-?[£$¤]?[\d,.]+%?$/)) {
          return sorttable.sort_numeric;
        }
        // check for a date: dd/mm/yyyy or dd/mm/yy 
        // can have / or . or - as separator
        // can be mm/dd as well
        possdate = text.match(sorttable.DATE_RE)
        if (possdate) {
          // looks like a date
          first = parseInt(possdate[1]);
          second = parseInt(possdate[2]);
          if (first > 12) {
            // definitely dd/mm
            return sorttable.sort_ddmm;
          } else if (second > 12) {
            return sorttable.sort_mmdd;
          } else {
            // looks like a date, but we can't tell which, so assume
            // that it's dd/mm (English imperialism!) and keep looking
            sortfn = sorttable.sort_ddmm;
          }
        }
      }
    }
    return sortfn;
  },
  
  getInnerText: function(node) {
    // gets the text we want to use for sorting for a cell.
    // strips leading and trailing whitespace.
    // this is *not* a generic getInnerText function; it's special to sorttable.
    // for example, you can override the cell text with a customkey attribute.
    // it also gets .value for <input> fields.
    
    hasInputs = (typeof node.getElementsByTagName == 'function') &&
                 node.getElementsByTagName('input').length;
    
    if (node.getAttribute("sorttable_customkey") != null) {
      return node.getAttribute("sorttable_customkey");
    }
    else if (typeof node.textContent != 'undefined' && !hasInputs) {
      return node.textContent.replace(/^\s+|\s+$/g, '');
    }
    else if (typeof node.innerText != 'undefined' && !hasInputs) {
      return node.innerText.replace(/^\s+|\s+$/g, '');
    }
    else if (typeof node.text != 'undefined' && !hasInputs) {
      return node.text.replace(/^\s+|\s+$/g, '');
    }
    else {
      switch (node.nodeType) {
        case 3:
          if (node.nodeName.toLowerCase() == 'input') {
            return node.value.replace(/^\s+|\s+$/g, '');
          }
        case 4:
          return node.nodeValue.replace(/^\s+|\s+$/g, '');
          break;
        case 1:
        case 11:
          var innerText = '';
          for (var i = 0; i < node.childNodes.length; i++) {
            innerText += sorttable.getInnerText(node.childNodes[i]);
          }
          return innerText.replace(/^\s+|\s+$/g, '');
          break;
        default:
          return '';
      }
    }
  },
  
  reverse: function(tbody) {
    // reverse the rows in a tbody
    newrows = [];
    for (var i=0; i<tbody.rows.length; i++) {
      newrows[newrows.length] = tbody.rows[i];
    }
    for (var i=newrows.length-1; i>=0; i--) {
       tbody.appendChild(newrows[i]);
    }
    delete newrows;
  },
  
  /* sort functions
     each sort function takes two parameters, a and b
     you are comparing a[0] and b[0] */
  sort_numeric: function(a,b) {
    aa = parseFloat(a[0].replace(/[^0-9.-]/g,''));
    if (isNaN(aa)) aa = 0;
    bb = parseFloat(b[0].replace(/[^0-9.-]/g,'')); 
    if (isNaN(bb)) bb = 0;
    return aa-bb;
  },
  sort_alpha: function(a,b) {
    if (a[0]==b[0]) return 0;
    if (a[0]<b[0]) return -1;
    return 1;
  },
  sort_ddmm: function(a,b) {
    mtch = a[0].match(sorttable.DATE_RE);
    y = mtch[3]; m = mtch[2]; d = mtch[1];
    if (m.length == 1) m = '0'+m;
    if (d.length == 1) d = '0'+d;
    dt1 = y+m+d;
    mtch = b[0].match(sorttable.DATE_RE);
    y = mtch[3]; m = mtch[2]; d = mtch[1];
    if (m.length == 1) m = '0'+m;
    if (d.length == 1) d = '0'+d;
    dt2 = y+m+d;
    if (dt1==dt2) return 0;
    if (dt1<dt2) return -1;
    return 1;
  },
  sort_mmdd: function(a,b) {
    mtch = a[0].match(sorttable.DATE_RE);
    y = mtch[3]; d = mtch[2]; m = mtch[1];
    if (m.length == 1) m = '0'+m;
    if (d.length == 1) d = '0'+d;
    dt1 = y+m+d;
    mtch = b[0].match(sorttable.DATE_RE);
    y = mtch[3]; d = mtch[2]; m = mtch[1];
    if (m.length == 1) m = '0'+m;
    if (d.length == 1) d = '0'+d;
    dt2 = y+m+d;
    if (dt1==dt2) return 0;
    if (dt1<dt2) return -1;
    return 1;
  },
  
  shaker_sort: function(list, comp_func) {
    // A stable sort function to allow multi-level sorting of data
    // see: http://en.wikipedia.org/wiki/Cocktail_sort
    // thanks to Joseph Nahmias
    var b = 0;
    var t = list.length - 1;
    var swap = true;

    while(swap) {
        swap = false;
        for(var i = b; i < t; ++i) {
            if ( comp_func(list[i], list[i+1]) > 0 ) {
                var q = list[i]; list[i] = list[i+1]; list[i+1] = q;
                swap = true;
            }
        } // for
        t--;

        if (!swap) break;

        for(var i = t; i > b; --i) {
            if ( comp_func(list[i], list[i-1]) < 0 ) {
                var q = list[i]; list[i] = list[i-1]; list[i-1] = q;
                swap = true;
            }
        } // for
        b++;

    } // while(swap)
  }  
}

/* ******************************************************************
   Supporting functions: bundled here to avoid depending on a library
   ****************************************************************** */

// Dean Edwards/Matthias Miller/John Resig

/* for Mozilla/Opera9 */
if (document.addEventListener) {
    document.addEventListener("DOMContentLoaded", sorttable.init, false);
}

/* for Internet Explorer */
/*@cc_on @*/
/*@if (@_win32)
    document.write("<script id=__ie_onload defer src=javascript:void(0)><\/script>");
    var script = document.getElementById("__ie_onload");
    script.onreadystatechange = function() {
        if (this.readyState == "complete") {
            sorttable.init(); // call the onload handler
        }
    };
/*@end @*/

/* for Safari */
if (/WebKit/i.test(navigator.userAgent)) { // sniff
    var _timer = setInterval(function() {
        if (/loaded|complete/.test(document.readyState)) {
            sorttable.init(); // call the onload handler
        }
    }, 10);
}

/* for other browsers */
window.onload = sorttable.init;

// written by Dean Edwards, 2005
// with input from Tino Zijdel, Matthias Miller, Diego Perini

// http://dean.edwards.name/weblog/2005/10/add-event/

function dean_addEvent(element, type, handler) {
 if (element.addEventListener) {
  element.addEventListener(type, handler, false);
 } else {
  // assign each event handler a unique ID
  if (!handler.$$guid) handler.$$guid = dean_addEvent.guid++;
  // create a hash table of event types for the element
  if (!element.events) element.events = {};
  // create a hash table of event handlers for each element/event pair
  var handlers = element.events[type];
  if (!handlers) {
   handlers = element.events[type] = {};
   // store the existing event handler (if there is one)
   if (element["on" + type]) {
    handlers[0] = element["on" + type];
   }
  }
  // store the event handler in the hash table
  handlers[handler.$$guid] = handler;
  // assign a global event handler to do all the work
  element["on" + type] = handleEvent;
 }
};
// a counter used to create unique IDs
dean_addEvent.guid = 1;

function removeEvent(element, type, handler) {
 if (element.removeEventListener) {
  element.removeEventListener(type, handler, false);
 } else {
  // delete the event handler from the hash table
  if (element.events && element.events[type]) {
   delete element.events[type][handler.$$guid];
  }
 }
};

function handleEvent(event) {
 var returnValue = true;
 // grab the event object (IE uses a global event object)
 event = event || fixEvent(((this.ownerDocument || this.document || this).parentWindow || window).event);
 // get a reference to the hash table of event handlers
 var handlers = this.events[event.type];
 // execute each event handler
 for (var i in handlers) {
  this.$$handleEvent = handlers[i];
  if (this.$$handleEvent(event) === false) {
   returnValue = false;
  }
 }
 return returnValue;
};

function fixEvent(event) {
 // add W3C standard event methods
 event.preventDefault = fixEvent.preventDefault;
 event.stopPropagation = fixEvent.stopPropagation;
 return event;
};
fixEvent.preventDefault = function() {
 this.returnValue = false;
};
fixEvent.stopPropagation = function() {
  this.cancelBubble = true;
}

// Dean's forEach: http://dean.edwards.name/base/forEach.js
/*
 forEach, version 1.0
 Copyright 2006, Dean Edwards
 License: http://www.opensource.org/licenses/mit-license.php
*/

// array-like enumeration
if (!Array.forEach) { // mozilla already supports this
 Array.forEach = function(array, block, context) {
  for (var i = 0; i < array.length; i++) {
   block.call(context, array[i], i, array);
  }
 };
}

// generic enumeration
Function.prototype.forEach = function(object, block, context) {
 for (var key in object) {
  if (typeof this.prototype[key] == "undefined") {
   block.call(context, object[key], key, object);
  }
 }
};

// character enumeration
String.forEach = function(string, block, context) {
 Array.forEach(string.split(""), function(chr, index) {
  block.call(context, chr, index, string);
 });
};

// globally resolve forEach enumeration
var forEach = function(object, block, context) {
 if (object) {
  var resolve = Object; // default
  if (object instanceof Function) {
   // functions have a "length" property
   resolve = Function;
  } else if (object.forEach instanceof Function) {
   // the object implements a custom forEach method so use that
   object.forEach(block, context);
   return;
  } else if (typeof object == "string") {
   // the object is a string
   resolve = String;
  } else if (typeof object.length == "number") {
   // the object is array-like
   resolve = Array;
  }
  resolve.forEach(object, block, context);
 }
};
//pctetapeclasamentetape.php
     <html>
<title>CLASAMENT</title> 
 <head>
 <script src="sorttable.js"></script>
<script src="dragtable.js"></script>




 <link rel="stylesheet" type="text/css" href="stdtheme.css" />
</head>
      <body>
               <?
                    include("meniuFotbal.php");
               ?>
<hr>
<center><H1>Liga I 2011-2012 CLASAMENT</H1>
<hr>
<?
for($i=1;$i<=34;$i++)
{

  PRINT '<a href="pctEtapaCLASAMENTetape.PHP?id='.$i.'">'.$i.'</a> - ';
  
 }
?>
<hr>
<table > <tr>  
  <td><table> <tr> <th>LOC</th> <th>o</th></tr>
    
 <?
  
  if(isset($_GET['id'])){
 

        $nretapa = $_GET['id'];
 }       
 else
 {
    $nretapa=1;
  }
  $ik=1;
  for($ik;$ik<=18;$ik++){
  print '
 <tr>
  <td class="ESR">'.$ik.'</td><td class="ESR"><img src="LOGO/0.jpeg" width="1px" height="20px"></td>
 </tr> ';
  }
  ?>
  
 
</table></td>
  <td>
  
 
  
<? 
             
//CONNECT
mysql_connect("localhost", "root", "");
mysql_select_db("fotbal");

     print '<table class="sortabledraggable"><tr><th>nr</th><th>echipa</th><th>judet</th>
     <th>MT</th><th>VA</th><th>EA</th><th>IA</th><th>VD</th>
     <th>ED</th><th>ID</th><th>GMA</th><th>GMD</th><th>GOA</th>
     <th>GOD</th><th>Vt</th><th>Et</th><th>It</th><th>GMt</th><th>GOt</th><th>GOL</th><th>PCTa</th><th>
     PCTd</th><th>PCT</th><th>ADVa</th><th>ADVd</th><th>ADV</th><th>Ma</th><th>Md</th><th>GOLa</th><th>GOLd</th><TH>LOGO</TH></tr>';

//$sqlE = "SELECT * FROM echipe ORDER BY ID ASC";
$sqlE = "SELECT * FROM echipe ,clasament WHERE echipe.ID=clasament.ID ORDER BY clasament.PUNCTE DESC";
$resursaE = mysql_query($sqlE);
$Va;
$Ea;
$Ia;
$GMa;
$GOa;
$Vd;
$Ed;
$Id;
$GMd;
$GOd;
$Ma;
$Md;
$GOLa;
$GOLd;




WHILE($rowE = mysql_fetch_array($resursaE))
{

  PRINT '<tr><td><A HREF=meciuriEchipa.php?id="'.$rowE['ID'].'">'.$rowE['ID'].'</A></td><td class="ESR"> '.$rowE['ECHIPA'].' </td><td>'.$rowE['JUDET'].'</td>';


  ///////////////////////////////////STARTCLASAMENT//////////////////////////
  
$sqlMT = "SELECT GAZDA, COUNT(GAZDA) FROM meciuri WHERE meciuri.ETAPA<=".$nretapa." AND (meciuri.GAZDA =". $rowE['ID'] ." OR meciuri.OASPETE =". $rowE['ID']." )";
$resursaMT = mysql_query($sqlMT);

WHILE($rowMT = mysql_fetch_array($resursaMT))
{

  PRINT '<td class="ESR"> '.$rowMT['COUNT(GAZDA)'].'</td> ';

} 
//meciuri per echipa TOTAL 

$sqlVa = "SELECT GAZDA, COUNT(GAZDA) FROM meciuri WHERE meciuri.ETAPA<=".$nretapa." AND (meciuri.GAZDA =". $rowE['ID'] .") AND (meciuri.GG > meciuri.GO)";
$resursaVa = mysql_query($sqlVa);

WHILE($rowVa = mysql_fetch_array($resursaVa))
{

  PRINT '<td>'.$rowVa['COUNT(GAZDA)'].'</td> ';
                    $Va=$rowVa['COUNT(GAZDA)'];
} 
//VICTORII per echipa ACASA 

$sqlEQa = "SELECT GAZDA, COUNT(GAZDA) FROM meciuri WHERE meciuri.ETAPA<=".$nretapa." AND (meciuri.GAZDA =". $rowE['ID'] .") AND (meciuri.GG = meciuri.GO)";
$resursaEQa = mysql_query($sqlEQa);

WHILE($rowEQa = mysql_fetch_array($resursaEQa))
{

  PRINT '<td>'.$rowEQa['COUNT(GAZDA)'].'</td> ';
                       $Ea=$rowEQa['COUNT(GAZDA)'];
} 
//EGALURI per echipa  ACASA

$sqlIa = "SELECT GAZDA, COUNT(GAZDA) FROM meciuri WHERE meciuri.ETAPA<=".$nretapa." AND (meciuri.GAZDA =". $rowE['ID'] .") AND (meciuri.GG < meciuri.GO)";
$resursaIa = mysql_query($sqlIa);

WHILE($rowIa = mysql_fetch_array($resursaIa))
{

  PRINT '<td>'.$rowIa['COUNT(GAZDA)'].'</td> ';
                       $Ia=$rowIa['COUNT(GAZDA)'];
} 
//INFRANGERI per echipa  ACASA
////////////////////////////////////////////////////////////////////////////////////////////////
//DEPLASARE
////////////////////////////////////////////////////////////////////////////////////////////////
$sqlVd = "SELECT OASPETE, COUNT(OASPETE) FROM meciuri WHERE meciuri.ETAPA<=".$nretapa." AND (meciuri.OASPETE =". $rowE['ID'] .") AND (meciuri.GG < meciuri.GO)";
$resursaVd = mysql_query($sqlVd);

WHILE($rowVd = mysql_fetch_array($resursaVd))
{

  PRINT '<td>'.$rowVd['COUNT(OASPETE)'].'</td> ';
                          $Vd=$rowVd['COUNT(OASPETE)'];
} 
//VICTORII per echipa DEPLASARE 

$sqlEQd = "SELECT OASPETE, COUNT(OASPETE) FROM meciuri WHERE meciuri.ETAPA<=".$nretapa." AND (meciuri.OASPETE =". $rowE['ID'] .") AND (meciuri.GG = meciuri.GO)";
$resursaEQd = mysql_query($sqlEQd);

WHILE($rowEQd = mysql_fetch_array($resursaEQd))
{

  PRINT '<td>'.$rowEQd['COUNT(OASPETE)'].'</td> ';
                           $Ed=$rowEQd['COUNT(OASPETE)'];
} 
//EGALURI per echipa  DEPLASARE 

$sqlId = "SELECT OASPETE, COUNT(OASPETE) FROM meciuri WHERE meciuri.ETAPA<=".$nretapa." AND (meciuri.OASPETE =". $rowE['ID'] .") AND (meciuri.GG > meciuri.GO)";
$resursaId = mysql_query($sqlId);

WHILE($rowId = mysql_fetch_array($resursaId))
{

  PRINT '<td>'.$rowId['COUNT(OASPETE)'].'</td> ';
                           $Id=$rowId['COUNT(OASPETE)'];
} 
//INFRANGERI per echipa DEPLASARE 

$sqlGMa = "SELECT GG, SUM(GG) FROM meciuri WHERE meciuri.ETAPA<=".$nretapa." AND (meciuri.GAZDA =". $rowE['ID'] .")";
$resursaGMa = mysql_query($sqlGMa);

WHILE($rowGMa = mysql_fetch_array($resursaGMa))
{

  PRINT '<td>'.$rowGMa['SUM(GG)'].'</td> ';
                        $GMa=$rowGMa['SUM(GG)'];
} 
//total goluri marcate  ACASA

$sqlGMd = "SELECT GO, SUM(GO) FROM meciuri WHERE meciuri.ETAPA<=".$nretapa." AND (meciuri.OASPETE =". $rowE['ID'] .")";
$resursaGMd = mysql_query($sqlGMd);

WHILE($rowGMd = mysql_fetch_array($resursaGMd))
{

  PRINT '<td>'.$rowGMd['SUM(GO)'].'</td> ';
                         $GMd=$rowGMd['SUM(GO)'];
} 
//total goluri marcate DEPLASARE

$sqlGOa = "SELECT GO, SUM(GO) FROM meciuri WHERE meciuri.ETAPA<=".$nretapa." AND (meciuri.GAZDA =". $rowE['ID'] .")";
$resursaGOa = mysql_query($sqlGOa);

WHILE($rowGOa = mysql_fetch_array($resursaGOa))
{

  PRINT '<td>'.$rowGOa['SUM(GO)'].' </td>';
                        $GOa=$rowGOa['SUM(GO)'];
} 
//total goluri PRIMITE  ACASA

$sqlGOd = "SELECT GG, SUM(GG) FROM meciuri WHERE meciuri.ETAPA<=".$nretapa." AND (meciuri.OASPETE =". $rowE['ID'] .")";
$resursaGOd = mysql_query($sqlGOd);

WHILE($rowGOd = mysql_fetch_array($resursaGOd))
{

  PRINT '<td>'.$rowGOd['SUM(GG)'].'</td> ';
                                 $GOd=$rowGOd['SUM(GG)'];
} 
//total goluri PRIMITE DEPLASARE
////////////////////////////////////////////////////////
$Vt=$Va+$Vd;
$Et=$Ea+ $Ed;
$It=$Ia+ $Id;
$GMt=$GMa+ $GMd;
$GOt=$GOa+ $GOd;
$GOL=$GMt-$GOt;
$PCTa=($Va*3)+($Ea*1);
$PCTd=($Vd*3)+($Ed*1) ;
$PCT= $PCTa+$PCTd ;
$ADVa=(($Ia*3)+($Ea*2))*(-1);
$ADVd=($Vd*3)+($Ed*1) ;
$ADV= $ADVa+$ADVd ;
$Ma=$Va+$Ea+$Ia;
$Md=$Vd+$Ed+$Id;
$GOLa=$GMa-$GOa;
$GOLd=$GMd-$GOd;


print ' <td class="ESR">'.$Vt.'</td><td class="ESR"> '.$Et.' </td><td class="ESR">'.$It.'</td><td class="ESR"> '.$GMt.'</td><td class="ESR"> '.$GOt.'</td><td class="ESR"> '.$GOL.' </td><td>'.$PCTa.'</td><td> '.$PCTd.'</td><td class="ESR"> '.$PCT.'</td><td> '.$ADVa.'</td><td> '.$ADVd.'</td><td class="ESR"> '.$ADV.'</td>';
print '<td> '.$Ma.'</td><td> '.$Md.'</td><td> '.$GOLa.'</td><td> '.$GOLd.'</td>';

$adresaimagine = "LOGO/".$rowE['ID'].".jpeg";
   if(file_exists($adresaimagine)) { 
     print '<td class="ESR"><A HREF="meciuriEchipa.php?id='.$rowE['ID'].'"><img src="'.$adresaimagine.'" width="20px" height="20px"></a></td>'; }
  
  
 print '</tr>';


 ///////////////////////////////////ENDCLASAMENT//////////////////////////
           $PCTETAPA=0;
$sqlVEId = "SELECT * FROM meciuri WHERE (meciuri.ETAPA=".$nretapa.") AND (meciuri.OASPETE =".$rowE['ID'].")";
$resursaVEId = mysql_query($sqlVEId);

WHILE($rowVEId = mysql_fetch_array($resursaVEId))
{

 if($rowVEId['GG']<$rowVEId['GO']){$PCTETAPA=3;}
 if($rowVEId['GG']>$rowVEId['GO']){$PCTETAPA=0;}
 if($rowVEId['GG']==$rowVEId['GO']){$PCTETAPA=1;}

 }     
 
$sqlVEIa = "SELECT * FROM meciuri WHERE (meciuri.ETAPA=".$nretapa.") AND (meciuri.GAZDA=".$rowE['ID'].")";
$resursaVEIa = mysql_query($sqlVEIa);
       
WHILE($rowVEIa = mysql_fetch_array($resursaVEIa))
{

 if($rowVEIa['GG']>$rowVEIa['GO']){$PCTETAPA=3;}
 if($rowVEIa['GG']<$rowVEIa['GO']){$PCTETAPA=0;}
 if($rowVEIa['GG']==$rowVEIa['GO']){$PCTETAPA=1;}
} 
 
 ///////////////////////////////////PCT ETAPA ////////////////////////////

$sqlVEI = "UPDATE clasament SET clasament.P".$nretapa."='".$PCTETAPA."' WHERE CLASAMENT.ID = ".$rowE['ID'] ;
mysql_query($sqlVEI);
}
//ECHIPE
     print '</table></td>
 </tr>
</table>';
     
?>



<hr>

<p> Copyright 2012-2020 by Tralsbro Sibiu, Romania. All Rights Reserved.</P>

   </center></body>
 </html>


//pctclasamentetape.php

     <html>
<title>CLASAMENT</title> 
 <head>
 <script src="sorttable.js"></script>
<script src="dragtable.js"></script>




 <link rel="stylesheet" type="text/css" href="stdtheme.css" />
</head>
      <body>
               <?
                    include("meniuFotbal.php");
               ?>
<hr>
<center><H1>Liga I 2011-2012 CLASAMENT</H1>
<hr>
<?
for($i=1;$i<=34;$i++)
{

  PRINT '<a href="pctCLASAMENTetape.php?id='.$i.'">'.$i.'</a> - ';
  
 }
?>
<hr>
<table > <tr>  
  <td><table> <tr> <th>LOC</th> <th>o</th></tr>
    
 <?
  
  if(isset($_GET['id'])){
 

        $nretapa = $_GET['id'];
 }       
 else
 {
    $nretapa=1;
  }
  $ik=1;
  for($ik;$ik<=18;$ik++){
  print '
 <tr>
  <td class="ESR">'.$ik.'</td><td class="ESR"><img src="LOGO/0.jpeg" width="1px" height="20px"></td>
 </tr> ';
  }
  ?>
  
 
</table></td>
  <td>
  
 
  
<? 
             
//CONNECT
mysql_connect("localhost", "root", "");
mysql_select_db("fotbal");

     print '<table class="sortabledraggable"><tr><th>nr</th><th>echipa</th><th>judet</th>
     <th>MT</th><th>VA</th><th>EA</th><th>IA</th><th>VD</th>
     <th>ED</th><th>ID</th><th>GMA</th><th>GMD</th><th>GOA</th>
     <th>GOD</th><th>Vt</th><th>Et</th><th>It</th><th>GMt</th><th>GOt</th><th>GOL</th><th>PCTa</th><th>
     PCTd</th><th>PCT</th><th>ADVa</th><th>ADVd</th><th>ADV</th><th>Ma</th><th>Md</th><th>GOLa</th><th>GOLd</th><TH>LOGO</TH></tr>';

//$sqlE = "SELECT * FROM echipe ORDER BY ID ASC";
$sqlE = "SELECT * FROM echipe ,clasament WHERE echipe.ID=clasament.ID ORDER BY clasament.PUNCTE DESC";
$resursaE = mysql_query($sqlE);
$Va;
$Ea;
$Ia;
$GMa;
$GOa;
$Vd;
$Ed;
$Id;
$GMd;
$GOd;
$Ma;
$Md;
$GOLa;
$GOLd;




WHILE($rowE = mysql_fetch_array($resursaE))
{

  PRINT '<tr><td><A HREF=meciuriEchipa.php?id="'.$rowE['ID'].'">'.$rowE['ID'].'</A></td><td class="ESR"> '.$rowE['ECHIPA'].' </td><td>'.$rowE['JUDET'].'</td>';


  ///////////////////////////////////STARTCLASAMENT//////////////////////////
  
$sqlMT = "SELECT GAZDA, COUNT(GAZDA) FROM meciuri WHERE meciuri.ETAPA<=".$nretapa." AND (meciuri.GAZDA =". $rowE['ID'] ." OR meciuri.OASPETE =". $rowE['ID']." )";
$resursaMT = mysql_query($sqlMT);

WHILE($rowMT = mysql_fetch_array($resursaMT))
{

  PRINT '<td class="ESR"> '.$rowMT['COUNT(GAZDA)'].'</td> ';

} 
//meciuri per echipa TOTAL 

$sqlVa = "SELECT GAZDA, COUNT(GAZDA) FROM meciuri WHERE meciuri.ETAPA<=".$nretapa." AND (meciuri.GAZDA =". $rowE['ID'] .") AND (meciuri.GG > meciuri.GO)";
$resursaVa = mysql_query($sqlVa);

WHILE($rowVa = mysql_fetch_array($resursaVa))
{

  PRINT '<td>'.$rowVa['COUNT(GAZDA)'].'</td> ';
                    $Va=$rowVa['COUNT(GAZDA)'];
} 
//VICTORII per echipa ACASA 

$sqlEQa = "SELECT GAZDA, COUNT(GAZDA) FROM meciuri WHERE meciuri.ETAPA<=".$nretapa." AND (meciuri.GAZDA =". $rowE['ID'] .") AND (meciuri.GG = meciuri.GO)";
$resursaEQa = mysql_query($sqlEQa);

WHILE($rowEQa = mysql_fetch_array($resursaEQa))
{

  PRINT '<td>'.$rowEQa['COUNT(GAZDA)'].'</td> ';
                       $Ea=$rowEQa['COUNT(GAZDA)'];
} 
//EGALURI per echipa  ACASA

$sqlIa = "SELECT GAZDA, COUNT(GAZDA) FROM meciuri WHERE meciuri.ETAPA<=".$nretapa." AND (meciuri.GAZDA =". $rowE['ID'] .") AND (meciuri.GG < meciuri.GO)";
$resursaIa = mysql_query($sqlIa);

WHILE($rowIa = mysql_fetch_array($resursaIa))
{

  PRINT '<td>'.$rowIa['COUNT(GAZDA)'].'</td> ';
                       $Ia=$rowIa['COUNT(GAZDA)'];
} 
//INFRANGERI per echipa  ACASA
////////////////////////////////////////////////////////////////////////////////////////////////
//DEPLASARE
////////////////////////////////////////////////////////////////////////////////////////////////
$sqlVd = "SELECT OASPETE, COUNT(OASPETE) FROM meciuri WHERE meciuri.ETAPA<=".$nretapa." AND (meciuri.OASPETE =". $rowE['ID'] .") AND (meciuri.GG < meciuri.GO)";
$resursaVd = mysql_query($sqlVd);

WHILE($rowVd = mysql_fetch_array($resursaVd))
{

  PRINT '<td>'.$rowVd['COUNT(OASPETE)'].'</td> ';
                          $Vd=$rowVd['COUNT(OASPETE)'];
} 
//VICTORII per echipa DEPLASARE 

$sqlEQd = "SELECT OASPETE, COUNT(OASPETE) FROM meciuri WHERE meciuri.ETAPA<=".$nretapa." AND (meciuri.OASPETE =". $rowE['ID'] .") AND (meciuri.GG = meciuri.GO)";
$resursaEQd = mysql_query($sqlEQd);

WHILE($rowEQd = mysql_fetch_array($resursaEQd))
{

  PRINT '<td>'.$rowEQd['COUNT(OASPETE)'].'</td> ';
                           $Ed=$rowEQd['COUNT(OASPETE)'];
} 
//EGALURI per echipa  DEPLASARE 

$sqlId = "SELECT OASPETE, COUNT(OASPETE) FROM meciuri WHERE meciuri.ETAPA<=".$nretapa." AND (meciuri.OASPETE =". $rowE['ID'] .") AND (meciuri.GG > meciuri.GO)";
$resursaId = mysql_query($sqlId);

WHILE($rowId = mysql_fetch_array($resursaId))
{

  PRINT '<td>'.$rowId['COUNT(OASPETE)'].'</td> ';
                           $Id=$rowId['COUNT(OASPETE)'];
} 
//INFRANGERI per echipa DEPLASARE 

$sqlGMa = "SELECT GG, SUM(GG) FROM meciuri WHERE meciuri.ETAPA<=".$nretapa." AND (meciuri.GAZDA =". $rowE['ID'] .")";
$resursaGMa = mysql_query($sqlGMa);

WHILE($rowGMa = mysql_fetch_array($resursaGMa))
{

  PRINT '<td>'.$rowGMa['SUM(GG)'].'</td> ';
                        $GMa=$rowGMa['SUM(GG)'];
} 
//total goluri marcate  ACASA

$sqlGMd = "SELECT GO, SUM(GO) FROM meciuri WHERE meciuri.ETAPA<=".$nretapa." AND (meciuri.OASPETE =". $rowE['ID'] .")";
$resursaGMd = mysql_query($sqlGMd);

WHILE($rowGMd = mysql_fetch_array($resursaGMd))
{

  PRINT '<td>'.$rowGMd['SUM(GO)'].'</td> ';
                         $GMd=$rowGMd['SUM(GO)'];
} 
//total goluri marcate DEPLASARE

$sqlGOa = "SELECT GO, SUM(GO) FROM meciuri WHERE meciuri.ETAPA<=".$nretapa." AND (meciuri.GAZDA =". $rowE['ID'] .")";
$resursaGOa = mysql_query($sqlGOa);

WHILE($rowGOa = mysql_fetch_array($resursaGOa))
{

  PRINT '<td>'.$rowGOa['SUM(GO)'].' </td>';
                        $GOa=$rowGOa['SUM(GO)'];
} 
//total goluri PRIMITE  ACASA

$sqlGOd = "SELECT GG, SUM(GG) FROM meciuri WHERE meciuri.ETAPA<=".$nretapa." AND (meciuri.OASPETE =". $rowE['ID'] .")";
$resursaGOd = mysql_query($sqlGOd);

WHILE($rowGOd = mysql_fetch_array($resursaGOd))
{

  PRINT '<td>'.$rowGOd['SUM(GG)'].'</td> ';
                                 $GOd=$rowGOd['SUM(GG)'];
} 
//total goluri PRIMITE DEPLASARE
////////////////////////////////////////////////////////
$Vt=$Va+$Vd;
$Et=$Ea+ $Ed;
$It=$Ia+ $Id;
$GMt=$GMa+ $GMd;
$GOt=$GOa+ $GOd;
$GOL=$GMt-$GOt;
$PCTa=($Va*3)+($Ea*1);
$PCTd=($Vd*3)+($Ed*1) ;
$PCT= $PCTa+$PCTd ;
$ADVa=(($Ia*3)+($Ea*2))*(-1);
$ADVd=($Vd*3)+($Ed*1) ;
$ADV= $ADVa+$ADVd ;
$Ma=$Va+$Ea+$Ia;
$Md=$Vd+$Ed+$Id;
$GOLa=$GMa-$GOa;
$GOLd=$GMd-$GOd;


print ' <td class="ESR">'.$Vt.'</td><td class="ESR"> '.$Et.' </td><td class="ESR">'.$It.'</td><td class="ESR"> '.$GMt.'</td><td class="ESR"> '.$GOt.'</td><td class="ESR"> '.$GOL.' </td><td>'.$PCTa.'</td><td> '.$PCTd.'</td><td class="ESR"> '.$PCT.'</td><td> '.$ADVa.'</td><td> '.$ADVd.'</td><td class="ESR"> '.$ADV.'</td>';
print '<td> '.$Ma.'</td><td> '.$Md.'</td><td> '.$GOLa.'</td><td> '.$GOLd.'</td>';

$adresaimagine = "LOGO/".$rowE['ID'].".jpeg";
   if(file_exists($adresaimagine)) { 
     print '<td class="ESR"><A HREF="meciuriEchipa.php?id='.$rowE['ID'].'"><img src="'.$adresaimagine.'" width="20px" height="20px"></a></td>'; }
  
  
 print '</tr>';


 ///////////////////////////////////ENDCLASAMENT//////////////////////////
          
 ///////////////////////////////////PCT ETAPA ////////////////////////////
  $sqlm = "UPDATE clasament SET clasament.T".$nretapa."='".$PCT."' WHERE CLASAMENT.ID = ".$rowE['ID'] ;
mysql_query($sqlm);

}
//ECHIPE
     print '</table></td>
 </tr>
</table>';
     
?>



<hr>

<p> Copyright 2012-2020 by Tralsbro Sibiu, Romania. All Rights Reserved.</P>

   </center></body>
 </html>


//meniufotbal.php


<script language="jscript">

function showmeniubar(){
plusmeniu.style.visibility="hidden";
plusmeniu.style.display="none";
speedlinks.style.visibility="visible";
speedlinks.style.display="block";
minusmeniu.style.visibility="visible";
minusmeniu.style.display="block";
}

function hiddemeniubar(){
plusmeniu.style.visibility="visible";
plusmeniu.style.display="block";
speedlinks.style.visibility="hidden";
speedlinks.style.display="none";
minusmeniu.style.visibility="hidden";
minusmeniu.style.display="none";
}
</script>

<div id="speedlinks" style="background-color:transparent;font: 9pt Tahoma;color: black; display:none; visibility:hidden; position:absolute; top:10px; left:7px; width:200px; height:200px; border=1px;">
<table >
<th>MENIU</th>
<tr><td class="ESR"><a href="football.php" onclick="hiddemeniubar();">football</a></td></tr>
<tr><td class="ESR"><a href="addMeci.php" onclick="hiddemeniubar();">add</a></td></tr>
<tr><td class="ESR"><a href="echipe.php" onclick="hiddemeniubar();">echipe</a></td></tr>
<tr><td class="ESR"><a href="fotbal.php" onclick="hiddemeniubar();">fotbal</a></td></tr>
<tr><td class="ESR"><a href="index.php" onclick="hiddemeniubar();">index</a></td></tr>
<tr><td class="ESR"><a href="meciuri.php" onclick="hiddemeniubar();">meciuri</a></td></tr>
<tr><td class="ESR"><a href="meciuriEchipa.php" onclick="hiddemeniubar();">meciuri Echipa</a></td></tr>

<tr><td class="ESR"><a href="MECIURINEJUCATE.PHP" onclick="hiddemeniubar();">meciuri NEjucate</a></td></tr>
<tr><td class="ESR"><a href="CLASAMENT_TOTAL.PHP" onclick="hiddemeniubar();">CLASAMENT TOTAL</a></td></tr>
<tr><td class="ESR"><a href="delMeci.php" onclick="hiddemeniubar();">del</a></td></tr>
<tr><tr><td class="ESR"><a href="Clasament.php" onclick="hiddemeniubar();">Clasament</a></td></tr>
<tr><td class="ESR"><a href="Tabel.php" onclick="hiddemeniubar();">Tabel</a></td></tr>
<tr><td class="ESR"><a href="Etape.PHP" onclick="hiddemeniubar();">Etape</a></td></tr>

<tr><td class="ESR"><a href="Clasamentacasa.php" onclick="hiddemeniubar();">Clasament A</a></td></tr>
<tr><td class="ESR"><a href="Clasamentdeplasare.PHP" onclick="hiddemeniubar();">Clasament D</a></td></tr>
<tr><td class="ESR"><a href="Clasamentetapemeciuri.PHP" onclick="hiddemeniubar();">Clasament etape meciuri</a></td></tr>
<tr><td class="ESR"><a href="Clasamentetape.PHP" onclick="hiddemeniubar();">Clasament etape</a></td></tr>
<tr><td class="ESR"><a href="Etapacurenta.PHP" onclick="hiddemeniubar();">Etapa curenta</a></td></tr>
<tr><td class="ESR"><a href="CLASAMENTtur.php" onclick="hiddemeniubar();">Clasament Tur</a></td></tr>

<tr><td class="ESR"><a href="CLASAMENTretur.php" onclick="hiddemeniubar();">Clasament Retur</a></td></tr>
<tr><td class="ESR"><a href="CLASAMENTdeplasareTur.PHP" onclick="hiddemeniubar();">Clasament deplasare Tur</a></td></tr>
<tr><td class="ESR"><a href="CLASAMENTdeplasareRetur.PHP" onclick="hiddemeniubar();">Clasament deplasare Retur</a></td></tr>
<tr><td class="ESR"><a href="CLASAMENTacasaTur.PHP" onclick="hiddemeniubar();">Clasament acasa Tur</a></td></tr>
<tr><td class="ESR"><a href="CLASAMENTacasaRetur.PHP" onclick="hiddemeniubar();">Clasament acasa Retur</a></td></tr>
<tr><td class="ESR"><a href="index.PHP" onclick="hiddemeniubar();">index</a></td></tr>

<tr><td class="ESR"><a href="pctCLASAMENTETAPE.PHP" onclick="hiddemeniubar();">pct CLASAMENT ETAPE</a></td></tr>
<tr><td class="ESR"><a href="pctEtapaCLASAMENTetape.PHP" onclick="hiddemeniubar();">pct etapa CLASAMENT ETAPE</a></td></tr>
<tr><td class="ESR"><a href="chartFootball2.html" onclick="hiddemeniubar();">pct chart Football 2.html</a></td></tr>
<tr><td class="ESR"><a href="chartFootballLoc.html" onclick="hiddemeniubar();">chart Football Loc</a></td></tr>                                                                

                                                                
</tr>
</table>
</div>

<div id="plusmeniu" onmouseover="this.style.cursor='hand';" onclick="showmeniubar();" style="background-color:transparent; font:bolder 9pt Tahoma; color:black ; display:block; visibility:visible; position:absolute; top:5px; left:5px; width:20px; height:20px">
<center><b>[+]</b></center>
</div>

<div id="minusmeniu" onmouseover="this.style.cursor='hand';" onclick="hiddemeniubar();" style="background-color:transparent; font:bolder 9pt Tahoma; color:black ; display:none; visibility:hidden; position:absolute; top:5px; left:5px; width:20px; height:20px">
<center><b>[-]</b></center>
</div>




//meciurinejucate.php

     <html>
 
 <head>   <link rel="stylesheet" type="text/css" href="stdtheme.css" />
 <script src="sorttable.js"></script>
<script src="dragtable.js"></script>
   </head>
   <body><center>

<?
     include("meniuFotbal.php");
mysql_connect("localhost", "root", "");
mysql_select_db("fotbal");
/////////////////////meciuri nejucate inca/////////////////////////////////
           $idmeci;
if(isset($_GET['etapa'])){
 

        $ETAPA = $_GET['etapa'];
 }       
 else
 {
  $ETAPA =1;
 
 }
 
  /////////////////////////////////////////////////////////////////////////////
$sqlccMc = "SELECT * FROM cmeciuri WHERE cmeciuri.ETAPA=".$ETAPA." ORDER BY cmeciuri.ID ASC";
$resursaccMc = mysql_query($sqlccMc);


 
 PRINT '<TABLE><TR>';
for($i=1;$i<=34;$i++)
{

  PRINT '<TD><a href="MECIURINEJUCATE.php?etapa='.$i.'">'.$i.'</a></TD>';
  }
 PRINT '</TR></TABLE>';
  
 



print '<table class="sortabledraggable">';
PRINT '<tr>
<td class="ESR">ID</TD>
<TD class="ESR">ETAPA</TD>
<TD class="ESR">DATA</TD>
<TD class="ESR">iGAZDE</TD>
<TD class="ESR">GG</TD>
<TD class="ESR">GO</TD>
<TD class="ESR">iOASPETI</TD>
<TD class="ESR">J</TD>
<TD class="ESR">GAZDE</TD>
<TD class="ESR">iGAZDE</TD>
<TD class="ESR">iOASPETE</TD>
<TD class="ESR">OASPETE</TD>
<TD class="ESR">J</TD>
<TD class="ESR">ADD</TD>
</TR>';
WHILE($rowccMc = mysql_fetch_array($resursaccMc))
{

  PRINT '<tr><td>'.$rowccMc['ID'].'</TD><TD>'.$rowccMc['ETAPA'].'</TD><TD> '.$rowccMc['DATA'].' </TD><TD> '.$rowccMc['GAZDA'].' </TD><TD> '.$rowccMc['GG'].' </TD><TD> '.$rowccMc['GO'].' </TD><TD> '.$rowccMc['OASPETE'].'</TD>';
  
  $sqlccEC = "SELECT * FROM cmeciuri, echipe WHERE echipe.ID=cmeciuri.GAZDA AND cmeciuri.ID=".$rowccMc['ID']." AND cmeciuri.ETAPA=".$ETAPA." ORDER BY cmeciuri.ID ASC";
$resursaccEC = mysql_query($sqlccEC);

WHILE($rowccEC = mysql_fetch_array($resursaccEC))
{

  PRINT ' <TD> '.$rowccEC['ID'].' </TD><TD> '.$rowccEC['ECHIPA'].'</TD><TD> '.$rowccEC['JUDET'].'</TD>';

  

}  

$sqlccECO = "SELECT * FROM cmeciuri, echipe WHERE echipe.ID=cmeciuri.OASPETE AND cmeciuri.ID=".$rowccMc['ID']." AND cmeciuri.ETAPA=".$ETAPA." ORDER BY cmeciuri.ID ASC";
$resursaccECO = mysql_query($sqlccECO);

WHILE($rowccECO = mysql_fetch_array($resursaccECO))
{

  PRINT ' <TD> '.$rowccECO['ID'].' </TD><TD> '.$rowccECO['ECHIPA'].'</TD><TD> '.$rowccECO['JUDET'].'</TD><TD><a href="addMeci.php?idmeci='.$rowccMc['ID'].'">'.$rowccMc['ID'].'</a></TD></Tr>';
                              
  

}  



  

}  
print '</table>';
?>
<hr>

</center>
</body>
 </html>

//meciuriechipa.php

     <html>
 
 <head>   <link rel="stylesheet" type="text/css" href="stdtheme.css" />
 <script src="sorttable.js"></script>
<script src="dragtable.js"></script>
     </head><body>      <center>
<?
      include("meniuFotbal.php");
      include("logos.php");
if(isset($_GET['id'])){
 

        $id = $_GET['id'];
 }       
 else
 {
  $id =1;

 }
 
 print '<h2>REZULTATE</h2>';
 
mysql_connect("localhost", "root", "");
mysql_select_db("fotbal");

////////////////////////////////////////////////////////

$sqlE = "SELECT * FROM echipe WHERE ID=".$id." ORDER BY ID ASC";
$resursaE = mysql_query($sqlE);

 

WHILE($rowE = mysql_fetch_array($resursaE))
{

  PRINT ''.$rowE['ID'].'  <b> '.$rowE['ECHIPA'].' </b>   '.$rowE['JUDET'].'';
  $adresaimagine = "LOGO/".$rowE['ID'].".jpeg";
   if(file_exists($adresaimagine)) { 
     print '<A HREF="meciuriEchipa.php?id='.$rowE['ID'].'"><img src="'.$adresaimagine.'" width="20px" height="20px"></a>'; }
      
  }
                        print'<br><br><br>';
  
  
  ////////////////////////////////////////////////////////


 

$sqlccMc = "SELECT * FROM meciuri WHERE GAZDA=".$id." OR OASPETE=".$id." ORDER BY meciuri.ID ASC";
$resursaccMc = mysql_query($sqlccMc);

print '<table class="sortabledraggable"><TR><TH>id</TH><TH>etapa</TH><TH>data</TH><TH>gazda</TH><TH>gg</TH><TH>go</TH><TH>oaspete</TH><TH>id</TH><TH>echipa</TH><TH>judet</TH><TH>id</TH><TH>echipa</TH><TH>judet</TH><TH>v.e.i</TH></TR>';

WHILE($rowccMc = mysql_fetch_array($resursaccMc))
{

  PRINT '<tr><td>'.$rowccMc['ID'].'</TD><TD>'.$rowccMc['ETAPA'].'</TD><TD> '.$rowccMc['DATA'].' </TD><TD> '.$rowccMc['GAZDA'].' </TD><TD> '.$rowccMc['GG'].' </TD><TD> '.$rowccMc['GO'].' </TD><TD> '.$rowccMc['OASPETE'].'</TD>';
  
  $sqlccEC = "SELECT * FROM meciuri, echipe WHERE echipe.ID=meciuri.GAZDA AND meciuri.ID=".$rowccMc['ID']." ORDER BY meciuri.ID ASC";
$resursaccEC = mysql_query($sqlccEC);

WHILE($rowccEC = mysql_fetch_array($resursaccEC))
{

  PRINT ' <TD> '.$rowccEC['ID'].' </TD><TD> '.$rowccEC['ECHIPA'].'</TD><TD> '.$rowccEC['JUDET'].'</TD>';
 

}  

$sqlccECO = "SELECT * FROM meciuri, echipe WHERE echipe.ID=meciuri.OASPETE AND meciuri.ID=".$rowccMc['ID']." ORDER BY meciuri.ID ASC";
$resursaccECO = mysql_query($sqlccECO);

WHILE($rowccECO = mysql_fetch_array($resursaccECO))
{

  PRINT ' <TD> '.$rowccECO['ID'].' </TD><TD> '.$rowccECO['ECHIPA'].'</TD><TD> '.$rowccECO['JUDET'].'</TD>';
  
  
  if($rowccMc['GAZDA']==$id){
   if ($rowccMc['GG']>$rowccMc['GO']){print '<td class="va"> V';}
   if ($rowccMc['GG']==$rowccMc['GO']){print '<td class="ea"> E';}
   if ($rowccMc['GG']<$rowccMc['GO']){print '<td class="ia"> I';}
   }
  if($rowccMc['OASPETE']==$id){
   if ($rowccMc['GG']<$rowccMc['GO']){print '<td class="vd"> V';}
   if ($rowccMc['GG']==$rowccMc['GO']){print '<td class="ed"> E';}
   if ($rowccMc['GG']>$rowccMc['GO']){print '<td class="id"> I';}
   }
   
  print '</td></Tr>';

  

}  }

 print '</table>';
 
 
 
 //////////////////////////////////////////////////////////////////////////////////
            
            
            
            
            
            print '<h2>JOCURI DE DISPUTAT</h2>';
            
            
            
            
            
 

$sqlccMc = "SELECT * FROM cmeciuri WHERE GAZDA=".$id." OR OASPETE=".$id." ORDER BY cmeciuri.ID ASC";
$resursaccMc = mysql_query($sqlccMc);

print '<table class="sortabledraggable"><tr><TH>id</TH><TH>etapa</TH><TH>data</TH><TH>gazda</TH><TH>gg</TH><TH>go</TH><TH>oaspete</TH><TH>id</TH><TH>echipa</TH><TH>judet</TH><TH>id</TH><TH>echipa</TH><TH>judet</TH></TR>';

WHILE($rowccMc = mysql_fetch_array($resursaccMc))
{

  PRINT '<tr><td>'.$rowccMc['ID'].'</TD><TD>'.$rowccMc['ETAPA'].'</TD><TD> '.$rowccMc['DATA'].' </TD><TD> '.$rowccMc['GAZDA'].' </TD><TD> '.$rowccMc['GG'].' </TD><TD> '.$rowccMc['GO'].' </TD><TD> '.$rowccMc['OASPETE'].'</TD>';
  
  $sqlccEC = "SELECT * FROM cmeciuri, echipe WHERE echipe.ID=cmeciuri.GAZDA AND cmeciuri.ID=".$rowccMc['ID']." ORDER BY cmeciuri.ID ASC";
$resursaccEC = mysql_query($sqlccEC);

WHILE($rowccEC = mysql_fetch_array($resursaccEC))
{

  PRINT ' <TD> '.$rowccEC['ID'].' </TD><TD> '.$rowccEC['ECHIPA'].'</TD><TD> '.$rowccEC['JUDET'].'</TD>';

  

}  

$sqlccECO = "SELECT * FROM cmeciuri, echipe WHERE echipe.ID=cmeciuri.OASPETE AND cmeciuri.ID=".$rowccMc['ID']." ORDER BY cmeciuri.ID ASC";
$resursaccECO = mysql_query($sqlccECO);

WHILE($rowccECO = mysql_fetch_array($resursaccECO))
{

  PRINT ' <TD> '.$rowccECO['ID'].' </TD><TD> '.$rowccECO['ECHIPA'].'</TD><TD> '.$rowccECO['JUDET'].'</TD></Tr>';

  

}  }

 print '</table>';
 
 
  ?>
  <hr>
<p> Copyright 2012-2020 by Tralsbro Sibiu, Romania. All Rights Reserved.</P>
         </center>
  </body>
  </html>

//meciuri.php

     <html>
 
 <head>
 <script src="sorttable.js"></script>
<script src="dragtable.js"></script>
 
 <link rel="stylesheet" type="text/css" href="stdtheme.css" />
 
</head>
<body>
<?     include("meniuFotbal.php");?>
<br>
<table ><TR>

<?     
     //CONNECT
mysql_connect("localhost", "root", "");
mysql_select_db("fotbal");

//////////////////////////////////////////////salveaza////////////////////////////////////////////
if(isset($_POST['salveaza']))
{
$sqlm = "UPDATE meciuri SET meciuri.GG='".$_POST['sGG']."',meciuri.GO='".$_POST['sGO']."' WHERE meciuri.ID = ".$_POST['sID'] ;
mysql_query($sqlm);

print '<b>Modificarea a fost facuta!</b><br>';
echo "\n<meta http-equiv=\"refresh\" " . " content=\"3;URL=meciuri.php\">\n";

}
/////////////////////////////////////////////end salveaza////////////////////////////////////////


///////////////////////////////////////////////////////////////////////////////////////////////   

if(isset($_GET['etapa'])){
 

        $ETAPA = $_GET['etapa'];
 }       
 else
 {
  $ETAPA =1;
 
 }
for($i=1;$i<=34;$i++)
{

  PRINT '<TD><a href="meciuri.php?etapa='.$i.'">'.$i.'</a></TD>';
  
 }

///////////////////////////////////////////////////////////////////////////////////////////////
?>

</TR></TABLE> 
          <hr>
<TABLE class="sortabledraggable">
<TR><TD class="ESR">ID</TD><TD class="ESR">ETAPA</TD><TD class="ESR">DATA</TD><TD class="ESR">G</TD><TD class="ESR">GG</TD><TD class="ESR">GO</TD><TD class="ESR">O</TD><TD class="ESR">_</TD><TD class="ESR">G</TD><TD class="ESR">G</TD><TD class="ESR">J</TD><TD class="ESR">O</TD><TD class="ESR">O</TD><TD class="ESR">J</TD><TD class="ESR">Modify</TD></TR>
<?

$sqlMc = "SELECT * FROM meciuri WHERE ETAPA=".$ETAPA." ORDER BY meciuri.ID ASC";

$resursaMc = mysql_query($sqlMc);

WHILE($rowMc = mysql_fetch_array($resursaMc))
{

  PRINT '<TR><TD>'.$rowMc['ID'].' </TD><TD> '.$rowMc['ETAPA'].' </TD><TD> '.$rowMc['DATA'].' </TD><TD> '.$rowMc['GAZDA'].' </TD><TD> '.$rowMc['GG'].' </TD><TD> '.$rowMc['GO'].' </TD><TD> '.$rowMc['OASPETE'].'</TD><TD>';
  
  $sqlEC = "SELECT * FROM meciuri, echipe WHERE echipe.ID=meciuri.GAZDA AND meciuri.ID=".$rowMc['ID']." ORDER BY meciuri.ID ASC";
$resursaEC = mysql_query($sqlEC);

WHILE($rowEC = mysql_fetch_array($resursaEC))
{

  PRINT ' <TD> '.$rowEC['ID'].' </TD><TD> '.$rowEC['ECHIPA'].'</TD><TD> '.$rowEC['JUDET'].'</TD>';

  

}  

$sqlECO = "SELECT * FROM meciuri, echipe WHERE echipe.ID=meciuri.OASPETE AND meciuri.ID=".$rowMc['ID']." ORDER BY meciuri.ID ASC";
$resursaECO = mysql_query($sqlECO);

WHILE($rowECO = mysql_fetch_array($resursaECO))
{

  PRINT ' <TD> '.$rowECO['ID'].' </TD><TD> '.$rowECO['ECHIPA'].' </TD><TD> '.$rowECO['JUDET'].'</TD>';

    print '<TD><FORM action="meciuri.php" method="post">';
  print '<INPUT type="text" name="sGG" size="5" value="'.$rowMc['GG'].'"> - <INPUT type="text" name="sGO" size="5" value="'.$rowMc['GO'].'"><INPUT type="hidden" name="sID" size="5" value="'.$rowMc['ID'].'">';
  print '<input type="submit" value="save" id="save" name="salveaza" title="salveaza">';
  print '</FORM></TD></TR>';
  
  
  

}  



  

}  

//MECIURI COMPLETE
//////////////////////////////////////////////////////////////////


?>
</TABLE>

//logos.php

<?
       print '<br>';
mysql_connect("localhost", "root", "");
mysql_select_db("fotbal");

$sqlE = "SELECT * FROM echipe ORDER BY ID ASC";
$resursaE = mysql_query($sqlE);

 

WHILE($rowE = mysql_fetch_array($resursaE))
{

  
  
  $adresaimagine = "LOGO/".$rowE['ID'].".jpeg";
   if(file_exists($adresaimagine)) { 
     print '<A HREF="meciuriEchipa.php?id='.$rowE['ID'].'"><img src="'.$adresaimagine.'" width="20px" height="20px"></a>'; }
  
 
  }
  
  
  ?>

//index.php


     <html>
<title>fotbal index</title> 
 <head>
 <script src="sorttable.js"></script>
<script src="dragtable.js"></script>




 <link rel="stylesheet" type="text/css" href="stdtheme.css" />
</head>
<body> 
<?
      include("meniuFotbal.php");
      print'<br>'; 
      include("Clasament.php");  
?>

 
  
<? 
         
//CONNECT
mysql_connect("localhost", "root", "");
mysql_select_db("fotbal");

     
     print '<iframe src="meciuri.php" frameborder="0" height="400px" width="800px"></iframe>';
     print '<iframe src="fotbal.php" frameborder="0" height="800px" width="100%"></iframe>';
?>



<hr>

<p> Copyright 2012-2020 by Tralsbro Sibiu, Romania. All Rights Reserved.</P>

   </center></body>
 </html>


//fotbalmeciuri.php

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title></title>
<meta name="" content="">
</head>
<body   

<?
 include("meniuFotbal.php");
?>
<FORM action="http://somesite.com/prog/adduser" method="post">
    <P>
    First name: <INPUT type="text" name="firstname"><BR>
    Last name: <INPUT type="text" name="lastname"><BR>
    email: <INPUT type="text" name="email"><BR>
    <INPUT type="radio" name="sex" value="Male"> Male<BR>
    <INPUT type="radio" name="sex" value="Female"> Female<BR>
    <INPUT type="submit" value="Send"> <INPUT type="reset">
    </P>
 </FORM>
</body>
</html>



//fotbal.php

     <html>
 
 <head>        <link rel="stylesheet" type="text/css" href="stdtheme.css" />
 <script src="sorttable.js"></script>
<script src="dragtable.js"></script>




 <link rel="stylesheet" type="text/css" href="stdtheme.css" />
</head>
<body>   
<?
 include("meniuFotbal.php");   
?>  
<table class="sortabledraggable">
<? 
             
//CONNECT
mysql_connect("localhost", "root", "");
mysql_select_db("fotbal");


$sql = "SELECT * FROM regiuni ORDER BY ID ASC";
$resursa = mysql_query($sql);

WHILE($row = mysql_fetch_array($resursa))
{

  PRINT '<tr><TD>'.$row['ID'].'</TD><TD> '.$row['REGIUNE'].'</TD></tr>';

}  
 PRINT '<HR></table><table class="sortabledraggable">';
//REGIUNE
//////////////////////////////////////////////////////////////////
$sqlSR = "SELECT * FROM subregiuni ORDER BY ID ASC";
$resursaSR = mysql_query($sqlSR);

WHILE($rowSR = mysql_fetch_array($resursaSR))
{

  PRINT '<tr><td>'.$rowSR['ID'].' </TD><TD> '.$rowSR['SUBREGIUNE'].'</td></Tr>';

}  
 PRINT '</table><table class="sortabledraggable">';
//SUBREGIUNE
//////////////////////////////////////////////////////////////////
$sqlJ = "SELECT * FROM judete ORDER BY ID ASC";
$resursaJ = mysql_query($sqlJ);

WHILE($rowJ = mysql_fetch_array($resursaJ))
{

  PRINT '<Tr><TD>'.$rowJ['ID'].' </TD><TD> '.$rowJ['JUDET'].'</TD></Tr>';

}  
 PRINT '</table><table class="sortabledraggable">';
//JUDETE
//////////////////////////////////////////////////////////////////
//$sqlE = "SELECT * FROM echipe ORDER BY ID ASC";
$sqlE = "SELECT * FROM echipe ,clasament WHERE echipe.ID=clasament.ID ORDER BY clasament.PUNCTE DESC";
$resursaE = mysql_query($sqlE);
$Va;
$Ea;
$Ia;
$GMa;
$GOa;
$Vd;
$Ed;
$Id;
$GMd;
$GOd;



WHILE($rowE = mysql_fetch_array($resursaE))
{

  PRINT '<TR><TD>'.$rowE['ID'].' </TD><TD> '.$rowE['ECHIPA'].' </TD><TD> '.$rowE['JUDET'].'</TD>';


  ///////////////////////////////////STARTCLASAMENT//////////////////////////
  
$sqlMT = "SELECT GAZDA, COUNT(GAZDA) FROM meciuri WHERE meciuri.GAZDA =". $rowE['ID'] ." OR meciuri.OASPETE =". $rowE['ID'] ;
$resursaMT = mysql_query($sqlMT);

WHILE($rowMT = mysql_fetch_array($resursaMT))
{

  PRINT '<TD> '.$rowMT['COUNT(GAZDA)'].'</TD> ';

} 
//meciuri per echipa TOTAL 

$sqlVa = "SELECT GAZDA, COUNT(GAZDA) FROM meciuri WHERE (meciuri.GAZDA =". $rowE['ID'] .") AND (meciuri.GG > meciuri.GO)";
$resursaVa = mysql_query($sqlVa);

WHILE($rowVa = mysql_fetch_array($resursaVa))
{

  PRINT '<TD>'.$rowVa['COUNT(GAZDA)'].'</TD>';
                    $Va=$rowVa['COUNT(GAZDA)'];
} 
//VICTORII per echipa ACASA 

$sqlEQa = "SELECT GAZDA, COUNT(GAZDA) FROM meciuri WHERE (meciuri.GAZDA =". $rowE['ID'] .") AND (meciuri.GG = meciuri.GO)";
$resursaEQa = mysql_query($sqlEQa);

WHILE($rowEQa = mysql_fetch_array($resursaEQa))
{

  PRINT '<TD>'.$rowEQa['COUNT(GAZDA)'].'</TD> ';
                       $Ea=$rowEQa['COUNT(GAZDA)'];
} 
//AGALURI per echipa  ACASA

$sqlIa = "SELECT GAZDA, COUNT(GAZDA) FROM meciuri WHERE (meciuri.GAZDA =". $rowE['ID'] .") AND (meciuri.GG < meciuri.GO)";
$resursaIa = mysql_query($sqlIa);

WHILE($rowIa = mysql_fetch_array($resursaIa))
{

  PRINT '<TD>'.$rowIa['COUNT(GAZDA)'].'</TD> ';
                       $Ia=$rowIa['COUNT(GAZDA)'];
} 
//INFRANGERI per echipa  ACASA
////////////////////////////////////////////////////////////////////////////////////////////////
//DEPLASARE
////////////////////////////////////////////////////////////////////////////////////////////////
$sqlVd = "SELECT OASPETE, COUNT(OASPETE) FROM meciuri WHERE (meciuri.OASPETE =". $rowE['ID'] .") AND (meciuri.GG < meciuri.GO)";
$resursaVd = mysql_query($sqlVd);

WHILE($rowVd = mysql_fetch_array($resursaVd))
{

  PRINT '<TD>'.$rowVd['COUNT(OASPETE)'].'</TD> ';
                          $Vd=$rowVd['COUNT(OASPETE)'];
} 
//VICTORII per echipa DEPLASARE 

$sqlEQd = "SELECT OASPETE, COUNT(OASPETE) FROM meciuri WHERE (meciuri.OASPETE =". $rowE['ID'] .") AND (meciuri.GG = meciuri.GO)";
$resursaEQd = mysql_query($sqlEQd);

WHILE($rowEQd = mysql_fetch_array($resursaEQd))
{

  PRINT '<TD>'.$rowEQd['COUNT(OASPETE)'].'</TD> ';
                           $Ed=$rowEQd['COUNT(OASPETE)'];
} 
//AGALURI per echipa  DEPLASARE 

$sqlId = "SELECT OASPETE, COUNT(OASPETE) FROM meciuri WHERE (meciuri.OASPETE =". $rowE['ID'] .") AND (meciuri.GG > meciuri.GO)";
$resursaId = mysql_query($sqlId);

WHILE($rowId = mysql_fetch_array($resursaId))
{

  PRINT '<TD>'.$rowId['COUNT(OASPETE)'].' </TD>';
                           $Id=$rowId['COUNT(OASPETE)'];
} 
//INFRANGERI per echipa DEPLASARE 

$sqlGMa = "SELECT GG, SUM(GG) FROM meciuri WHERE (meciuri.GAZDA =". $rowE['ID'] .")";
$resursaGMa = mysql_query($sqlGMa);

WHILE($rowGMa = mysql_fetch_array($resursaGMa))
{

  PRINT '<TD>'.$rowGMa['SUM(GG)'].'</TD> ';
                        $GMa=$rowGMa['SUM(GG)'];
} 
//total goluri marcate  ACASA

$sqlGMd = "SELECT GO, SUM(GO) FROM meciuri WHERE (meciuri.OASPETE =". $rowE['ID'] .")";
$resursaGMd = mysql_query($sqlGMd);

WHILE($rowGMd = mysql_fetch_array($resursaGMd))
{

  PRINT '<TD>'.$rowGMd['SUM(GO)'].'</TD> ';
                         $GMd=$rowGMd['SUM(GO)'];
} 
//total goluri marcate DEPLASARE

$sqlGOa = "SELECT GO, SUM(GO) FROM meciuri WHERE (meciuri.GAZDA =". $rowE['ID'] .")";
$resursaGOa = mysql_query($sqlGOa);

WHILE($rowGOa = mysql_fetch_array($resursaGOa))
{

  PRINT '<TD>'.$rowGOa['SUM(GO)'].'</TD> ';
                        $GOa=$rowGOa['SUM(GO)'];
} 
//total goluri PRIMITE  ACASA

$sqlGOd = "SELECT GG, SUM(GG) FROM meciuri WHERE (meciuri.OASPETE =". $rowE['ID'] .")";
$resursaGOd = mysql_query($sqlGOd);

WHILE($rowGOd = mysql_fetch_array($resursaGOd))
{

  PRINT '<TD>'.$rowGOd['SUM(GG)'].'</TD> ';
                                 $GOd=$rowGOd['SUM(GG)'];
} 
//total goluri PRIMITE DEPLASARE



/////////////////////////////////////////////////////////////


   $Vt=$Va+$Vd;
$Et=$Ea+ $Ed;
$It=$Ia+ $Id;
$GMt=$GMa+ $GMd;
$GOt=$GOa+ $GOd;
$GOL=$GMt-$GOt;
$PCTa=($Va*3)+($Ea*1);
$PCTd=($Vd*3)+($Ed*1) ;
$PCT= $PCTa+$PCTd ;
$ADVa=(-1)*($Ia*3)+($Ea*2);
$ADVd=($Vd*3)+($Ed*1) ;
$ADV= $ADVa+$ADVd ;

   print '<TD>'.$Vt.'</TD><TD> '.$Et.' </TD><TD>'. $It.' </TD><TD>'. $GMt.'</TD><TD> '. $GOt.' </TD><TD>'. $GOL.'</TD><TD> '. $PCTa.'</TD><TD> '. $PCTd.' </TD><TD>'. $PCT.' </TD><TD>'. $ADVa.' </TD><TD>'. $ADVd.' </TD><TD>'. $ADV.'</TD></tr> ';
}
 ///////////////////////////////////ENDCLASAMENT//////////////////////////
  
 PRINT '</table><table class="sortabledraggable">';
//ECHIPE
//////////////////////////////////////////////////////////////////
$sqlM = "SELECT * FROM meciuri ORDER BY ID ASC";
$resursaM = mysql_query($sqlM);

WHILE($rowM = mysql_fetch_array($resursaM))
{

  PRINT '<tr><TD>'.$rowM['ID'].' </TD><TD> '.$rowM['ETAPA'].' </TD><TD> '.$rowM['DATA'].' </TD><TD> '.$rowM['GAZDA'].' </TD><TD> '.$rowM['GG'].' </TD><TD> '.$rowM['GO'].' </TD><TD> '.$rowM['OASPETE'].'</TD></tr>';

}  
 
//MECIURI
//////////////////////////////////////////////////////////////////
$sqlcM = "SELECT * FROM cmeciuri ORDER BY ID ASC";
$resursacM = mysql_query($sqlcM);

WHILE($rowcM = mysql_fetch_array($resursacM))
{

  PRINT '<tr><TD>'.$rowcM['ID'].' </TD><TD> '.$rowcM['ETAPA'].' </TD><TD> '.$rowcM['DATA'].' </TD><TD> '.$rowcM['GAZDA'].' </TD><TD> '.$rowcM['GG'].' </TD><TD> '.$rowcM['GO'].' </TD><TD> '.$rowcM['OASPETE'].'</TD></tr>';

}  
 PRINT '</table><table class="sortabledraggable">';
//MECIURI
//////////////////////////////////////////////////////////////////

$sqlMc = "SELECT * FROM meciuri ORDER BY meciuri.ID ASC";
$resursaMc = mysql_query($sqlMc);

WHILE($rowMc = mysql_fetch_array($resursaMc))
{

  PRINT '<tr><td>'.$rowMc['ID'].' </TD><TD> '.$rowMc['ETAPA'].' </TD><TD> '.$rowMc['DATA'].' </TD><TD> '.$rowMc['GAZDA'].' </TD><TD> '.$rowMc['GG'].' </TD><TD> '.$rowMc['GO'].' </TD><TD> '.$rowMc['OASPETE'].'</TD>';
  
  $sqlEC = "SELECT * FROM meciuri, echipe WHERE echipe.ID=meciuri.GAZDA AND meciuri.ID=".$rowMc['ID']." ORDER BY meciuri.ID ASC";
$resursaEC = mysql_query($sqlEC);

WHILE($rowEC = mysql_fetch_array($resursaEC))
{

  PRINT ' <TD> '.$rowEC['ID'].' </TD><TD> '.$rowEC['ECHIPA'].' </TD><TD> '.$rowEC['JUDET'].'</TD>';

  

}  

$sqlECO = "SELECT * FROM meciuri, echipe WHERE echipe.ID=meciuri.OASPETE AND meciuri.ID=".$rowMc['ID']." ORDER BY meciuri.ID ASC";
$resursaECO = mysql_query($sqlECO);

WHILE($rowECO = mysql_fetch_array($resursaECO))
{

  PRINT ' <TD> '.$rowECO['ID'].' </TD><TD> '.$rowECO['ECHIPA'].' </TD><TD> '.$rowECO['JUDET'].'</TD></tr>';

  

}  



  

}  
 PRINT '</table>';
//MECIURI COMPLETE
//////////////////////////////////////////////////////////////////


/////////////////////meciuri nejucate inca/////////////////////////////////

$sqlccMc = "SELECT * FROM cmeciuri ORDER BY cmeciuri.ID ASC";
$resursaccMc = mysql_query($sqlccMc);

print '<table class="sortabledraggable">';

WHILE($rowccMc = mysql_fetch_array($resursaccMc))
{

  PRINT '<tr><td>'.$rowccMc['ID'].'</TD><TD>'.$rowccMc['ETAPA'].'</TD><TD> '.$rowccMc['DATA'].' </TD><TD> '.$rowccMc['GAZDA'].' </TD><TD> '.$rowccMc['GG'].' </TD><TD> '.$rowccMc['GO'].' </TD><TD> '.$rowccMc['OASPETE'].'</TD>';
  
  $sqlccEC = "SELECT * FROM cmeciuri, echipe WHERE echipe.ID=cmeciuri.GAZDA AND cmeciuri.ID=".$rowccMc['ID']." ORDER BY cmeciuri.ID ASC";
$resursaccEC = mysql_query($sqlccEC);

WHILE($rowccEC = mysql_fetch_array($resursaccEC))
{

  PRINT ' <TD> '.$rowccEC['ID'].' </TD><TD> '.$rowccEC['ECHIPA'].'</TD><TD> '.$rowccEC['JUDET'].'</TD><TD>';

  

}  

$sqlccECO = "SELECT * FROM cmeciuri, echipe WHERE echipe.ID=cmeciuri.OASPETE AND cmeciuri.ID=".$rowccMc['ID']." ORDER BY cmeciuri.ID ASC";
$resursaccECO = mysql_query($sqlccECO);

WHILE($rowccECO = mysql_fetch_array($resursaccECO))
{

  PRINT ' <TD> '.$rowccECO['ID'].' </TD><TD> '.$rowccECO['ECHIPA'].'</TD><TD> '.$rowccECO['JUDET'].'</TD></Tr>';

  

}  



  

}  
print '</table>';
 PRINT '<HR>';
//MECIURI COMPLETE
//////////////////////////////////////////////////////////////////

?>
</body>
 </html>

//fotball.php

     <html>
<title>CLASAMENT</title> 
 <head>
 <script src="sorttable.js"></script>
<script src="dragtable.js"></script>




 <link rel="stylesheet" type="text/css" href="stdtheme.css" />
</head>
      <body>
               <?
                    include("meniuFotbal.php");
               ?>
<hr>
<center><H1>Liga I 2011-2012 CLASAMENT</H1>
<hr>


  
<? 
             
//CONNECT
mysql_connect("localhost", "root", "");
mysql_select_db("fotbal");

     
             
             
             $S=19;
    IF($S>=19){
    ?>
    
    <table > <tr>  
  <td><table> <tr> <th>LOC</th> <th>o</th></tr>
 <?
  $ik=1;
  for($ik;$ik<=18;$ik++){
  print '
 <tr>
  <td class="ESR">'.$ik.'</td><td class="ESR"><img src="LOGO/0.jpeg" width="1px" height="20px"></td>
 </tr> ';
  }
  ?>
  
 
</table></td>
  <td>
  
 
    
    <?    
     print '<table class="sortabledraggable"><tr><th>loc</th><th>nr</th><th>echipa</th><th>judet</th>
     <th>MT</th><th>VA</th><th>EA</th><th>IA</th><th>VD</th>
     <th>ED</th><th>ID</th><th>GMA</th><th>GMD</th><th>GOA</th>
     <th>GOD</th><th>Vt</th><th>Et</th><th>It</th><th>GMt</th><th>GOt</th><th>GOL</th><th>PCTa</th><th>
     PCTd</th><th>PCT</th><th>ADVa</th><th>ADVd</th><th>ADV</th><th>Ma</th><th>Md</th><th>GOLa</th><th>GOLd</th><TH>LOGO</TH></tr>';

$sqlE = "SELECT * FROM echipe ,clasament WHERE echipe.ID=clasament.ID ORDER BY   clasament.PUNCTE DESC,  clasament.GOL DESC,clasament.GM DESC";
//
$resursaE = mysql_query($sqlE);
$Va;
$Ea;
$Ia;
$GMa;
$GOa;
$Vd;
$Ed;
$Id;
$GMd;
$GOd;
$Ma;
$Md;
$GOLa;
$GOLd;
$kloc=1;



WHILE($rowE = mysql_fetch_array($resursaE))
{

  PRINT '<tr><td>'.$kloc++.'</td><td><A HREF=meciuriEchipa.php?id="'.$rowE['ID'].'">'.$rowE['ID'].'</A></td><td class="ESR"> '.$rowE['ECHIPA'].' </td><td>'.$rowE['JUDET'].'</td>';


  ///////////////////////////////////STARTCLASAMENT//////////////////////////
  
$sqlMT = "SELECT GAZDA, COUNT(GAZDA) FROM meciuri WHERE meciuri.GAZDA =". $rowE['ID'] ." OR meciuri.OASPETE =". $rowE['ID'] ;
$resursaMT = mysql_query($sqlMT);

WHILE($rowMT = mysql_fetch_array($resursaMT))
{

  PRINT '<td class="ESR"> '.$rowMT['COUNT(GAZDA)'].'</td> ';

} 
//meciuri per echipa TOTAL 

$sqlVa = "SELECT GAZDA, COUNT(GAZDA) FROM meciuri WHERE (meciuri.GAZDA =". $rowE['ID'] .") AND (meciuri.GG > meciuri.GO)";
$resursaVa = mysql_query($sqlVa);

WHILE($rowVa = mysql_fetch_array($resursaVa))
{

  PRINT '<td>'.$rowVa['COUNT(GAZDA)'].'</td> ';
                    $Va=$rowVa['COUNT(GAZDA)'];
} 
//VICTORII per echipa ACASA 

$sqlEQa = "SELECT GAZDA, COUNT(GAZDA) FROM meciuri WHERE (meciuri.GAZDA =". $rowE['ID'] .") AND (meciuri.GG = meciuri.GO)";
$resursaEQa = mysql_query($sqlEQa);

WHILE($rowEQa = mysql_fetch_array($resursaEQa))
{

  PRINT '<td>'.$rowEQa['COUNT(GAZDA)'].'</td> ';
                       $Ea=$rowEQa['COUNT(GAZDA)'];
} 
//AGALURI per echipa  ACASA

$sqlIa = "SELECT GAZDA, COUNT(GAZDA) FROM meciuri WHERE (meciuri.GAZDA =". $rowE['ID'] .") AND (meciuri.GG < meciuri.GO)";
$resursaIa = mysql_query($sqlIa);

WHILE($rowIa = mysql_fetch_array($resursaIa))
{

  PRINT '<td>'.$rowIa['COUNT(GAZDA)'].'</td> ';
                       $Ia=$rowIa['COUNT(GAZDA)'];
} 
//INFRANGERI per echipa  ACASA
////////////////////////////////////////////////////////////////////////////////////////////////
//DEPLASARE
////////////////////////////////////////////////////////////////////////////////////////////////
$sqlVd = "SELECT OASPETE, COUNT(OASPETE) FROM meciuri WHERE (meciuri.OASPETE =". $rowE['ID'] .") AND (meciuri.GG < meciuri.GO)";
$resursaVd = mysql_query($sqlVd);

WHILE($rowVd = mysql_fetch_array($resursaVd))
{

  PRINT '<td>'.$rowVd['COUNT(OASPETE)'].'</td> ';
                          $Vd=$rowVd['COUNT(OASPETE)'];
} 
//VICTORII per echipa DEPLASARE 

$sqlEQd = "SELECT OASPETE, COUNT(OASPETE) FROM meciuri WHERE (meciuri.OASPETE =". $rowE['ID'] .") AND (meciuri.GG = meciuri.GO)";
$resursaEQd = mysql_query($sqlEQd);

WHILE($rowEQd = mysql_fetch_array($resursaEQd))
{

  PRINT '<td>'.$rowEQd['COUNT(OASPETE)'].'</td> ';
                           $Ed=$rowEQd['COUNT(OASPETE)'];
} 
//AGALURI per echipa  DEPLASARE 

$sqlId = "SELECT OASPETE, COUNT(OASPETE) FROM meciuri WHERE (meciuri.OASPETE =". $rowE['ID'] .") AND (meciuri.GG > meciuri.GO)";
$resursaId = mysql_query($sqlId);

WHILE($rowId = mysql_fetch_array($resursaId))
{

  PRINT '<td>'.$rowId['COUNT(OASPETE)'].'</td> ';
                           $Id=$rowId['COUNT(OASPETE)'];
} 
//INFRANGERI per echipa DEPLASARE 

$sqlGMa = "SELECT GG, SUM(GG) FROM meciuri WHERE (meciuri.GAZDA =". $rowE['ID'] .")";
$resursaGMa = mysql_query($sqlGMa);

WHILE($rowGMa = mysql_fetch_array($resursaGMa))
{

  PRINT '<td>'.$rowGMa['SUM(GG)'].'</td> ';
                        $GMa=$rowGMa['SUM(GG)'];
} 
//total goluri marcate  ACASA

$sqlGMd = "SELECT GO, SUM(GO) FROM meciuri WHERE (meciuri.OASPETE =". $rowE['ID'] .")";
$resursaGMd = mysql_query($sqlGMd);

WHILE($rowGMd = mysql_fetch_array($resursaGMd))
{

  PRINT '<td>'.$rowGMd['SUM(GO)'].'</td> ';
                         $GMd=$rowGMd['SUM(GO)'];
} 
//total goluri marcate DEPLASARE

$sqlGOa = "SELECT GO, SUM(GO) FROM meciuri WHERE (meciuri.GAZDA =". $rowE['ID'] .")";
$resursaGOa = mysql_query($sqlGOa);

WHILE($rowGOa = mysql_fetch_array($resursaGOa))
{

  PRINT '<td>'.$rowGOa['SUM(GO)'].' </td>';
                        $GOa=$rowGOa['SUM(GO)'];
} 
//total goluri PRIMITE  ACASA

$sqlGOd = "SELECT GG, SUM(GG) FROM meciuri WHERE (meciuri.OASPETE =". $rowE['ID'] .")";
$resursaGOd = mysql_query($sqlGOd);

WHILE($rowGOd = mysql_fetch_array($resursaGOd))
{

  PRINT '<td>'.$rowGOd['SUM(GG)'].'</td> ';
                                 $GOd=$rowGOd['SUM(GG)'];
} 
//total goluri PRIMITE DEPLASARE
////////////////////////////////////////////////////////
$Vt=$Va+$Vd;
$Et=$Ea+ $Ed;
$It=$Ia+ $Id;
$GMt=$GMa+ $GMd;
$GOt=$GOa+ $GOd;
$GOL=$GMt-$GOt;
$PCTa=($Va*3)+($Ea*1);
$PCTd=($Vd*3)+($Ed*1) ;
$PCT= $PCTa+$PCTd ;
$ADVa=(($Ia*3)+($Ea*2))*(-1);
$ADVd=($Vd*3)+($Ed*1) ;
$ADV= $ADVa+$ADVd ;
$Ma=$Va+$Ea+$Ia;
$Md=$Vd+$Ed+$Id;
$GOLa=$GMa-$GOa;
$GOLd=$GMd-$GOd;


print ' <td class="ESR">'.$Vt.'</td><td class="ESR"> '.$Et.' </td><td class="ESR">'.$It.'</td><td class="ESR"> '.$GMt.'</td><td class="ESR"> '.$GOt.'</td><td class="ESR"> '.$GOL.' </td><td>'.$PCTa.'</td><td> '.$PCTd.'</td><td class="ESR"> '.$PCT.'</td><td> '.$ADVa.'</td><td> '.$ADVd.'</td><td class="ESR"> '.$ADV.'</td>';
print '<td> '.$Ma.'</td><td> '.$Md.'</td><td> '.$GOLa.'</td><td> '.$GOLd.'</td>';

$adresaimagine = "LOGO/".$rowE['ID'].".jpeg";
   if(file_exists($adresaimagine)) { 
     print '<td class="ESR"><A HREF="meciuriEchipa.php?id='.$rowE['ID'].'"><img src="'.$adresaimagine.'" width="20px" height="20px"></a></td>'; }
  
  
 print '</tr>';

 $sqlm = "UPDATE clasament SET clasament.PUNCTE='".$PCT."' WHERE CLASAMENT.ID = ".$rowE['ID'] ;
mysql_query($sqlm);
 
 $sqlgol = "UPDATE clasament SET clasament.GOL='".$GOL."' WHERE CLASAMENT.ID = ".$rowE['ID'] ;
mysql_query($sqlgol);

 $sqlgm = "UPDATE clasament SET clasament.GM='".$GMt."' WHERE CLASAMENT.ID = ".$rowE['ID'] ;
mysql_query($sqlgm);

}
 ///////////////////////////////////ENDCLASAMENT//////////////////////////
 
//ECHIPE
     print '</table>';
     }
     PRINT'</td>
 </tr>
</table>';
        
?>



<hr>

<p> Copyright 2012-2020 by Tralsbro Sibiu, Romania. All Rights Reserved.</P>

   </center></body>
 </html>



//etape.php

     <html>
<title>TABEL ETAPE</title> 
 <head>
 <script src="sorttable.js"></script>
<script src="dragtable.js"></script>




 <link rel="stylesheet" type="text/css" href="stdtheme.css" />
</head>

<hr>
<center><H1>Liga I 2011-2012 ETAPA</H1>
<hr>

  
 
  
<? 
      include("meniuFotbal.php");           
//CONNECT
mysql_connect("localhost", "root", "");
mysql_select_db("fotbal");

    $sqlEE = "SELECT * FROM echipe ORDER BY ID ASC";

$resursaEE = mysql_query($sqlEE);
  
  PRINT '<br><TABLE><TR><TH>LOGO</TH>';
  
WHILE($rowEE = mysql_fetch_array($resursaEE))
{
PRINT '<TH>';
  $adresaimagine = "LOGO/".$rowEE['ID'].".jpeg";
     if(file_exists($adresaimagine)) { 
     print '<A HREF="meciuriEchipa.php?id='.$rowEE['ID'].'"><img src="'.$adresaimagine.'" width="20px" height="20px"></a></TH>';
             }
}
  

 PRINT '</TR>';

  FOR($I=1;$I<=18;$I++){
    $sqlE = "SELECT * FROM echipe WHERE ID=".$I." ORDER BY ID ASC";
    $resursaE = mysql_query($sqlE);
    $rowE = mysql_fetch_array($resursaE);

PRINT '<TR><TD  class="ESR">';

  $adresaimagine = "LOGO/".$rowE['ID'].".jpeg";
     if(file_exists($adresaimagine)) { 
     print '<A HREF="meciuriEchipa.php?id='.$rowE['ID'].'">';
      print '<img src="'.$adresaimagine.'" width="20px" height="20px"></a></TD>';
             }
    
  FOR($J=1;$J<=18;$J++){
    $sqlES = "SELECT * FROM meciuri WHERE GAZDA=".$I." AND OASPETE=".$J." ORDER BY GAZDA ASC";
    $resursaES = mysql_query($sqlES);
    $rowES = mysql_fetch_array($resursaES);
    
    $sqlESR = "SELECT * FROM cmeciuri WHERE GAZDA=".$I." AND OASPETE=".$J." ORDER BY GAZDA ASC";
    $resursaESR = mysql_query($sqlESR);
    $rowESR = mysql_fetch_array($resursaESR);
                  
      if($I==$J)
      {
      PRINT '<TD> x </TD>';
      }
      else
      { IF($rowES!=''){
      PRINT '<TD>'.$rowES['ETAPA'].'</TD>';
         }else{
      PRINT '<TD class="ESR">'.$rowESR['ETAPA'].'</TD>';
      }
      } 
    
  }       
      PRINT '</TR>';
}
    PRINT '</TABLE>';
?>
<hr>
<p> Copyright 2012-2020 by Tralsbro Sibiu, Romania. All Rights Reserved.</P>
   </center></body>
 </html>


//etapacurenta.php

     <html>
 
 <head>        <link rel="stylesheet" type="text/css" href="stdtheme.css" />
 <script src="sorttable.js"></script>
<script src="dragtable.js"></script>




 <link rel="stylesheet" type="text/css" href="stdtheme.css" />
</head>
<body>   
<?
 include("meniuFotbal.php");   
?>  
<table class="sortabledraggable">
<?
for($i=1;$i<=34;$i++)
{

  PRINT '| <a href="Etapacurenta.php?id='.$i.'">'.$i.'</a> |';
  
 }
 if(isset($_GET['id'])){
 

        $nretapa = $_GET['id'];
 }       
 else
 {
    $nretapa=1;
  }
?>

<? 
             
//CONNECT
mysql_connect("localhost", "root", "");
mysql_select_db("fotbal");





$sqlE = "SELECT * FROM echipe ORDER BY ID ASC";
$resursaE = mysql_query($sqlE);


  
 PRINT '<hr><p>SAU JUCAT</p><HR><table class="sortabledraggable">';




$sqlMc = "SELECT * FROM meciuri WHERE meciuri.ETAPA=".$nretapa." ORDER BY meciuri.ID ASC";
$resursaMc = mysql_query($sqlMc);

WHILE($rowMc = mysql_fetch_array($resursaMc))
{

  PRINT '<tr><td>'.$rowMc['ID'].' </TD><TD> '.$rowMc['ETAPA'].' </TD><TD> '.$rowMc['DATA'].' </TD><TD> '.$rowMc['GAZDA'].' </TD><TD> '.$rowMc['GG'].' </TD><TD> '.$rowMc['GO'].' </TD><TD> '.$rowMc['OASPETE'].'</TD>';
  
  $sqlEC = "SELECT * FROM meciuri, echipe WHERE echipe.ID=meciuri.GAZDA AND meciuri.ID=".$rowMc['ID']." ORDER BY meciuri.ID ASC";
$resursaEC = mysql_query($sqlEC);

WHILE($rowEC = mysql_fetch_array($resursaEC))
{

  PRINT ' <TD> '.$rowEC['ID'].' </TD><TD> '.$rowEC['ECHIPA'].' </TD><TD> '.$rowEC['JUDET'].'</TD>';

  

}  

$sqlECO = "SELECT * FROM meciuri, echipe WHERE echipe.ID=meciuri.OASPETE AND meciuri.ID=".$rowMc['ID']." ORDER BY meciuri.ID ASC";
$resursaECO = mysql_query($sqlECO);

WHILE($rowECO = mysql_fetch_array($resursaECO))
{

  PRINT ' <TD> '.$rowECO['ID'].' </TD><TD> '.$rowECO['ECHIPA'].' </TD><TD> '.$rowECO['JUDET'].'</TD></tr>';

  

}  



  

}  
 PRINT '</table><hr><p>NEJUCATE</p>';
//MECIURI COMPLETE
//////////////////////////////////////////////////////////////////


/////////////////////meciuri nejucate inca/////////////////////////////////

$sqlccMc = "SELECT * FROM cmeciuri WHERE cmeciuri.ETAPA=".$nretapa." ORDER BY cmeciuri.ID ASC";
$resursaccMc = mysql_query($sqlccMc);

print '<table class="sortabledraggable">';

WHILE($rowccMc = mysql_fetch_array($resursaccMc))
{

  PRINT '<tr><td>'.$rowccMc['ID'].'</TD><TD>'.$rowccMc['ETAPA'].'</TD><TD> '.$rowccMc['DATA'].' </TD><TD> '.$rowccMc['GAZDA'].' </TD><TD> '.$rowccMc['GG'].' </TD><TD> '.$rowccMc['GO'].' </TD><TD> '.$rowccMc['OASPETE'].'</TD>';
  
  $sqlccEC = "SELECT * FROM cmeciuri, echipe WHERE echipe.ID=cmeciuri.GAZDA AND cmeciuri.ID=".$rowccMc['ID']." ORDER BY cmeciuri.ID ASC";
$resursaccEC = mysql_query($sqlccEC);

WHILE($rowccEC = mysql_fetch_array($resursaccEC))
{

  PRINT ' <TD> '.$rowccEC['ID'].' </TD><TD> '.$rowccEC['ECHIPA'].'</TD><TD> '.$rowccEC['JUDET'].'</TD><TD>';

  

}  

$sqlccECO = "SELECT * FROM cmeciuri, echipe WHERE echipe.ID=cmeciuri.OASPETE AND cmeciuri.ID=".$rowccMc['ID']." ORDER BY cmeciuri.ID ASC";
$resursaccECO = mysql_query($sqlccECO);

WHILE($rowccECO = mysql_fetch_array($resursaccECO))
{

  PRINT ' <TD> '.$rowccECO['ID'].' </TD><TD> '.$rowccECO['ECHIPA'].'</TD><TD> '.$rowccECO['JUDET'].'</TD></Tr>';

  

}  



  

}  
print '</table>';
 PRINT '<HR>';
//MECIURI COMPLETE
//////////////////////////////////////////////////////////////////

?>
</body>
 </html>

//echipe.php

     <html>
 
 <head>   <link rel="stylesheet" type="text/css" href="stdtheme.css" />
 <script src="sorttable.js"></script>
<script src="dragtable.js"></script>
     </head><body><center>
<?
                   include("meniuFotbal.php");print'<BR>';
mysql_connect("localhost", "root", "");
mysql_select_db("fotbal");

//$sqlE = "SELECT * FROM echipe ORDER BY ID ASC";
$sqlE = "SELECT * FROM echipe ,clasament WHERE echipe.ID=clasament.ID ORDER BY clasament.PUNCTE DESC";
$resursaE = mysql_query($sqlE);

 PRINT '<table class="sortabledraggable"><tr><th>ID</th><th>ECHIPA</th><th>JUDET</th><th>LOGO</th></tr>';

WHILE($rowE = mysql_fetch_array($resursaE))
{

  PRINT '<TR><TD  class="ESR"><a href="meciuriEchipa.php?id='.$rowE['ID'].'">'.$rowE['ID'].'</a></TD><TD class="ESR">'.$rowE['ECHIPA'].'</TD><TD class="ESR"> '.$rowE['JUDET'].'</TD><td class="ESR">';
  
  $adresaimagine = "LOGO/".$rowE['ID'].".jpeg";
   if(file_exists($adresaimagine)) { 
     print '<A HREF="meciuriEchipa.php?id='.$rowE['ID'].'"><img src="'.$adresaimagine.'" width="20px" height="20px"></a>'; }
  
  print '</td></tr>';
  }
  
  print '</table>';
  ?>
  <hr>
<p> Copyright 2012-2020 by Tralsbro Sibiu, Romania. All Rights Reserved.</P>    </center>
  </body>
  </html>



//dragtable.js

/*
  dragtable v1.0
  June 26, 2008
  Dan Vanderkam, http://danvk.org/dragtable/
                 http://code.google.com/p/dragtable/
                      \Bsortabledraggable\B
  Instructions:
    - Download this file
    - Add <script src="dragtable.js"></script> to your HTML.
    - Add class="draggable" to any table you might like to reorder.
    - Drag the headers around to reorder them.

  This is code was based on:
    - Stuart Langridge's SortTable (kryogenix.org/code/browser/sorttable)
    - Mike Hall's draggable class (http://www.brainjar.com/dhtml/drag/)
    - A discussion of permuting table columns on comp.lang.javascript

  Licensed under the MIT license.
 */

// Here's the notice from Mike Hall's draggable script:
//*****************************************************************************
// Do not remove this notice.
//
// Copyright 2001 by Mike Hall.
// See http://www.brainjar.com for terms of use.
//*****************************************************************************
dragtable = {
  // How far should the mouse move before it's considered a drag, not a click?
  dragRadius2: 100,
  setMinDragDistance: function(x) {
    dragtable.dragRadius2 = x * x;
  },

  // How long should cookies persist? (in days)
  cookieDays: 365,
  setCookieDays: function(x) {
    dragtable.cookieDays = x;
  },

  // Determine browser and version.
  // TODO: eliminate browser sniffing except where it's really necessary.
  Browser: function() {
    var ua, s, i;

    this.isIE    = false;
    this.isNS    = false;
    this.version = null;
    ua = navigator.userAgent;

    s = "MSIE";
    if ((i = ua.indexOf(s)) >= 0) {
      this.isIE = true;
      this.version = parseFloat(ua.substr(i + s.length));
      return;
    }

    s = "Netscape6/";
    if ((i = ua.indexOf(s)) >= 0) {
      this.isNS = true;
      this.version = parseFloat(ua.substr(i + s.length));
      return;
    }

    // Treat any other "Gecko" browser as NS 6.1.
    s = "Gecko";
    if ((i = ua.indexOf(s)) >= 0) {
      this.isNS = true;
      this.version = 6.1;
      return;
    }
  },
  browser: null,

  // Detect all draggable tables and attach handlers to their headers.
  init: function() {
    // Don't initialize twice
    if (arguments.callee.done) return;
    arguments.callee.done = true;
    if (_dgtimer) clearInterval(_dgtimer);
    if (!document.createElement || !document.getElementsByTagName) return;

    dragtable.dragObj.zIndex = 0;
    dragtable.browser = new dragtable.Browser();
    forEach(document.getElementsByTagName('table'), function(table) {
      if (table.className.search(/\bsortabledraggable\b/) != -1) {
        dragtable.makeDraggable(table);
      }
    });
  },

  // The thead business is taken straight from sorttable.
  makeDraggable: function(table) {
    if (table.getElementsByTagName('thead').length == 0) {
      the = document.createElement('thead');
      the.appendChild(table.rows[0]);
      table.insertBefore(the,table.firstChild);
    }

    // Safari doesn't support table.tHead, sigh
    if (table.tHead == null) {
      table.tHead = table.getElementsByTagName('thead')[0];
    }

    var headers = table.tHead.rows[0].cells;
    for (var i = 0; i < headers.length; i++) {
      headers[i].onmousedown = dragtable.dragStart;
    }

  // Replay reorderings from cookies if there are any.
  if (dragtable.cookiesEnabled() && table.id &&
    table.className.search(/\bforget-ordering\b/) == -1) {
   dragtable.replayDrags(table);
  }
  },

  // Global object to hold drag information.
  dragObj: new Object(),

  // Climb up the DOM until there's a tag that matches.
  findUp: function(elt, tag) {
    do {
      if (elt.nodeName && elt.nodeName.search(tag) != -1)
        return elt;
    } while (elt = elt.parentNode);
    return null;
  },

  // clone an element, copying its style and class.
  fullCopy: function(elt, deep) {
    var new_elt = elt.cloneNode(deep);
    new_elt.className = elt.className;
    forEach(elt.style,
        function(value, key, object) {
          if (value == null) return;
          if (typeof(value) == "string" && value.length == 0) return;

          new_elt.style[key] = elt.style[key];
        });
    return new_elt;
  },

  eventPosition: function(event) {
    var x, y;
    if (dragtable.browser.isIE) {
      x = window.event.clientX + document.documentElement.scrollLeft
        + document.body.scrollLeft;
      y = window.event.clientY + document.documentElement.scrollTop
        + document.body.scrollTop;
      return {x: x, y: y};
    }
    return {x: event.pageX, y: event.pageY};
  },

 // Determine the position of this element on the page. Many thanks to Magnus
 // Kristiansen for help making this work with "position: fixed" elements.
 absolutePosition: function(elt, stopAtRelative) {
   var ex = 0, ey = 0;
   do {
     var curStyle = dragtable.browser.isIE ? elt.currentStyle
                                           : window.getComputedStyle(elt, '');
     var supportFixed = !(dragtable.browser.isIE &&
                          dragtable.browser.version < 7);
     if (stopAtRelative && curStyle.position == 'relative') {
       break;
     } else if (supportFixed && curStyle.position == 'fixed') {
       // Get the fixed el's offset
       ex += parseInt(curStyle.left, 10);
       ey += parseInt(curStyle.top, 10);
       // Compensate for scrolling
       ex += document.body.scrollLeft;
       ey += document.body.scrollTop;
       // End the loop
       break;
     } else {
       ex += elt.offsetLeft;
       ey += elt.offsetTop;
     }
   } while (elt = elt.offsetParent);
   return {x: ex, y: ey};
 },

  // MouseDown handler -- sets up the appropriate mousemove/mouseup handlers
  // and fills in the global dragtable.dragObj object.
  dragStart: function(event, id) {
    var el;
    var x, y;
    var dragObj = dragtable.dragObj;

    var browser = dragtable.browser;
    if (browser.isIE)
      dragObj.origNode = window.event.srcElement;
    else
      dragObj.origNode = event.target;
    var pos = dragtable.eventPosition(event);

    // Drag the entire table cell, not just the element that was clicked.
    dragObj.origNode = dragtable.findUp(dragObj.origNode, /T[DH]/);

    // Since a column header can't be dragged directly, duplicate its contents
    // in a div and drag that instead.
    // TODO: I can assume a tHead...
    var table = dragtable.findUp(dragObj.origNode, "TABLE");
    dragObj.table = table;
    dragObj.startCol = dragtable.findColumn(table, pos.x);
    if (dragObj.startCol == -1) return;

    var new_elt = dragtable.fullCopy(table, false);
    new_elt.style.margin = '0';

    // Copy the entire column
    var copySectionColumn = function(sec, col) {
      var new_sec = dragtable.fullCopy(sec, false);
      forEach(sec.rows, function(row) {
        var cell = row.cells[col];
        var new_tr = dragtable.fullCopy(row, false);
        if (row.offsetHeight) new_tr.style.height = row.offsetHeight + "px";
        var new_td = dragtable.fullCopy(cell, true);
        if (cell.offsetWidth) new_td.style.width = cell.offsetWidth + "px";
        new_tr.appendChild(new_td);
        new_sec.appendChild(new_tr);
      });
      return new_sec;
    };

    // First the heading
    if (table.tHead) {
      new_elt.appendChild(copySectionColumn(table.tHead, dragObj.startCol));
    }
    forEach(table.tBodies, function(tb) {
      new_elt.appendChild(copySectionColumn(tb, dragObj.startCol));
    });
    if (table.tFoot) {
      new_elt.appendChild(copySectionColumn(table.tFoot, dragObj.startCol));
    }

    var obj_pos = dragtable.absolutePosition(dragObj.origNode, true);
    new_elt.style.position = "absolute";
    new_elt.style.left = obj_pos.x + "px";
    new_elt.style.top = obj_pos.y + "px";
    new_elt.style.width = dragObj.origNode.offsetWidth + "px";
    new_elt.style.height = dragObj.origNode.offsetHeight + "px";
    new_elt.style.opacity = 0.7;

    // Hold off adding the element until this is clearly a drag.
    dragObj.addedNode = false;
    dragObj.tableContainer = dragObj.table.parentNode || document.body;
    dragObj.elNode = new_elt;

    // Save starting positions of cursor and element.
    dragObj.cursorStartX = pos.x;
    dragObj.cursorStartY = pos.y;
    dragObj.elStartLeft  = parseInt(dragObj.elNode.style.left, 10);
    dragObj.elStartTop   = parseInt(dragObj.elNode.style.top,  10);

    if (isNaN(dragObj.elStartLeft)) dragObj.elStartLeft = 0;
    if (isNaN(dragObj.elStartTop))  dragObj.elStartTop  = 0;

    // Update element's z-index.
    dragObj.elNode.style.zIndex = ++dragObj.zIndex;

    // Capture mousemove and mouseup events on the page.
    if (browser.isIE) {
      document.attachEvent("onmousemove", dragtable.dragMove);
      document.attachEvent("onmouseup",   dragtable.dragEnd);
      window.event.cancelBubble = true;
      window.event.returnValue = false;
    } else {
      document.addEventListener("mousemove", dragtable.dragMove, true);
      document.addEventListener("mouseup",   dragtable.dragEnd, true);
      event.preventDefault();
    }
  },

  // Move the floating column header with the mouse
  // TODO: Reorder columns as the mouse moves for a more interactive feel.
  dragMove: function(event) {
    var x, y;
    var dragObj = dragtable.dragObj;

    // Get cursor position with respect to the page.
    var pos = dragtable.eventPosition(event);

    var dx = dragObj.cursorStartX - pos.x;
    var dy = dragObj.cursorStartY - pos.y;
    if (!dragObj.addedNode && dx * dx + dy * dy > dragtable.dragRadius2) {
      dragObj.tableContainer.insertBefore(dragObj.elNode, dragObj.table);
      dragObj.addedNode = true;
    }

    // Move drag element by the same amount the cursor has moved.
    var style = dragObj.elNode.style;
    style.left = (dragObj.elStartLeft + pos.x - dragObj.cursorStartX) + "px";
    style.top  = (dragObj.elStartTop  + pos.y - dragObj.cursorStartY) + "px";

    if (dragtable.browser.isIE) {
      window.event.cancelBubble = true;
      window.event.returnValue = false;
    } else {
      event.preventDefault();
    }
  },

  // Stop capturing mousemove and mouseup events.
  // Determine which (if any) column we're over and shuffle the table.
  dragEnd: function(event) {
    if (dragtable.browser.isIE) {
      document.detachEvent("onmousemove", dragtable.dragMove);
      document.detachEvent("onmouseup", dragtable.dragEnd);
    } else {
      document.removeEventListener("mousemove", dragtable.dragMove, true);
      document.removeEventListener("mouseup", dragtable.dragEnd, true);
    }

    // If the floating header wasn't added, the mouse didn't move far enough.
    var dragObj = dragtable.dragObj;
    if (!dragObj.addedNode) {
      return;
    }
    dragObj.tableContainer.removeChild(dragObj.elNode);

    // Determine whether the drag ended over the table, and over which column.
    var pos = dragtable.eventPosition(event);
    var table_pos = dragtable.absolutePosition(dragObj.table);
    if (pos.y < table_pos.y ||
        pos.y > table_pos.y + dragObj.table.offsetHeight) {
      return;
    }
    var targetCol = dragtable.findColumn(dragObj.table, pos.x);
    if (targetCol != -1 && targetCol != dragObj.startCol) {
      dragtable.moveColumn(dragObj.table, dragObj.startCol, targetCol);
      if (dragObj.table.id && dragtable.cookiesEnabled() &&
     dragObj.table.className.search(/\bforget-ordering\b/) == -1) {
        dragtable.rememberDrag(dragObj.table.id, dragObj.startCol, targetCol);
      }
    }
  },

  // Which column does the x value fall inside of? x should include scrollLeft.
  findColumn: function(table, x) {
    var header = table.tHead.rows[0].cells;
    for (var i = 0; i < header.length; i++) {
      //var left = header[i].offsetLeft;
      var pos = dragtable.absolutePosition(header[i]);
      //if (left <= x && x <= left + header[i].offsetWidth) {
      if (pos.x <= x && x <= pos.x + header[i].offsetWidth) {
        return i;
      }
    }
    return -1;
  },

  // Move a column of table from start index to finish index.
  // Based on the "Swapping table columns" discussion on comp.lang.javascript.
  // Assumes there are columns at sIdx and fIdx
  moveColumn: function(table, sIdx, fIdx) {
    var row, cA;
    var i=table.rows.length;
    while (i--){
      row = table.rows[i]
      var x = row.removeChild(row.cells[sIdx]);
      if (fIdx < row.cells.length) {
        row.insertBefore(x, row.cells[fIdx]);
      } else {
        row.appendChild(x);
      }
    }

    // For whatever reason, sorttable tracks column indices this way.
    // Without a manual update, clicking one column will sort on another.
    var headrow = table.tHead.rows[0].cells;
    for (var i=0; i<headrow.length; i++) {
      headrow[i].sorttable_columnindex = i;
    }
  },

  // Are cookies enabled? We should not attempt to set cookies on a local file.
  cookiesEnabled: function() {
    return (window.location.protocol != 'file:') && navigator.cookieEnabled;
  },

  // Store a column swap in a cookie for posterity.
  rememberDrag: function(id, a, b) {
    var cookieName = "dragtable-" + id;
    var prev = dragtable.readCookie(cookieName);
    var new_val = "";
    if (prev) new_val = prev + ",";
    new_val += a + "/" + b;
    dragtable.createCookie(cookieName, new_val, dragtable.cookieDays);
  },

 // Replay all column swaps for a table.
 replayDrags: function(table) {
  if (!dragtable.cookiesEnabled()) return;
  var dragstr = dragtable.readCookie("dragtable-" + table.id);
  if (!dragstr) return;
  var drags = dragstr.split(',');
  for (var i = 0; i < drags.length; i++) {
   var pair = drags[i].split("/");
   if (pair.length != 2) continue;
   var a = parseInt(pair[0]);
   var b = parseInt(pair[1]);
   if (isNaN(a) || isNaN(b)) continue;
   dragtable.moveColumn(table, a, b);
  }
 },

  // Cookie functions based on http://www.quirksmode.org/js/cookies.html
  // Cookies won't work for local files.
  cookiesEnabled: function() {
    return (window.location.protocol != 'file:') && navigator.cookieEnabled;
  },

  createCookie: function(name,value,days) {
    if (days) {
      var date = new Date();
      date.setTime(date.getTime()+(days*24*60*60*1000));
      var expires = "; expires="+date.toGMTString();
    }
    else var expires = "";

  var path = document.location.pathname;
    document.cookie = name+"="+value+expires+"; path="+path
  },

  readCookie: function(name) {
    var nameEQ = name + "=";
    var ca = document.cookie.split(';');
    for(var i=0;i < ca.length;i++) {
      var c = ca[i];
      while (c.charAt(0)==' ') c = c.substring(1,c.length);
      if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
    }
    return null;
  },

  eraseCookie: function(name) {
    dragtable.createCookie(name,"",-1);
  }

}

/* ******************************************************************
   Supporting functions: bundled here to avoid depending on a library
   ****************************************************************** */

// Dean Edwards/Matthias Miller/John Resig
// has a hook for dragtable.init already been added? (see below)
var dgListenOnLoad = false;

/* for Mozilla/Opera9 */
if (document.addEventListener) {
  dgListenOnLoad = true;
  document.addEventListener("DOMContentLoaded", dragtable.init, false);
}

/* for Internet Explorer */
/*@cc_on @*/
/*@if (@_win32)
  dgListenOnLoad = true;
  document.write("<script id=__dt_onload defer src=//0)><\/script>");
  var script = document.getElementById("__dt_onload");
  script.onreadystatechange = function() {
    if (this.readyState == "complete") {
      dragtable.init(); // call the onload handler
    }
  };
/*@end @*/

/* for Safari */
if (/WebKit/i.test(navigator.userAgent)) { // sniff
  dgListenOnLoad = true;
  var _dgtimer = setInterval(function() {
    if (/loaded|complete/.test(document.readyState)) {
      dragtable.init(); // call the onload handler
    }
  }, 10);
}

/* for other browsers */
/* Avoid this unless it's absolutely necessary (it breaks sorttable) */
if (!dgListenOnLoad) {
  window.onload = dragtable.init;
}

// Dean's forEach: http://dean.edwards.name/base/forEach.js
/*
  forEach, version 1.0
  Copyright 2006, Dean Edwards
  License: http://www.opensource.org/licenses/mit-license.php
*/

// array-like enumeration
if (!Array.forEach) { // mozilla already supports this
  Array.forEach = function(array, block, context) {
    for (var i = 0; i < array.length; i++) {
      block.call(context, array[i], i, array);
    }
  };
}

// generic enumeration
Function.prototype.forEach = function(object, block, context) {
  for (var key in object) {
    if (typeof this.prototype[key] == "undefined") {
      block.call(context, object[key], key, object);
    }
  }
};

// character enumeration
String.forEach = function(string, block, context) {
  Array.forEach(string.split(""), function(chr, index) {
    block.call(context, chr, index, string);
  });
};

// globally resolve forEach enumeration
var forEach = function(object, block, context) {
  if (object) {
    var resolve = Object; // default
    if (object instanceof Function) {
      // functions have a "length" property
      resolve = Function;
    } else if (object.forEach instanceof Function) {
      // the object implements a custom forEach method so use that
      object.forEach(block, context);
      return;
    } else if (typeof object == "string") {
      // the object is a string
      resolve = String;
    } else if (typeof object.length == "number") {
      // the object is array-like
      resolve = Array;
    }
    resolve.forEach(object, block, context);
  }
};

//delmeciuri.php

     <html>
 
 <head>       <link rel="stylesheet" type="text/css" href="stdtheme.css" />
 <script src="sorttable.js"></script>
<script src="dragtable.js"></script>  
  
 <link rel="stylesheet" type="text/css" href="stdtheme.css" />
</head>
<body>
<br>

<?
      include("meniuFotbal.php");
     //CONNECT
mysql_connect("localhost", "root", "");
mysql_select_db("fotbal");
                            
                              
//////////////////////////////////////////////salveaza//////////////////////////
if(isset($_GET['idmeci']))
{

 $sqlccMc = "SELECT * FROM cmeciuri WHERE cmeciuri.ID=".$_GET['idmeci']." ORDER BY cmeciuri.ID ASC";
$resursaccMc = mysql_query($sqlccMc);
$rowccMc = mysql_fetch_array($resursaccMc);

$idcmeci=$_GET['idmeci'];
$idcetapa=$rowccMc['ETAPA'];
$idcG=$rowccMc['GAZDA'];
$idcGG=$rowccMc['GG'];
$idcGO=$rowccMc['GO'];
$idcO=$rowccMc['OASPETE'];

print '<table><FORM action="delMeciul.php" method="post">';

  print '<tr><td>ID:</td>';
  print '<td>ETAPA:</td>';
  print '<td>DATA:</td>';
  print '<td>GAZDA:</td>';
  print '<td>GG:</td>';
  print '<td>GO:</td>';
   print '<td>OASPETE:</td></tr>';
   
  print '<tr><td><INPUT type="text" name="sID" size="5" VALUE="'.$idcmeci.'"></td>';
  print '<td><INPUT type="text" name="sETAPA" size="5" VALUE="'.$idcetapa.'"></td>';
  print '<td><INPUT type="text" name="sDATA" size="10" VALUE="0000-00-00"></td>';
  print '<td><INPUT type="text" name="sGAZDA" size="5" VALUE="'.$idcG.'"></td>';
  print '<td><INPUT type="text" name="sGG" size="5" VALUE="'.$idcGG.'"></td>';
  print '<td><INPUT type="text" name="sGO" size="5" VALUE="'.$idcGO.'"></td>';
   print '<td><INPUT type="text" name="sOASPETE" size="5" VALUE="'.$idcO.'"></td></tr>';
  
  print '<input type="submit" value="sterge" id="sterge" name="sterge" title="strge">';
  print '</FORM></table>';
  
}

//////////////////
if(isset($_POST['sterge']))
{
$sqlm = "DELETE FROM fotbal.cmeciuri WHERE cmeciuri.ETAPA = ".$_POST['sETAPA']. " AND cmeciuri.ID = ".$_POST['sID']." LIMIT 1";

if($_POST['sID']=="NNN" OR $_POST['sETAPA']=="NN" OR $_POST['sGAZDA']=="NN" OR $_POST['sOASPETE']==="NN" OR $_POST['sGG']=="NN" OR $_POST['sGO']=="NN"){


echo "<script type='text/javascript'>alert('Introduceti toate datele! Anulat !');</script>";


}
else{
               
              
               
mysql_query($sqlm);

 
print '<b>Stergerea a fost facuta!</b><br>';
echo "\n<meta http-equiv=\"refresh\" " . " content=\"3;URL=delMeci.php\">\n";
              ///////////////////////
     }        
     
              
              
              }




if(!isset($_GET['idmeci']))
{
  print '<table><FORM action="delMeciul.php" method="post">';

  print '<tr><td>ID:</td>';
  print '<td>ETAPA:</td>';
  print '<td>DATA:</td>';
  print '<td>GAZDA:</td>';
  print '<td>GG:</td>';
  print '<td>GO:</td>';
   print '<td>OASPETE:</td></tr>';
   
  print '<tr><td><INPUT type="text" name="sID" size="5" VALUE="NNN"></td>';
  print '<td><INPUT type="text" name="sETAPA" size="5" VALUE="NN"></td>';
  print '<td><INPUT type="text" name="sDATA" size="10" VALUE="0000-00-00"></td>';
  print '<td><INPUT type="text" name="sGAZDA" size="5" VALUE="NN"></td>';
  print '<td><INPUT type="text" name="sGG" size="5" VALUE="NN"></td>';
  print '<td><INPUT type="text" name="sGO" size="5" VALUE="NN"></td>';
   print '<td><INPUT type="text" name="sOASPETE" size="5" VALUE="NN"></td></tr>';
  
  print '<input type="submit" value="save" id="del" name="sterge" title="sterge">';
  print '</FORM></table>';
 } 
  print '<iframe src="MECIURINEJUCATE.php" frameborder="0" height="200px" width="800px"></iframe>';
 
?>
        </body>
 </html>



//delmeci.php

     <html>
 
 <head>   <link rel="stylesheet" type="text/css" href="stdtheme.css" />
 <script src="sorttable.js"></script>
<script src="dragtable.js"></script>
   </head>
   <body>

<?
 include("meniuFotbal.php");
mysql_connect("localhost", "root", "");
mysql_select_db("fotbal");
/////////////////////meciuri nejucate inca/////////////////////////////////
           $idmeci;
if(isset($_GET['etapa'])){
 

        $ETAPA = $_GET['etapa'];
 }       
 else
 {
  $ETAPA =1;
 
 }
 
  /////////////////////////////////////////////////////////////////////////////
$sqlccMc = "SELECT * FROM cmeciuri WHERE cmeciuri.ETAPA=".$ETAPA." ORDER BY cmeciuri.ID ASC";
$resursaccMc = mysql_query($sqlccMc);


 
 PRINT '<TABLE><TR>';
for($i=1;$i<=34;$i++)
{

  PRINT '<TD><a href="delMeci.php?etapa='.$i.'">'.$i.'</a></TD>';
  }
 PRINT '</TR></TABLE>';
  
 



print '<table class="sortabledraggable">';
PRINT '<tr>
<td class="ESR">ID</TD>
<TD class="ESR">ETAPA</TD>
<TD class="ESR">DATA</TD>
<TD class="ESR">iGAZDE</TD>
<TD class="ESR">GG</TD>
<TD class="ESR">GO</TD>
<TD class="ESR">iOASPETI</TD>
<TD class="ESR">J</TD>
<TD class="ESR">GAZDE</TD>
<TD class="ESR">iGAZDE</TD>
<TD class="ESR">iOASPETE</TD>
<TD class="ESR">OASPETE</TD>
<TD class="ESR">J</TD>
<TD class="ESR">DELETE</TD>
</TR>';
WHILE($rowccMc = mysql_fetch_array($resursaccMc))
{

  PRINT '<tr><td>'.$rowccMc['ID'].'</TD><TD>'.$rowccMc['ETAPA'].'</TD><TD> '.$rowccMc['DATA'].' </TD><TD> '.$rowccMc['GAZDA'].' </TD><TD> '.$rowccMc['GG'].' </TD><TD> '.$rowccMc['GO'].' </TD><TD> '.$rowccMc['OASPETE'].'</TD>';
  
  $sqlccEC = "SELECT * FROM cmeciuri, echipe WHERE echipe.ID=cmeciuri.GAZDA AND cmeciuri.ID=".$rowccMc['ID']." AND cmeciuri.ETAPA=".$ETAPA." ORDER BY cmeciuri.ID ASC";
$resursaccEC = mysql_query($sqlccEC);

WHILE($rowccEC = mysql_fetch_array($resursaccEC))
{

  PRINT ' <TD> '.$rowccEC['ID'].' </TD><TD> '.$rowccEC['ECHIPA'].'</TD><TD> '.$rowccEC['JUDET'].'</TD>';

  

}  

$sqlccECO = "SELECT * FROM cmeciuri, echipe WHERE echipe.ID=cmeciuri.OASPETE AND cmeciuri.ID=".$rowccMc['ID']." AND cmeciuri.ETAPA=".$ETAPA." ORDER BY cmeciuri.ID ASC";
$resursaccECO = mysql_query($sqlccECO);

WHILE($rowccECO = mysql_fetch_array($resursaccECO))
{

  PRINT ' <TD> '.$rowccECO['ID'].' </TD><TD> '.$rowccECO['ECHIPA'].'</TD><TD> '.$rowccECO['JUDET'].'</TD><TD><a href="delMeciul.php?idmeci='.$rowccMc['ID'].'">'.$rowccMc['ID'].'</a></TD></Tr>';
                              
  

}  



  

}  
print '</table>';
?>
</body>
 </html>



//count.php

$sqlP = "SELECT GAZDA, COUNT(GAZDA) FROM meciuri WHERE meciuri.GAZDA =". $rowMc['GAZDA'] ;
$resursaP = mysql_query($sqlP);

WHILE($rowP = mysql_fetch_array($resursaP))
{

  PRINT ' | <b>meciuri jucate '.$rowP['COUNT(GAZDA)'].'</b>';

} 
//meciuri per echipa  gazde



//clasamenttur.php

     <html>
<title>CLASAMENT</title> 
 <head>
 <script src="sorttable.js"></script>
<script src="dragtable.js"></script>




 <link rel="stylesheet" type="text/css" href="stdtheme.css" />
</head>
      <body>
               <?
                    include("meniuFotbal.php");
               ?>
<hr>
<center>

<?


  PRINT '<H1>CLASAMENT TUR TOTAL</H1>';
  

?>
<hr>
<table > <tr>  
  <td><table> <tr> <th>LOC</th> <th>o</th></tr>
    
 <?
  
  
        $nretapa = 17;
 
  
  $ik=1;
  
  for($ik;$ik<=18;$ik++){
  print '
 <tr>
  <td class="ESR">'.$ik.'</td><td class="ESR"><img src="LOGO/0.jpeg" width="1px" height="20px"></td>
 </tr> ';
  }
  ?>
  
 
</table></td>
  <td>
  
 
  
<? 
             
//CONNECT
mysql_connect("localhost", "root", "");
mysql_select_db("fotbal");

     print '<table class="sortabledraggable"><tr><th>nr</th><th>echipa</th><th>judet</th>
     <th>MT</th><th>VA</th><th>EA</th><th>IA</th><th>VD</th>
     <th>ED</th><th>ID</th><th>GMA</th><th>GMD</th><th>GOA</th>
     <th>GOD</th><th>Vt</th><th>Et</th><th>It</th><th>GMt</th><th>GOt</th><th>GOL</th><th>PCTa</th><th>
     PCTd</th><th>PCT</th><th>ADVa</th><th>ADVd</th><th>ADV</th><th>Ma</th><th>Md</th><th>GOLa</th><th>GOLd</th><TH>LOGO</TH></tr>';

//$sqlE = "SELECT * FROM echipe ORDER BY ID ASC";
$sqlE = "SELECT * FROM echipe ,clasament WHERE echipe.ID=clasament.ID ORDER BY clasament.PUNCTE DESC";
$resursaE = mysql_query($sqlE);
$Va;
$Ea;
$Ia;
$GMa;
$GOa;
$Vd;
$Ed;
$Id;
$GMd;
$GOd;
$Ma;
$Md;
$GOLa;
$GOLd;




WHILE($rowE = mysql_fetch_array($resursaE))
{

  PRINT '<tr><td><A HREF=meciuriEchipa.php?id="'.$rowE['ID'].'">'.$rowE['ID'].'</A></td><td class="ESR"> '.$rowE['ECHIPA'].' </td><td>'.$rowE['JUDET'].'</td>';


  ///////////////////////////////////STARTCLASAMENT//////////////////////////
  
$sqlMT = "SELECT GAZDA, COUNT(GAZDA) FROM meciuri WHERE meciuri.ETAPA<=".$nretapa." AND (meciuri.GAZDA =". $rowE['ID'] ." OR meciuri.OASPETE =". $rowE['ID']." )";
$resursaMT = mysql_query($sqlMT);

WHILE($rowMT = mysql_fetch_array($resursaMT))
{

  PRINT '<td class="ESR"> '.$rowMT['COUNT(GAZDA)'].'</td> ';

} 
//meciuri per echipa TOTAL 

$sqlVa = "SELECT GAZDA, COUNT(GAZDA) FROM meciuri WHERE meciuri.ETAPA<=".$nretapa." AND (meciuri.GAZDA =". $rowE['ID'] .") AND (meciuri.GG > meciuri.GO)";
$resursaVa = mysql_query($sqlVa);

WHILE($rowVa = mysql_fetch_array($resursaVa))
{

  PRINT '<td>'.$rowVa['COUNT(GAZDA)'].'</td> ';
                    $Va=$rowVa['COUNT(GAZDA)'];
} 
//VICTORII per echipa ACASA 

$sqlEQa = "SELECT GAZDA, COUNT(GAZDA) FROM meciuri WHERE meciuri.ETAPA<=".$nretapa." AND (meciuri.GAZDA =". $rowE['ID'] .") AND (meciuri.GG = meciuri.GO)";
$resursaEQa = mysql_query($sqlEQa);

WHILE($rowEQa = mysql_fetch_array($resursaEQa))
{

  PRINT '<td>'.$rowEQa['COUNT(GAZDA)'].'</td> ';
                       $Ea=$rowEQa['COUNT(GAZDA)'];
} 
//AGALURI per echipa  ACASA

$sqlIa = "SELECT GAZDA, COUNT(GAZDA) FROM meciuri WHERE meciuri.ETAPA<=".$nretapa." AND (meciuri.GAZDA =". $rowE['ID'] .") AND (meciuri.GG < meciuri.GO)";
$resursaIa = mysql_query($sqlIa);

WHILE($rowIa = mysql_fetch_array($resursaIa))
{

  PRINT '<td>'.$rowIa['COUNT(GAZDA)'].'</td> ';
                       $Ia=$rowIa['COUNT(GAZDA)'];
} 
//INFRANGERI per echipa  ACASA
////////////////////////////////////////////////////////////////////////////////////////////////
//DEPLASARE
////////////////////////////////////////////////////////////////////////////////////////////////
$sqlVd = "SELECT OASPETE, COUNT(OASPETE) FROM meciuri WHERE meciuri.ETAPA<=".$nretapa." AND (meciuri.OASPETE =". $rowE['ID'] .") AND (meciuri.GG < meciuri.GO)";
$resursaVd = mysql_query($sqlVd);

WHILE($rowVd = mysql_fetch_array($resursaVd))
{

  PRINT '<td>'.$rowVd['COUNT(OASPETE)'].'</td> ';
                          $Vd=$rowVd['COUNT(OASPETE)'];
} 
//VICTORII per echipa DEPLASARE 

$sqlEQd = "SELECT OASPETE, COUNT(OASPETE) FROM meciuri WHERE meciuri.ETAPA<=".$nretapa." AND (meciuri.OASPETE =". $rowE['ID'] .") AND (meciuri.GG = meciuri.GO)";
$resursaEQd = mysql_query($sqlEQd);

WHILE($rowEQd = mysql_fetch_array($resursaEQd))
{

  PRINT '<td>'.$rowEQd['COUNT(OASPETE)'].'</td> ';
                           $Ed=$rowEQd['COUNT(OASPETE)'];
} 
//AGALURI per echipa  DEPLASARE 

$sqlId = "SELECT OASPETE, COUNT(OASPETE) FROM meciuri WHERE meciuri.ETAPA<=".$nretapa." AND (meciuri.OASPETE =". $rowE['ID'] .") AND (meciuri.GG > meciuri.GO)";
$resursaId = mysql_query($sqlId);

WHILE($rowId = mysql_fetch_array($resursaId))
{

  PRINT '<td>'.$rowId['COUNT(OASPETE)'].'</td> ';
                           $Id=$rowId['COUNT(OASPETE)'];
} 
//INFRANGERI per echipa DEPLASARE 

$sqlGMa = "SELECT GG, SUM(GG) FROM meciuri WHERE meciuri.ETAPA<=".$nretapa." AND (meciuri.GAZDA =". $rowE['ID'] .")";
$resursaGMa = mysql_query($sqlGMa);

WHILE($rowGMa = mysql_fetch_array($resursaGMa))
{

  PRINT '<td>'.$rowGMa['SUM(GG)'].'</td> ';
                        $GMa=$rowGMa['SUM(GG)'];
} 
//total goluri marcate  ACASA

$sqlGMd = "SELECT GO, SUM(GO) FROM meciuri WHERE meciuri.ETAPA<=".$nretapa." AND (meciuri.OASPETE =". $rowE['ID'] .")";
$resursaGMd = mysql_query($sqlGMd);

WHILE($rowGMd = mysql_fetch_array($resursaGMd))
{

  PRINT '<td>'.$rowGMd['SUM(GO)'].'</td> ';
                         $GMd=$rowGMd['SUM(GO)'];
} 
//total goluri marcate DEPLASARE

$sqlGOa = "SELECT GO, SUM(GO) FROM meciuri WHERE meciuri.ETAPA<=".$nretapa." AND (meciuri.GAZDA =". $rowE['ID'] .")";
$resursaGOa = mysql_query($sqlGOa);

WHILE($rowGOa = mysql_fetch_array($resursaGOa))
{

  PRINT '<td>'.$rowGOa['SUM(GO)'].' </td>';
                        $GOa=$rowGOa['SUM(GO)'];
} 
//total goluri PRIMITE  ACASA

$sqlGOd = "SELECT GG, SUM(GG) FROM meciuri WHERE meciuri.ETAPA<=".$nretapa." AND (meciuri.OASPETE =". $rowE['ID'] .")";
$resursaGOd = mysql_query($sqlGOd);

WHILE($rowGOd = mysql_fetch_array($resursaGOd))
{

  PRINT '<td>'.$rowGOd['SUM(GG)'].'</td> ';
                                 $GOd=$rowGOd['SUM(GG)'];
} 
//total goluri PRIMITE DEPLASARE
////////////////////////////////////////////////////////
$Vt=$Va+$Vd;
$Et=$Ea+ $Ed;
$It=$Ia+ $Id;
$GMt=$GMa+ $GMd;
$GOt=$GOa+ $GOd;
$GOL=$GMt-$GOt;
$PCTa=($Va*3)+($Ea*1);
$PCTd=($Vd*3)+($Ed*1) ;
$PCT= $PCTa+$PCTd ;
$ADVa=(($Ia*3)+($Ea*2))*(-1);
$ADVd=($Vd*3)+($Ed*1) ;
$ADV= $ADVa+$ADVd ;
$Ma=$Va+$Ea+$Ia;
$Md=$Vd+$Ed+$Id;
$GOLa=$GMa-$GOa;
$GOLd=$GMd-$GOd;


print ' <td class="ESR">'.$Vt.'</td><td class="ESR"> '.$Et.' </td><td class="ESR">'.$It.'</td><td class="ESR"> '.$GMt.'</td><td class="ESR"> '.$GOt.'</td><td class="ESR"> '.$GOL.' </td><td>'.$PCTa.'</td><td> '.$PCTd.'</td><td class="ESR"> '.$PCT.'</td><td> '.$ADVa.'</td><td> '.$ADVd.'</td><td class="ESR"> '.$ADV.'</td>';
print '<td> '.$Ma.'</td><td> '.$Md.'</td><td> '.$GOLa.'</td><td> '.$GOLd.'</td>';

$adresaimagine = "LOGO/".$rowE['ID'].".jpeg";
   if(file_exists($adresaimagine)) { 
     print '<td class="ESR"><A HREF="meciuriEchipa.php?id='.$rowE['ID'].'"><img src="'.$adresaimagine.'" width="20px" height="20px"></a></td>'; }
  
  
 print '</tr>';

}
 ///////////////////////////////////ENDCLASAMENT//////////////////////////
 
//ECHIPE
     print '</table></td>
 </tr>
</table>';
     
?>



<hr>

<p> Copyright 2012-2020 by Tralsbro Sibiu, Romania. All Rights Reserved.</P>

   </center></body>
 </html>

//clasamentretur.php

     <html>
<title>CLASAMENT</title> 
 <head>
 <script src="sorttable.js"></script>
<script src="dragtable.js"></script>




 <link rel="stylesheet" type="text/css" href="stdtheme.css" />
</head>
      <body>
               <?
                    include("meniuFotbal.php");
               ?>
<hr>

<?


  PRINT '<CENTER><H1>CLASAMENT RETUR TOTAL</H1>';
  

?>
<hr>
<table > <tr>  
  <td><table> <tr> <th>LOC</th> <th>o</th></tr>
    
 <?
  
  
        $nretapa = 18;
 
  
  $ik=1;
  
  for($ik;$ik<=18;$ik++){
  print '
 <tr>
  <td class="ESR">'.$ik.'</td><td class="ESR"><img src="LOGO/0.jpeg" width="1px" height="20px"></td>
 </tr> ';
  }
  ?>
  
 
</table></td>
  <td>
  
 
  
<? 
             
//CONNECT
mysql_connect("localhost", "root", "");
mysql_select_db("fotbal");

     print '<table class="sortabledraggable"><tr><th>nr</th><th>echipa</th><th>judet</th>
     <th>MT</th><th>VA</th><th>EA</th><th>IA</th><th>VD</th>
     <th>ED</th><th>ID</th><th>GMA</th><th>GMD</th><th>GOA</th>
     <th>GOD</th><th>Vt</th><th>Et</th><th>It</th><th>GMt</th><th>GOt</th><th>GOL</th><th>PCTa</th><th>
     PCTd</th><th>PCT</th><th>ADVa</th><th>ADVd</th><th>ADV</th><th>Ma</th><th>Md</th><th>GOLa</th><th>GOLd</th><TH>LOGO</TH></tr>';

//$sqlE = "SELECT * FROM echipe ORDER BY ID ASC";
$sqlE = "SELECT * FROM echipe ,clasament WHERE echipe.ID=clasament.ID ORDER BY clasament.PUNCTE DESC";
$resursaE = mysql_query($sqlE);
$Va;
$Ea;
$Ia;
$GMa;
$GOa;
$Vd;
$Ed;
$Id;
$GMd;
$GOd;
$Ma;
$Md;
$GOLa;
$GOLd;




WHILE($rowE = mysql_fetch_array($resursaE))
{

  PRINT '<tr><td><A HREF=meciuriEchipa.php?id="'.$rowE['ID'].'">'.$rowE['ID'].'</A></td><td class="ESR"> '.$rowE['ECHIPA'].' </td><td>'.$rowE['JUDET'].'</td>';


  ///////////////////////////////////STARTCLASAMENT//////////////////////////
  
$sqlMT = "SELECT GAZDA, COUNT(GAZDA) FROM meciuri WHERE meciuri.ETAPA>=".$nretapa." AND (meciuri.GAZDA =". $rowE['ID'] ." OR meciuri.OASPETE =". $rowE['ID']." )";
$resursaMT = mysql_query($sqlMT);

WHILE($rowMT = mysql_fetch_array($resursaMT))
{

  PRINT '<td class="ESR"> '.$rowMT['COUNT(GAZDA)'].'</td> ';

} 
//meciuri per echipa TOTAL 

$sqlVa = "SELECT GAZDA, COUNT(GAZDA) FROM meciuri WHERE meciuri.ETAPA>=".$nretapa." AND (meciuri.GAZDA =". $rowE['ID'] .") AND (meciuri.GG > meciuri.GO)";
$resursaVa = mysql_query($sqlVa);

WHILE($rowVa = mysql_fetch_array($resursaVa))
{

  PRINT '<td>'.$rowVa['COUNT(GAZDA)'].'</td> ';
                    $Va=$rowVa['COUNT(GAZDA)'];
} 
//VICTORII per echipa ACASA 

$sqlEQa = "SELECT GAZDA, COUNT(GAZDA) FROM meciuri WHERE meciuri.ETAPA>=".$nretapa." AND (meciuri.GAZDA =". $rowE['ID'] .") AND (meciuri.GG = meciuri.GO)";
$resursaEQa = mysql_query($sqlEQa);

WHILE($rowEQa = mysql_fetch_array($resursaEQa))
{

  PRINT '<td>'.$rowEQa['COUNT(GAZDA)'].'</td> ';
                       $Ea=$rowEQa['COUNT(GAZDA)'];
} 
//AGALURI per echipa  ACASA

$sqlIa = "SELECT GAZDA, COUNT(GAZDA) FROM meciuri WHERE meciuri.ETAPA>=".$nretapa." AND (meciuri.GAZDA =". $rowE['ID'] .") AND (meciuri.GG < meciuri.GO)";
$resursaIa = mysql_query($sqlIa);

WHILE($rowIa = mysql_fetch_array($resursaIa))
{

  PRINT '<td>'.$rowIa['COUNT(GAZDA)'].'</td> ';
                       $Ia=$rowIa['COUNT(GAZDA)'];
} 
//INFRANGERI per echipa  ACASA
////////////////////////////////////////////////////////////////////////////////////////////////
//DEPLASARE
////////////////////////////////////////////////////////////////////////////////////////////////
$sqlVd = "SELECT OASPETE, COUNT(OASPETE) FROM meciuri WHERE meciuri.ETAPA>=".$nretapa." AND (meciuri.OASPETE =". $rowE['ID'] .") AND (meciuri.GG < meciuri.GO)";
$resursaVd = mysql_query($sqlVd);

WHILE($rowVd = mysql_fetch_array($resursaVd))
{

  PRINT '<td>'.$rowVd['COUNT(OASPETE)'].'</td> ';
                          $Vd=$rowVd['COUNT(OASPETE)'];
} 
//VICTORII per echipa DEPLASARE 

$sqlEQd = "SELECT OASPETE, COUNT(OASPETE) FROM meciuri WHERE meciuri.ETAPA>=".$nretapa." AND (meciuri.OASPETE =". $rowE['ID'] .") AND (meciuri.GG = meciuri.GO)";
$resursaEQd = mysql_query($sqlEQd);

WHILE($rowEQd = mysql_fetch_array($resursaEQd))
{

  PRINT '<td>'.$rowEQd['COUNT(OASPETE)'].'</td> ';
                           $Ed=$rowEQd['COUNT(OASPETE)'];
} 
//AGALURI per echipa  DEPLASARE 

$sqlId = "SELECT OASPETE, COUNT(OASPETE) FROM meciuri WHERE meciuri.ETAPA>=".$nretapa." AND (meciuri.OASPETE =". $rowE['ID'] .") AND (meciuri.GG > meciuri.GO)";
$resursaId = mysql_query($sqlId);

WHILE($rowId = mysql_fetch_array($resursaId))
{

  PRINT '<td>'.$rowId['COUNT(OASPETE)'].'</td> ';
                           $Id=$rowId['COUNT(OASPETE)'];
} 
//INFRANGERI per echipa DEPLASARE 

$sqlGMa = "SELECT GG, SUM(GG) FROM meciuri WHERE meciuri.ETAPA>=".$nretapa." AND (meciuri.GAZDA =". $rowE['ID'] .")";
$resursaGMa = mysql_query($sqlGMa);

WHILE($rowGMa = mysql_fetch_array($resursaGMa))
{

  PRINT '<td>'.$rowGMa['SUM(GG)'].'</td> ';
                        $GMa=$rowGMa['SUM(GG)'];
} 
//total goluri marcate  ACASA

$sqlGMd = "SELECT GO, SUM(GO) FROM meciuri WHERE meciuri.ETAPA>=".$nretapa." AND (meciuri.OASPETE =". $rowE['ID'] .")";
$resursaGMd = mysql_query($sqlGMd);

WHILE($rowGMd = mysql_fetch_array($resursaGMd))
{

  PRINT '<td>'.$rowGMd['SUM(GO)'].'</td> ';
                         $GMd=$rowGMd['SUM(GO)'];
} 
//total goluri marcate DEPLASARE

$sqlGOa = "SELECT GO, SUM(GO) FROM meciuri WHERE meciuri.ETAPA>=".$nretapa." AND (meciuri.GAZDA =". $rowE['ID'] .")";
$resursaGOa = mysql_query($sqlGOa);

WHILE($rowGOa = mysql_fetch_array($resursaGOa))
{

  PRINT '<td>'.$rowGOa['SUM(GO)'].' </td>';
                        $GOa=$rowGOa['SUM(GO)'];
} 
//total goluri PRIMITE  ACASA

$sqlGOd = "SELECT GG, SUM(GG) FROM meciuri WHERE meciuri.ETAPA>=".$nretapa." AND (meciuri.OASPETE =". $rowE['ID'] .")";
$resursaGOd = mysql_query($sqlGOd);

WHILE($rowGOd = mysql_fetch_array($resursaGOd))
{

  PRINT '<td>'.$rowGOd['SUM(GG)'].'</td> ';
                                 $GOd=$rowGOd['SUM(GG)'];
} 
//total goluri PRIMITE DEPLASARE
////////////////////////////////////////////////////////
$Vt=$Va+$Vd;
$Et=$Ea+ $Ed;
$It=$Ia+ $Id;
$GMt=$GMa+ $GMd;
$GOt=$GOa+ $GOd;
$GOL=$GMt-$GOt;
$PCTa=($Va*3)+($Ea*1);
$PCTd=($Vd*3)+($Ed*1) ;
$PCT= $PCTa+$PCTd ;
$ADVa=(($Ia*3)+($Ea*2))*(-1);
$ADVd=($Vd*3)+($Ed*1) ;
$ADV= $ADVa+$ADVd ;
$Ma=$Va+$Ea+$Ia;
$Md=$Vd+$Ed+$Id;
$GOLa=$GMa-$GOa;
$GOLd=$GMd-$GOd;


print ' <td class="ESR">'.$Vt.'</td><td class="ESR"> '.$Et.' </td><td class="ESR">'.$It.'</td><td class="ESR"> '.$GMt.'</td><td class="ESR"> '.$GOt.'</td><td class="ESR"> '.$GOL.' </td><td>'.$PCTa.'</td><td> '.$PCTd.'</td><td class="ESR"> '.$PCT.'</td><td> '.$ADVa.'</td><td> '.$ADVd.'</td><td class="ESR"> '.$ADV.'</td>';
print '<td> '.$Ma.'</td><td> '.$Md.'</td><td> '.$GOLa.'</td><td> '.$GOLd.'</td>';

$adresaimagine = "LOGO/".$rowE['ID'].".jpeg";
   if(file_exists($adresaimagine)) { 
     print '<td class="ESR"><A HREF="meciuriEchipa.php?id='.$rowE['ID'].'"><img src="'.$adresaimagine.'" width="20px" height="20px"></a></td>'; }
  
  
 print '</tr>';

}
 ///////////////////////////////////ENDCLASAMENT//////////////////////////
 
//ECHIPE
     print '</table></td>
 </tr>
</table>';
     
?>



<hr>

<p> Copyright 2012-2020 by Tralsbro Sibiu, Romania. All Rights Reserved.</P>

   </center></body>
 </html>

//clasamentetapemeciuri.php

     <html>
 
 <head>
 <script src="sorttable.js"></script>
<script src="dragtable.js"></script>
 
 <link rel="stylesheet" type="text/css" href="stdtheme.css" />
 
</head>
<body>
<?     include("meniuFotbal.php");?>
<br>
<table ><TR>

<?     
     //CONNECT
mysql_connect("localhost", "root", "");
mysql_select_db("fotbal");

//////////////////////////////////////////////salveaza////////////////////////////////////////////
if(isset($_POST['salveaza']))
{
$sqlm = "UPDATE meciuri SET meciuri.GG='".$_POST['sGG']."',meciuri.GO='".$_POST['sGO']."' WHERE meciuri.ID = ".$_POST['sID'] ;mysql_query($sqlm);

print '<b>Modificarea a fost facuta!</b><br>';
echo "\n<meta http-equiv=\"refresh\" " . " content=\"3;URL=meciuri.php\">\n";

}
/////////////////////////////////////////////end salveaza////////////////////////////////////////


///////////////////////////////////////////////////////////////////////////////////////////////   

if(isset($_GET['etapa'])){
 

        $ETAPA = $_GET['etapa'];
 }       
 else
 {
  $ETAPA =1;
 
 }
for($i=1;$i<=34;$i++)
{

  PRINT '<TD><a href="Clasamentetape.php?id='.$i.'">'.$i.'</a></TD>';
  
 }

///////////////////////////////////////////////////////////////////////////////////////////////
?>

</TR></TABLE> 
          <hr>
<TABLE class="sortabledraggable">
<TR><TD class="ESR">ID</TD><TD class="ESR">ETAPA</TD><TD class="ESR">DATA</TD><TD class="ESR">G</TD><TD class="ESR">GG</TD><TD class="ESR">GO</TD><TD class="ESR">O</TD><TD class="ESR">_</TD><TD class="ESR">G</TD><TD class="ESR">G</TD><TD class="ESR">J</TD><TD class="ESR">O</TD><TD class="ESR">O</TD><TD class="ESR">J</TD><TD class="ESR">Modify</TD></TR>
<?

$sqlMc = "SELECT * FROM meciuri WHERE ETAPA=".$ETAPA." ORDER BY meciuri.ID ASC";

$resursaMc = mysql_query($sqlMc);

WHILE($rowMc = mysql_fetch_array($resursaMc))
{

  PRINT '<TR><TD>'.$rowMc['ID'].' </TD><TD> '.$rowMc['ETAPA'].' </TD><TD> '.$rowMc['DATA'].' </TD><TD> '.$rowMc['GAZDA'].' </TD><TD> '.$rowMc['GG'].' </TD><TD> '.$rowMc['GO'].' </TD><TD> '.$rowMc['OASPETE'].'</TD><TD>';
  
  $sqlEC = "SELECT * FROM meciuri, echipe WHERE echipe.ID=meciuri.GAZDA AND meciuri.ID=".$rowMc['ID']." ORDER BY meciuri.ID ASC";
$resursaEC = mysql_query($sqlEC);

WHILE($rowEC = mysql_fetch_array($resursaEC))
{

  PRINT ' <TD> '.$rowEC['ID'].' </TD><TD> '.$rowEC['ECHIPA'].'</TD><TD> '.$rowEC['JUDET'].'</TD>';

  

}  

$sqlECO = "SELECT * FROM meciuri, echipe WHERE echipe.ID=meciuri.OASPETE AND meciuri.ID=".$rowMc['ID']." ORDER BY meciuri.ID ASC";
$resursaECO = mysql_query($sqlECO);

WHILE($rowECO = mysql_fetch_array($resursaECO))
{

  PRINT ' <TD> '.$rowECO['ID'].' </TD><TD> '.$rowECO['ECHIPA'].' </TD><TD> '.$rowECO['JUDET'].'</TD>';

    print '<TD><FORM action="meciuri.php" method="post">';
  print '<INPUT type="text" name="sGG" size="5" value="'.$rowMc['GG'].'"> - <INPUT type="text" name="sGO" size="5" value="'.$rowMc['GO'].'"><INPUT type="hidden" name="sID" size="5" value="'.$rowMc['ID'].'">';
  print '<input type="submit" value="save" id="save" name="salveaza" title="salveaza">';
  print '</FORM></TD></TR>';
  
  
  

}  



  

}  

//MECIURI COMPLETE
//////////////////////////////////////////////////////////////////


?>
</TABLE>



//clasamentetape.php

     <html>
<title>CLASAMENT</title> 
 <head>
 <script src="sorttable.js"></script>
<script src="dragtable.js"></script>




 <link rel="stylesheet" type="text/css" href="stdtheme.css" />
</head>
      <body>
               <?
                    include("meniuFotbal.php");
               ?>
<hr>
<center><H1>Liga I 2011-2012 CLASAMENT</H1>
<hr>
<?
for($i=1;$i<=34;$i++)
{

  PRINT '<a href="Clasamentetape.php?id='.$i.'">'.$i.'</a> - ';
  
 }
?>
<hr>
<table > <tr>  
  <td><table> <tr> <th>LOC</th> <th>o</th></tr>
    
 <?
  
  if(isset($_GET['id'])){
 

        $nretapa = $_GET['id'];
 }       
 else
 {
    $nretapa=1;
  }
  $ik=1;
  for($ik;$ik<=18;$ik++){
  print '
 <tr>
  <td class="ESR">'.$ik.'</td><td class="ESR"><img src="LOGO/0.jpeg" width="1px" height="20px"></td>
 </tr> ';
  }
  ?>
  
 
</table></td>
  <td>
  
 
  
<? 
             
//CONNECT
mysql_connect("localhost", "root", "");
mysql_select_db("fotbal");

     print '<table class="sortabledraggable"><tr><th>nr</th><th>echipa</th><th>judet</th>
     <th>MT</th><th>VA</th><th>EA</th><th>IA</th><th>VD</th>
     <th>ED</th><th>ID</th><th>GMA</th><th>GMD</th><th>GOA</th>
     <th>GOD</th><th>Vt</th><th>Et</th><th>It</th><th>GMt</th><th>GOt</th><th>GOL</th><th>PCTa</th><th>
     PCTd</th><th>PCT</th><th>ADVa</th><th>ADVd</th><th>ADV</th><th>Ma</th><th>Md</th><th>GOLa</th><th>GOLd</th><TH>LOGO</TH></tr>';

//$sqlE = "SELECT * FROM echipe ORDER BY ID ASC";
$sqlE = "SELECT * FROM echipe ,clasament WHERE echipe.ID=clasament.ID ORDER BY clasament.PUNCTE DESC";
$resursaE = mysql_query($sqlE);
$Va;
$Ea;
$Ia;
$GMa;
$GOa;
$Vd;
$Ed;
$Id;
$GMd;
$GOd;
$Ma;
$Md;
$GOLa;
$GOLd;




WHILE($rowE = mysql_fetch_array($resursaE))
{

  PRINT '<tr><td><A HREF=meciuriEchipa.php?id="'.$rowE['ID'].'">'.$rowE['ID'].'</A></td><td class="ESR"> '.$rowE['ECHIPA'].' </td><td>'.$rowE['JUDET'].'</td>';


  ///////////////////////////////////STARTCLASAMENT//////////////////////////
  
$sqlMT = "SELECT GAZDA, COUNT(GAZDA) FROM meciuri WHERE meciuri.ETAPA<=".$nretapa." AND (meciuri.GAZDA =". $rowE['ID'] ." OR meciuri.OASPETE =". $rowE['ID']." )";
$resursaMT = mysql_query($sqlMT);

WHILE($rowMT = mysql_fetch_array($resursaMT))
{

  PRINT '<td class="ESR"> '.$rowMT['COUNT(GAZDA)'].'</td> ';

} 
//meciuri per echipa TOTAL 

$sqlVa = "SELECT GAZDA, COUNT(GAZDA) FROM meciuri WHERE meciuri.ETAPA<=".$nretapa." AND (meciuri.GAZDA =". $rowE['ID'] .") AND (meciuri.GG > meciuri.GO)";
$resursaVa = mysql_query($sqlVa);

WHILE($rowVa = mysql_fetch_array($resursaVa))
{

  PRINT '<td>'.$rowVa['COUNT(GAZDA)'].'</td> ';
                    $Va=$rowVa['COUNT(GAZDA)'];
} 
//VICTORII per echipa ACASA 

$sqlEQa = "SELECT GAZDA, COUNT(GAZDA) FROM meciuri WHERE meciuri.ETAPA<=".$nretapa." AND (meciuri.GAZDA =". $rowE['ID'] .") AND (meciuri.GG = meciuri.GO)";
$resursaEQa = mysql_query($sqlEQa);

WHILE($rowEQa = mysql_fetch_array($resursaEQa))
{

  PRINT '<td>'.$rowEQa['COUNT(GAZDA)'].'</td> ';
                       $Ea=$rowEQa['COUNT(GAZDA)'];
} 
//AGALURI per echipa  ACASA

$sqlIa = "SELECT GAZDA, COUNT(GAZDA) FROM meciuri WHERE meciuri.ETAPA<=".$nretapa." AND (meciuri.GAZDA =". $rowE['ID'] .") AND (meciuri.GG < meciuri.GO)";
$resursaIa = mysql_query($sqlIa);

WHILE($rowIa = mysql_fetch_array($resursaIa))
{

  PRINT '<td>'.$rowIa['COUNT(GAZDA)'].'</td> ';
                       $Ia=$rowIa['COUNT(GAZDA)'];
} 
//INFRANGERI per echipa  ACASA
////////////////////////////////////////////////////////////////////////////////////////////////
//DEPLASARE
////////////////////////////////////////////////////////////////////////////////////////////////
$sqlVd = "SELECT OASPETE, COUNT(OASPETE) FROM meciuri WHERE meciuri.ETAPA<=".$nretapa." AND (meciuri.OASPETE =". $rowE['ID'] .") AND (meciuri.GG < meciuri.GO)";
$resursaVd = mysql_query($sqlVd);

WHILE($rowVd = mysql_fetch_array($resursaVd))
{

  PRINT '<td>'.$rowVd['COUNT(OASPETE)'].'</td> ';
                          $Vd=$rowVd['COUNT(OASPETE)'];
} 
//VICTORII per echipa DEPLASARE 

$sqlEQd = "SELECT OASPETE, COUNT(OASPETE) FROM meciuri WHERE meciuri.ETAPA<=".$nretapa." AND (meciuri.OASPETE =". $rowE['ID'] .") AND (meciuri.GG = meciuri.GO)";
$resursaEQd = mysql_query($sqlEQd);

WHILE($rowEQd = mysql_fetch_array($resursaEQd))
{

  PRINT '<td>'.$rowEQd['COUNT(OASPETE)'].'</td> ';
                           $Ed=$rowEQd['COUNT(OASPETE)'];
} 
//AGALURI per echipa  DEPLASARE 

$sqlId = "SELECT OASPETE, COUNT(OASPETE) FROM meciuri WHERE meciuri.ETAPA<=".$nretapa." AND (meciuri.OASPETE =". $rowE['ID'] .") AND (meciuri.GG > meciuri.GO)";
$resursaId = mysql_query($sqlId);

WHILE($rowId = mysql_fetch_array($resursaId))
{

  PRINT '<td>'.$rowId['COUNT(OASPETE)'].'</td> ';
                           $Id=$rowId['COUNT(OASPETE)'];
} 
//INFRANGERI per echipa DEPLASARE 

$sqlGMa = "SELECT GG, SUM(GG) FROM meciuri WHERE meciuri.ETAPA<=".$nretapa." AND (meciuri.GAZDA =". $rowE['ID'] .")";
$resursaGMa = mysql_query($sqlGMa);

WHILE($rowGMa = mysql_fetch_array($resursaGMa))
{

  PRINT '<td>'.$rowGMa['SUM(GG)'].'</td> ';
                        $GMa=$rowGMa['SUM(GG)'];
} 
//total goluri marcate  ACASA

$sqlGMd = "SELECT GO, SUM(GO) FROM meciuri WHERE meciuri.ETAPA<=".$nretapa." AND (meciuri.OASPETE =". $rowE['ID'] .")";
$resursaGMd = mysql_query($sqlGMd);

WHILE($rowGMd = mysql_fetch_array($resursaGMd))
{

  PRINT '<td>'.$rowGMd['SUM(GO)'].'</td> ';
                         $GMd=$rowGMd['SUM(GO)'];
} 
//total goluri marcate DEPLASARE

$sqlGOa = "SELECT GO, SUM(GO) FROM meciuri WHERE meciuri.ETAPA<=".$nretapa." AND (meciuri.GAZDA =". $rowE['ID'] .")";
$resursaGOa = mysql_query($sqlGOa);

WHILE($rowGOa = mysql_fetch_array($resursaGOa))
{

  PRINT '<td>'.$rowGOa['SUM(GO)'].' </td>';
                        $GOa=$rowGOa['SUM(GO)'];
} 
//total goluri PRIMITE  ACASA

$sqlGOd = "SELECT GG, SUM(GG) FROM meciuri WHERE meciuri.ETAPA<=".$nretapa." AND (meciuri.OASPETE =". $rowE['ID'] .")";
$resursaGOd = mysql_query($sqlGOd);

WHILE($rowGOd = mysql_fetch_array($resursaGOd))
{

  PRINT '<td>'.$rowGOd['SUM(GG)'].'</td> ';
                                 $GOd=$rowGOd['SUM(GG)'];
} 
//total goluri PRIMITE DEPLASARE
////////////////////////////////////////////////////////
$Vt=$Va+$Vd;
$Et=$Ea+ $Ed;
$It=$Ia+ $Id;
$GMt=$GMa+ $GMd;
$GOt=$GOa+ $GOd;
$GOL=$GMt-$GOt;
$PCTa=($Va*3)+($Ea*1);
$PCTd=($Vd*3)+($Ed*1) ;
$PCT= $PCTa+$PCTd ;
$ADVa=(($Ia*3)+($Ea*2))*(-1);
$ADVd=($Vd*3)+($Ed*1) ;
$ADV= $ADVa+$ADVd ;
$Ma=$Va+$Ea+$Ia;
$Md=$Vd+$Ed+$Id;
$GOLa=$GMa-$GOa;
$GOLd=$GMd-$GOd;


print ' <td class="ESR">'.$Vt.'</td><td class="ESR"> '.$Et.' </td><td class="ESR">'.$It.'</td><td class="ESR"> '.$GMt.'</td><td class="ESR"> '.$GOt.'</td><td class="ESR"> '.$GOL.' </td><td>'.$PCTa.'</td><td> '.$PCTd.'</td><td class="ESR"> '.$PCT.'</td><td> '.$ADVa.'</td><td> '.$ADVd.'</td><td class="ESR"> '.$ADV.'</td>';
print '<td> '.$Ma.'</td><td> '.$Md.'</td><td> '.$GOLa.'</td><td> '.$GOLd.'</td>';

$adresaimagine = "LOGO/".$rowE['ID'].".jpeg";
   if(file_exists($adresaimagine)) { 
     print '<td class="ESR"><A HREF="meciuriEchipa.php?id='.$rowE['ID'].'"><img src="'.$adresaimagine.'" width="20px" height="20px"></a></td>'; }
  
  
 print '</tr>';


 ///////////////////////////////////ENDCLASAMENT//////////////////////////
 
  

}
//ECHIPE
     print '</table></td>
 </tr>
</table>';
     
?>



<hr>

<p> Copyright 2012-2020 by Tralsbro Sibiu, Romania. All Rights Reserved.</P>

   </center></body>
 </html>

//clasamentdeplasaretur.php

     <html>
<title>CLASAMENT</title> 
 <head>
 <script src="sorttable.js"></script>
<script src="dragtable.js"></script>




 <link rel="stylesheet" type="text/css" href="stdtheme.css" />
</head>
      <body>
               <?
                    include("meniuFotbal.php");
               ?>
<hr>
<center><H1>CLASAMENT DEPLASARE TUR</H1>
<hr>
<table > <tr>  
  <td><table> <tr> <th>LOC</th> <th>o</th></tr>
 <?
  $nretapa=17;
  $ik=1;
  for($ik;$ik<=18;$ik++){
  print '
 <tr>
  <td class="ESR">'.$ik.'</td><td class="ESR"><img src="LOGO/0.jpeg" width="1px" height="20px"></td>
 </tr> ';
  }
  ?>
  
 
</table></td>
  <td>
  
 
  
<? 
             
//CONNECT
mysql_connect("localhost", "root", "");
mysql_select_db("fotbal");

     print '<table class="sortabledraggable"><tr><th>nr</th><th>echipa</th><th>judet</th>
     <th>VD</th>
     <th>ED</th><th>ID</th><th>GMD</th><th>GOD</th>
     <th>PCTd</th><th>ADVd</th><th>Md</th><th>GOLd</th><TH>LOGO</TH></tr>';

//$sqlE = "SELECT * FROM echipe ORDER BY ID ASC";
$sqlE = "SELECT * FROM echipe ,clasament WHERE echipe.ID=clasament.ID ORDER BY clasament.PUNCTE DESC";
$resursaE = mysql_query($sqlE);
$Va;
$Ea;
$Ia;
$GMa;
$GOa;
$Vd;
$Ed;
$Id;
$GMd;
$GOd;
$Ma;
$Md;
$GOLa;
$GOLd;




WHILE($rowE = mysql_fetch_array($resursaE))
{

  PRINT '<tr><td><A HREF=meciuriEchipa.php?id="'.$rowE['ID'].'">'.$rowE['ID'].'</A></td><td class="ESR"> '.$rowE['ECHIPA'].' </td><td>'.$rowE['JUDET'].'</td>';


  ///////////////////////////////////STARTCLASAMENT//////////////////////////
  
$sqlMT = "SELECT GAZDA, COUNT(GAZDA) FROM meciuri WHERE meciuri.ETAPA<=".$nretapa." AND meciuri.GAZDA =". $rowE['ID'] ." OR meciuri.OASPETE =". $rowE['ID'] ;
$resursaMT = mysql_query($sqlMT);

WHILE($rowMT = mysql_fetch_array($resursaMT))
{

  //PRINT '<td class="ESR"> '.$rowMT['COUNT(GAZDA)'].'</td> ';

} 
//meciuri per echipa TOTAL 

$sqlVa = "SELECT GAZDA, COUNT(GAZDA) FROM meciuri WHERE meciuri.ETAPA<=".$nretapa." AND  (meciuri.GAZDA =". $rowE['ID'] .") AND (meciuri.GG > meciuri.GO)";
$resursaVa = mysql_query($sqlVa);

WHILE($rowVa = mysql_fetch_array($resursaVa))
{

  //PRINT '<td>'.$rowVa['COUNT(GAZDA)'].'</td> ';
                    $Va=$rowVa['COUNT(GAZDA)'];
} 
//VICTORII per echipa ACASA 

$sqlEQa = "SELECT GAZDA, COUNT(GAZDA) FROM meciuri WHERE meciuri.ETAPA<=".$nretapa." AND  (meciuri.GAZDA =". $rowE['ID'] .") AND (meciuri.GG = meciuri.GO)";
$resursaEQa = mysql_query($sqlEQa);

WHILE($rowEQa = mysql_fetch_array($resursaEQa))
{

  //PRINT '<td>'.$rowEQa['COUNT(GAZDA)'].'</td> ';
                       $Ea=$rowEQa['COUNT(GAZDA)'];
} 
//AGALURI per echipa  ACASA

$sqlIa = "SELECT GAZDA, COUNT(GAZDA) FROM meciuri WHERE meciuri.ETAPA<=".$nretapa." AND  (meciuri.GAZDA =". $rowE['ID'] .") AND (meciuri.GG < meciuri.GO)";
$resursaIa = mysql_query($sqlIa);

WHILE($rowIa = mysql_fetch_array($resursaIa))
{

  //PRINT '<td>'.$rowIa['COUNT(GAZDA)'].'</td> ';
                       $Ia=$rowIa['COUNT(GAZDA)'];
} 
//INFRANGERI per echipa  ACASA
////////////////////////////////////////////////////////////////////////////////////////////////
//DEPLASARE
////////////////////////////////////////////////////////////////////////////////////////////////
$sqlVd = "SELECT OASPETE, COUNT(OASPETE) FROM meciuri WHERE meciuri.ETAPA<=".$nretapa." AND  (meciuri.OASPETE =". $rowE['ID'] .") AND (meciuri.GG < meciuri.GO)";
$resursaVd = mysql_query($sqlVd);

WHILE($rowVd = mysql_fetch_array($resursaVd))
{

  PRINT '<td>'.$rowVd['COUNT(OASPETE)'].'</td> ';
                          $Vd=$rowVd['COUNT(OASPETE)'];
} 
//VICTORII per echipa DEPLASARE 

$sqlEQd = "SELECT OASPETE, COUNT(OASPETE) FROM meciuri WHERE meciuri.ETAPA<=".$nretapa." AND  (meciuri.OASPETE =". $rowE['ID'] .") AND (meciuri.GG = meciuri.GO)";
$resursaEQd = mysql_query($sqlEQd);

WHILE($rowEQd = mysql_fetch_array($resursaEQd))
{

  PRINT '<td>'.$rowEQd['COUNT(OASPETE)'].'</td> ';
                           $Ed=$rowEQd['COUNT(OASPETE)'];
} 
//AGALURI per echipa  DEPLASARE 

$sqlId = "SELECT OASPETE, COUNT(OASPETE) FROM meciuri WHERE meciuri.ETAPA<=".$nretapa." AND  (meciuri.OASPETE =". $rowE['ID'] .") AND (meciuri.GG > meciuri.GO)";
$resursaId = mysql_query($sqlId);

WHILE($rowId = mysql_fetch_array($resursaId))
{

  PRINT '<td>'.$rowId['COUNT(OASPETE)'].'</td> ';
                           $Id=$rowId['COUNT(OASPETE)'];
} 
//INFRANGERI per echipa DEPLASARE 

$sqlGMa = "SELECT GG, SUM(GG) FROM meciuri WHERE meciuri.ETAPA<=".$nretapa." AND  (meciuri.GAZDA =". $rowE['ID'] .")";
$resursaGMa = mysql_query($sqlGMa);

WHILE($rowGMa = mysql_fetch_array($resursaGMa))
{

  //PRINT '<td>'.$rowGMa['SUM(GG)'].'</td> ';
                        $GMa=$rowGMa['SUM(GG)'];
} 
//total goluri marcate  ACASA

$sqlGMd = "SELECT GO, SUM(GO) FROM meciuri WHERE meciuri.ETAPA<=".$nretapa." AND  (meciuri.OASPETE =". $rowE['ID'] .")";
$resursaGMd = mysql_query($sqlGMd);

WHILE($rowGMd = mysql_fetch_array($resursaGMd))
{

  PRINT '<td>'.$rowGMd['SUM(GO)'].'</td> ';
                         $GMd=$rowGMd['SUM(GO)'];
} 
//total goluri marcate DEPLASARE

$sqlGOa = "SELECT GO, SUM(GO) FROM meciuri WHERE meciuri.ETAPA<=".$nretapa." AND  (meciuri.GAZDA =". $rowE['ID'] .")";
$resursaGOa = mysql_query($sqlGOa);

WHILE($rowGOa = mysql_fetch_array($resursaGOa))
{

  //PRINT '<td>'.$rowGOa['SUM(GO)'].' </td>';
                        $GOa=$rowGOa['SUM(GO)'];
} 
//total goluri PRIMITE  ACASA

$sqlGOd = "SELECT GG, SUM(GG) FROM meciuri WHERE meciuri.ETAPA<=".$nretapa." AND  (meciuri.OASPETE =". $rowE['ID'] .")";
$resursaGOd = mysql_query($sqlGOd);

WHILE($rowGOd = mysql_fetch_array($resursaGOd))
{

  PRINT '<td>'.$rowGOd['SUM(GG)'].'</td> ';
                                 $GOd=$rowGOd['SUM(GG)'];
} 
//total goluri PRIMITE DEPLASARE
////////////////////////////////////////////////////////
$Vt=$Va+$Vd;
$Et=$Ea+ $Ed;
$It=$Ia+ $Id;
$GMt=$GMa+ $GMd;
$GOt=$GOa+ $GOd;
$GOL=$GMt-$GOt;
$PCTa=($Va*3)+($Ea*1);
$PCTd=($Vd*3)+($Ed*1) ;
$PCT= $PCTa+$PCTd ;
$ADVa=(($Ia*3)+($Ea*2))*(-1);
$ADVd=($Vd*3)+($Ed*1) ;
$ADV= $ADVa+$ADVd ;
$Ma=$Va+$Ea+$Ia;
$Md=$Vd+$Ed+$Id;
$GOLa=$GMa-$GOa;
$GOLd=$GMd-$GOd;


print '<td>'.$PCTd.'</td><td> '.$ADVd.'</td>';
print '<td> '.$Md.'</td>
<td> '.$GOLd.'</td>
';

$adresaimagine = "LOGO/".$rowE['ID'].".jpeg";
   if(file_exists($adresaimagine)) { 
     print '<td class="ESR"><A HREF="meciuriEchipa.php?id='.$rowE['ID'].'"><img src="'.$adresaimagine.'" width="20px" height="20px"></a></td>'; }
  
  
 print '</tr>';

}
 ///////////////////////////////////ENDCLASAMENT//////////////////////////
 
//ECHIPE
     print '</table></td>
 </tr>
</table>';
     
?>



<hr>

<p> Copyright 2012-2020 by Tralsbro Sibiu, Romania. All Rights Reserved.</P>

   </center></body>
 </html>

//clasamentdeplasareretur.php

     <html>
<title>CLASAMENT</title> 
 <head>
 <script src="sorttable.js"></script>
<script src="dragtable.js"></script>




 <link rel="stylesheet" type="text/css" href="stdtheme.css" />
</head>
      <body>
               <?
                    include("meniuFotbal.php");
               ?>
<hr>
<center><H1>CLASAMENT DEPLASARE RETUR</H1>
<hr>
<table > <tr>  
  <td><table> <tr> <th>LOC</th> <th>o</th></tr>
 <?
  $nretapa=18;
  $ik=1;
  for($ik;$ik<=18;$ik++){
  print '
 <tr>
  <td class="ESR">'.$ik.'</td><td class="ESR"><img src="LOGO/0.jpeg" width="1px" height="20px"></td>
 </tr> ';
  }
  ?>
  
 
</table></td>
  <td>
  
 
  
<? 
             
//CONNECT
mysql_connect("localhost", "root", "");
mysql_select_db("fotbal");

     print '<table class="sortabledraggable"><tr><th>nr</th><th>echipa</th><th>judet</th>
     <th>VD</th>
     <th>ED</th><th>ID</th><th>GMD</th><th>GOD</th>
     <th>PCTd</th><th>ADVd</th><th>Md</th><th>GOLd</th><TH>LOGO</TH></tr>';

//$sqlE = "SELECT * FROM echipe ORDER BY ID ASC";
$sqlE = "SELECT * FROM echipe ,clasament WHERE echipe.ID=clasament.ID ORDER BY clasament.PUNCTE DESC";
$resursaE = mysql_query($sqlE);
$Va;
$Ea;
$Ia;
$GMa;
$GOa;
$Vd;
$Ed;
$Id;
$GMd;
$GOd;
$Ma;
$Md;
$GOLa;
$GOLd;




WHILE($rowE = mysql_fetch_array($resursaE))
{

  PRINT '<tr><td><A HREF=meciuriEchipa.php?id="'.$rowE['ID'].'">'.$rowE['ID'].'</A></td><td class="ESR"> '.$rowE['ECHIPA'].' </td><td>'.$rowE['JUDET'].'</td>';


  ///////////////////////////////////STARTCLASAMENT//////////////////////////
  
$sqlMT = "SELECT GAZDA, COUNT(GAZDA) FROM meciuri WHERE meciuri.ETAPA<=".$nretapa." AND meciuri.GAZDA =". $rowE['ID'] ." OR meciuri.OASPETE =". $rowE['ID'] ;
$resursaMT = mysql_query($sqlMT);

WHILE($rowMT = mysql_fetch_array($resursaMT))
{

  //PRINT '<td class="ESR"> '.$rowMT['COUNT(GAZDA)'].'</td> ';

} 
//meciuri per echipa TOTAL 

$sqlVa = "SELECT GAZDA, COUNT(GAZDA) FROM meciuri WHERE meciuri.ETAPA>=".$nretapa."  AND   (meciuri.GAZDA =". $rowE['ID'] .") AND (meciuri.GG > meciuri.GO)";
$resursaVa = mysql_query($sqlVa);

WHILE($rowVa = mysql_fetch_array($resursaVa))
{

  //PRINT '<td>'.$rowVa['COUNT(GAZDA)'].'</td> ';
                    $Va=$rowVa['COUNT(GAZDA)'];
} 
//VICTORII per echipa ACASA 

$sqlEQa = "SELECT GAZDA, COUNT(GAZDA) FROM meciuri WHERE meciuri.ETAPA>=".$nretapa."  AND   (meciuri.GAZDA =". $rowE['ID'] .") AND (meciuri.GG = meciuri.GO)";
$resursaEQa = mysql_query($sqlEQa);

WHILE($rowEQa = mysql_fetch_array($resursaEQa))
{

  //PRINT '<td>'.$rowEQa['COUNT(GAZDA)'].'</td> ';
                       $Ea=$rowEQa['COUNT(GAZDA)'];
} 
//AGALURI per echipa  ACASA

$sqlIa = "SELECT GAZDA, COUNT(GAZDA) FROM meciuri WHERE meciuri.ETAPA>=".$nretapa."  AND   (meciuri.GAZDA =". $rowE['ID'] .") AND (meciuri.GG < meciuri.GO)";
$resursaIa = mysql_query($sqlIa);

WHILE($rowIa = mysql_fetch_array($resursaIa))
{

  //PRINT '<td>'.$rowIa['COUNT(GAZDA)'].'</td> ';
                       $Ia=$rowIa['COUNT(GAZDA)'];
} 
//INFRANGERI per echipa  ACASA
////////////////////////////////////////////////////////////////////////////////////////////////
//DEPLASARE
////////////////////////////////////////////////////////////////////////////////////////////////
$sqlVd = "SELECT OASPETE, COUNT(OASPETE) FROM meciuri WHERE meciuri.ETAPA>=".$nretapa."  AND   (meciuri.OASPETE =". $rowE['ID'] .") AND (meciuri.GG < meciuri.GO)";
$resursaVd = mysql_query($sqlVd);

WHILE($rowVd = mysql_fetch_array($resursaVd))
{

  PRINT '<td>'.$rowVd['COUNT(OASPETE)'].'</td> ';
                          $Vd=$rowVd['COUNT(OASPETE)'];
} 
//VICTORII per echipa DEPLASARE 

$sqlEQd = "SELECT OASPETE, COUNT(OASPETE) FROM meciuri WHERE meciuri.ETAPA>=".$nretapa."  AND   (meciuri.OASPETE =". $rowE['ID'] .") AND (meciuri.GG = meciuri.GO)";
$resursaEQd = mysql_query($sqlEQd);

WHILE($rowEQd = mysql_fetch_array($resursaEQd))
{

  PRINT '<td>'.$rowEQd['COUNT(OASPETE)'].'</td> ';
                           $Ed=$rowEQd['COUNT(OASPETE)'];
} 
//AGALURI per echipa  DEPLASARE 

$sqlId = "SELECT OASPETE, COUNT(OASPETE) FROM meciuri WHERE meciuri.ETAPA>=".$nretapa."  AND   (meciuri.OASPETE =". $rowE['ID'] .") AND (meciuri.GG > meciuri.GO)";
$resursaId = mysql_query($sqlId);

WHILE($rowId = mysql_fetch_array($resursaId))
{

  PRINT '<td>'.$rowId['COUNT(OASPETE)'].'</td> ';
                           $Id=$rowId['COUNT(OASPETE)'];
} 
//INFRANGERI per echipa DEPLASARE 

$sqlGMa = "SELECT GG, SUM(GG) FROM meciuri WHERE meciuri.ETAPA>=".$nretapa."  AND   (meciuri.GAZDA =". $rowE['ID'] .")";
$resursaGMa = mysql_query($sqlGMa);

WHILE($rowGMa = mysql_fetch_array($resursaGMa))
{

  //PRINT '<td>'.$rowGMa['SUM(GG)'].'</td> ';
                        $GMa=$rowGMa['SUM(GG)'];
} 
//total goluri marcate  ACASA

$sqlGMd = "SELECT GO, SUM(GO) FROM meciuri WHERE meciuri.ETAPA>=".$nretapa."  AND   (meciuri.OASPETE =". $rowE['ID'] .")";
$resursaGMd = mysql_query($sqlGMd);

WHILE($rowGMd = mysql_fetch_array($resursaGMd))
{

  PRINT '<td>'.$rowGMd['SUM(GO)'].'</td> ';
                         $GMd=$rowGMd['SUM(GO)'];
} 
//total goluri marcate DEPLASARE

$sqlGOa = "SELECT GO, SUM(GO) FROM meciuri WHERE meciuri.ETAPA>=".$nretapa."  AND   (meciuri.GAZDA =". $rowE['ID'] .")";
$resursaGOa = mysql_query($sqlGOa);

WHILE($rowGOa = mysql_fetch_array($resursaGOa))
{

  //PRINT '<td>'.$rowGOa['SUM(GO)'].' </td>';
                        $GOa=$rowGOa['SUM(GO)'];
} 
//total goluri PRIMITE  ACASA

$sqlGOd = "SELECT GG, SUM(GG) FROM meciuri WHERE meciuri.ETAPA>=".$nretapa."  AND   (meciuri.OASPETE =". $rowE['ID'] .")";
$resursaGOd = mysql_query($sqlGOd);

WHILE($rowGOd = mysql_fetch_array($resursaGOd))
{

  PRINT '<td>'.$rowGOd['SUM(GG)'].'</td> ';
                                 $GOd=$rowGOd['SUM(GG)'];
} 
//total goluri PRIMITE DEPLASARE
////////////////////////////////////////////////////////
$Vt=$Va+$Vd;
$Et=$Ea+ $Ed;
$It=$Ia+ $Id;
$GMt=$GMa+ $GMd;
$GOt=$GOa+ $GOd;
$GOL=$GMt-$GOt;
$PCTa=($Va*3)+($Ea*1);
$PCTd=($Vd*3)+($Ed*1) ;
$PCT= $PCTa+$PCTd ;
$ADVa=(($Ia*3)+($Ea*2))*(-1);
$ADVd=($Vd*3)+($Ed*1) ;
$ADV= $ADVa+$ADVd ;
$Ma=$Va+$Ea+$Ia;
$Md=$Vd+$Ed+$Id;
$GOLa=$GMa-$GOa;
$GOLd=$GMd-$GOd;


print '<td>'.$PCTd.'</td><td> '.$ADVd.'</td>';
print '<td> '.$Md.'</td>
<td> '.$GOLd.'</td>
';

$adresaimagine = "LOGO/".$rowE['ID'].".jpeg";
   if(file_exists($adresaimagine)) { 
     print '<td class="ESR"><A HREF="meciuriEchipa.php?id='.$rowE['ID'].'"><img src="'.$adresaimagine.'" width="20px" height="20px"></a></td>'; }
  
  
 print '</tr>';

}
 ///////////////////////////////////ENDCLASAMENT//////////////////////////
 
//ECHIPE
     print '</table></td>
 </tr>
</table>';
     
?>



<hr>

<p> Copyright 2012-2020 by Tralsbro Sibiu, Romania. All Rights Reserved.</P>

   </center></body>
 </html>

//clasamentdeplasare.php

     <html>
<title>CLASAMENT</title> 
 <head>
 <script src="sorttable.js"></script>
<script src="dragtable.js"></script>




 <link rel="stylesheet" type="text/css" href="stdtheme.css" />
</head>
      <body>
               <?
                    include("meniuFotbal.php");
               ?>
<hr>
<center><H1>Liga I 2011-2012 CLASAMENT</H1>
<hr>
<table > <tr>  
  <td><table> <tr> <th>LOC</th> <th>o</th></tr>
 <?
  $ik=1;
  for($ik;$ik<=18;$ik++){
  print '
 <tr>
  <td class="ESR">'.$ik.'</td><td class="ESR"><img src="LOGO/0.jpeg" width="1px" height="20px"></td>
 </tr> ';
  }
  ?>
  
 
</table></td>
  <td>
  
 
  
<? 
             
//CONNECT
mysql_connect("localhost", "root", "");
mysql_select_db("fotbal");

     print '<table class="sortabledraggable"><tr><th>nr</th><th>echipa</th><th>judet</th>
     <th>VD</th>
     <th>ED</th><th>ID</th><th>GMD</th><th>GOD</th>
     <th>PCTd</th><th>ADVd</th><th>Md</th><th>GOLd</th><TH>LOGO</TH></tr>';

//$sqlE = "SELECT * FROM echipe ORDER BY ID ASC";
$sqlE = "SELECT * FROM echipe ,clasament WHERE echipe.ID=clasament.ID ORDER BY clasament.PUNCTE DESC";
$resursaE = mysql_query($sqlE);
$Va;
$Ea;
$Ia;
$GMa;
$GOa;
$Vd;
$Ed;
$Id;
$GMd;
$GOd;
$Ma;
$Md;
$GOLa;
$GOLd;




WHILE($rowE = mysql_fetch_array($resursaE))
{

  PRINT '<tr><td><A HREF=meciuriEchipa.php?id="'.$rowE['ID'].'">'.$rowE['ID'].'</A></td><td class="ESR"> '.$rowE['ECHIPA'].' </td><td>'.$rowE['JUDET'].'</td>';


  ///////////////////////////////////STARTCLASAMENT//////////////////////////
  
$sqlMT = "SELECT GAZDA, COUNT(GAZDA) FROM meciuri WHERE meciuri.GAZDA =". $rowE['ID'] ." OR meciuri.OASPETE =". $rowE['ID'] ;
$resursaMT = mysql_query($sqlMT);

WHILE($rowMT = mysql_fetch_array($resursaMT))
{

  //PRINT '<td class="ESR"> '.$rowMT['COUNT(GAZDA)'].'</td> ';

} 
//meciuri per echipa TOTAL 

$sqlVa = "SELECT GAZDA, COUNT(GAZDA) FROM meciuri WHERE (meciuri.GAZDA =". $rowE['ID'] .") AND (meciuri.GG > meciuri.GO)";
$resursaVa = mysql_query($sqlVa);

WHILE($rowVa = mysql_fetch_array($resursaVa))
{

  //PRINT '<td>'.$rowVa['COUNT(GAZDA)'].'</td> ';
                    $Va=$rowVa['COUNT(GAZDA)'];
} 
//VICTORII per echipa ACASA 

$sqlEQa = "SELECT GAZDA, COUNT(GAZDA) FROM meciuri WHERE (meciuri.GAZDA =". $rowE['ID'] .") AND (meciuri.GG = meciuri.GO)";
$resursaEQa = mysql_query($sqlEQa);

WHILE($rowEQa = mysql_fetch_array($resursaEQa))
{

  //PRINT '<td>'.$rowEQa['COUNT(GAZDA)'].'</td> ';
                       $Ea=$rowEQa['COUNT(GAZDA)'];
} 
//AGALURI per echipa  ACASA

$sqlIa = "SELECT GAZDA, COUNT(GAZDA) FROM meciuri WHERE (meciuri.GAZDA =". $rowE['ID'] .") AND (meciuri.GG < meciuri.GO)";
$resursaIa = mysql_query($sqlIa);

WHILE($rowIa = mysql_fetch_array($resursaIa))
{

  //PRINT '<td>'.$rowIa['COUNT(GAZDA)'].'</td> ';
                       $Ia=$rowIa['COUNT(GAZDA)'];
} 
//INFRANGERI per echipa  ACASA
////////////////////////////////////////////////////////////////////////////////////////////////
//DEPLASARE
////////////////////////////////////////////////////////////////////////////////////////////////
$sqlVd = "SELECT OASPETE, COUNT(OASPETE) FROM meciuri WHERE (meciuri.OASPETE =". $rowE['ID'] .") AND (meciuri.GG < meciuri.GO)";
$resursaVd = mysql_query($sqlVd);

WHILE($rowVd = mysql_fetch_array($resursaVd))
{

  PRINT '<td>'.$rowVd['COUNT(OASPETE)'].'</td> ';
                          $Vd=$rowVd['COUNT(OASPETE)'];
} 
//VICTORII per echipa DEPLASARE 

$sqlEQd = "SELECT OASPETE, COUNT(OASPETE) FROM meciuri WHERE (meciuri.OASPETE =". $rowE['ID'] .") AND (meciuri.GG = meciuri.GO)";
$resursaEQd = mysql_query($sqlEQd);

WHILE($rowEQd = mysql_fetch_array($resursaEQd))
{

  PRINT '<td>'.$rowEQd['COUNT(OASPETE)'].'</td> ';
                           $Ed=$rowEQd['COUNT(OASPETE)'];
} 
//AGALURI per echipa  DEPLASARE 

$sqlId = "SELECT OASPETE, COUNT(OASPETE) FROM meciuri WHERE (meciuri.OASPETE =". $rowE['ID'] .") AND (meciuri.GG > meciuri.GO)";
$resursaId = mysql_query($sqlId);

WHILE($rowId = mysql_fetch_array($resursaId))
{

  PRINT '<td>'.$rowId['COUNT(OASPETE)'].'</td> ';
                           $Id=$rowId['COUNT(OASPETE)'];
} 
//INFRANGERI per echipa DEPLASARE 

$sqlGMa = "SELECT GG, SUM(GG) FROM meciuri WHERE (meciuri.GAZDA =". $rowE['ID'] .")";
$resursaGMa = mysql_query($sqlGMa);

WHILE($rowGMa = mysql_fetch_array($resursaGMa))
{

  //PRINT '<td>'.$rowGMa['SUM(GG)'].'</td> ';
                        $GMa=$rowGMa['SUM(GG)'];
} 
//total goluri marcate  ACASA

$sqlGMd = "SELECT GO, SUM(GO) FROM meciuri WHERE (meciuri.OASPETE =". $rowE['ID'] .")";
$resursaGMd = mysql_query($sqlGMd);

WHILE($rowGMd = mysql_fetch_array($resursaGMd))
{

  PRINT '<td>'.$rowGMd['SUM(GO)'].'</td> ';
                         $GMd=$rowGMd['SUM(GO)'];
} 
//total goluri marcate DEPLASARE

$sqlGOa = "SELECT GO, SUM(GO) FROM meciuri WHERE (meciuri.GAZDA =". $rowE['ID'] .")";
$resursaGOa = mysql_query($sqlGOa);

WHILE($rowGOa = mysql_fetch_array($resursaGOa))
{

  //PRINT '<td>'.$rowGOa['SUM(GO)'].' </td>';
                        $GOa=$rowGOa['SUM(GO)'];
} 
//total goluri PRIMITE  ACASA

$sqlGOd = "SELECT GG, SUM(GG) FROM meciuri WHERE (meciuri.OASPETE =". $rowE['ID'] .")";
$resursaGOd = mysql_query($sqlGOd);

WHILE($rowGOd = mysql_fetch_array($resursaGOd))
{

  PRINT '<td>'.$rowGOd['SUM(GG)'].'</td> ';
                                 $GOd=$rowGOd['SUM(GG)'];
} 
//total goluri PRIMITE DEPLASARE
////////////////////////////////////////////////////////
$Vt=$Va+$Vd;
$Et=$Ea+ $Ed;
$It=$Ia+ $Id;
$GMt=$GMa+ $GMd;
$GOt=$GOa+ $GOd;
$GOL=$GMt-$GOt;
$PCTa=($Va*3)+($Ea*1);
$PCTd=($Vd*3)+($Ed*1) ;
$PCT= $PCTa+$PCTd ;
$ADVa=(($Ia*3)+($Ea*2))*(-1);
$ADVd=($Vd*3)+($Ed*1) ;
$ADV= $ADVa+$ADVd ;
$Ma=$Va+$Ea+$Ia;
$Md=$Vd+$Ed+$Id;
$GOLa=$GMa-$GOa;
$GOLd=$GMd-$GOd;


print '<td>'.$PCTd.'</td><td> '.$ADVd.'</td>';
print '<td> '.$Md.'</td>
<td> '.$GOLd.'</td>
';

$adresaimagine = "LOGO/".$rowE['ID'].".jpeg";
   if(file_exists($adresaimagine)) { 
     print '<td class="ESR"><A HREF="meciuriEchipa.php?id='.$rowE['ID'].'"><img src="'.$adresaimagine.'" width="20px" height="20px"></a></td>'; }
  
  
 print '</tr>';

}
 ///////////////////////////////////ENDCLASAMENT//////////////////////////
 
//ECHIPE
     print '</table></td>
 </tr>
</table>';
     
?>



<hr>

<p> Copyright 2012-2020 by Tralsbro Sibiu, Romania. All Rights Reserved.</P>

   </center></body>
 </html>


//clasamentacasatur.php

     <html>
<title>CLASAMENT</title> 
 <head>
 <script src="sorttable.js"></script>
<script src="dragtable.js"></script>




 <link rel="stylesheet" type="text/css" href="stdtheme.css" />
</head>
      <body>
               <?
                    include("meniuFotbal.php");
               ?>
<hr>
<center><H1>Liga I 2011-2012 CLASAMENT</H1>
<hr>
<table > <tr>  
  <td><table> <tr> <th>LOC</th> <th>o</th></tr>
 <?
   $nretapa=17;
  $ik=1;
  for($ik;$ik<=18;$ik++){
  print '
 <tr>
  <td class="ESR">'.$ik.'</td><td class="ESR"><img src="LOGO/0.jpeg" width="1px" height="20px"></td>
 </tr> ';
  }
  ?>
  
 
</table></td>
  <td>
  
 
  
<? 
             
//CONNECT
mysql_connect("localhost", "root", "");
mysql_select_db("fotbal");

     print '<table class="sortabledraggable"><tr><th>nr</th><th>echipa</th><th>judet</th>
     <th>VA</th>
     <th>EA</th><th>IA</th><th>GMA</th><th>GOA</th>
     <th>PCTa</th><th>ADVa</th><th>Ma</th><th>GOLa</th><TH>LOGO</TH></tr>';

//$sqlE = "SELECT * FROM echipe ORDER BY ID ASC";
$sqlE = "SELECT * FROM echipe ,clasament WHERE echipe.ID=clasament.ID ORDER BY clasament.PUNCTE DESC";
$resursaE = mysql_query($sqlE);
$Va;
$Ea;
$Ia;
$GMa;
$GOa;
$Vd;
$Ed;
$Id;
$GMd;
$GOd;
$Ma;
$Md;
$GOLa;
$GOLd;




WHILE($rowE = mysql_fetch_array($resursaE))
{

  PRINT '<tr><td><A HREF=meciuriEchipa.php?id="'.$rowE['ID'].'">'.$rowE['ID'].'</A></td><td class="ESR"> '.$rowE['ECHIPA'].' </td><td>'.$rowE['JUDET'].'</td>';


  ///////////////////////////////////STARTCLASAMENT//////////////////////////
  
$sqlMT = "SELECT GAZDA, COUNT(GAZDA) FROM meciuri WHERE  meciuri.ETAPA<=".$nretapa." AND meciuri.GAZDA =". $rowE['ID'] ." OR meciuri.OASPETE =". $rowE['ID'] ;
$resursaMT = mysql_query($sqlMT);

WHILE($rowMT = mysql_fetch_array($resursaMT))
{

  //PRINT '<td class="ESR"> '.$rowMT['COUNT(GAZDA)'].'</td> ';

} 
//meciuri per echipa TOTAL 

$sqlVa = "SELECT GAZDA, COUNT(GAZDA) FROM meciuri WHERE meciuri.ETAPA<=".$nretapa." AND  (meciuri.GAZDA =". $rowE['ID'] .") AND (meciuri.GG > meciuri.GO)";
$resursaVa = mysql_query($sqlVa);

WHILE($rowVa = mysql_fetch_array($resursaVa))
{

  PRINT '<td>'.$rowVa['COUNT(GAZDA)'].'</td> ';
                    $Va=$rowVa['COUNT(GAZDA)'];
} 
//VICTORII per echipa ACASA 

$sqlEQa = "SELECT GAZDA, COUNT(GAZDA) FROM meciuri WHERE meciuri.ETAPA<=".$nretapa." AND  (meciuri.GAZDA =". $rowE['ID'] .") AND (meciuri.GG = meciuri.GO)";
$resursaEQa = mysql_query($sqlEQa);

WHILE($rowEQa = mysql_fetch_array($resursaEQa))
{

  PRINT '<td>'.$rowEQa['COUNT(GAZDA)'].'</td> ';
                       $Ea=$rowEQa['COUNT(GAZDA)'];
} 
//AGALURI per echipa  ACASA

$sqlIa = "SELECT GAZDA, COUNT(GAZDA) FROM meciuri WHERE meciuri.ETAPA<=".$nretapa." AND  (meciuri.GAZDA =". $rowE['ID'] .") AND (meciuri.GG < meciuri.GO)";
$resursaIa = mysql_query($sqlIa);

WHILE($rowIa = mysql_fetch_array($resursaIa))
{

  PRINT '<td>'.$rowIa['COUNT(GAZDA)'].'</td> ';
                       $Ia=$rowIa['COUNT(GAZDA)'];
} 
//INFRANGERI per echipa  ACASA
////////////////////////////////////////////////////////////////////////////////////////////////
//DEPLASARE
////////////////////////////////////////////////////////////////////////////////////////////////
$sqlVd = "SELECT OASPETE, COUNT(OASPETE) FROM meciuri WHERE meciuri.ETAPA<=".$nretapa." AND  (meciuri.OASPETE =". $rowE['ID'] .") AND (meciuri.GG < meciuri.GO)";
$resursaVd = mysql_query($sqlVd);

WHILE($rowVd = mysql_fetch_array($resursaVd))
{

  //PRINT '<td>'.$rowVd['COUNT(OASPETE)'].'</td> ';
                          $Vd=$rowVd['COUNT(OASPETE)'];
} 
//VICTORII per echipa DEPLASARE 

$sqlEQd = "SELECT OASPETE, COUNT(OASPETE) FROM meciuri WHERE meciuri.ETAPA<=".$nretapa." AND  (meciuri.OASPETE =". $rowE['ID'] .") AND (meciuri.GG = meciuri.GO)";
$resursaEQd = mysql_query($sqlEQd);

WHILE($rowEQd = mysql_fetch_array($resursaEQd))
{

  //PRINT '<td>'.$rowEQd['COUNT(OASPETE)'].'</td> ';
                           $Ed=$rowEQd['COUNT(OASPETE)'];
} 
//AGALURI per echipa  DEPLASARE 

$sqlId = "SELECT OASPETE, COUNT(OASPETE) FROM meciuri WHERE meciuri.ETAPA<=".$nretapa." AND  (meciuri.OASPETE =". $rowE['ID'] .") AND (meciuri.GG > meciuri.GO)";
$resursaId = mysql_query($sqlId);

WHILE($rowId = mysql_fetch_array($resursaId))
{

  //PRINT '<td>'.$rowId['COUNT(OASPETE)'].'</td> ';
                           $Id=$rowId['COUNT(OASPETE)'];
} 
//INFRANGERI per echipa DEPLASARE 

$sqlGMa = "SELECT GG, SUM(GG) FROM meciuri WHERE meciuri.ETAPA<=".$nretapa." AND  (meciuri.GAZDA =". $rowE['ID'] .")";
$resursaGMa = mysql_query($sqlGMa);

WHILE($rowGMa = mysql_fetch_array($resursaGMa))
{

  PRINT '<td>'.$rowGMa['SUM(GG)'].'</td> ';
                        $GMa=$rowGMa['SUM(GG)'];
} 
//total goluri marcate  ACASA

$sqlGMd = "SELECT GO, SUM(GO) FROM meciuri WHERE meciuri.ETAPA<=".$nretapa." AND  (meciuri.OASPETE =". $rowE['ID'] .")";
$resursaGMd = mysql_query($sqlGMd);

WHILE($rowGMd = mysql_fetch_array($resursaGMd))
{

  //PRINT '<td>'.$rowGMd['SUM(GO)'].'</td> ';
                         $GMd=$rowGMd['SUM(GO)'];
} 
//total goluri marcate DEPLASARE

$sqlGOa = "SELECT GO, SUM(GO) FROM meciuri WHERE meciuri.ETAPA<=".$nretapa." AND  (meciuri.GAZDA =". $rowE['ID'] .")";
$resursaGOa = mysql_query($sqlGOa);

WHILE($rowGOa = mysql_fetch_array($resursaGOa))
{

  PRINT '<td>'.$rowGOa['SUM(GO)'].' </td>';
                        $GOa=$rowGOa['SUM(GO)'];
} 
//total goluri PRIMITE  ACASA

$sqlGOd = "SELECT GG, SUM(GG) FROM meciuri WHERE meciuri.ETAPA<=".$nretapa." AND  (meciuri.OASPETE =". $rowE['ID'] .")";
$resursaGOd = mysql_query($sqlGOd);

WHILE($rowGOd = mysql_fetch_array($resursaGOd))
{

  //PRINT '<td>'.$rowGOd['SUM(GG)'].'</td> ';
                                 $GOd=$rowGOd['SUM(GG)'];
} 
//total goluri PRIMITE DEPLASARE
////////////////////////////////////////////////////////
$Vt=$Va+$Vd;
$Et=$Ea+ $Ed;
$It=$Ia+ $Id;
$GMt=$GMa+ $GMd;
$GOt=$GOa+ $GOd;
$GOL=$GMt-$GOt;
$PCTa=($Va*3)+($Ea*1);
$PCTd=($Vd*3)+($Ed*1) ;
$PCT= $PCTa+$PCTd ;
$ADVa=(($Ia*3)+($Ea*2))*(-1);
$ADVd=($Vd*3)+($Ed*1) ;
$ADV= $ADVa+$ADVd ;
$Ma=$Va+$Ea+$Ia;
$Md=$Vd+$Ed+$Id;
$GOLa=$GMa-$GOa;
$GOLd=$GMd-$GOd;


print '<td>'.$PCTa.'</td><td> '.$ADVa.'</td>';
print '<td> '.$Ma.'</td>
<td> '.$GOLa.'</td>
';

$adresaimagine = "LOGO/".$rowE['ID'].".jpeg";
   if(file_exists($adresaimagine)) { 
     print '<td class="ESR"><A HREF="meciuriEchipa.php?id='.$rowE['ID'].'"><img src="'.$adresaimagine.'" width="20px" height="20px"></a></td>'; }
  
  
 print '</tr>';

}
 ///////////////////////////////////ENDCLASAMENT//////////////////////////
 
//ECHIPE
     print '</table></td>
 </tr>
</table>';
     
?>



<hr>

<p> Copyright 2012-2020 by Tralsbro Sibiu, Romania. All Rights Reserved.</P>

   </center></body>
 </html>


//clasamentacasaretur.php

     <html>
<title>CLASAMENT</title> 
 <head>
 <script src="sorttable.js"></script>
<script src="dragtable.js"></script>




 <link rel="stylesheet" type="text/css" href="stdtheme.css" />
</head>
      <body>
               <?
                    include("meniuFotbal.php");
               ?>
<hr>
<center><H1>Liga I 2011-2012 CLASAMENT</H1>
<hr>
<table > <tr>  
  <td><table> <tr> <th>LOC</th> <th>o</th></tr>
 <?
   $nretapa=18;
  $ik=1;
  for($ik;$ik<=18;$ik++){
  print '
 <tr>
  <td class="ESR">'.$ik.'</td><td class="ESR"><img src="LOGO/0.jpeg" width="1px" height="20px"></td>
 </tr> ';
  }
  ?>
  
 
</table></td>
  <td>
  
 
  
<? 
             
//CONNECT
mysql_connect("localhost", "root", "");
mysql_select_db("fotbal");

     print '<table class="sortabledraggable"><tr><th>nr</th><th>echipa</th><th>judet</th>
     <th>VA</th>
     <th>EA</th><th>IA</th><th>GMA</th><th>GOA</th>
     <th>PCTa</th><th>ADVa</th><th>Ma</th><th>GOLa</th><TH>LOGO</TH></tr>';

//$sqlE = "SELECT * FROM echipe ORDER BY ID ASC";
$sqlE = "SELECT * FROM echipe ,clasament WHERE echipe.ID=clasament.ID ORDER BY clasament.PUNCTE DESC";
$resursaE = mysql_query($sqlE);
$Va;
$Ea;
$Ia;
$GMa;
$GOa;
$Vd;
$Ed;
$Id;
$GMd;
$GOd;
$Ma;
$Md;
$GOLa;
$GOLd;




WHILE($rowE = mysql_fetch_array($resursaE))
{

  PRINT '<tr><td><A HREF=meciuriEchipa.php?id="'.$rowE['ID'].'">'.$rowE['ID'].'</A></td><td class="ESR"> '.$rowE['ECHIPA'].' </td><td>'.$rowE['JUDET'].'</td>';


  ///////////////////////////////////STARTCLASAMENT//////////////////////////
  
$sqlMT = "SELECT GAZDA, COUNT(GAZDA) FROM meciuri WHERE  meciuri.ETAPA>=".$nretapa." AND meciuri.GAZDA =". $rowE['ID'] ." OR meciuri.OASPETE =". $rowE['ID'] ;
$resursaMT = mysql_query($sqlMT);

WHILE($rowMT = mysql_fetch_array($resursaMT))
{

  //PRINT '<td class="ESR"> '.$rowMT['COUNT(GAZDA)'].'</td> ';

} 
//meciuri per echipa TOTAL 

$sqlVa = "SELECT GAZDA, COUNT(GAZDA) FROM meciuri WHERE meciuri.ETAPA>=".$nretapa." AND  (meciuri.GAZDA =". $rowE['ID'] .") AND (meciuri.GG > meciuri.GO)";
$resursaVa = mysql_query($sqlVa);

WHILE($rowVa = mysql_fetch_array($resursaVa))
{

  PRINT '<td>'.$rowVa['COUNT(GAZDA)'].'</td> ';
                    $Va=$rowVa['COUNT(GAZDA)'];
} 
//VICTORII per echipa ACASA 

$sqlEQa = "SELECT GAZDA, COUNT(GAZDA) FROM meciuri WHERE meciuri.ETAPA>=".$nretapa." AND  (meciuri.GAZDA =". $rowE['ID'] .") AND (meciuri.GG = meciuri.GO)";
$resursaEQa = mysql_query($sqlEQa);

WHILE($rowEQa = mysql_fetch_array($resursaEQa))
{

  PRINT '<td>'.$rowEQa['COUNT(GAZDA)'].'</td> ';
                       $Ea=$rowEQa['COUNT(GAZDA)'];
} 
//AGALURI per echipa  ACASA

$sqlIa = "SELECT GAZDA, COUNT(GAZDA) FROM meciuri WHERE meciuri.ETAPA>=".$nretapa." AND  (meciuri.GAZDA =". $rowE['ID'] .") AND (meciuri.GG < meciuri.GO)";
$resursaIa = mysql_query($sqlIa);

WHILE($rowIa = mysql_fetch_array($resursaIa))
{

  PRINT '<td>'.$rowIa['COUNT(GAZDA)'].'</td> ';
                       $Ia=$rowIa['COUNT(GAZDA)'];
} 
//INFRANGERI per echipa  ACASA
////////////////////////////////////////////////////////////////////////////////////////////////
//DEPLASARE
////////////////////////////////////////////////////////////////////////////////////////////////
$sqlVd = "SELECT OASPETE, COUNT(OASPETE) FROM meciuri WHERE meciuri.ETAPA>=".$nretapa." AND  (meciuri.OASPETE =". $rowE['ID'] .") AND (meciuri.GG < meciuri.GO)";
$resursaVd = mysql_query($sqlVd);

WHILE($rowVd = mysql_fetch_array($resursaVd))
{

  //PRINT '<td>'.$rowVd['COUNT(OASPETE)'].'</td> ';
                          $Vd=$rowVd['COUNT(OASPETE)'];
} 
//VICTORII per echipa DEPLASARE 

$sqlEQd = "SELECT OASPETE, COUNT(OASPETE) FROM meciuri WHERE meciuri.ETAPA>=".$nretapa." AND  (meciuri.OASPETE =". $rowE['ID'] .") AND (meciuri.GG = meciuri.GO)";
$resursaEQd = mysql_query($sqlEQd);

WHILE($rowEQd = mysql_fetch_array($resursaEQd))
{

  //PRINT '<td>'.$rowEQd['COUNT(OASPETE)'].'</td> ';
                           $Ed=$rowEQd['COUNT(OASPETE)'];
} 
//AGALURI per echipa  DEPLASARE 

$sqlId = "SELECT OASPETE, COUNT(OASPETE) FROM meciuri WHERE meciuri.ETAPA>=".$nretapa." AND  (meciuri.OASPETE =". $rowE['ID'] .") AND (meciuri.GG > meciuri.GO)";
$resursaId = mysql_query($sqlId);

WHILE($rowId = mysql_fetch_array($resursaId))
{

  //PRINT '<td>'.$rowId['COUNT(OASPETE)'].'</td> ';
                           $Id=$rowId['COUNT(OASPETE)'];
} 
//INFRANGERI per echipa DEPLASARE 

$sqlGMa = "SELECT GG, SUM(GG) FROM meciuri WHERE meciuri.ETAPA>=".$nretapa." AND  (meciuri.GAZDA =". $rowE['ID'] .")";
$resursaGMa = mysql_query($sqlGMa);

WHILE($rowGMa = mysql_fetch_array($resursaGMa))
{

  PRINT '<td>'.$rowGMa['SUM(GG)'].'</td> ';
                        $GMa=$rowGMa['SUM(GG)'];
} 
//total goluri marcate  ACASA

$sqlGMd = "SELECT GO, SUM(GO) FROM meciuri WHERE meciuri.ETAPA>=".$nretapa." AND  (meciuri.OASPETE =". $rowE['ID'] .")";
$resursaGMd = mysql_query($sqlGMd);

WHILE($rowGMd = mysql_fetch_array($resursaGMd))
{

  //PRINT '<td>'.$rowGMd['SUM(GO)'].'</td> ';
                         $GMd=$rowGMd['SUM(GO)'];
} 
//total goluri marcate DEPLASARE

$sqlGOa = "SELECT GO, SUM(GO) FROM meciuri WHERE meciuri.ETAPA>=".$nretapa." AND  (meciuri.GAZDA =". $rowE['ID'] .")";
$resursaGOa = mysql_query($sqlGOa);

WHILE($rowGOa = mysql_fetch_array($resursaGOa))
{

  PRINT '<td>'.$rowGOa['SUM(GO)'].' </td>';
                        $GOa=$rowGOa['SUM(GO)'];
} 
//total goluri PRIMITE  ACASA

$sqlGOd = "SELECT GG, SUM(GG) FROM meciuri WHERE meciuri.ETAPA>=".$nretapa." AND  (meciuri.OASPETE =". $rowE['ID'] .")";
$resursaGOd = mysql_query($sqlGOd);

WHILE($rowGOd = mysql_fetch_array($resursaGOd))
{

  //PRINT '<td>'.$rowGOd['SUM(GG)'].'</td> ';
                                 $GOd=$rowGOd['SUM(GG)'];
} 
//total goluri PRIMITE DEPLASARE
////////////////////////////////////////////////////////
$Vt=$Va+$Vd;
$Et=$Ea+ $Ed;
$It=$Ia+ $Id;
$GMt=$GMa+ $GMd;
$GOt=$GOa+ $GOd;
$GOL=$GMt-$GOt;
$PCTa=($Va*3)+($Ea*1);
$PCTd=($Vd*3)+($Ed*1) ;
$PCT= $PCTa+$PCTd ;
$ADVa=(($Ia*3)+($Ea*2))*(-1);
$ADVd=($Vd*3)+($Ed*1) ;
$ADV= $ADVa+$ADVd ;
$Ma=$Va+$Ea+$Ia;
$Md=$Vd+$Ed+$Id;
$GOLa=$GMa-$GOa;
$GOLd=$GMd-$GOd;


print '<td>'.$PCTa.'</td><td> '.$ADVa.'</td>';
print '<td> '.$Ma.'</td>
<td> '.$GOLa.'</td>
';

$adresaimagine = "LOGO/".$rowE['ID'].".jpeg";
   if(file_exists($adresaimagine)) { 
     print '<td class="ESR"><A HREF="meciuriEchipa.php?id='.$rowE['ID'].'"><img src="'.$adresaimagine.'" width="20px" height="20px"></a></td>'; }
  
  
 print '</tr>';

}
 ///////////////////////////////////ENDCLASAMENT//////////////////////////
 
//ECHIPE
     print '</table></td>
 </tr>
</table>';
     
?>



<hr>

<p> Copyright 2012-2020 by Tralsbro Sibiu, Romania. All Rights Reserved.</P>

   </center></body>
 </html>

//clasamentacasa.php

     <html>
<title>CLASAMENT</title> 
 <head>
 <script src="sorttable.js"></script>
<script src="dragtable.js"></script>




 <link rel="stylesheet" type="text/css" href="stdtheme.css" />
</head>
      <body>
               <?
                    include("meniuFotbal.php");
               ?>
<hr>
<center><H1>Liga I 2011-2012 CLASAMENT</H1>
<hr>
<table > <tr>  
  <td><table> <tr> <th>LOC</th> <th>o</th></tr>
 <?
  $ik=1;
  for($ik;$ik<=18;$ik++){
  print '
 <tr>
  <td class="ESR">'.$ik.'</td><td class="ESR"><img src="LOGO/0.jpeg" width="1px" height="20px"></td>
 </tr> ';
  }
  ?>
  
 
</table></td>
  <td>
  
 
  
<? 
             
//CONNECT
mysql_connect("localhost", "root", "");
mysql_select_db("fotbal");

     print '<table class="sortabledraggable"><tr><th>nr</th><th>echipa</th><th>judet</th>
     <th>VA</th>
     <th>EA</th><th>IA</th><th>GMA</th><th>GOA</th>
     <th>PCTa</th><th>ADVa</th><th>Ma</th><th>GOLa</th><TH>LOGO</TH></tr>';

//$sqlE = "SELECT * FROM echipe ORDER BY ID ASC";
$sqlE = "SELECT * FROM echipe ,clasament WHERE echipe.ID=clasament.ID ORDER BY clasament.PUNCTE DESC";

$resursaE = mysql_query($sqlE);
$Va;
$Ea;
$Ia;
$GMa;
$GOa;
$Vd;
$Ed;
$Id;
$GMd;
$GOd;
$Ma;
$Md;
$GOLa;
$GOLd;




WHILE($rowE = mysql_fetch_array($resursaE))
{

  PRINT '<tr><td><A HREF=meciuriEchipa.php?id="'.$rowE['ID'].'">'.$rowE['ID'].'</A></td><td class="ESR"> '.$rowE['ECHIPA'].' </td><td>'.$rowE['JUDET'].'</td>';


  ///////////////////////////////////STARTCLASAMENT//////////////////////////
  
$sqlMT = "SELECT GAZDA, COUNT(GAZDA) FROM meciuri WHERE meciuri.GAZDA =". $rowE['ID'] ." OR meciuri.OASPETE =". $rowE['ID'] ;
$resursaMT = mysql_query($sqlMT);

WHILE($rowMT = mysql_fetch_array($resursaMT))
{

  //PRINT '<td class="ESR"> '.$rowMT['COUNT(GAZDA)'].'</td> ';

} 
//meciuri per echipa TOTAL 

$sqlVa = "SELECT GAZDA, COUNT(GAZDA) FROM meciuri WHERE (meciuri.GAZDA =". $rowE['ID'] .") AND (meciuri.GG > meciuri.GO)";
$resursaVa = mysql_query($sqlVa);

WHILE($rowVa = mysql_fetch_array($resursaVa))
{

  PRINT '<td>'.$rowVa['COUNT(GAZDA)'].'</td> ';
                    $Va=$rowVa['COUNT(GAZDA)'];
} 
//VICTORII per echipa ACASA 

$sqlEQa = "SELECT GAZDA, COUNT(GAZDA) FROM meciuri WHERE (meciuri.GAZDA =". $rowE['ID'] .") AND (meciuri.GG = meciuri.GO)";
$resursaEQa = mysql_query($sqlEQa);

WHILE($rowEQa = mysql_fetch_array($resursaEQa))
{

  PRINT '<td>'.$rowEQa['COUNT(GAZDA)'].'</td> ';
                       $Ea=$rowEQa['COUNT(GAZDA)'];
} 
//AGALURI per echipa  ACASA

$sqlIa = "SELECT GAZDA, COUNT(GAZDA) FROM meciuri WHERE (meciuri.GAZDA =". $rowE['ID'] .") AND (meciuri.GG < meciuri.GO)";
$resursaIa = mysql_query($sqlIa);

WHILE($rowIa = mysql_fetch_array($resursaIa))
{

  PRINT '<td>'.$rowIa['COUNT(GAZDA)'].'</td> ';
                       $Ia=$rowIa['COUNT(GAZDA)'];
} 
//INFRANGERI per echipa  ACASA
////////////////////////////////////////////////////////////////////////////////////////////////
//DEPLASARE
////////////////////////////////////////////////////////////////////////////////////////////////
$sqlVd = "SELECT OASPETE, COUNT(OASPETE) FROM meciuri WHERE (meciuri.OASPETE =". $rowE['ID'] .") AND (meciuri.GG < meciuri.GO)";
$resursaVd = mysql_query($sqlVd);

WHILE($rowVd = mysql_fetch_array($resursaVd))
{

  //PRINT '<td>'.$rowVd['COUNT(OASPETE)'].'</td> ';
                          $Vd=$rowVd['COUNT(OASPETE)'];
} 
//VICTORII per echipa DEPLASARE 

$sqlEQd = "SELECT OASPETE, COUNT(OASPETE) FROM meciuri WHERE (meciuri.OASPETE =". $rowE['ID'] .") AND (meciuri.GG = meciuri.GO)";
$resursaEQd = mysql_query($sqlEQd);

WHILE($rowEQd = mysql_fetch_array($resursaEQd))
{

  //PRINT '<td>'.$rowEQd['COUNT(OASPETE)'].'</td> ';
                           $Ed=$rowEQd['COUNT(OASPETE)'];
} 
//AGALURI per echipa  DEPLASARE 

$sqlId = "SELECT OASPETE, COUNT(OASPETE) FROM meciuri WHERE (meciuri.OASPETE =". $rowE['ID'] .") AND (meciuri.GG > meciuri.GO)";
$resursaId = mysql_query($sqlId);

WHILE($rowId = mysql_fetch_array($resursaId))
{

  //PRINT '<td>'.$rowId['COUNT(OASPETE)'].'</td> ';
                           $Id=$rowId['COUNT(OASPETE)'];
} 
//INFRANGERI per echipa DEPLASARE 

$sqlGMa = "SELECT GG, SUM(GG) FROM meciuri WHERE (meciuri.GAZDA =". $rowE['ID'] .")";
$resursaGMa = mysql_query($sqlGMa);

WHILE($rowGMa = mysql_fetch_array($resursaGMa))
{

  PRINT '<td>'.$rowGMa['SUM(GG)'].'</td> ';
                        $GMa=$rowGMa['SUM(GG)'];
} 
//total goluri marcate  ACASA

$sqlGMd = "SELECT GO, SUM(GO) FROM meciuri WHERE (meciuri.OASPETE =". $rowE['ID'] .")";
$resursaGMd = mysql_query($sqlGMd);

WHILE($rowGMd = mysql_fetch_array($resursaGMd))
{

  //PRINT '<td>'.$rowGMd['SUM(GO)'].'</td> ';
                         $GMd=$rowGMd['SUM(GO)'];
} 
//total goluri marcate DEPLASARE

$sqlGOa = "SELECT GO, SUM(GO) FROM meciuri WHERE (meciuri.GAZDA =". $rowE['ID'] .")";
$resursaGOa = mysql_query($sqlGOa);

WHILE($rowGOa = mysql_fetch_array($resursaGOa))
{

  PRINT '<td>'.$rowGOa['SUM(GO)'].' </td>';
                        $GOa=$rowGOa['SUM(GO)'];
} 
//total goluri PRIMITE  ACASA

$sqlGOd = "SELECT GG, SUM(GG) FROM meciuri WHERE (meciuri.OASPETE =". $rowE['ID'] .")";
$resursaGOd = mysql_query($sqlGOd);

WHILE($rowGOd = mysql_fetch_array($resursaGOd))
{

  //PRINT '<td>'.$rowGOd['SUM(GG)'].'</td> ';
                                 $GOd=$rowGOd['SUM(GG)'];
} 
//total goluri PRIMITE DEPLASARE
////////////////////////////////////////////////////////
$Vt=$Va+$Vd;
$Et=$Ea+ $Ed;
$It=$Ia+ $Id;
$GMt=$GMa+ $GMd;
$GOt=$GOa+ $GOd;
$GOL=$GMt-$GOt;
$PCTa=($Va*3)+($Ea*1);
$PCTd=($Vd*3)+($Ed*1) ;
$PCT= $PCTa+$PCTd ;
$ADVa=(($Ia*3)+($Ea*2))*(-1);
$ADVd=($Vd*3)+($Ed*1) ;
$ADV= $ADVa+$ADVd ;
$Ma=$Va+$Ea+$Ia;
$Md=$Vd+$Ed+$Id;
$GOLa=$GMa-$GOa;
$GOLd=$GMd-$GOd;


print '<td>'.$PCTa.'</td><td> '.$ADVa.'</td>';
print '<td> '.$Ma.'</td>
<td> '.$GOLa.'</td>
';

$adresaimagine = "LOGO/".$rowE['ID'].".jpeg";
   if(file_exists($adresaimagine)) { 
     print '<td class="ESR"><A HREF="meciuriEchipa.php?id='.$rowE['ID'].'"><img src="'.$adresaimagine.'" width="20px" height="20px"></a></td>'; }
  
  
 print '</tr>';

}
 ///////////////////////////////////ENDCLASAMENT//////////////////////////
 
//ECHIPE
     print '</table></td>
 </tr>
</table>';
     
?>



<hr>

<p> Copyright 2012-2020 by Tralsbro Sibiu, Romania. All Rights Reserved.</P>

   </center></body>
 </html>



//clasament.php

     <html>
<title>CLASAMENT</title> 
 <head>
 <script src="sorttable.js"></script>
<script src="dragtable.js"></script>




 <link rel="stylesheet" type="text/css" href="stdtheme.css" />
</head>
      <body>
               <?
                    include("meniuFotbal.php");
               ?>
<hr>
<center><H1>Liga I 2011-2012 CLASAMENT</H1>
<hr>
<table > <tr>  
  <td><table> <tr> <th>LOC</th> <th>o</th></tr>
 <?
  $ik=1;
  for($ik;$ik<=18;$ik++){
  print '
 <tr>
  <td class="ESR">'.$ik.'</td><td class="ESR"><img src="LOGO/0.jpeg" width="1px" height="20px"></td>
 </tr> ';
  }
  ?>
  
 
</table></td>
  <td>
  
 
  
<? 
             
//CONNECT
mysql_connect("localhost", "root", "");
mysql_select_db("fotbal");

     print '<table class="sortabledraggable"><tr><th>nr</th><th>echipa</th><th>judet</th>
     <th>MT</th><th>VA</th><th>EA</th><th>IA</th><th>VD</th>
     <th>ED</th><th>ID</th><th>GMA</th><th>GMD</th><th>GOA</th>
     <th>GOD</th><th>Vt</th><th>Et</th><th>It</th><th>GMt</th><th>GOt</th><th>GOL</th><th>PCTa</th><th>
     PCTd</th><th>PCT</th><th>ADVa</th><th>ADVd</th><th>ADV</th><th>Ma</th><th>Md</th><th>GOLa</th><th>GOLd</th><TH>LOGO</TH></tr>';

//$sqlE = "SELECT * FROM echipe ORDER BY ID ASC";
$sqlE = "SELECT * FROM echipe ,clasament WHERE echipe.ID=clasament.ID ORDER BY   clasament.PUNCTE DESC,  clasament.GOL DESC,clasament.GM DESC";
$resursaE = mysql_query($sqlE);
$Va;
$Ea;
$Ia;
$GMa;
$GOa;
$Vd;
$Ed;
$Id;
$GMd;
$GOd;
$Ma;
$Md;
$GOLa;
$GOLd;




WHILE($rowE = mysql_fetch_array($resursaE))
{

  PRINT '<tr><td><A HREF=meciuriEchipa.php?id="'.$rowE['ID'].'">'.$rowE['ID'].'</A></td><td class="ESR"> '.$rowE['ECHIPA'].' </td><td>'.$rowE['JUDET'].'</td>';


  ///////////////////////////////////STARTCLASAMENT//////////////////////////
  
$sqlMT = "SELECT GAZDA, COUNT(GAZDA) FROM meciuri WHERE meciuri.GAZDA =". $rowE['ID'] ." OR meciuri.OASPETE =". $rowE['ID'] ;
$resursaMT = mysql_query($sqlMT);

WHILE($rowMT = mysql_fetch_array($resursaMT))
{

  PRINT '<td class="ESR"> '.$rowMT['COUNT(GAZDA)'].'</td> ';

} 
//meciuri per echipa TOTAL 

$sqlVa = "SELECT GAZDA, COUNT(GAZDA) FROM meciuri WHERE (meciuri.GAZDA =". $rowE['ID'] .") AND (meciuri.GG > meciuri.GO)";
$resursaVa = mysql_query($sqlVa);

WHILE($rowVa = mysql_fetch_array($resursaVa))
{

  PRINT '<td>'.$rowVa['COUNT(GAZDA)'].'</td> ';
                    $Va=$rowVa['COUNT(GAZDA)'];
} 
//VICTORII per echipa ACASA 

$sqlEQa = "SELECT GAZDA, COUNT(GAZDA) FROM meciuri WHERE (meciuri.GAZDA =". $rowE['ID'] .") AND (meciuri.GG = meciuri.GO)";
$resursaEQa = mysql_query($sqlEQa);

WHILE($rowEQa = mysql_fetch_array($resursaEQa))
{

  PRINT '<td>'.$rowEQa['COUNT(GAZDA)'].'</td> ';
                       $Ea=$rowEQa['COUNT(GAZDA)'];
} 
//AGALURI per echipa  ACASA

$sqlIa = "SELECT GAZDA, COUNT(GAZDA) FROM meciuri WHERE (meciuri.GAZDA =". $rowE['ID'] .") AND (meciuri.GG < meciuri.GO)";
$resursaIa = mysql_query($sqlIa);

WHILE($rowIa = mysql_fetch_array($resursaIa))
{

  PRINT '<td>'.$rowIa['COUNT(GAZDA)'].'</td> ';
                       $Ia=$rowIa['COUNT(GAZDA)'];
} 
//INFRANGERI per echipa  ACASA
////////////////////////////////////////////////////////////////////////////////////////////////
//DEPLASARE
////////////////////////////////////////////////////////////////////////////////////////////////
$sqlVd = "SELECT OASPETE, COUNT(OASPETE) FROM meciuri WHERE (meciuri.OASPETE =". $rowE['ID'] .") AND (meciuri.GG < meciuri.GO)";
$resursaVd = mysql_query($sqlVd);

WHILE($rowVd = mysql_fetch_array($resursaVd))
{

  PRINT '<td>'.$rowVd['COUNT(OASPETE)'].'</td> ';
                          $Vd=$rowVd['COUNT(OASPETE)'];
} 
//VICTORII per echipa DEPLASARE 

$sqlEQd = "SELECT OASPETE, COUNT(OASPETE) FROM meciuri WHERE (meciuri.OASPETE =". $rowE['ID'] .") AND (meciuri.GG = meciuri.GO)";
$resursaEQd = mysql_query($sqlEQd);

WHILE($rowEQd = mysql_fetch_array($resursaEQd))
{

  PRINT '<td>'.$rowEQd['COUNT(OASPETE)'].'</td> ';
                           $Ed=$rowEQd['COUNT(OASPETE)'];
} 
//AGALURI per echipa  DEPLASARE 

$sqlId = "SELECT OASPETE, COUNT(OASPETE) FROM meciuri WHERE (meciuri.OASPETE =". $rowE['ID'] .") AND (meciuri.GG > meciuri.GO)";
$resursaId = mysql_query($sqlId);

WHILE($rowId = mysql_fetch_array($resursaId))
{

  PRINT '<td>'.$rowId['COUNT(OASPETE)'].'</td> ';
                           $Id=$rowId['COUNT(OASPETE)'];
} 
//INFRANGERI per echipa DEPLASARE 

$sqlGMa = "SELECT GG, SUM(GG) FROM meciuri WHERE (meciuri.GAZDA =". $rowE['ID'] .")";
$resursaGMa = mysql_query($sqlGMa);

WHILE($rowGMa = mysql_fetch_array($resursaGMa))
{

  PRINT '<td>'.$rowGMa['SUM(GG)'].'</td> ';
                        $GMa=$rowGMa['SUM(GG)'];
} 
//total goluri marcate  ACASA

$sqlGMd = "SELECT GO, SUM(GO) FROM meciuri WHERE (meciuri.OASPETE =". $rowE['ID'] .")";
$resursaGMd = mysql_query($sqlGMd);

WHILE($rowGMd = mysql_fetch_array($resursaGMd))
{

  PRINT '<td>'.$rowGMd['SUM(GO)'].'</td> ';
                         $GMd=$rowGMd['SUM(GO)'];
} 
//total goluri marcate DEPLASARE

$sqlGOa = "SELECT GO, SUM(GO) FROM meciuri WHERE (meciuri.GAZDA =". $rowE['ID'] .")";
$resursaGOa = mysql_query($sqlGOa);

WHILE($rowGOa = mysql_fetch_array($resursaGOa))
{

  PRINT '<td>'.$rowGOa['SUM(GO)'].' </td>';
                        $GOa=$rowGOa['SUM(GO)'];
} 
//total goluri PRIMITE  ACASA

$sqlGOd = "SELECT GG, SUM(GG) FROM meciuri WHERE (meciuri.OASPETE =". $rowE['ID'] .")";
$resursaGOd = mysql_query($sqlGOd);

WHILE($rowGOd = mysql_fetch_array($resursaGOd))
{

  PRINT '<td>'.$rowGOd['SUM(GG)'].'</td> ';
                                 $GOd=$rowGOd['SUM(GG)'];
} 
//total goluri PRIMITE DEPLASARE
////////////////////////////////////////////////////////
$Vt=$Va+$Vd;
$Et=$Ea+ $Ed;
$It=$Ia+ $Id;
$GMt=$GMa+ $GMd;
$GOt=$GOa+ $GOd;
$GOL=$GMt-$GOt;
$PCTa=($Va*3)+($Ea*1);
$PCTd=($Vd*3)+($Ed*1) ;
$PCT= $PCTa+$PCTd ;
$ADVa=(($Ia*3)+($Ea*2))*(-1);
$ADVd=($Vd*3)+($Ed*1) ;
$ADV= $ADVa+$ADVd ;
$Ma=$Va+$Ea+$Ia;
$Md=$Vd+$Ed+$Id;
$GOLa=$GMa-$GOa;
$GOLd=$GMd-$GOd;


print ' <td class="ESR">'.$Vt.'</td><td class="ESR"> '.$Et.' </td><td class="ESR">'.$It.'</td><td class="ESR"> '.$GMt.'</td><td class="ESR"> '.$GOt.'</td><td class="ESR"> '.$GOL.' </td><td>'.$PCTa.'</td><td> '.$PCTd.'</td><td class="ESR"> '.$PCT.'</td><td> '.$ADVa.'</td><td> '.$ADVd.'</td><td class="ESR"> '.$ADV.'</td>';
print '<td> '.$Ma.'</td><td> '.$Md.'</td><td> '.$GOLa.'</td><td> '.$GOLd.'</td>';

$adresaimagine = "LOGO/".$rowE['ID'].".jpeg";
   if(file_exists($adresaimagine)) { 
     print '<td class="ESR"><A HREF="meciuriEchipa.php?id='.$rowE['ID'].'"><img src="'.$adresaimagine.'" width="20px" height="20px"></a></td>'; }
  
  
 print '</tr>';

}
 ///////////////////////////////////ENDCLASAMENT//////////////////////////
 
//ECHIPE
     print '</table></td>
 </tr>
</table>';
     
?>



<hr>

<p> Copyright 2012-2020 by Tralsbro Sibiu, Romania. All Rights Reserved.</P>

   </center></body>
 </html>

//clasament_total.php

     <html>
<title>CLASAMENT</title> 
 <head>
 <script src="sorttable.js"></script>
<script src="dragtable.js"></script>




 <link rel="stylesheet" type="text/css" href="stdtheme.css" />
</head>
      <body>
               <?
                    include("meniuFotbal.php");
               ?>
<hr>
<center><H1>Liga I 2011-2012 CLASAMENT</H1>
<hr>
<table > <tr>  
  <td><table> <tr> <th>LOC</th> <th>o</th></tr>
 <?
  $ik=1;
  for($ik;$ik<=18;$ik++){
  print '
 <tr>
  <td class="ESR">'.$ik.'</td><td class="ESR"><img src="LOGO/0.jpeg" width="1px" height="20px"></td>
 </tr> ';
  }
  ?>
  
 
</table></td>
  <td>
  
 
  
<? 
             
//CONNECT
mysql_connect("localhost", "root", "");
mysql_select_db("fotbal");

     print '<table class="sortabledraggable"><tr><th>nr</th><th>echipa</th><th>judet</th>';
     print '<th>MT</th>';
     //PRINT'<th>VA</th><th>EA</th><th>IA</th><th>VD</th>';
     //print '<th>ED</th><th>ID</th><th>GMA</th><th>GMD</th><th>GOA</th>';
     //print '<th>GOD</th>';
     PRINT '<th>Vt</th><th>Et</th><th>It</th><th>GMt</th><th>GOt</th><th>GOL</th>';
     //print '<th>PCTa</th>';
     //print '<th>PCTd</th>';
     print'<th>PCT</th>';
     //print'<th>ADVa</th><th>ADVd</th>';
     print'<th>ADV</th>';
     //print'<th>Ma</th><th>Md</th><th>GOLa</th><th>GOLd</th>';
     print'<TH>LOGO</TH></tr>';

//$sqlE = "SELECT * FROM echipe ORDER BY ID ASC";
$sqlE = "SELECT * FROM echipe ,clasament WHERE echipe.ID=clasament.ID ORDER BY   clasament.PUNCTE DESC,  clasament.GOL DESC,clasament.GM DESC";
$resursaE = mysql_query($sqlE);
$Va;
$Ea;
$Ia;
$GMa;
$GOa;
$Vd;
$Ed;
$Id;
$GMd;
$GOd;
$Ma;
$Md;
$GOLa;
$GOLd;




WHILE($rowE = mysql_fetch_array($resursaE))
{

  PRINT '<tr><td><A HREF=meciuriEchipa.php?id="'.$rowE['ID'].'">'.$rowE['ID'].'</A></td><td class="ESR"> '.$rowE['ECHIPA'].' </td><td>'.$rowE['JUDET'].'</td>';


  ///////////////////////////////////STARTCLASAMENT//////////////////////////
  
$sqlMT = "SELECT GAZDA, COUNT(GAZDA) FROM meciuri WHERE meciuri.GAZDA =". $rowE['ID'] ." OR meciuri.OASPETE =". $rowE['ID'] ;
$resursaMT = mysql_query($sqlMT);

WHILE($rowMT = mysql_fetch_array($resursaMT))
{

  PRINT '<td class="ESR"> '.$rowMT['COUNT(GAZDA)'].'</td> ';

} 
//meciuri per echipa TOTAL 

$sqlVa = "SELECT GAZDA, COUNT(GAZDA) FROM meciuri WHERE (meciuri.GAZDA =". $rowE['ID'] .") AND (meciuri.GG > meciuri.GO)";
$resursaVa = mysql_query($sqlVa);

WHILE($rowVa = mysql_fetch_array($resursaVa))
{

  //PRINT '<td>'.$rowVa['COUNT(GAZDA)'].'</td> ';
                    $Va=$rowVa['COUNT(GAZDA)'];
} 
//VICTORII per echipa ACASA 

$sqlEQa = "SELECT GAZDA, COUNT(GAZDA) FROM meciuri WHERE (meciuri.GAZDA =". $rowE['ID'] .") AND (meciuri.GG = meciuri.GO)";
$resursaEQa = mysql_query($sqlEQa);

WHILE($rowEQa = mysql_fetch_array($resursaEQa))
{

  //PRINT '<td>'.$rowEQa['COUNT(GAZDA)'].'</td> ';
                       $Ea=$rowEQa['COUNT(GAZDA)'];
} 
//AGALURI per echipa  ACASA

$sqlIa = "SELECT GAZDA, COUNT(GAZDA) FROM meciuri WHERE (meciuri.GAZDA =". $rowE['ID'] .") AND (meciuri.GG < meciuri.GO)";
$resursaIa = mysql_query($sqlIa);

WHILE($rowIa = mysql_fetch_array($resursaIa))
{

  //PRINT '<td>'.$rowIa['COUNT(GAZDA)'].'</td> ';
                       $Ia=$rowIa['COUNT(GAZDA)'];
} 
//INFRANGERI per echipa  ACASA
////////////////////////////////////////////////////////////////////////////////////////////////
//DEPLASARE
////////////////////////////////////////////////////////////////////////////////////////////////
$sqlVd = "SELECT OASPETE, COUNT(OASPETE) FROM meciuri WHERE (meciuri.OASPETE =". $rowE['ID'] .") AND (meciuri.GG < meciuri.GO)";
$resursaVd = mysql_query($sqlVd);

WHILE($rowVd = mysql_fetch_array($resursaVd))
{

  //PRINT '<td>'.$rowVd['COUNT(OASPETE)'].'</td> ';
                          $Vd=$rowVd['COUNT(OASPETE)'];
} 
//VICTORII per echipa DEPLASARE 

$sqlEQd = "SELECT OASPETE, COUNT(OASPETE) FROM meciuri WHERE (meciuri.OASPETE =". $rowE['ID'] .") AND (meciuri.GG = meciuri.GO)";
$resursaEQd = mysql_query($sqlEQd);

WHILE($rowEQd = mysql_fetch_array($resursaEQd))
{

  //PRINT '<td>'.$rowEQd['COUNT(OASPETE)'].'</td> ';
                           $Ed=$rowEQd['COUNT(OASPETE)'];
} 
//AGALURI per echipa  DEPLASARE 

$sqlId = "SELECT OASPETE, COUNT(OASPETE) FROM meciuri WHERE (meciuri.OASPETE =". $rowE['ID'] .") AND (meciuri.GG > meciuri.GO)";
$resursaId = mysql_query($sqlId);

WHILE($rowId = mysql_fetch_array($resursaId))
{

  //PRINT '<td>'.$rowId['COUNT(OASPETE)'].'</td> ';
                           $Id=$rowId['COUNT(OASPETE)'];
} 
//INFRANGERI per echipa DEPLASARE 

$sqlGMa = "SELECT GG, SUM(GG) FROM meciuri WHERE (meciuri.GAZDA =". $rowE['ID'] .")";
$resursaGMa = mysql_query($sqlGMa);

WHILE($rowGMa = mysql_fetch_array($resursaGMa))
{

  //PRINT '<td>'.$rowGMa['SUM(GG)'].'</td> ';
                        $GMa=$rowGMa['SUM(GG)'];
} 
//total goluri marcate  ACASA

$sqlGMd = "SELECT GO, SUM(GO) FROM meciuri WHERE (meciuri.OASPETE =". $rowE['ID'] .")";
$resursaGMd = mysql_query($sqlGMd);

WHILE($rowGMd = mysql_fetch_array($resursaGMd))
{

  //PRINT '<td>'.$rowGMd['SUM(GO)'].'</td> ';
                         $GMd=$rowGMd['SUM(GO)'];
} 
//total goluri marcate DEPLASARE

$sqlGOa = "SELECT GO, SUM(GO) FROM meciuri WHERE (meciuri.GAZDA =". $rowE['ID'] .")";
$resursaGOa = mysql_query($sqlGOa);

WHILE($rowGOa = mysql_fetch_array($resursaGOa))
{

  //PRINT '<td>'.$rowGOa['SUM(GO)'].' </td>';
                        $GOa=$rowGOa['SUM(GO)'];
} 
//total goluri PRIMITE  ACASA

$sqlGOd = "SELECT GG, SUM(GG) FROM meciuri WHERE (meciuri.OASPETE =". $rowE['ID'] .")";
$resursaGOd = mysql_query($sqlGOd);

WHILE($rowGOd = mysql_fetch_array($resursaGOd))
{

  //PRINT '<td>'.$rowGOd['SUM(GG)'].'</td> ';
                                 $GOd=$rowGOd['SUM(GG)'];
} 
//total goluri PRIMITE DEPLASARE
////////////////////////////////////////////////////////
$Vt=$Va+$Vd;
$Et=$Ea+ $Ed;
$It=$Ia+ $Id;
$GMt=$GMa+ $GMd;
$GOt=$GOa+ $GOd;
$GOL=$GMt-$GOt;
$PCTa=($Va*3)+($Ea*1);
$PCTd=($Vd*3)+($Ed*1) ;
$PCT= $PCTa+$PCTd ;
$ADVa=(($Ia*3)+($Ea*2))*(-1);
$ADVd=($Vd*3)+($Ed*1) ;
$ADV= $ADVa+$ADVd ;
$Ma=$Va+$Ea+$Ia;
$Md=$Vd+$Ed+$Id;
$GOLa=$GMa-$GOa;
$GOLd=$GMd-$GOd;


print ' <td class="ESR">'.$Vt.'</td><td class="ESR"> '.$Et.' </td><td class="ESR">'.$It.'</td><td class="ESR"> '.$GMt.'</td><td class="ESR"> '.$GOt.'</td><td class="ESR"> '.$GOL.' </td>';
//PRINT '<td>'.$PCTa.'</td><td> '.$PCTd.'</td>';
PRINT '<td class="ESR"> '.$PCT.'</td>';
//PRINT '<td> '.$ADVa.'</td><td> '.$ADVd.'</td>';
PRINT '<td class="ESR"> '.$ADV.'</td>';
//print '<td> '.$Ma.'</td><td> '.$Md.'</td><td> '.$GOLa.'</td><td> '.$GOLd.'</td>';

$adresaimagine = "LOGO/".$rowE['ID'].".jpeg";
   if(file_exists($adresaimagine)) { 
     print '<td class="ESR"><A HREF="meciuriEchipa.php?id='.$rowE['ID'].'"><img src="'.$adresaimagine.'" width="20px" height="20px"></a></td>'; }
  
  
 print '</tr>';

}
 ///////////////////////////////////ENDCLASAMENT//////////////////////////
 
//ECHIPE
     print '</table></td>
 </tr>
</table>';
     
?>



<hr>

<p> Copyright 2012-2020 by Tralsbro Sibiu, Romania. All Rights Reserved.</P>

   </center></body>
 </html>

//chartfotballloc.php


<html>
  
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<head>
    <script type="text/javascript" src="https://www.google.com/jsapi"></script>
    <script type="text/javascript">
      google.load("visualization", "1", {packages:["corechart"]});
      google.setOnLoadCallback(drawChart);
      function drawChart() {
        var data = google.visualization.arrayToDataTable([
//          ['Year', 'Sales', 'Expenses'],
//          ['2004',  1000,      400],
//          ['2005',  1170,      460],
//          ['2006',  660,       1120],
//          ['2007',  1030,      540]
//        ]);
['et','cfr cluj','dinamo','rapid','vaslui','steaua','otelul','u cluj','pandurii','astra','medias','ceahlaul','brasov','chiajna','mures','sibiu','petrolul','sportul','mioveni'],
['1 ',1,1,1,12,8,12,1,8,12,12,8,1,12,12,8,1,1,12],
['2 ',1,1,9,11,4,11,1,4,15,15,10,9,11,15,4,4,4,15],
['3 ',3,1,3,8,2,8,3,8,13,13,15,3,16,16,7,8,8,18],
['4 ',7,1,2,13,4,4,2,4,7,7,11,7,17,13,11,13,13,18],
['5 ',5,1,2,7,3,7,3,6,7,11,14,11,18,15,11,7,15,17],
['6 ',3,1,2,6,6,11,4,4,9,8,9,11,18,15,11,11,15,17],
['7 ',2,1,3,7,7,7,5,3,6,11,11,7,18,15,13,13,17,15],
['8 ',2,1,3,7,9,9,3,5,5,8,12,11,16,16,13,13,16,13],
['9 ',4,1,2,5,8,10,2,6,6,9,12,10,18,14,14,13,14,14],
['10 ',4,1,2,6,8,9,2,5,7,9,13,11,18,14,16,11,14,16],
['11 ',2,1,3,7,8,9,4,4,6,9,13,11,18,15,13,11,15,15],
['12 ',2,1,3,6,7,9,4,4,7,10,11,12,15,17,14,12,15,17],
['13 ',3,1,2,7,5,7,4,5,9,10,10,14,15,17,12,12,15,17],
['14 ',3,1,2,5,8,5,4,8,7,11,10,12,16,13,13,13,16,18],
['15 ',2,1,3,8,5,5,4,5,8,11,10,13,17,14,15,11,16,18],
['16 ',2,1,3,5,4,8,5,7,9,12,10,11,17,14,15,12,16,18],
['17 ',2,1,3,4,5,7,8,5,9,11,10,12,17,15,14,13,16,18],
['18 ',2,1,3,6,4,5,8,6,9,11,10,12,17,15,14,13,16,18],
['19 ',2,1,3,5,4,6,8,7,9,12,11,10,17,16,13,14,15,18],
['20 ',2,1,3,5,4,6,8,7,9,12,10,10,17,16,13,15,14,18],
['21 ',1,2,3,5,3,6,8,7,9,10,11,11,17,16,14,15,11,18],
['22 ',1,2,3,5,3,6,7,8,9,10,10,10,16,15,14,17,13,18],
['23 ',1,2,5,3,3,6,8,7,11,12,9,9,16,14,13,17,14,18],
['24 ',1,2,5,3,3,6,7,8,9,12,9,9,15,15,13,17,13,18],
['25 ',1,2,4,5,2,6,7,8,9,12,10,11,15,14,12,16,16,18],
['26 ',1,2,4,5,2,6,7,8,9,12,10,11,14,14,12,16,17,18],
['27 ',1,1,3,4,4,6,6,8,9,11,10,12,12,12,15,16,17,18],
['28 ',1,2,2,2,5,6,7,7,9,10,11,11,11,14,15,16,17,18],
['29 ',1,4,2,3,5,8,6,7,9,10,11,13,12,14,16,15,17,18],
['30 ',1,5,4,2,3,6,7,8,10,11,9,12,13,15,16,14,17,18],
['31 ',1,5,4,2,3,6,7,8,12,13,10,9,11,15,16,14,17,18],
['32 ',1,4,5,2,3,6,8,7,13,14,12,11,9,15,16,10,17,18],
['33 ',1,5,4,2,3,6,7,8,11,12,14,9,10,15,16,13,17,18],
['34 ',1,5,4,2,3,6,8,7,12,13,11,10,9,15,16,14,17,18]
]);
//['et','cfr cluj','dinamo','rapid','vaslui','steaua','otelul','u cluj','pandurii','astra',
//'medias','ceahlaul','brasov','chiajna','mures','sibiu','petrolul','sportul','mioveni'],
        var options = {
          title: 'Locuri echipe 2011-2012 Liga 1 Romania',
          vAxis:{direction: -1}
        };

        var chart = new google.visualization.LineChart(document.getElementById('chart_div'));
        chart.draw(data, options);
      }
    </script>
  </head>
  <body>
    <div id="chart_div" style="width: 1000px; height: 800px;"></div>
  </body>
</html>
//chartfilled.php
<html>
  <head>
    <script type="text/javascript" src="https://www.google.com/jsapi"></script>
    <script type="text/javascript">
      google.load("visualization", "1", {packages:["corechart"]});
      google.setOnLoadCallback(drawChart);
      function drawChart() {
        var data = google.visualization.arrayToDataTable([
          ['Year', 'Sales', 'Expenses'],
          ['2004',  1000,      400],
          ['2005',  1170,      460],
          ['2006',  660,       1120],
          ['2007',  1030,      540]
        ]);

        var options = {
          title: 'Company Performance',
          hAxis: {title: 'Year',  titleTextStyle: {color: 'red'}}
        };

        var chart = new google.visualization.AreaChart(document.getElementById('chart_div'));
        chart.draw(data, options);
      }
    </script>
  </head>
  <body>
    <div id="chart_div" style="width: 900px; height: 500px;"></div>
  </body>
</html>




////////////////////////////////
/////////////////////////

//tabele

clasament

ID PUNCTE T1 T2 T3 T4 T5 T6 T7 T8 T9 T10 T11 T12 T13 T14 T15 T16 T17 T18 T19 T20 T21 T22 T23 T24 T25 T26 T27 T28 T29 T30 T31 T32 T33 T34 P1 P2 P3 P4 P5 P6 P7 P8 P9 P10 P11 P12 P13 P14 P15 P16 P17 P18 P19 P20 P21 P22 P23 P24 P25 P26 P27 P28 P29 P30 P31 P32 P33 P34 GOL GM 


cmeciuri

ID ETAPA DATA GAZDA GG GO OASPETE


echipe

ID ECHIPA JUDET

judete

ID JUDET IDREG

meciuri

ID ETAPA DATA GAZDA GG GO OASPETE

regiuni

ID  REGIUNE

subregiuni

ID  SUBREGIUNE  IDREG

bkupcmeciuri

ETAPA ID DATA GAZDA GG GO OASPETE


///////////////////////////
////////////////////////////
///////////////////////////////


//addmeci.php

     <html>
 
 <head>       <link rel="stylesheet" type="text/css" href="stdtheme.css" />
 <script src="sorttable.js"></script>
<script src="dragtable.js"></script>




 <link rel="stylesheet" type="text/css" href="stdtheme.css" />
</head>
<body>  <center>

<br>

<?
     //CONNECT
     include("meniuFotbal.php");
mysql_connect("localhost", "root", "");
mysql_select_db("fotbal");

//////////////////////////////////////////////salveaza//////////////////////////
if(isset($_GET['idmeci']))
{

 $sqlccMc = "SELECT * FROM cmeciuri WHERE cmeciuri.ID=".$_GET['idmeci']." ORDER BY cmeciuri.ID ASC";
$resursaccMc = mysql_query($sqlccMc);
$rowccMc = mysql_fetch_array($resursaccMc);

$idcmeci=$_GET['idmeci'];
$idcetapa=$rowccMc['ETAPA'];
$idcG=$rowccMc['GAZDA'];
$idcGG=$rowccMc['GG'];
$idcGO=$rowccMc['GO'];
$idcO=$rowccMc['OASPETE'];

print '<table><FORM action="addMeci.php" method="post">';

  print '<tr><td>ID:</td>';
  print '<td>ETAPA:</td>';
  print '<td>DATA:</td>';
  print '<td>GAZDA:</td>';
  print '<td>GG:</td>';
  print '<td>GO:</td>';
   print '<td>OASPETE:</td></tr>';
   
  print '<tr><td><INPUT type="text" name="sID" size="5" VALUE="'.$idcmeci.'"></td>';
  print '<td><INPUT type="text" name="sETAPA" size="5" VALUE="'.$idcetapa.'"></td>';
  print '<td><INPUT type="text" name="sDATA" size="10" VALUE="0000-00-00"></td>';
  print '<td><INPUT type="text" name="sGAZDA" size="5" VALUE="'.$idcG.'"></td>';
  print '<td><INPUT type="text" name="sGG" size="5" VALUE="'.$idcGG.'"></td>';
  print '<td><INPUT type="text" name="sGO" size="5" VALUE="'.$idcGO.'"></td>';
   print '<td><INPUT type="text" name="sOASPETE" size="5" VALUE="'.$idcO.'"></td></tr>';
  
  print '<input type="submit" value="save" id="save" name="salveaza" title="salveaza">';
  print '</FORM></table>';
  
}

//////////////////
if(isset($_POST['salveaza']))
{
//INSERT INTO `fotbal`.`meciuri` (`ID`, `ETAPA`, `DATA`, `GAZDA`, `GG`, `GO`, `OASPETE`) VALUES('5 ','1 ','0000-00-00 ','8 ','0 ','1 ','17');

$sqlm = "INSERT INTO meciuri (ID, ETAPA, DATA, GAZDA, GG, GO, OASPETE) VALUES(".$_POST['sID'].",".$_POST['sETAPA'].",".$_POST['sDATA'].",".$_POST['sGAZDA'].",".$_POST['sGG'].",".$_POST['sGO'].",".$_POST['sOASPETE'].")";

if($_POST['sID']=="NNN" OR $_POST['sETAPA']=="NN" OR $_POST['sGAZDA']=="NN" OR $_POST['sOASPETE']==="NN" OR $_POST['sGG']=="NN" OR $_POST['sGO']=="NN"){


echo "<script type='text/javascript'>alert('Introduceti toate datele! Anulat !');</script>";


}
else{
mysql_query($sqlm);


print '<b>Modificarea a fost facuta!</b><br>';
echo "\n<meta http-equiv=\"refresh\" " . " content=\"3;URL=meciuri.php\">\n";
}
}

if(!isset($_GET['idmeci']))
{
  print '<table><FORM action="addMeci.php" method="post">';

  print '<tr><td>ID:</td>';
  print '<td>ETAPA:</td>';
  print '<td>DATA:</td>';
  print '<td>GAZDA:</td>';
  print '<td>GG:</td>';
  print '<td>GO:</td>';
   print '<td>OASPETE:</td></tr>';
   
  print '<tr><td><INPUT type="text" name="sID" size="5" VALUE="NNN"></td>';
  print '<td><INPUT type="text" name="sETAPA" size="5" VALUE="NN"></td>';
  print '<td><INPUT type="text" name="sDATA" size="10" VALUE="0000-00-00"></td>';
  print '<td><INPUT type="text" name="sGAZDA" size="5" VALUE="NN"></td>';
  print '<td><INPUT type="text" name="sGG" size="5" VALUE="NN"></td>';
  print '<td><INPUT type="text" name="sGO" size="5" VALUE="NN"></td>';
   print '<td><INPUT type="text" name="sOASPETE" size="5" VALUE="NN"></td></tr>';
  
  print '<input type="submit" value="save" id="save" name="salveaza" title="salveaza">';
  print '</FORM></table>';
 } 
  print '<iframe src="MECIURINEJUCATE.php" frameborder="0" height="400px" width="800px"></iframe>';
 
?>
<hr>
<p> Copyright 2012-2020 by Tralsbro Sibiu, Romania. All Rights Reserved.</P>
</center>
        </body>
 </html>


Comentarii

Postări populare de pe acest blog

program principal cpp

#include "clasa.h" #include <stdio.h> #include <conio.h> #include <stdlib.h> #include <string.h> #define DELAY 9000000 void delay() { for(long i=0;i<DELAY;i++); } //constructor cu initializare de la tastatura BigInt::BigInt() {char x; signed char t[400]; int i; printf("\nNumarul cu semn "); do s=getche(); while((s!='+')&&(s!='-')); n=0; do {x=getche(); t[n]=x-'0'; n++; } while((x>='0')&&(x<='9')); n--; for(i=0;i<n;i++) nr[i]=t[n-i-1]; } //constructor cu initializare prin parametri BigInt::BigInt(char semn,signed char numar[],int dim) {int i; s=semn; n=dim; for(i=0;i<n;i++) nr[i]=numar[n-i-1]; } //transform un int negativ in pozitiv int BigInt::Pozitiv(int x) {int a,vb; a=0; vb=0; while(vb==0) if((x+a)==0) vb=1; else a=a+1; x=a; return x; } //constructor dintr-un nr int obisnuit BigInt::BigInt(int x) {int i; if(x>=0) s='+'…

NUMERE PRIME ALGORITM C++

// NUMERE PRIME ALGORITM C++//  reediting from scratch //on this page is just the study for a next algoritm for generating the parime nr series like Fibonnaci or ....if possibile

74111121313417374414124343447 if u know the red part you can generate the orange part
1 0 1 111112222 1 1 23

o aplicatie php localitati romania

//APLICATIA SE REFERA LA BAZA DE DATE SIRUTA

//dragtable.js


/* dragtable v1.0 June 26, 2008 Dan Vanderkam, http://danvk.org/dragtable/ http://code.google.com/p/dragtable/ \Bsortabledraggable\B Instructions: - Download this file - Add <script src="dragtable.js"></script> to your HTML. - Add class="draggable" to any table you might like to reorder. - Drag the headers around to reorder them. This is code was based on: - Stuart Langridge's SortTable (kryogenix.org/code/browser/sorttable) - Mike Hall's draggable class (http://www.brainjar.com/dhtml/drag/) - A discussion of permuting table columns on comp.lang.javascript Licensed under the MIT license. */ // Here's the notice from Mike Hall's draggable script: //***************************************************************************** // Do not remove this notice. // // Copyright 2001 by Mike Hall. // See http…