2018-11-17 14:43:50 +01:00
|
|
|
<?php
|
|
|
|
if( !isset( $_SESSION ) ) session_start();
|
|
|
|
include "../settings/db_connect.php";
|
|
|
|
$title = $_POST["title"];
|
|
|
|
$meta_desc = $_POST["meta_desc"];
|
|
|
|
$text = $_POST["post_text"];
|
|
|
|
$userlogin=$_SESSION['user'];
|
|
|
|
$query="SELECT user_id FROM user WHERE username='$userlogin'";
|
|
|
|
if ($result=mysqli_query($mysqli,$query)){
|
|
|
|
while ($row=mysqli_fetch_row($result)){
|
|
|
|
$userid=$row[0];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$sql = $mysqli->prepare("INSERT INTO post VALUES (NULL,?, ?, ?, ?,NOW(),NOW());");
|
|
|
|
if ($sql)
|
|
|
|
{
|
|
|
|
$sql->bind_param("isss",$userid,$title,$meta_desc,$text);
|
|
|
|
$sql->execute();
|
|
|
|
$sql->close();
|
|
|
|
}
|
|
|
|
$mysqli->close();
|
|
|
|
|
2018-12-13 00:58:38 +01:00
|
|
|
header ("Location: ./");
|
2018-11-17 14:43:50 +01:00
|
|
|
?>
|