Ok, so granted this code is longer than need be, as I havent had time to shorten it up. I was in a hurry to get it done for myself and making it longer took less time than shorter, if that makes sense.
I will most likely be going over this at a later date and shortening it quite a bit, but for now, here you go :-)
This gives you 3 safes to crack, you can set the difficulty on just how hard.
there is a pot in the SQL database that goes up per each fail on the safes. Free pot gives users 10 attempts per day, the other 2 are pay as you go.
Win someone wins, the password to the safe automatically changes to something differant.
The only way to know the combo is to have sql access

+1 me if you guys use or enjoy this, i'm also open to any suggestions.
CREATE TABLE IF NOT EXISTS `cracksafe` (
`sname` varchar(255) NOT NULL default '0',
`pot` int(11) NOT NULL default '0',
`pot2` int(11) NOT NULL default '0',
`pot3` int(11) NOT NULL default '0',
`winnings` int(11) NOT NULL default '0',
`winnings2` int(11) NOT NULL default '0'
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
CREATE TABLE IF NOT EXISTS `cracksafe` (
`sname` varchar(255) NOT NULL default '0',
`pot` int(11) NOT NULL default '0',
`pot2` int(11) NOT NULL default '0',
`pot3` int(11) NOT NULL default '0',
`winnings` int(11) NOT NULL default '0',
`winnings2` int(11) NOT NULL default '0'
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
CREATE TABLE IF NOT EXISTS `cracksafe` (
`sname` varchar(255) NOT NULL default '0',
`pot` int(11) NOT NULL default '0',
`pot2` int(11) NOT NULL default '0',
`pot3` int(11) NOT NULL default '0',
`winnings` int(11) NOT NULL default '0',
`winnings2` int(11) NOT NULL default '0'
) ENGINE=MyISAM DEFAULT CHARSET=latin1;Insert into Users
safetries` int(11) NOT NULL default '10INSERT INTO `cracksafe` (`sname`, `pot`, `pot2`, `pot3`, `winnings`, `winnings2`) VALUES
('1', 211, 12, 5, 100000, 100);
INSERT INTO `cracksafe2` (`sname`, `pot`, `pot2`, `pot3`, `winnings`, `winnings2`) VALUES
('1', 835, 17, 2, 500000, 300);INSERT INTO `cracksafe3` (`sname`, `pot`, `pot2`, `pot3`, `winnings`, `winnings2`) VALUES
('1', 972, 14, 3, 100000, 500);cracksafe.php
<?php
include "globals.php";
global $ir,$c,$h,$userid,$db;
if(isset($_POST['submit']))
{
$safe=$db->query("SELECT * FROM `cracksafe` WHERE `sname`='1'");
$pot=$db->fetch_row($safe);
$rand3 = $pot['pot']; //sql query attempt
if($_POST['3digit'] != $rand3) {
print "Error, Wrong Combination!";
$db->query("UPDATE users SET safetries=safetries-1 WHERE $userid=userid");
$db->query("UPDATE cracksafe SET winnings=winnings+2000,winnings2=winnings2+5 WHERE sname = 1");
exit(0);
}
$safe=$db->query("SELECT * FROM `cracksafe` WHERE `sname`='1'");
$pot=$db->fetch_row($safe);
$rand2 = $pot['pot2']; //sql query attempt
if($_POST['2digit'] != $rand2) {
print "Error, Wrong Combination!";
$db->query("UPDATE users SET safetries=safetries-1 WHERE $userid=userid");
$db->query("UPDATE cracksafe SET winnings=winnings+2000,winnings2=winnings2+5 WHERE sname = 1");
exit(0);
}
$safe=$db->query("SELECT * FROM `cracksafe` WHERE `sname`='1'");
$pot=$db->fetch_row($safe);
$rand1 = $pot['pot3']; //sql query attempt
if($_POST['1digit'] != $rand1) {
print "Error, Wrong Combination!";
$db->query("UPDATE users SET safetries=safetries-1 WHERE $userid=userid");
$db->query("UPDATE cracksafe SET winnings=winnings+2000,winnings2=winnings2+5 WHERE sname = 1");
exit(0);
}
else if($_POST['3digit'] == $rand3 && $_POST['2digit'] == $rand2 && $_POST['1digit'] == $rand1) {
$winnings = $pot['winnings'];
$winnings2 = $pot['winnings2'];
print "You press the numbers [{$_POST['3digit']}][{$_POST['2digit']}][{$_POST['1digit']}]<br />
<font color='green' size='3'>Correct Combination, You've won $winnings and $winnings2 Points! </font>";
$r1 = rand(100,999);
$r2 = rand(10,99);
$r3 = rand(1,9);
$money= $pot['winnings']; //The cash pot
$points= $pot['winnings2']; //The points pot
$db->query("UPDATE `users` SET money=money+{$money},crystals=crystals+{$points} WHERE userid=$userid");
$db->query("UPDATE cracksafe SET winnings=100000,winnings2=100 WHERE sname = 1");
$db->query("UPDATE cracksafe SET pot={$r1},pot2={$r2},pot3={$r3} WHERE sname = 1");
}
}
else
{
print "<form action='cracksafe.php' method='post'>
Have a shot at cracking the safe! It isnt easy, all 3 numbers must match the correct combination in order to crack the vault. However, the Prize is Well worth it :-)
Good luck!<br />
First Three: [<input type='text' name='3digit' length='3' maxlength='3'>] <sup>Hint: 100 - 999</sup><br />
Second Two: [<input type='text' name='2digit' length='2' maxlength='2'>] <sup>Hint: 10 - 99</sup><br />
Last One: [<input type='text' name='1digit' length='1' maxlength='1'>] <sup>Hint: 1 - 9</sup><br />
<input type='submit' name='submit' value='submit'>
</form>";
}
?>cracksafe2.php
<?php
//****Modified by Immortal Thug
//
//***Please keep this notice.
include "globals.php";
global $ir,$c,$h,$userid,$db;
if($ir['money'] < 10000)
{
print "You cannot afford to purchase a crack the safe attempt";
exit(0);
}
if(isset($_POST['submit']))
{
$safe=$db->query("SELECT * FROM `cracksafe2` WHERE `sname`='1'");
$pot=$db->fetch_row($safe);
$rand3 = $pot['pot']; //sql query attempt
$_POST['3digit'] = abs(@intval($_POST['3digit']));
if($_POST['3digit'] != $rand3) {
print "Error, Wrong Combination!";
$db->query("UPDATE users SET money=money-10000 WHERE $userid=userid");
$db->query("UPDATE cracksafe2 SET winnings=winnings+10000,winnings2=winnings2+10 WHERE sname = 1");
exit(0);
}
$safe=$db->query("SELECT * FROM `cracksafe2` WHERE `sname`='1'");
$pot=$db->fetch_row($safe);
$rand2 = $pot['pot2']; //sql query attempt
$_POST['2digit'] = abs(@intval($_POST['2digit']));
if($_POST['2digit'] != $rand2) {
print "Error, Wrong Combination!";
$db->query("UPDATE users SET money=money-10000 WHERE $userid=userid");
$db->query("UPDATE cracksafe2 SET winnings=winnings+10000,winnings2=winnings2+10 WHERE sname = 1");
exit(0);
}
$safe=$db->query("SELECT * FROM `cracksafe2` WHERE `sname`='1'");
$pot=$db->fetch_row($safe);
$rand1 = $pot['pot3']; //sql query attempt
$_POST['1digit'] = abs(@intval($_POST['1digit']));
if($_POST['1digit'] != $rand1) {
print "Error, Wrong Combination!";
$db->query("UPDATE users SET money=money-10000 WHERE $userid=userid");
$db->query("UPDATE cracksafe2 SET winnings=winnings+10000,winnings2=winnings2+10 WHERE sname = 1");
exit(0);
}
else if($_POST['3digit'] == $rand3 && $_POST['2digit'] == $rand2 && $_POST['1digit'] == $rand1) {
$winnings = $pot['winnings'];
$winnings2 = $pot['winnings2'];
print "You press the numbers [{$_POST['3digit']}][{$_POST['2digit']}][{$_POST['1digit']}]<br />
<font color='green' size='3'>Correct Combination, You've won $winnings and $winnings2 Points! </font>";
$r1 = rand(100,999);
$r2 = rand(10,99);
$r3 = rand(1,9);
$money= $pot['winnings']; //The cash pot
$points= $pot['winnings2']; //The points pot
$db->query("UPDATE `users` SET money=money+{$money},crystals=crystals+{$points} WHERE userid=$userid");
$db->query("UPDATE cracksafe2 SET winnings=500000,winnings2=300 WHERE sname = 1");
$db->query("UPDATE cracksafe2 SET pot={$r1}, pot2={$r2},pot3={$r3} WHERE sname = 1");
}
}
else
{
print "<form action='cracksafe2.php' method='post'>
Have a shot at cracking the safe! It isnt easy, all 3 numbers must match the correct combination in order to crack the vault. However, the Prize is Well worth it :-)
Good luck!<br />
First Three: [<input type='text' name='3digit' length='3' maxlength='3'>] <sup>Hint: 100 - 999</sup><br />
Second Two: [<input type='text' name='2digit' length='2' maxlength='2'>] <sup>Hint: 10 - 99</sup><br />
Last One: [<input type='text' name='1digit' length='1' maxlength='1'>] <sup>Hint: 1 - 9</sup><br />
<input type='submit' name='submit' value='submit'>
</form>";
}
?>cracksafe3.php
<?php
//****Modified by Immortal Thug
//
//***Please keep this notice.
include "globals.php";
global $ir,$c,$h,$userid,$db;
if($ir['money'] < 100000)
{
print "You cannot afford this crack the safe attempt";
exit(0);
}
if(isset($_POST['submit']))
{
$safe=$db->query("SELECT * FROM `cracksafe3` WHERE `sname`='1'");
$pot=$db->fetch_row($safe);
$rand3 = $pot['pot']; //sql query attempt
$_POST['3digit'] = abs(@intval($_POST['3digit']));
if($_POST['3digit'] != $rand3) {
print "Error, Wrong Combination!";
$db->query("UPDATE users SET money=money-100000 WHERE $userid=userid");
$db->query("UPDATE cracksafe3 SET winnings=winnings+100000,winnings2=winnings2+20 WHERE sname = 1");
exit(0);
}
$safe=$db->query("SELECT * FROM `cracksafe3` WHERE `sname`='1'");
$pot=$db->fetch_row($safe);
$rand2 = $pot['pot2']; //sql query attempt
$_POST['2digit'] = abs(@intval($_POST['2digit']));
if($_POST['2digit'] != $rand2) {
print "Error, Wrong Combination!";
$db->query("UPDATE users SET money=money-100000 WHERE $userid=userid");
$db->query("UPDATE cracksafe3 SET winnings=winnings+100000,winnings2=winnings2+20 WHERE sname = 1");
exit(0);
}
$safe=$db->query("SELECT * FROM `cracksafe3` WHERE `sname`='1'");
$pot=$db->fetch_row($safe);
$rand1 = $pot['pot3']; //sql query attempt
$_POST['1digit'] = abs(@intval($_POST['1digit']));
if($_POST['1digit'] != $rand1) {
print "Error, Wrong Combination!";
$db->query("UPDATE users SET money=money-100000 WHERE $userid=userid");
$db->query("UPDATE cracksafe3 SET winnings=winnings+100000,winnings2=winnings2+20 WHERE sname = 1");
exit(0);
}
else if($_POST['3digit'] == $rand3 && $_POST['2digit'] == $rand2 && $_POST['1digit'] == $rand1) {
$winnings = $pot['winnings'];
$winnings2 = $pot['winnings2'];
print "You press the numbers [{$_POST['3digit']}][{$_POST['2digit']}][{$_POST['1digit']}]<br />
<font color='green' size='3'>Correct Combination, You've won $winnings and $winnings2 Points! </font>";
$r1 = rand(100,999);
$r2 = rand(10,99);
$r3 = rand(1,9);
$money= $pot['winnings']; //The cash pot
$points= $pot['winnings2']; //The points pot
$db->query("UPDATE `users` SET money=money+{$money},crystals=crystals+{$points} WHERE userid=$userid");
$db->query("UPDATE cracksafe3 SET winnings=1000000,winnings2=500 WHERE sname = 1");
$db->query("UPDATE cracksafe3 SET pot={$r1},pot2={$r2},pot3={$r3} WHERE sname = 1");
}
}
else
{
print "<form action='cracksafe3.php' method='post'>
For 100k you have the chance to crack the Ultra Safe. The prize is...immaculate..but the chance of success is slim. You'll need luck, so good luck!<br />
First Three: [<input type='text' name='3digit' length='3' maxlength='3'>] <sup>Hint: 100 - 999</sup><br />
Second Two: [<input type='text' name='2digit' length='2' maxlength='2'>] <sup>Hint: 10 - 99</sup><br />
Last One: [<input type='text' name='1digit' length='1' maxlength='1'>] <sup>Hint: 1 - 9</sup><br />
<input type='submit' name='submit' value='submit'>
</form>";
}
?>crackasafe.php
<?php
//****Modified by Immortal Thug
//
//***Please keep this notice.
include "globals.php";
if ($ir ['safetries']<= 0)
{
print "<font color=#800517><b><h3>You have no more try's today come back tomorow";
$h->endpage();
exit;
}
$safe=$db->query("SELECT * FROM `cracksafe` WHERE `sname`='1'");
$r=$db->fetch_row($safe);
$safe=$db->query("SELECT * FROM `cracksafe2` WHERE `sname`='1'");
$r2=$db->fetch_row($safe);
$safe=$db->query("SELECT * FROM `cracksafe3` WHERE `sname`='1'");
$r3=$db->fetch_row($safe);
$r['winnings']=number_format($r['winnings']);
$r2['winnings']=number_format($r2['winnings']);
$r3['winnings']=number_format($r3['winnings']);
$r['winnings2']=number_format($r['winnings2']);
$r2['winnings2']=number_format($r2['winnings2']);
$r3['winnings2']=number_format($r3['winnings2']);
print "
<table width=50% border=1 class=table>
<tr align=center>
<td colspan=3>Attempts Remaining:</td><td colspan=2><font size=3><font color=green><b>{$ir ['safetries']}</b></font></font></td>
<tr>
<th class=h colspan=2>Crack The Safe's</th><th colspan=2>Pot Amounts</th>
</tr>
<tr>
<th class=h colspan=2> </th><th>Cash</th><th>Credits</th>
</tr>
<tr align=center>
<td align=center>Safe 1 [ Free ]</td><td><a href='cracksafe.php'>Crack</a></td><td><b><font color=green>\${$r ['winnings']}</b></font></td><td><b><font color=green>{$r ['winnings2']}</b></font></td>
</tr>
<tr align=center>
<td align=center>Safe 2 [ 10K ]</td><td><a href='cracksafe2.php'>Crack</a></td><td><b><font color=green>\${$r2 ['winnings']}</b></font></td><td><b><font color=green>{$r2 ['winnings2']}</b></font></td>
</tr>
<tr align=center>
<td align=center>Safe 3 [ 100K ]</td><td><a href='cracksafe3.php'>Crack</a></td><td><b><font color=green>\${$r3 ['winnings']}</b></font></td><td><b><font color=green>{$r3 ['winnings2']}</b></font></td>
</tr>
</table>";
$h->endpage();
?>Again, hope you enjoy i know it's long, But feel free to +1 me
