-
Notifications
You must be signed in to change notification settings - Fork 3
/
slotsmachine3.php
executable file
·150 lines (144 loc) · 5.26 KB
/
slotsmachine3.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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
<?php
/*
MCCodes FREE
slotsmachine3.php Rev 1.1.0
Copyright (C) 2005-2012 Dabomstew
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
session_start();
require "global_func.php";
if ($_SESSION['loggedin'] == 0)
{
header("Location: login.php");
exit;
}
$userid = $_SESSION['userid'];
require "header.php";
$h = new headers;
$h->startheaders();
include "mysql.php";
global $c;
$is =
mysql_query(
"SELECT u.*,us.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid WHERE u.userid=$userid",
$c) or die(mysql_error());
$ir = mysql_fetch_array($is);
check_level();
$fm = money_formatter($ir['money']);
$cm = money_formatter($ir['crystals'], '');
$lv = date('F j, Y, g:i a', $ir['laston']);
$h->userdata($ir, $lv, $fm, $cm);
$h->menuarea();
$tresder = (int) (rand(100, 999));
$maxbet = $ir['level'] * 500;
$_GET['tresde'] = abs((int) $_GET['tresde']);
if (($_SESSION['tresde'] == $_GET['tresde']) || $_GET['tresde'] < 100)
{
die(
"Error, you cannot refresh or go back on the slots, please use a side link to go somewhere else.<br />
<a href='slotsmachine3.php?tresde=$tresder'>> Back</a>");
}
$_SESSION['tresde'] = $_GET['tresde'];
$_GET['bet'] = abs((int) $_GET['bet']);
print "<h3>5 Line Slotmachine</h3>";
if ($_GET['bet'])
{
if ($_GET['bet'] > $ir['money'])
{
die(
"You are trying to bet more than you have.<br />
<a href='slotsmachine3.php?tresde=$tresder'>> Back</a>");
}
else if ($_GET['bet'] > $maxbet)
{
die(
"You have gone over the max bet.<br />
<a href='slotsmachine3.php?tresde=$tresder'>> Back</a>");
}
$slot[1] = (int) rand(0, 9);
$slot[2] = (int) rand(0, 9);
$slot[3] = (int) rand(0, 9);
$slot[4] = (int) rand(0, 9);
$slot[5] = (int) rand(0, 9);
print
"You place \${$_GET['bet']} into the slot and pull the pole.<br />
You see the numbers: <b>$slot[1] $slot[2] $slot[3] $slot[4] $slot[5]</b><br />
You bet \${$_GET['bet']} ";
if ($slot[1] == $slot[2] && $slot[2] == $slot[3] && $slot[3] == $slot[4]
&& $slot[4] == $slot[5])
{
$won = $_GET['bet'] * 126;
$gain = $_GET['bet'] * 125;
print
"and won \$$won by lining up 5 numbers pocketing you \$$gain extra.";
}
else if (($slot[1] == $slot[2] && $slot[2] == $slot[3]
&& $slot[3] == $slot[4])
|| ($slot[2] == $slot[3] && $slot[3] == $slot[4]
&& $slot[4] == $slot[5])
|| ($slot[1] == $slot[3] && $slot[3] == $slot[4]
&& $slot[4] == $slot[5])
|| ($slot[1] == $slot[2] && $slot[2] == $slot[4]
&& $slot[4] == $slot[5])
|| ($slot[1] == $slot[2] && $slot[2] == $slot[3]
&& $slot[3] == $slot[5]))
{
$won = $_GET['bet'] * 36;
$gain = $_GET['bet'] * 35;
print
"and won \$$won by lining up 4 numbers pocketing you \$$gain extra.";
}
else if (($slot[1] == $slot[2] && $slot[2] == $slot[3])
|| ($slot[2] == $slot[3] && $slot[3] == $slot[5])
|| ($slot[3] == $slot[4] && $slot[4] == $slot[5])
|| ($slot[1] == $slot[3] && $slot[3] == $slot[5])
|| ($slot[1] == $slot[4] && $slot[4] == $slot[5])
|| ($slot[1] == $slot[2] && $slot[2] == $slot[4])
|| ($slot[2] == $slot[3] && $slot[3] == $slot[5])
|| ($slot[1] == $slot[3] && $slot[3] == $slot[4])
|| ($slot[2] == $slot[4] && $slot[4] == $slot[5])
|| ($slot[1] == $slot[2] && $slot[2] == $slot[5])
|| ($slot[2] == $slot[3] && $slot[3] == $slot[4]))
{
$won = $_GET['bet'] * 9;
$gain = $_GET['bet'] * 8;
print
"and won \$$won by lining up 3 numbers pocketing you \$$gain extra.";
}
else
{
$won = 0;
$gain = -$_GET['bet'];
print "and lost it.";
}
mysql_query(
"UPDATE users SET money=money+({$gain}) where userid=$userid", $c);
$tresder = (int) (rand(100, 999));
print
"<br />
<a href='slotsmachine3.php?bet={$_GET['bet']}&tresde=$tresder'>> Another time, same bet.</a><br />
<a href='slotsmachine3.php?tresde=$tresder'>> I'll continue, but I'm changing my bet.</a><br />
<a href='explore.php'>> Enough's enough, I'm off.</a>";
}
else
{
print
"Ready to try your luck? Play today!<br />
The maximum bet for your level is \$$maxbet.<br />
<form action='slotsmachine3.php' method='get'>
Bet: \$<input type='text' name='bet' value='5' /><br />
<input type='hidden' name='tresde' value='$tresder' />
<input type='submit' value='Play!!' />
</form>";
}
$h->endpage();