Blame view

sendNews.php 609 Bytes
febd6409   henyxia   News creation done
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
  <?php
  require_once("creds.php");
  
  if(isset($_SESSION["admin"])&&$_SESSION["admin"])
  {
  	$link = mysql_connect(__MYSQL_HOSTNAME__, __MYSQL_USERNAME__, __MYSQL_PASSWORD__)
  		or die("Impossible de se connecter : " . mysql_error());
  	if(!mysql_select_db('crep', $link))
  	{
  		echo 'Selection de la base de donnees impossible';
  		exit;
  	}
  	$requete = "INSERT INTO  `crep`.`news` (`pk` ,`fk_author` ,`created` ,`title` ,`content`) VALUES (NULL ,  '2',  CURDATE(), ".base64_decode($_POST["title"]).", ".base64_decode($_POST["content"]).")";
  	$resultat = mysql_query($requete);
  }
  else
  	die("Nop, only admins here !");