43 lines
1.2 KiB
PHP
43 lines
1.2 KiB
PHP
<?php
|
|
$FilesDir = str_replace("files", "",dirname(__FILE__));
|
|
require_once("".$FilesDir."user/config.php");
|
|
require_once(''.$MainDir.'user/verifications.php');
|
|
if (isset($_POST['titre']) AND isset ($_POST['article']))
|
|
{
|
|
|
|
|
|
$this_article_id=$_GET['id'];
|
|
|
|
$date = "42";
|
|
$titre = $_POST['titre'];
|
|
$article = $_POST['article'];
|
|
$bdd = new PDO("mysql:dbname=$base;host=$server", "$user", "$passwd");
|
|
|
|
$sql="SELECT * FROM article";
|
|
$req = mysql_query($sql) or die('Erreur SQL !<br />'.$sql.'<br />'.mysql_error());
|
|
$data_articles=mysql_fetch_assoc($req);
|
|
|
|
|
|
mysql_query('UPDATE article SET titre=("'.$titre.'") WHERE id_article="'.$this_article_id.'"') or die ('error : '.mysql_error());
|
|
|
|
mysql_query('UPDATE article SET article=("'.$article.'") WHERE id_article="'.$this_article_id.'"') or die ('error : '.mysql_error());
|
|
|
|
|
|
|
|
|
|
//$req = $bdd->prepare('INSERT INTO article(user,titre,article) VALUES (:user, :titre, :article)');
|
|
//$req->execute(array(
|
|
// "user" => $username,
|
|
// "titre" => $titre,
|
|
// "article" => $article,
|
|
|
|
//));
|
|
echo "Votre article a bien été enregistré ! <a href='".$root_path."'>Retour</a>";
|
|
//echo date_default_timezone_set('l jS \of F Y h:i:s A');
|
|
}
|
|
else
|
|
{
|
|
echo "Il y a eu une erreur.";
|
|
}
|
|
?>
|