<?php
include ('logue.php'); 
include ('entete2.php');

$req = "SELECT * FROM matgraph_axxnews WHERE idjoueur = $idlogin";
$res = db_mysql_Query($req) or die('Erreur SQL! <br>'.$req.'<br>'.mysql_error());
$num = mysql_num_rows($res);
if ( $num == 0 ) {
echo '<script language="javascript" type="text/javascript">
<!--
window.location.replace("index.php");
-->
</script>'; }

$sujet = $_POST["sujet"];
$msg = $_POST["msg"];
$requete = "INSERT INTO matgraph_news VALUES ('','$idlogin',now(),'$sujet','$msg')";
$resultat = db_mysql_Query($requete)or die('erreur sql<br>'.$requete.'<br>'.mysql_error());

echo '<script language=javascript> alert ("Message envoyer");</script>';
echo '<script language="javascript" type="text/javascript">
<!--
window.location.replace("index.php");
-->
</script>';
?>