-
Notifications
You must be signed in to change notification settings - Fork 0
/
sendoffer.php
104 lines (95 loc) · 2.79 KB
/
sendoffer.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<?php
session_start();
include_once 'class/class.pagebuild.php';
include_once 'class/class.user.php';
include_once 'class/class.cars.php';
$car = new cars();
$user = new user();
$page = new pageBuild();
$page->checkLogin();
$title = "New Car Scrimmage - Send Offer";
$page->defaultHead($title);
$page->startBody();
$page->navBar();
//Catch anything posted to ourselves... no use for another utility.
if(isset($_POST['request'])){
foreach( $_POST as $key => $value ){
$_POST[$key] = $user->db->filter( $value );
}
$price = $_POST['price'];
$request = $_POST['request'];
$message = $_POST['message'];
$dealer = $_SESSION['dealerID'];
$input = array(
'request_id' => $request,
'offered_price' => $price,
'offer_details' => $message,
'dealer_id' => $dealer
);
if($user->db->insert('offers', $input)){
header('Location: http://onlinelotbuilder.com/controlpanel.php');
}
}
if(isset($_SESSION['dealer'])){
foreach( $_GET as $key => $value ){
$_GET[$key] = $user->db->filter( $value );
}
$rid = $_GET['r'];
$id = $_GET['dealer'];
$offerDeets = $user->getRequest($rid);
$offerDeets = $offerDeets[0];
$trimNames = $car->getNameByTrim($offerDeets['car_trim']);
$hidden = "<input type='hidden' id='request' name='request' value='$rid'>";
$vehicle = <<<CAR
<tr>
<td>{$offerDeets['car_year']}</td>
<td>{$offerDeets['makeName']}</td>
<td>{$offerDeets['name']}</td>
<td>{$trimNames['long']}</td>
</tr>
CAR;
?>
<h2>Send An Offer</h2>
<table class="table table-hover">
<thead>
<tr>
<th>Year</th>
<th>Make</th>
<th>Model</th>
<th>Trim</th>
</tr>
</thead>
<tbody>
<?php echo $vehicle; ?>
</tbody>
</table>
<form class="form-horizontal" method="POST" action="">
<fieldset>
<legend></legend>
<div class="form-group">
<label class="col-md-4 control-label" for="price">Price</label>
<div class="col-md-4">
<input id="price" name="price" type="number" step="0.01" placeholder="$xx,xxx" class="form-control input-md">
</div>
</div>
<!-- Textarea -->
<div class="form-group">
<label class="col-md-4 control-label" for="message">Text Area</label>
<div class="col-md-4">
<textarea class="form-control" id="message" name="message"></textarea>
</div>
</div>
<?php echo $hidden; ?>
<!-- Button -->
<div class="form-group">
<label class="col-md-4 control-label" for="go"></label>
<div class="col-md-4">
<button id="go" name="go" class="btn btn-success" >Send Offer</button>
</div>
</div>
</fieldset>
</form>
<?php
}
$page->footer();
?>