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
   |  
<?php
session_start();
// Connexion
$lien=mysql_connect("localhost","root","");
mysql_select_db("complaint_applet",$lien);
 
//Test connexion
if ($lien==0)
{
	printf("Error of connexion with the server");
}
 
//Recovery of the data
$CompName= $_POST['CompName'];
$IncNb = $_POST['IncNb'];
$DateRec = $_POST['arrivee'];
$Desc = $_POST['Description'];
$Los = $_POST['Los'];
$Natco = $_POST['Natco'];
//To grant rights
//if ($Profile==TSI && ( $Los==Other || $Los==RM))
//{
//	exit("You are not authorised to create complaints with a Other or RM LOS because you have a TSI profile");
//}
 
 
 
$request1="SELECT MAX(Complaint_number) FROM  complaint";
$result=mysql_query($request1);
if ($result==0)
{
	$NbC=0000;
}
else
{
	$row=mysql_fetch_row($result);
	$NbC=$row[0]+1;	
}
 
	//Recovery of modification date & time
	$CurrentYear=Date("Y");
	$CurrentMonth=Date("m");
	$CurrentDay=Date("j");
	$CurrentHour=Date("H");
	$CurrentMinute=Date("i");
	$CurrentSecond=Date("s");
	$CurrentDate=$CurrentYear."-".$CurrentMonth."-".$CurrentDay;
	$CurrentTime=$CurrentHour.":".$CurrentMinute.":".$CurrentSecond;
 
	//Request
	//Complaint creation
	$User = $_SESSION['Name'];
	$request2="INSERT INTO complaint(Complaint_reception_date, Description, Incident_Request_number, Natco, LOS, 	Complainant_name, Recording_date, Recording_time, Complaint_year, Complaint_number, Status, Recorded_by) VALUES ('$DateRec','$Desc','$IncNb','$Natco','$Los','$CompName','$CurrentDate','$CurrentTime','$CurrentYear','$NbC','Opened','$User')";
	$result2=mysql_query($request2);
	if($result2==0)
	{
		echo"<font color=darkblue>You could not record this complaint</font color>";
	}
	else
	{
		?>
		<script language="JavaScript">
		confirm("You have been created the complaint number <?php echo"$CurrentYear"; echo"-"; echo"$NbC"; ?>");
		</script>
		<?php
		include"Create.php";
	}
	mysql_close($lien);
?> | 
Partager