-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathfeatured_product.php
More file actions
75 lines (63 loc) · 2.62 KB
/
Copy pathfeatured_product.php
File metadata and controls
75 lines (63 loc) · 2.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
68
69
70
71
72
73
74
75
<?php
/**
* Silurus Classifieds Builder
*
*
* @author SnowHall - http://snowhall.com
* @website http://snowhall.com/silurus
* @email support@snowhall.com
*
* @version 2.0
* @date March 7, 2013
*
* Silurus is a professionally developed PHP Classifieds script that was built for you.
* Whether you are running classifieds for autos, motorcycles, bicycles, rv's, guns,
* horses, or general merchandise, our product is the right package for you.
* It has template system and no limit to usage with free for any changes.
*
* Copyright (c) 2009-2013
*/
include("./include_php/init.php");
if($_SESSION['memberID'] == 0) header("location: index.php");
$info = mysql_fetch_array(mysql_query("select * from Store where userID=".$_SESSION['memberID']." and ID=".intval($_REQUEST['ID'])));
if(!$info) header("location: profile.php");
$productId = isset($_REQUEST['ID']) ? intval($_REQUEST['ID']) : null;
if ($productId)
{
$productSearch = mysql_query("SELECT * FROM `Store` WHERE `id` = '".$productId."'");
$product = mysql_fetch_assoc($productSearch);
$smarty->assign("product", $product);
}
$user = mysql_fetch_assoc(mysql_query("select * from Profiles where ID=".intval($_SESSION['memberID'])));
$smarty->assign('user',$user);
$smarty->assign('featured_cost',$gConfig['featured_cost']);
if($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['Confirm']))
{
$err = array();
//if(floatval(str_replace(",",".",$_REQUEST['price'])) <= 0) {$err['fieldError'] = 1;$_REQUEST['price']='';}
//if(trim($_REQUEST['Title']) == '') {$err['fieldError'] = 1;}
if (intval($_POST['terms']) === 0) {$err['terms'] = 1;}
if ($user['balance'] < $gConfig['featured_cost']) {$err['balance'] = 1;}
if ($product['featured'] == '1') {$err['already_paid'] = 1;}
if(empty($err))
{
$result = mysql_query("UPDATE Store SET
`featured_date`='".date('Y-m-d H:i:s')."',
`featured`='1'
WHERE `ID`='".$product['ID']."'");
if ($result)
{
$newBalance = $user['balance'] - $gConfig['featured_cost'];
mysql_query("UPDATE Profiles SET ".
"`balance` = '".doubleval($newBalance)."' ".
" WHERE `ID` = '".$user['ID']."'");
}
header("location: product.php?ID=".$product['ID']); die();
}
$smarty->assign("error", $err);
}
$HEADERTEXT='Featured Product for Sale';
$smarty->assign("site_title", $HEADERTEXT." :: ".$gConfig['site_title']);
$smarty->assign("HEADERTEXT", $HEADERTEXT);
show_smarty_template('featured_product');
?>