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 146
|
<?php
if(isSet ($_GET['Supprimer']))
{$p=$_GET['V1'];
$r=$_GET['V2'];
setcookie("idpap",$p,mktime()+60);
@ $db = new mysqli('localhost','root','','conférence1');
$query1= "delete from rapport where idpap='$p' and idrapp='$r'";
$result1=$db->query($query1);
@ $db = new mysqli('localhost','root','','auteurth');
$query= "insert into papier values ('$p')";
setcookie("idrapp",$r,mktime()+60);
$result=$db->query($query);
if($result1)
{include("modifier1.php");
}
}
if(isSet ($_GET['Ajouter']))
{
class papier
{public function getnbrapp($pap)
{@ $db = new mysqli('localhost','root','','conférence1');
$query10= "select count(*)nbrapp from rapport where idpap='$pap'";
$result10=$db->query($query10);
if($result10)
{while($nb=mysqli_fetch_object($result10))
{return($nb->nbrapp);}}
}}
class rapporteur
{public function getnbpap($rapp)
{@ $db = new mysqli('localhost','root','','conférence1');
$query10= "select count(*)nbpap from rapport where idrapp='$rapp'";
$result10=$db->query($query10);
if($result10)
{while($nb=mysqli_fetch_object($result10))
{return($nb->nbpap);}}
}
public function verifier($pap,$rapp)
{@ $db = new mysqli('localhost','root','','conférence1');
$query11 = "SELECT `auteur`.`lab` FROM `auteur`,écrire WHERE `auteur`.`idaut`=écrire.`idaut` and écrire.idpap='$pap'";
$res=$db->query($query11);
if($res)
{$b=array();
while($e=mysqli_fetch_object($res))
{
array_push($b,$e->lab);}
}
@ $db = new mysqli('localhost','root','','conférence1');
$query12 = "SELECT `rapporteur`.`labr` FROM `rapporteur` WHERE idrapp='$rapp'";
$res1=$db->query($query12);
if($res1)
{$r=array();
while($i=mysqli_fetch_object($res1))
{
array_push($r,$i->labr);}
}
$number_of_b=count($b);
$number_of_r=count($r);
for($i=0;$i<$number_of_b;$i++)
{for($j=0;$j<$number_of_r;$j++)
{if($b[$i]==$r[$j])
{return 1;
exit;}
}
}
return 0;
}
}
$p=$_GET['V6'];
$p1=$_GET['V6'];
$p2=$_GET['V6'];
$p3=$_GET['V6'];
$g=$_GET['V2'];
$g1=$_GET['V2'];
$g2=$_GET['V2'];
setcookie("idrapp",$g2,mktime()+60);
@ $db = new mysqli('localhost','root','','conférence1');
$query4= "select désignation from théme_papier where idpap='$p' ORDER BY `n°` ASC";
$result4=$db->query($query4);
if($result4)
{$b=array();
while($i=mysqli_fetch_object($result4))
{array_push($b,$i->désignation);}
}
@ $db = new mysqli('localhost','root','','conférence1');
$query= "select* from théme_rapporteur where idrapp='$g' ORDER BY `n°` ASC";
$result=$db->query($query);
if($result)
{$T=array();
$r=array();
while($h=mysqli_fetch_object($result))
{array_push($T,$h->désignation);
array_push($r,$h->idrapp);
} }
$number_of_b=count($b);
$number_of_T=count($T);
for($i=0;$i<$number_of_b;$i++)
{for($j=0;$j<$number_of_T;$j++)
{if(($b[$i]=$T[$j]))
{$papier=new papier();
$nb=$papier->getnbrapp($p1);
$rapporteur=new rapporteur();
$nbp=$rapporteur->getnbpap($r[$j]);
$v=$rapporteur->verifier($p2,$g);
if(($nb<2)and($v!=1)and($b[$i]==$T[$j]))
{
@ $db = new mysqli('localhost','root','','conférence1');
$query5= "INSERT INTO `rapport` ( `idrapp` , `idpap` , `notet` , `remarque` )
VALUES ('$g1', '$p3', '', ''); ";
$result5=$db->query($query5);
@ $db = new mysqli('localhost','root','','auteurth');
$query1= "delete from papier where idpap='$p2'";
$result1=$db->query($query1);
if( $result5)
{include("modifier1.php");
exit;}
}}}}
if(($nb>=2))
{
echo "papier deja affecter a deux rapporteurs";
include("modifier1.php");}
if($v==1)
{
echo "rapporteur '$g' et auteur appartenant a un meme organisme";
include("modifier1.php");}
if($i==$number_of_T)
{
echo "Les théme de '$g' et les théme du papier ne sont pas compatible";
include("modifier1.php");}
} |
Partager