Cronwerks MCCode/MCCodes Forums

Please login or register.

Login with username, password and session length

News:

After purchasing with us the download link will be delivered to your forum message box.


This forum is now closed and has moved to a new location! Click here to find out why.
Pages: [1] 2

AuthorTopic: A much Better Crack the Safe with Pot!  (Read 1447 times)

JoshuaDams

  • Active Member
  • **
  • Reputation Power: 129
  • JoshuaDams is working their way up.JoshuaDams is working their way up.JoshuaDams is working their way up.
  • Offline Offline
  • Posts: 240
    • MSN Messenger - immortalthug4ever@hotmail.com
    • View Profile
    • WWW
A much Better Crack the Safe with Pot!
« on: November 09, 2009, 04:36:30 PM »
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.

Code: [Select]
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
Code: [Select]
safetries` int(11) NOT NULL default '10

Code: [Select]
INSERT INTO `cracksafe` (`sname`, `pot`, `pot2`, `pot3`, `winnings`, `winnings2`) VALUES
('1', 211, 12, 5, 100000, 100);
Code: [Select]
INSERT INTO `cracksafe2` (`sname`, `pot`, `pot2`, `pot3`, `winnings`, `winnings2`) VALUES
('1', 835, 17, 2, 500000, 300);

Code: [Select]
INSERT INTO `cracksafe3` (`sname`, `pot`, `pot2`, `pot3`, `winnings`, `winnings2`) VALUES
('1', 972, 14, 3, 100000, 500);


cracksafe.php
Code: [Select]
<?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
Code: [Select]
<?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
Code: [Select]
<?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
Code: [Select]
<?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>&nbsp;</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 ;)

JoshuaDams

  • Active Member
  • **
  • Reputation Power: 129
  • JoshuaDams is working their way up.JoshuaDams is working their way up.JoshuaDams is working their way up.
  • Offline Offline
  • Posts: 240
    • MSN Messenger - immortalthug4ever@hotmail.com
    • View Profile
    • WWW
Re: A much Better Crack the Safe with Pot!
« Reply #1 on: November 16, 2009, 05:51:31 AM »




OK, so i got bored and figured this mod needed a little work.

Added a few things and made it 1 .php instead of 4.  Enjoy

Add these SQLS PLUS the ones in the Post Above
Code: [Select]
ALTER TABLE `cracksafe` ADD `attempts_1` INT(11) NOT NULL DEFAULT '0';
ALTER TABLE `cracksafe2` ADD `attempts_2` INT(11) NOT NULL DEFAULT '0';
ALTER TABLE `cracksafe3` ADD `attempts_3` INT(11) NOT NULL DEFAULT '0';


cracksafe.php
Code: [Select]
<?php
include_once (DIRNAME(__FILE__) . '/globals.php');
//******************************************************//
//***********This Mod Made by ImmortalThug****************//
//***************Please Leave This Notice******************//
//*******************November 15, 2009******************//
//*****************************************************//          

switch($_GET['action'])
{
case 
"index":
index();
break;

case 
"safe_1":
safe_1();
break;

case 
"safe_2":
safe_2();
break;

case 
"safe_3":
safe_3();
break;

default:
index();
break;
}

function 
index()
{
global 
$ir,$c,$h,$userid,$db;

if(isset(
$_SESSION['view']))
{
    
$_SESSION['view']=$_SESSION['view']+1;
}
else
{
    
$_SESSION['view']=1;
}
print 
"Page Views This Session: ".$_SESSION['view'];


$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><th>Tries this round</th>
</tr>
<tr>
<th class=h colspan=2>Safes</th>
<th>Cash</th><th>Credits</th><th>Attempts</th>
</tr>
<tr align=center>
<td align=center>Free Safe</td>
<td><a href='cracksafe.php?action=safe_1'>Crack</a></td>
<td><b><font color=green>\${$r ['winnings']}</b></font></td>
<td><b><font color=green>{$r ['winnings2']}</b></font></td><td><b><font color=green>{$r ['attempts_1']}</b></font></td>
</tr>
<tr align=center>
<td align=center>10k Safe</td><td><a href='cracksafe.php?action=safe_2'>Crack</a></td><td><b><font color=green>\${$r2 ['winnings']}</b></font></td><td><b><font color=green>{$r2 ['winnings2']}</b></font></td><td><b><font color=green>{$r2 ['attempts_2']}</b></font></td>
</tr>
<tr align=center>
<td align=center>100k Safe</td><td><a href='cracksafe.php?action=safe_3'>Crack</a></td><td><b><font color=green>\${$r3 ['winnings']}</b></font></td><td><b><font color=green>{$r3 ['winnings2']}</b></font></td><td><b><font color=green>{$r3 ['attempts_3']}</b></font></td>
</tr>
</table>"
;
}

function 
safe_1()
{
global 
$ir,$c,$h,$userid,$db;

if(isset(
$_POST['submit']))
{
$safe=$db->query(sprintf("SELECT * FROM `cracksafe` WHERE `sname`='%d'",1));
$pot=$db->fetch_row($safe);
$rand3 abs(@intval($pot['pot']));
$_POST['3digit'] = abs(@intval($_POST['3digit']));
$_POST['2digit'] = abs(@intval($_POST['2digit']));
$_POST['1digit'] = abs(@intval($_POST['1digit']));

if(
$_POST['3digit'] != $rand3)
{
print 
"You have entered an incorrect combination.<br /><a href='cracksafe.php'>Return to Safes</a>";
$db->query("UPDATE users SET safetries=safetries-1 WHERE $userid=userid");
$db->query(sprintf("UPDATE cracksafe SET winnings=winnings+%d,winnings2=winnings2+%d WHERE sname = %u",2000,5,1));
           exit(
0);
}
$safe=$db->query("SELECT * FROM `cracksafe` WHERE `sname`='1'");
$pot=$db->fetch_row($safe);
$rand2 abs(@intval($pot['pot2']));
if(
$_POST['2digit'] != $rand2)
{
print 
"You have entered an incorrect combination.<br /><a href='cracksafe.php'>Return to Safes</a>";
$db->query("UPDATE users SET safetries=safetries-1 WHERE $userid=userid");
$db->query(sprintf("UPDATE cracksafe SET winnings=winnings+%d,winnings2=winnings2+%d WHERE sname = %d",2000,5,1));
    exit(
0);
}
$safe=$db->query(sprintf("SELECT * FROM `cracksafe` WHERE `sname`='%d'",1));
$pot=$db->fetch_row($safe);
$rand1 abs(@intval($pot['pot3']));
if(
$_POST['1digit'] != $rand1)
{
print 
"You have entered the incorrect combination.<br><a href='cracksafe.php'>Return to Safes</a>";
$db->query("UPDATE users SET safetries=safetries-1 WHERE $userid=userid");
$db->query(sprintf("UPDATE cracksafe SET winnings=winnings+%d,winnings2=winnings2+%d WHERE sname = %d",2000,5,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,110);
$r2 rand(10,20);
$r3 rand(1,9);

   
$money$pot['winnings']; //The cash pot
   
$points$pot['winnings2']; //The points pot
   
$db->query(sprintf("UPDATE `users` SET money=money+%u,crystals=crystals+%u WHERE userid=%d",$money,$points,$userid));
   
$db->query(sprintf("UPDATE cracksafe SET winnings=%d,winnings2=%d WHERE sname = %d",100000,100,1));
   
$db->query(sprintf("UPDATE cracksafe SET pot=%u,pot2=%u,pot3=%u WHERE sname = %d",abs(@intval($r1)), abs(@intval($r2)), abs(@intval($r3)),1));
$db->query(sprintf("UPDATE cracksafe SET attempts_1=%d WHERE sname = %d",0,1));
  }
}
else
{
print 
"<form action='cracksafe.php?action=safe_1' 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 - 110</sup><br />
   Second Two: [<input type='text' name='2digit' length='2' maxlength='2'>] <sup>Hint: 10 - 20</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>"
;
$db->query("UPDATE cracksafe SET attempts_1=attempts_1+1 WHERE sname = 1");
}
}


function 
safe_2()
{
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 abs(@intval($pot['pot'])); //sql query attempt
$_POST['3digit'] = abs(@intval($_POST['3digit']));

if(
$_POST['3digit'] != $rand3) {
     print 
"You entered an incorrect combination.<br /><a href='cracksafe.php'>Back To Safes</a>";
$db->query(sprintf("UPDATE users SET money=money-%d WHERE $userid=userid",10000));
$db->query(sprintf("UPDATE cracksafe2 SET winnings=winnings+%d WHERE sname = 1",10000));
$db->query(sprintf("UPDATE cracksafe2 SET winnings2=winnings2+%d WHERE sname = 1",10));
           exit(
0);
}

$safe=$db->query("SELECT * FROM `cracksafe2` WHERE `sname`='1'");
$pot=$db->fetch_row($safe);
$rand2 abs(@intval($pot['pot2']));
$_POST['2digit'] = abs(@intval($_POST['2digit']));

if(
$_POST['2digit'] != $rand2) {
   print 
"You entered an incorrect combination.<br /><a href='cracksafe.php'>Return to Safes</a>";
$db->query(sprintf("UPDATE users SET money=money-%d WHERE $userid=userid",10000));
$db->query(sprintf("UPDATE cracksafe2 SET winnings=winnings+%d WHERE sname = 1",10000));
$db->query(sprintf("UPDATE cracksafe2 SET winnings2=winnings2+%d WHERE sname = 1",10));
    exit(
0);
}
$safe=$db->query("SELECT * FROM `cracksafe2` WHERE `sname`='1'");
$pot=$db->fetch_row($safe);
$rand1 abs(@intval($pot['pot3'])); //sql query attempt
$_POST['1digit'] = abs(@intval($_POST['1digit']));

if(
$_POST['1digit'] != $rand1) {
   print 
"You entered the incorrect combination.<br /><a href='cracksafe.php'>Return to Safes</a>";
$db->query(sprintf("UPDATE users SET money=money-%d WHERE $userid=userid",10000));
$db->query(sprintf("UPDATE cracksafe2 SET winnings=winnings+%d WHERE sname = 1",10000));
$db->query(sprintf("UPDATE cracksafe2 SET winnings2=winnings2+%d WHERE sname = 1",10));
    exit(
0);
}

else if(
$_POST['3digit'] == $rand3 && $_POST['2digit'] == $rand2 && $_POST['1digit'] == $rand1) {
$winnings abs(@intval($pot['winnings']));
$winnings2 abs(@intval($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! <br /><a href='index.php'>Return Home</a></font>"
;

$r1 rand(100,150);
$r2 rand(10,30);
$r3 rand(1,9);

   
$moneyabs(@intval($pot['winnings'])); //The cash pot
   
$pointsabs(@intval($pot['winnings2'])); //The points pot
   
$db->query(sprintf("UPDATE `users` SET money=money+%d,crystals=crystals+%d WHERE userid=%u",$money,$points,$userid));
   
$db->query(sprintf("UPDATE cracksafe2 SET winnings=%d WHERE sname = 1",500000));
   
$db->query(sprintf("UPDATE cracksafe2 SET winnings2=%d WHERE sname = 1",300));
   
$db->query(sprintf("UPDATE cracksafe2 SET pot=%u, pot2=%u,pot3=%u WHERE sname = 1",$r1,$r2,$r3));
$db->query("UPDATE cracksafe2 SET attempts_2=0 WHERE sname = 1");
}
}
else
{
   print 
"<form action='cracksafe.php?action=safe_2' 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 - 150</sup><br />
   Second Two: [<input type='text' name='2digit' length='2' maxlength='2'>] <sup>Hint: 10 - 30</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>"
;
$db->query("UPDATE cracksafe2 SET attempts_2=attempts_2+1 WHERE sname = 1");
}
}
function 
safe_3()
{
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 abs(@intval($pot['pot']));
$_POST['3digit'] = abs(@intval($_POST['3digit']));

if(
$_POST['3digit'] != $rand3) {
     print 
"You entered the incorrect combination<br /><a href='cracksafe.php'>Return To Safes</a>";
$db->query(sprintf("UPDATE users SET money=money-%d WHERE $userid=userid",100000));
$db->query(sprintf("UPDATE cracksafe3 SET winnings=winnings+%d WHERE sname = 1",100000));
$db->query(sprintf("UPDATE cracksafe3 SET winnings2=winnings2+%d WHERE sname = 1",20));
           exit(
0);
}

$safe=$db->query("SELECT * FROM `cracksafe3` WHERE `sname`='1'");
$pot=$db->fetch_row($safe);
$rand2 abs(@intval($pot['pot2']));
$_POST['2digit'] = abs(@intval($_POST['2digit']));

if(
$_POST['2digit'] != $rand2) {
   print 
"You entered the Incorrect Combination<br /><a href='cracksafe.php'>Return to Safes</a>";
$db->query(sprintf("UPDATE users SET money=money-%d WHERE $userid=userid",100000));
$db->query(sprintf("UPDATE cracksafe3 SET winnings=winnings+%d WHERE sname = 1",100000));
$db->query(sprintf("UPDATE cracksafe3 SET winnings2=winnings2+%d WHERE sname = 1",20));
    exit(
0);
}
$safe=$db->query("SELECT * FROM `cracksafe3` WHERE `sname`='1'");
$pot=$db->fetch_row($safe);
$rand1 abs(@intval($pot['pot3'])); 
$_POST['1digit'] = abs(@intval($_POST['1digit']));

if(
$_POST['1digit'] != $rand1) {
   print 
"You entered the incorrect combination<br /><a href='cracksafe.php'>Return to Safes</a>";
$db->query(sprint("UPDATE users SET money=money-%d WHERE $userid=userid",100000));
$db->query(sprintf("UPDATE cracksafe3 SET winnings=winnings+%d WHERE sname = 1",100000));
$db->query(sprintf("UPDATE cracksafe3 SET winnings2=winnings2+%d WHERE sname = 1",20));
    exit(
0);
}

else if(
$_POST['3digit'] == $rand3 && $_POST['2digit'] == $rand2 && $_POST['1digit'] == $rand1) {
$winnings abs(@intval($pot['winnings']));
$winnings2 abs(@intval($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!<a href='index.php'>Return Home</a> </font>"
;

$r1 rand(100,200);
$r2 rand(10,25);
$r3 rand(1,9);

   
$moneyabs(@intval($pot['winnings'])); //The cash pot
   
$pointsabs(@intval($pot['winnings2'])); //The points pot
   
$db->query(sprintf("UPDATE `users` SET money=money+%u,crystals=crystals+%u WHERE userid=%u",$money,$points,$userid));
   
$db->query(sprintf("UPDATE cracksafe3 SET winnings=%d WHERE sname = 1",1000000));
   
$db->query(sprintf("UPDATE cracksafe3 SET winnings2=%d WHERE sname = 1",500));
 
$db->query(sprintf("UPDATE cracksafe3 SET pot=%u,pot2=%u,pot3=%u WHERE sname = 1",$r1,$r2,$r3));
$db->query("UPDATE cracksafe3 SET attempts_3=0 WHERE sname = 1");
}
}
else
{
   print 
"<form action='cracksafe.php?action=safe_2' 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 - 200</sup><br />
   Second Two: [<input type='text' name='2digit' length='2' maxlength='2'>] <sup>Hint: 10 - 25</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>"
;
$db->query("UPDATE cracksafe3 SET attempts_3=attempts_3+1 WHERE sname = 1");
}
}
$h->endpage();
?>

Diesel

  • Basic Member
  • *
  • Reputation Power: 6
  • Diesel has no influence.
  • Offline Offline
  • Posts: 14
    • View Profile
Re: A much Better Crack the Safe with Pot!
« Reply #2 on: November 22, 2009, 06:31:16 AM »
Just a few things...

1. The 3 sql tables in your first post are all named "cracksafe". They need to be "cracksafe", "cracksafe2", and "cracksafe3"

2. I think you forgot to add the query to cron that refills the number of safe tries for the user.

3. And in your second post, theres nothing blocking a user from going into negative safe tries. You can attempt to crack the safe even if you have 0 safe tries left.
« Last Edit: November 22, 2009, 06:33:48 AM by Diesel »
Logged

JoshuaDams

  • Active Member
  • **
  • Reputation Power: 129
  • JoshuaDams is working their way up.JoshuaDams is working their way up.JoshuaDams is working their way up.
  • Offline Offline
  • Posts: 240
    • MSN Messenger - immortalthug4ever@hotmail.com
    • View Profile
    • WWW
Re: A much Better Crack the Safe with Pot!
« Reply #3 on: November 22, 2009, 11:31:58 AM »
oops yea posted fix for this already on other board i'll fetch real quick

Diesel

  • Basic Member
  • *
  • Reputation Power: 6
  • Diesel has no influence.
  • Offline Offline
  • Posts: 14
    • View Profile
Re: A much Better Crack the Safe with Pot!
« Reply #4 on: November 22, 2009, 03:10:15 PM »
oops yea posted fix for this already on other board i'll fetch real quick

Ok, let us know when the post is updated. Good mod by the way. I really like the idea.
Logged

Redex

  • Basic Member
  • *
  • Reputation Power: 9
  • Redex has no influence.
  • Offline Offline
  • Posts: 19
    • MSN Messenger - redex1995@hotmail.com
    • View Profile
    • Email
Re: A much Better Crack the Safe with Pot!
« Reply #5 on: November 23, 2009, 03:34:11 AM »
Good idea - Good mod - Good job.
Logged

JoshuaDams

  • Active Member
  • **
  • Reputation Power: 129
  • JoshuaDams is working their way up.JoshuaDams is working their way up.JoshuaDams is working their way up.
  • Offline Offline
  • Posts: 240
    • MSN Messenger - immortalthug4ever@hotmail.com
    • View Profile
    • WWW
Re: A much Better Crack the Safe with Pot!
« Reply #6 on: November 23, 2009, 04:52:49 AM »
Near the Top of the Script fin

Code: [Select]
print "<form action='cracksafe.php?action=safe_2' method='post'>
For 100k you have the chance to crack the Ultra Safe.

Change to

Code: [Select]
print "<form action='cracksafe.php?action=safe_3' method='post'>
For 100k you have the chance to crack the Ultra Safe.


Up top find

Code: [Select]
function safe_1()
{
global $ir,$c,$h,$userid,$db;

Add Under

Code: [Select]
if($ir['safetries'] < 1)
{
print "You have already used your 10 tries today, come back tomorrow";
$h-endpage();
exit;
}

SQL TABLES
should be

cracksafe, cracksafe2, cracksafe 3.  sorry about that.

Cron_DAY php

This will give users 10 tries per day on the free safe.

$db->query("UPDATE users SET safetries = 10");

again sorry.

gambino

  • Active Member
  • **
  • Reputation Power: 0
  • gambino is looked down upon.gambino is looked down upon.gambino is looked down upon.
  • Offline Offline
  • Posts: 113
    • View Profile
Re: A much Better Crack the Safe with Pot!
« Reply #7 on: November 24, 2009, 02:24:59 PM »
can you please provide a download with installation stuff too? go under additional options... thing before the forum posting and click browse and upload them. I would use it but it's going to be hard enough trying to find out where to put things and stuff without a download with all the files without going tab to tab to get the information.
Logged

BARR3TT

  • Basic Member
  • *
  • Reputation Power: 35
  • BARR3TT has no influence.
  • Offline Offline
  • Posts: 1
    • View Profile
    • Email
Re: A much Better Crack the Safe with Pot!
« Reply #8 on: December 30, 2009, 07:00:38 PM »
Why does safe2 mess up all my site layout but safe 1 and 3 dont.. ive spent hour looking over it and cant understand.. Good Mod though
Logged

JoshuaDams

  • Active Member
  • **
  • Reputation Power: 129
  • JoshuaDams is working their way up.JoshuaDams is working their way up.JoshuaDams is working their way up.
  • Offline Offline
  • Posts: 240
    • MSN Messenger - immortalthug4ever@hotmail.com
    • View Profile
    • WWW
Re: A much Better Crack the Safe with Pot!
« Reply #9 on: February 21, 2010, 04:36:53 AM »
bumpz

Jordan

  • Active Member
  • **
  • Reputation Power: 55
  • Jordan has no influence.
  • Offline Offline
  • Posts: 102
  • Website Developer for hire;
    • MSN Messenger - Pudda2008@hotmail.co.uk
    • View Profile
    • WWW
    • Email
Re: A much Better Crack the Safe with Pot!
« Reply #10 on: February 21, 2010, 05:07:04 PM »
Why bump it? -.-
Logged
Contact me
MakeWebGames.com

JoshuaDams

  • Active Member
  • **
  • Reputation Power: 129
  • JoshuaDams is working their way up.JoshuaDams is working their way up.JoshuaDams is working their way up.
  • Offline Offline
  • Posts: 240
    • MSN Messenger - immortalthug4ever@hotmail.com
    • View Profile
    • WWW
Re: A much Better Crack the Safe with Pot!
« Reply #11 on: February 21, 2010, 08:09:51 PM »
Because I like Post Count? :O

Jordan

  • Active Member
  • **
  • Reputation Power: 55
  • Jordan has no influence.
  • Offline Offline
  • Posts: 102
  • Website Developer for hire;
    • MSN Messenger - Pudda2008@hotmail.co.uk
    • View Profile
    • WWW
    • Email
Re: A much Better Crack the Safe with Pot!
« Reply #12 on: February 22, 2010, 05:22:49 AM »
lmao
Logged
Contact me
MakeWebGames.com

Danny696

  • Senior Member
  • ****
  • Reputation Power: 317
  • Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.
  • Offline Offline
  • Posts: 540
    • View Profile
    • WWW
Re: A much Better Crack the Safe with Pot!
« Reply #13 on: February 22, 2010, 11:06:40 AM »
Looking good, ima re-code, just because itll be better for me ;)
Logged
Project Choosen - 10%
Daniel - Hanson . Com

Danny696

  • Senior Member
  • ****
  • Reputation Power: 317
  • Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.
  • Offline Offline
  • Posts: 540
    • View Profile
    • WWW
Re: A much Better Crack the Safe with Pot!
« Reply #14 on: February 22, 2010, 11:36:22 AM »
plural of y is ies ;) tries not try's and your not closing some tags
Logged
Project Choosen - 10%
Daniel - Hanson . Com
Pages: [1] 2
« previous next »
 


This forum is now closed and has moved to a new location! Click here to find out why.