-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsubmit_property.php
executable file
·78 lines (53 loc) · 1.83 KB
/
submit_property.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<? ob_start(); ?>
<?php
require_once("../includes/initialize.php");
if (isset($_POST['submit'])) { // Form has been submitted.
$prop = new property();
$prop->title = trim($_POST['Title']);
$prop->category = trim($_POST['category']);
$prop->propert_typ = trim($_POST['pro_type']);
$prop->bed = trim($_POST['bed']);
$prop->bath = trim($_POST['bath']);
$prop->district = trim($_POST['district']);
$prop->city = trim($_POST['city']);
$prop->size = trim($_POST['no_perches']);
$prop->contact_name = trim($_POST['contact_name']);
$prop->skype = trim($_POST['skype']);
$prop->tel_home = trim($_POST['telephone1']);
$prop->tel_other = trim($_POST['telephone2']);
$prop->email = trim($_POST['email']);
$prop->website = trim($_POST['web']);
$prop->price = trim($_POST['price']);
$prop->description = trim($_POST['description']);
$prop->date = date("Y-m-d");
$prop->verified=1;
$prop->create();
$insert_id= $db->insert_id();
// start image upload
// image upload 1
$max_file_size = 30485760; // expressed in bytes
// 10240 = 10 KB
// 102400 = 100 KB
// 1048576 = 1 MB
// 10485760 = 10 MB
for($i=1; $i<7; $i++){
if(isset($_POST['submit'])) {
$photo = new property_images();
$photo->property_id = $insert_id;
$photo->approved = 2;
$photo->img_no = $i;
$img="img".$i;
$photo->attach_file($_FILES[$img]);
if($photo->save()) {
// Success
} else {
// Failure
$message = join("<br />", $photo->errors);
}
}
}
}
$session->message("Your property had been submited sucessfully. we will review your property and approve it within 24 hours. Thank you!");
redirect_to("../index.php");
?>
<? ob_flush(); ?>