-
Notifications
You must be signed in to change notification settings - Fork 0
/
play.php
43 lines (29 loc) · 1.12 KB
/
play.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
<?php
session_start();
$id= $_GET['id'];
$user = $_SESSION['username'];
require 'database.php';
//update mood of pet being played with
$phptime = time();
date_default_timezone_set('America/Chicago');
$time = date ("Y-m-d H:i:s", $phptime);
$stmt = $mysqli->prepare("update pets set last_played=? where owner=?");
if(!$stmt){
printf("Query Prep Failed: %s\n", $mysqli->error);
exit;
}
$stmt->bind_param('ss', $time, $user);
$stmt->execute();
$stmt->close();
//delete item from inventory
$stmt = $mysqli->prepare("delete from inventory where id=?");
if(!$stmt){
printf("Query Prep Failed: %s\n", $mysqli->error);
exit;
}
$stmt->bind_param('i', $id);
$stmt->execute();
$stmt->close();
//then go back to inventory
header("Location: inventory.php");
?>