Repository navigation
Expand file tree
/
Copy pathupdatePackage.php
More file actions
86 lines (65 loc) · 1.85 KB
/
Copy pathupdatePackage.php
File metadata and controls
86 lines (65 loc) · 1.85 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
76
77
78
79
80
81
82
83
84
85
86
<?php
require_once('config.php');
session_start();
if(!isset($_SESSION['userName']))
{
header("Location:login.php");
exit();
}
$sql="SELECT * FROM users WHERE userName=?";
$stmt=mysqli_stmt_init($conn);
if(!mysqli_stmt_prepare($stmt,$sql))
{
header('location: login.php?error=sqlerror');
exit();
}
else
{
mysqli_stmt_bind_param($stmt,"s",$_SESSION['userName']);
mysqli_stmt_execute($stmt);
$result=mysqli_stmt_get_result($stmt);
if($row=mysqli_fetch_assoc($result))
{
$userName= $row['userName'];
$email=$row['email'];
$path=$row['profilePic'];
$amount=$row['amountBot'];
}
}
if($_POST['package']=="first")
{
//update first package
$newAmount=$amount-1000;
$sql="update users set amountBot='".$newAmount."' where userName='".$userName."' " ;
if (mysqli_query($conn, $sql))
{
echo "
חבילת אלף בקבוקים עודכנה בהצלחה
";
}
}
else if ($_POST['package']=="second")
{
//update second package
$newAmount=$amount-3000;
$sql="update users set amountBot='".$newAmount."' where userName='".$userName."' " ;
if (mysqli_query($conn, $sql))
{
echo "
חבילת שלושת אלפים בקבוקים עודכנה בהצלחה
";
}
}
else if ($_POST['package']=="third")
{
//update third package
$newAmount=$amount-5000;
$sql="update users set amountBot='".$newAmount."' where userName='".$userName."' " ;
if (mysqli_query($conn, $sql))
{
echo "
חבילת חמשת אלפים בקבוקים עודכנה בהצלחה
";
}
}
?>