24 lines
684 B
PHP
24 lines
684 B
PHP
|
<?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();
|
||
|
|
||
|
header ("Location: http://127.0.0.1/TAS-ALFA/admin-zone/");
|
||
|
?>
|