-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupload.php
More file actions
36 lines (33 loc) · 1.11 KB
/
upload.php
File metadata and controls
36 lines (33 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
session_start();
if(!isset($_SESSION['loggedin'])||$_SESSION['loggedin']!=true){
header("location:login.php");
exit;
}
$login=false;
if($_SERVER["REQUEST_METHOD"]=="POST"){
include 'db_connect.php';
$userid=$_SESSION["userid"];
$heading=$_POST["heading"];
$content=$_POST["content"];
$likes=0;
$dislikes=0;
$imgsrc=$_POST["image-src"];
$time = floor(microtime(true));
$rank = $dislikes-$likes+$time;
date_default_timezone_set('Asia/Kolkata');
$date = date("F j, Y, g:i a");
// echo $heading;
// echo " ";
// echo $content;
// echo " ";
// echo " ";
$sql="INSERT INTO `bloglist` (`rank`,`UserId`, `heading`, `content`,`image-source`,`likes`,`dislikes`,`Time`,`date`) VALUES ('$rank','$userid', '$heading',
'$content','$imgsrc','$likes','$dislikes','$time','$date');";
$res=mysqli_query($conn,$sql);
if($res)
header("location:index.html");
else
echo "Error occurred!!!while entering data into the database";
}
?>