-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathreviews_save.php
More file actions
67 lines (62 loc) · 1.62 KB
/
reviews_save.php
File metadata and controls
67 lines (62 loc) · 1.62 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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<?php
//============================================================+
// File name : reviews_save.php
//
// Description : This file saves the reviews written by user.
//
// Author: Aditya Mathur
//
// (c) Copyright:
// Aditya Mathur
// eztasker.com
//
// License:
// Copyright (C) 2014 Aditya Mathur - eztasker.com
//============================================================+
session_start();
if(isset($_SESSION['li_uname111'])){
$e=$_SESSION['li_uname111'];
}
elseif(isset($_SESSION['li_uname222'])){
$e=$_SESSION['li_uname222'];
$title="Task Poster";
}
elseif(isset($_SESSION['li_uname333'])){
$e=$_SESSION['li_uname333'];
$title="Task Worker";
}
else{
$e='';
header('location:login.php');die;//redirect to login page
}
?>
<?php
if(isset($_POST['submit'])){
//gathering user's entered data
$pid=trim($_POST["pid"]);
$wid=trim($_POST["wid"]);
$tpe=trim($_POST["type"]);
$review=trim($_POST["review"]);
//gathering other data
$today = mktime(0,0,0,date("m"),date("d"),date("Y"));
$date = date("m/d/y",$today);
//validating form content
if($review =="" ){
echo "<script> alert('Please write a review first.')</script>";
echo"<script> function goBack(){window.history.back()} goBack(); </script>";
}
else{
//processing form content
require_once './includes/db_config.php';
connect();
$query2 = "insert into reviews values('','$pid',$wid,'$review','$date','$tpe')";
$result2=mysql_query($query2);
if($result2){
//echo "<script> alert('Review written.') </script>" ;
echo"<script> function goBack(){window.history.back()} goBack(); </script>";
}else{
echo"Oops! Something went wrong!";
}
}
}
?>