コード例 #1
0
ファイル: profilo.php プロジェクト: aroblu94/DB-Proj
            $fld = "imgs/" . $_SESSION[User2decide][id] . "." . $ext;
            move_uploaded_file($_FILES['img']['tmp_name'], $fld);
            $res = ssql("select set_avatar('" . $_SESSION[User2decide][id] . "', '" . $_SESSION[User2decide][id] . "." . $ext . "')");
        }
        $res = ssql("select set_nome('" . $_SESSION[User2decide][id] . "', '" . $_POST[nome] . "', '" . $_POST[cognome] . "')");
        if ($res > 0) {
            $_SESSION[notify][type] = "ok";
            $_SESSION[notify][text] = "Utente aggiornato con successo.";
        } else {
            $_SESSION[notify][type] = "err";
            $_SESSION[notify][text] = "Errore! Utente non aggiornato, riprovare. Se il problema persiste contattare l'amministratore.";
        }
        break;
    case "read":
        if (isset($_GET[id2read])) {
            $res = ssql("select leggi_notifica(" . $_GET[id2read] . ")");
        }
        break;
    default:
        break;
}
ob_start();
$res = sql("select * from utenti where id='" . $_SESSION[User2decide][id] . "'");
while ($usr = pg_fetch_array($res)) {
    $nome = $usr[nome];
    $cognome = $usr[cognome];
    $user = $usr[username];
    $img = $usr[avatar];
}
bsformo();
hidden("save");
コード例 #2
0
ファイル: menus.php プロジェクト: aroblu94/DB-Proj
			Admin<i class="mainnav-caret"></i>
		</a>
		<ul class="dropdown-menu" role="menu">
			<li><a href="admin_tornei.php">Tornei</a></li>
			<li><a href="admin_gare.php">Gare e gironi</a></li>
			<li><a href="admin_giocatori.php">Giocatori</a></li>
		</ul>
	</li>';
} else {
    $usr_menu = '
	<li class="' . $home_class . '"><a href="index.php">Home</a></li>
	<li class="' . $past_class . '"><a href="passati.php">Tornei Passati</a></li>';
}
if (isset($_SESSION[User2decide])) {
    $nome = ssql("select get_nome('" . $_SESSION[User2decide][id] . "')");
    $img = ssql("select get_img('" . $_SESSION[User2decide][id] . "')");
    if ($img == "") {
        $img = "default.jpg";
    }
    $notifiche = getNotifiche();
    $n_notifiche = count($notifiche);
    if ($n_notifiche == 0) {
        $notifichezz = "<a href=# class=notification><span class=notification-title>Nessuna notifica</span></a>";
    } else {
        for ($i = 0; $i < $n_notifiche; $i++) {
            $notifichezz .= $notifiche[$i];
        }
        $badge = '<b class="badge badge-primary" id="badge">' . $n_notifiche . '</b>';
    }
    $menu = '
	<ul class="nav navbar-nav navbar-left">
コード例 #3
0
ファイル: admin_utenti.php プロジェクト: aroblu94/DB-Proj
}
ob_start();
# Ciclo gli utenti
$res = sql("select * from utenti where id>2 and id<>" . $_SESSION[User2decide][id]);
$count = 0;
while ($u = pg_fetch_array($res)) {
    $nome = $u[nome] . " " . $u[cognome];
    $list = "";
    if (ssql("select is_ban(" . $u[id] . ")") > 0) {
        $dban = "disabled";
        $dunban = "";
    } else {
        $dban = "";
        $dunban = "disabled";
    }
    if (ssql("select get_org(" . $u[id] . ")") > 2) {
        $cert = "";
        $setorg = "<br><br><a href='admin_utenti.php?op=makeorg&user="******"' class='btn btn-warning btn-sm btn-sm'>Promuovi</a>";
    } else {
        $setorg = "<br><br><a href='admin_utenti.php?op=declorg&user="******"' class='btn btn-warning btn-sm btn-sm'>Declassa</a>";
        $cert = "<i class='fa fa-certificate right'></i>";
    }
    # Tornei a cui partecipa l'utente
    $r = sql("select t.id as id, concat(t.nome,' ed.',t.ed) as nome, t.data_inizio as inizio\n\t\t\t\t\tfrom torneo as t\n\t\t\t\t\t\tjoin iscritto_a on t.id=IDtorneo\n\t\t\t\t\twhere IDutente='" . $u[id] . "'");
    while ($t = pg_fetch_array($r)) {
        $list .= '<p>' . $t[nome] . ' ' . $t[inizio] . '</p>';
    }
    # Stampo
    $usrs .= '
	<div class="col-md-3 col-sm-6">
		<div class="portlet portlet-boxed">
コード例 #4
0
ファイル: passati.php プロジェクト: aroblu94/DB-Proj
        $jq2footer .= '$("#formomod").append("' . $appendthat . '");';
    } else {
        $jq2footer .= '$("#formomod").append("Programma non ancora definito.");';
    }
} elseif ($_GET[clas] > 0) {
    $start = "\n\t<table class='table table-striped table-bordered table-hover ui-datatable'>\n\t<thead>\n\t\t<tr>\n\t\t\t<th>Posizione</th>\n\t\t\t<th>Giocatore</th>\n\t\t\t<th>Punteggio</th>\n\t\t</tr>\n\t</thead>\n\t<tbody>\n\t";
    $end = "\n\t</tbody>\n\t</table>\n\t";
    $rows = "";
    $res = sql("select concat(u.nome,' ',u.cognome) as giocatore, \n\t\t\t\t\tsum(pa.punteggio),\n\t\t\t\t\tcase  when sum(pa.punteggio) is null then 0\n\t\t\t\t\t\telse sum(pa.punteggio)\n\t\t\t\t\tend as punti\n\t\t\t\tfrom utenti u\n\t\t\t\t\tleft join partecipa_a pa on pa.IDutente=u.id\n\t\t\t\t\tleft join gara g on g.id=pa.IDgara\n\t\t\t\twhere g.IDtorneo='" . $_GET[torneo] . "'\n\t\t\t\t\tand u.id>2\n\t\t\t\tgroup by pa.IDutente, u.nome, u.cognome\n\t\t\t\torder by punti desc");
    $position = 1;
    while ($r = pg_fetch_array($res)) {
        $rows .= "\n\t\t<tr>\n\t\t\t<td>" . $position . "</td>\n\t\t\t<td>" . $r[giocatore] . "</td>\n\t\t\t<td>" . $r[punti] . "</td>\n\t\t</tr>\n\t\t";
        $position++;
    }
    $n = ssql("select get_nomet(" . $_GET[torneo] . ")");
    $e = ssql("select get_edizione(" . $_GET[torneo] . ")");
    $appendthat = str_replace("\n", "", $start . $rows . $end);
    $jq2footer .= '$("#modal-title").empty();
				$("#formomod").empty();
				$("#edithere").modal("show");
				$("#modal-title").append("Classifica del torneo ' . $n . ' ed.' . $e . '");
				';
    if ($position > 1) {
        $jq2footer .= '$("#formomod").append("' . $appendthat . '");';
    } else {
        $jq2footer .= '$("#formomod").append("Classifica non ancora definita.");';
    }
}
BSformcmod("passati.php");
$corpoPagina = ob_get_contents();
ob_end_clean();
コード例 #5
0
ファイル: admin_tornei.php プロジェクト: aroblu94/DB-Proj
$res = sql("select t.id as id,\n\t\t\t\t\tt.nome as nome,\n\t\t\t\t\tt.ed as ed,\n\t\t\t\t\tt.data_inizio as data_inizio,\n\t\t\t\t\tt.data_fine as data_fine,\n\t\t\t\t\tt.chiusura_iscr as chiusura_iscr,\n\t\t\t\t\tty.nome as tipo,\n\t\t\t\t\tt.num_gironi as gironi,\n\t\t\t\t\tconcat(u.nome,' ',u.cognome) as admin,\n\t\t\t\t\tt.quota_iscr as quota,\n\t\t\t\t\t(select count(*) from iscritto_a\n\t\t\t\t\t\twhere IDtorneo=t.id\n\t\t\t\t\t\t\tand IDutente>2) as iscritti,\n\t\t\t\t\tt.partecipanti as max\n\t\t\t\tfrom torneo t \n\t\t\t\t\tleft join tipo_torneo ty on ty.id=t.tipo\n\t\t\t\t\tleft join utenti u on u.id=t.admin\n\t\t\t\twhere (t.data_fine>now()\n\t\t\t\t\tor t.data_fine is null)\n\t\t\t\t" . $where . "\n\t\t\t\torder by data_inizio asc");
$count = 0;
while ($t = pg_fetch_array($res)) {
    $fine = $dis = $nogmrs = $gironi = "";
    if ($t[data_fine] > 0) {
        $fine = $t[data_fine];
    } else {
        $fine = "da destinarsi";
    }
    if ($t[iscritti] < 1) {
        $nogmrs = "disabled";
    }
    if (ssql("select get_tipo(" . $t[id] . ")") == 2) {
        $gironi = "(a " . $t[gironi] . " gironi)";
    }
    if (ssql("select reached_iscr_date(" . $t[id] . ")")) {
        $dis = "disabled";
    }
    $list .= '
	<div class="col-md col-sm-6">
		<div class="portlet portlet-boxed">
			<div class="portlet-header">
				<h4 class="portlet-title"><u>' . $t[nome] . ' ed.' . $t[ed] . '</u>
					<a href="admin_tornei.php?op=kill&torneo=' . $t[id] . '" class="right"><i class="fa fa-trash"></i></a>
				</h4>
			</div>
			<div class="portlet-body">
				<p>Data inizio: ' . $t[data_inizio] . '</p>
				<p>Chiusura iscrizioni: ' . $t[chiusura_iscr] . '</p>
				<p>Data fine: ' . $fine . '</p>
				<p>Tipo torneo: ' . $t[tipo] . ' ' . $gironi . '</p>
コード例 #6
0
ファイル: login.php プロジェクト: aroblu94/DB-Proj
     }
 } else {
     # Check if user exists
     $id = ssql("select esiste('" . $user . "')");
     if ($id < 1) {
         $_SESSION[notify][type] = "warn";
         $_SESSION[notify][cl] = "col-md-4 myalert";
         $_SESSION[notify][text] = "<strong>Attenzione!</strong> Utente non esistente, prego registrarsi.";
     } else {
         # Check if password is ok
         $res = ssql("select login_corretto(" . $id . ",md5('" . $pass . "'))");
         if ($res > 0) {
             # Then login him
             setcookie("user", $id);
             $_SESSION[User2decide][id] = $id;
             $org = ssql("select get_org(" . $id . ")");
             if ($org == 1) {
                 $_SESSION[adminUser][id] = $id;
             } else {
                 if ($org == 2) {
                     $_SESSION[trustedUser][id] = $id;
                 } else {
                     if ($org == 3) {
                         $_SESSION[loggedUser][id] = $id;
                     }
                 }
             }
             header("location:index.php");
         } else {
             $_SESSION[notify][type] = "warn";
             $_SESSION[notify][cl] = "col-md-4 myalert";
コード例 #7
0
ファイル: admin_gare.php プロジェクト: aroblu94/DB-Proj
        $jq2footer .= '
		var fine = ' . $isend . ';
		if(fine) {
			$("#data").prop("disabled", true);
			$("#gg1").prop("disabled", true);
			$("#gg2").prop("disabled", true);
			$("#formo button").prop("disabled", true);
		}
		';
    }
    BSformomod("admin_gare.php?torneo=" . $_GET[torneo]);
    if ($_GET[open] > 0 && $_GET[gid] > 0) {
        hidden("regris");
        hidden($_GET[gid], "gara");
        $gara = multisqlarr("select * from gara where id='" . $_GET[gid] . "'");
        $tipo = ssql("select get_tipo(" . $_GET[torneo] . ")");
        hidden($tipo, "tipo");
        $jq2footer = '$("#modal-title").empty();
					$("#modal-title").append("Risultati della gara del ' . $gara[data] . '");
					$("#edithere").modal("show");';
        $res = sql("select nome,\n\t\t\t\t\t\t\tcognome,\n\t\t\t\t\t\t\trisultato,\n\t\t\t\t\t\t\tid\n\t\t\t\t\t\tfrom utenti \n\t\t\t\t\t\t\tleft join partecipa_a on IDutente=id\n\t\t\t\t\t\twhere IDgara='" . $gara[id] . "'");
        $c = 1;
        while ($g = pg_fetch_array($res)) {
            BSnum("gioc{$c}", $g[nome] . " " . $g[cognome], $g[risultato]);
            hidden($g[id], "g{$c}");
            $c++;
        }
        BSbutton("Inserisci");
    }
    BSformcmod("admin_gare.php?torneo=" . $_GET[torneo]);
} else {
コード例 #8
0
ファイル: admin_giocatori.php プロジェクト: aroblu94/DB-Proj
if (isset($_GET[torneo])) {
    $n = ssql("select get_nomet(" . $_GET[torneo] . ")");
    $e = ssql("select get_edizione(" . $_GET[torneo] . ")");
    $tit_pag .= " del torneo {$n} ed.{$e}";
    $res = sql("select g.username as username,\n\t\t\t\t\tg.nome as nome,\n\t\t\t\t\tg.cognome as cognome,\n\t\t\t\t\tg.id as id,\n\t\t\t\t\tia.sconto_rincaro as sconto_rincaro\n\t\t\t\tfrom utenti g\n\t\t\t\t\tjoin iscritto_a ia on ia.IDutente=g.id\n\t\t\t\twhere ia.IDtorneo='" . $_GET[torneo] . "'\n\t\t\t\t\tand g.id>2");
    $start = ssql("select reached_start_date(" . $_GET[torneo] . ")");
    if ($start > 0) {
        $dis = "disabled";
    }
    while ($g = pg_fetch_array($res)) {
        $dapp = $dban = "";
        $app = ssql("select is_iscr_approved(" . $g[id] . ", " . $_GET[torneo] . ")");
        if ($app) {
            $dapp = "disabled";
        }
        $ban = ssql("select is_ban_local(" . $g[id] . "," . $_GET[torneo] . ")");
        if ($ban) {
            $dban = "disabled";
        }
        $usrs .= '
		<div class="col-md-3 col-sm-6">
			<div class="portlet portlet-boxed">
				<div class="portlet-header">
					<h4 class="portlet-title"><u>' . $g[nome] . ' ' . $g[cognome] . '</u></h4>
				</div>
				<div class="portlet-body">
					<input id="' . $g[id] . '" name="' . $g[id] . '" value="' . $g[sconto_rincaro] . '" class="form-control" type="number" step="5" ' . $dapp . '>
					<br>
					<a href="admin_giocatori.php?op=approve&u=' . $g[id] . '&torneo=' . $_GET[torneo] . '" class="btn btn-success btn-sm" ' . $dapp . '>Approva</a>
					<a href="admin_giocatori.php?op=ban&u=' . $g[id] . '&torneo=' . $_GET[torneo] . '" class="btn btn-primary btn-sm" ' . $dban . '>Ban</a>
				</div>