-
Notifications
You must be signed in to change notification settings - Fork 0
/
buygold.php
67 lines (63 loc) · 1.75 KB
/
buygold.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
<?php
include_once("script-head.php");
include_once("cp/connect.php");
$id = $_GET['itemid'];
$charid = $_SESSION['charid'];
// Get Item Information
$item_sql = mysql_query("SELECT * FROM tb_shopgold_item WHERE id = '".$api->cl($id)."'");
$item = mysql_fetch_assoc($item_sql);
if($_SESSION['user_no'] == "")
{
$api->go("member-login.php");
}
else if($charid == "")
{
$api->popup("กรุณาเลือกตัวละครก่อนค่ะ");
$api->back();
}
else if($gold < $item['item_price'])
{
$api->popup("คุณมี Gold ไม่เพียงพอค่ะ");
$api->back();
}
else
{
// Update and Send
$money_sql = $sql->prepare("EXEC C9Web.Web.UspUpdateGold :p1,:p2,:p3");
$money_sql->BindParam(":p1",$charid);
$money_sql->BindParam(":p2",$item['item_price']);
$money_sql->BindParam(":p3",$gold);
$money_sql->execute();
if(!$money_sql)
{
$api->popup("เกิดข้อผิดพลาดขณะรันข้อมูล");
$api->back();
}
else
{
$mail_type = 1;
$char_send = "GM";
$subject = "Item";
$content = "Thank you.";
$send = $sql->prepare("EXEC C9Web.Web.SendMailEx :p1,:p2,:p3,:p4,:p5,:p6,:p7");
$send->BindParam(":p1",$charid);
$send->BindParam(":p2",$mail_type);
$send->BindParam(":p3",$char_send);
$send->BindParam(":p4",$subject);
$send->BindParam(":p5",$content);
$send->BindParam(":p6",$item['item_id']);
$send->BindParam(":p7",$item['item_count']);
$send->execute();
if(!$send)
{
$api->popup("เกิดข้อผิดพลาดขณะรันข้อมูล");
$api->back();
}
else
{
$api->popup("ทำการซื้อเรียบร้อยค่ะ");
$api->back();
}
}
}
?>