1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145
| <?php
$nomMois = array("Erreur","Janvier" ,"Février" ,"Mars" ,"Avril" ,"Mai" ,"Juin" ,"Juillet" ,"Août" ,"Septembre" ,"Octobre" ,"Novembre" ,"Décembre" ,"Erreur");
include "../db.php";
session_start();
$con = new DBConnect();
if (@$_SESSION["ok"] != 1) {
//echo "";
$sql= "SELECT * FROM `user` WHERE `nom` = '".@$_POST["nom"]."' AND `pass` = '".@ $_POST["pass"]."'";
$res = $con->sendSql($sql);
$nres = mysql_num_rows($res);
if ($nres == 1) {
$_SESSION["ok"] = 1;
$_SESSION["user"] = mysql_fetch_array($res, MYSQL_ASSOC);
}else{
include "securite.php";
exit;
}
}
if ($_SESSION["user"]["droitcal"][0] == 1) {
echo '<A href="1eredom.php?action=add">Ajouter un match à domicile</A>';
}
if (@$_GET["action"] == "del") { // on efface
$sql = "DELETE FROM `matchs` WHERE ID = ".$_GET["id"];
$con->sendSql($sql);
}
if (@$_GET["action"] == "add") {
$action = "addExec";
include "1eredomform.php";
}
if (@$_POST["action"] == "addExec") {
foreach($_POST as $k => $v){
$p[$k] = addslashes($v);
}
$datetime = mktime ( 12 , 0 , 0, 00, 00, $p["mois"], $p["jour"], $p["annee"], $p["heure"], $p["minutes"] );
$sql = "INSERT INTO `matchs` ( `datetime`, `visiteur`, `resdom`, `resvis`)
VALUES ( '".$datetime."', '".$p["visiteur"]."', '".$p["resdom"]."', '".$p["resvis"]."')";
$con->sendSql($sql);
}
if (@$_GET["action"] == "edit") {
$sql ="SELECT * FROM `matchs` WHERE `ID` =".$_GET["id"];
$res = $con->sendSql($sql);
$row = mysql_fetch_array($res, MYSQL_ASSOC);
$action = "editExec";
include "1eredomform.php";
}
if (@$_POST["action"] == "editExec") {
foreach($_POST as $k => $v){
$p[$k] = addslashes($v);
}
$datetime = mktime ( 12 , 0 , 0, 00, 00, $p["mois"], $p["jour"], $p["annee"], $p["heure"], $p["minutes"] );
$sql = "UPDATE `matchs` SET
`datetime` = '".$datetime."',
`visiteur` = '".$p["visiteur"]."',
`resdom` = '".$p["resvis"]."'
WHERE `ID` = ".$p["id"]." LIMIT 1;";
$con->sendSql($sql);
}
//$sql ="SELECT * FROM `agenda` WHERE `date` > '".(time() - (60*60*24*30)) ."' ORDER BY `date` ASC";
$sql ="SELECT * FROM `matchs` WHERE `datetime` > '".(time()-(60*60*24*30*12))."' ORDER BY `datetime` DESC";
$res = $con->sendSql($sql);
echo '<table border="0" width="891">';
$ldatetime = "";
while ($row = mysql_fetch_array($res, MYSQL_ASSOC)) {
$t = $row["datetime"];
$datetime = $nomMois[date("n", $t)]." ".date("Y", $t);
if ($ldatetime != $datetime) {
?><title>ETOILE-SPORTING</title>
<body bgcolor="">
<tr>
<td style="border-bottom-style: dotted; border-bottom-width: 1" width="113"><br>
<b><?=$datetime?><br>
<br>
</b></td>
<td width="506" style="border-bottom-style: dotted; border-bottom-width: 1"></td>
<td width="161" style="border-bottom-style: dotted; border-bottom-width: 1"></td>
<td width="91"></td>
<td width="100"></td>
<td width="100"></td>
</tr>
<?
$ldatetime = $datetime;
}
?>
<tr>
<td style="border-bottom-style: dotted; border-bottom-width: 1" width="113">
<?
echo date("j", $t)."/".date("n", $t)."/".date("Y",$t)." ".date("H",$t).":".date("i",$t);
?>
</td>
<td width="506"
style="border-bottom-style: dotted; border-bottom-width: 1">F.C. Etoile-Sporting - <?=stripslashes($row["visiteur"])?></td>
<td width="161"
style="border-bottom-style: dotted; border-bottom-width: 1"><?=stripslashes($row["resdom"])?></td>
<td width="91"><b><font face="Tahoma" size="1" color="#3366FF"></font></b><b><font face="Tahoma" size="1" color="#3366FF">
<?=stripslashes($row["resvis"])?></font></b></td>
<td width="180">
<?
//ajouter, editer, effacer
?>
<?
if ($_SESSION["user"]["droitcal"][1] == 1) {
echo '<A href="1eredom.php?action=edit&id='.$row["ID"].'">Editer</A> ';
}
if ($_SESSION["user"]["droitcal"][2] == 1) {
echo '<A href="1eredom.php?action=del&id='.$row["ID"].'">Supprimer</A>';
}
?>
</td>
</tr>
<?
}
?>
</table>
<?
@$con->Uconn();
?> |
Partager