-
Notifications
You must be signed in to change notification settings - Fork 0
/
sellinsert.php
executable file
·54 lines (48 loc) · 1.58 KB
/
sellinsert.php
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
<?php
session_start();
require_once("DataConnection.php");
echo $_FILES["f1"]["error"];
if($_FILES["f1"]["error"]==0)
{
$FileName=$_FILES["f1"]["name"];
$Path=$_FILES["f1"]["tmp_name"];
$Size=$_FILES["f1"]["size"];
$title=isset($_POST["t1"])?$_POST["t1"]:"";
$extname = pathinfo($FileName,PATHINFO_EXTENSION);
$strInsert="insert into imageData(title,ImageName,ext,uploadDate) values('$title','$FileName','$extname',now())";
if($extname=="jpg" or $extname=="png" or $extname="jpeg")
{
$result=mysqli_query($con,$strInsert);
if($result==true)
{
$pid = mysqli_insert_id($con);
$strid="update imageData set id=$pid where title='$title'";
mysqli_query($con,$strid);
$pathName = "uploads/" . $title . "." . $extname;
move_uploaded_file($Path,$pathName);
}
}
else
echo "Please Select *.jpg file";
}
else
echo "Please Select File...";
$name=isset($_POST["t1"])?$_POST["t1"]:"";
$address=isset($_POST["t2"])?$_POST["t2"]:"";
$price=isset($_POST["t3"])?$_POST["t3"]:"";
$description=isset($_POST["t4"])?$_POST["t4"]:"";
$type=isset($_POST["t5"])?$_POST["t5"]:"";
$rn=$_SESSION["rollno"];
$_SESSION["name"]=$name;
$queryname="select name from logins where user=$rn";
//echo $queryname;
$res=mysqli_query($con,$queryname);
if($res==true and mysqli_num_rows($res)>0)
{
$row=mysqli_fetch_array($res);
$nameseller=$row[0];
}
$queryinsert="insert into product(status,date_pro,price,description,name,address,type_name,names) values('unsold',now(),$price,'$description','$name','$address','$type','$nameseller')";
$result=mysqli_query($con,$queryinsert);
header("location: sellcode.php");
?>