TalkPTC

The MarketPlace => Mods and Addons => Topic started by: Omega C. on March 14, 2010, 05:28:20 AM

Title: My Gift To Everyone - [FREE Aurora Mod] - Lotto/Jackpot Mod
Post by: Omega C. on March 14, 2010, 05:28:20 AM
since persons that remain nameless keep selling my mods as their own i am releasing it to the public. no longer will these ppl make money off of my work, and not pay me for such. Everyone will now have access to this.

members/lottery.php
Code: [Select]
<style type="text/css">
input.lottobutton
{
   background-color:#33CC00;
   border: none;
    font: 100% Verdana, Arial, Helvetica, sans-serif;
   margin: 1px 1px 1px 1px;
   width: 26px;
   height: 26px;
}
input.lottobutton2
{
   background-color: #CCCCCC;
   border: none;
    font: 100% Verdana, Arial, Helvetica, sans-serif;
   margin: 1px 1px 1px 1px;
   width: 26px;
   height: 26px;
}
input.lottobutton3
{
   background-color: #FFFF00;
   border: none;
    font: 100% Verdana, Arial, Helvetica, sans-serif;
   margin: 1px 1px 1px 1px;
   width: 26px;
   height: 26px;
}
</style>
<?php
//
$cklotq=$Db1->query("SELECT * FROM ls_config WHERE ls_id='1'");
$lot_config=$Db1->fetch_array($cklotq);

$includes[title]="Lottery";
 if(
$lot_config['ls_loton'] == "1"){
 
if(
$_POST
{
if($newbalance<=-0.00001)
{
$money $thismemberinfo['balance'];

else 
{
$money $newbalance;
}
if($money>$lot_config["ls_price"])
{
$ticketprice=$lot_config["ls_price"];

$username=$thismemberinfo['username'];
$number=$_POST['nr'];
$ticketquery "INSERT INTO jackpot (username,ticket_num) VALUES('$username','$number')";
$Db1->query($ticketquery);

    $ticketprice=$lot_config["ls_price"];
    $newbalance=$thismemberinfo[balance]-$ticketprice;
    $Db1->query("UPDATE user SET balance='$newbalance' WHERE username='$username'");
    $money=$newbalance;

    $nrticketquery $Db1->query("SELECT COUNT(*) AS tot FROM jackpot");
    $rows=$Db1->num_rows($nrticketquery);
    $i=0;
    
    if($rows $i)
    {
    while($x $Db1->fetch_array($nrticketquery))
    {
    $ticketsbought $x['tot'];
    }
    }
    else
    {
    $ticketsbought=0;
    }
$error_msg="You have just purchased a ticket ... Good luck !!!";
    }
//--------------------------------- IF ALL TICKETS ARE BOUGHT ---------------------------------------
if($ticketsbought>=100)
{
//These variables are the real amount of money the user will recieve. You can change them if you want.
    $prize1=$lot_config["ls_prize1"];
    $prize2=$lot_config["ls_prize2"];
    $prize3=$lot_config["ls_prize3"];
    $prize4=$lot_config["ls_prize4"];

    $queryinsertnr "INSERT INTO jackpot (username,ticket_num) VALUES('$username','$numberofticket')";
    $Db1->query($queryinsertnr);

    $winningnr1 mt_rand(1,100);

    $selectw1 $Db1->query("SELECT * FROM jackpot WHERE ticket_num='$winningnr1'");
    $username1 $Db1->fetch_array($selectw1);

    $winner1 $username1['username'];

    $luckynr1 $username1['ticket_num'];

    $userwinner1 $Db1->query("SELECT * FROM user WHERE username='$winner1'");
    $userwin1 $Db1->fetch_array($userwinner1);
    $newbalance1 $userwin1['balance']+$prize1;

    $Db1->query("UPDATE user SET balance='$newbalance1' WHERE username='$winner1'");

$winningnr2 mt_rand(1,100);
if($winningnr2=$winningnr1)
{
$winningnr2 mt_rand(1,100);
}

$selectw2 $Db1->query("SELECT * FROM jackpot WHERE ticket_num='$winningnr2'");
$username2 $Db1->fetch_array($selectw2);

$winner2 $username2['username'];

$luckynr2 $username2['ticket_num'];

$userwinner2 $Db1->query("SELECT * FROM user WHERE username='$winner2'");
$userwin2 $Db1->fetch_array($userwinner2);
$newbalance2 $userwin2['balance']+$prize2;

$Db1->query("UPDATE user SET balance='$newbalance2' WHERE username='$winner2'");


$winningnr3 mt_rand(1,100);
if($winningnr3=$winningnr1)
{
if($winningnr3=$winningnr2)
{
$winningnr3 mt_rand(1,100);
}
}
$selectw3 $Db1->query("SELECT * FROM jackpot WHERE ticket_num='$winningnr3'");
$username3 $Db1->fetch_array($selectw3);

$winner3 $username3['username'];

$luckynr3 $username3['ticket_num'];

$userwinner3 $Db1->query("SELECT * FROM user WHERE username='$winner3'");
$userwin3 $Db1->fetch_array($userwinner3);
$newbalance3 $userwin3['balance']+$prize3;

$Db1->query("UPDATE user SET balance='$newbalance3' WHERE username='$winner3'");

$winningnr4 mt_rand(1,100);
if($winningnr4=$winningnr1)
{
if($winningnr4=$winningnr2)
{
if($winningnr4=$winningnr3)
{
$winningnr4 mt_rand(1,100);
    }
    }
}
$selectw4 $Db1->query("SELECT * FROM jackpot WHERE ticket_num='$winningnr4'");
$username4 $Db1->fetch_array($selectw4);

$winner4 $username4['username'];
$luckynr4 $username4['ticket_num'];

$userwinner4 $Db1->query("SELECT * FROM user WHERE username='$winner4'");
$userwin4 $Db1->fetch_array($userwinner4);
$newbalance4 $userwin4['balance']+$prize4;

$Db1->query("UPDATE user SET balance='$newbalance4' WHERE username='$winner4'");

$Db1->query("INSERT INTO lottowinners (username1,ticket_num1,username2,ticket_num2,username3,ticket_num3,username4,ticket_num4) VALUES('$winner1','$winningnr1','$winner2','$winningnr2','$winner3','$winningnr3','$winner4','$winningnr4')");

//As all tickets were bought, balance was given and data inserted into the new database, we can now remove all data from the ticket info, so that we can start the lottery again.
    $Db1->query("TRUNCATE TABLE jackpot");
}
}
$includes[content]="<div style='background-color:#000000; float: left; border: 1px solid #000000; height: 280px; width: 282px'>
<form method='post' action='index.php?view=account&ac=lottery&
{$url_variables}'>";

//This will check the user's balance
if($newbalance<=-0.00001)
{
$money $thismemberinfo['balance'];

else 
{
$money $newbalance;
}

if(
$money<=$lot_config["ls_price"])
{
$ticketnumcheck 1;
while($ticketnumcheck<=100)
{
$result $Db1->query("SELECT * FROM jackpot WHERE ticket_num='{$ticketnumcheck}'");
if($Db1->num_rows($result) == 0)

$includes[content].="<input type='button' class='lottobutton' value='{$ticketnumcheck}'>";
}
else
{
    $ticketname=$result['username'];
    $sqlquerycheck "SELECT * FROM jackpot WHERE ticket_num='{$ticketnumcheck}'";
    $resultquerycheck $Db1->query($sqlquerycheck);        
    $checker $Db1->fetch_array($resultquerycheck);

    if($thismemberinfo[username]!=$checker['username'])
    {
        $includes[content].="<input type='button' class='lottobutton2' value='{$ticketnumcheck}'>";
    }
    else
    {
    $includes[content].="<input type='button' class='lottobutton3' value='{$ticketnumcheck}'>";
    }
    }
  //Adding the ticket number to check . If it's still less than 100 it'll do this again. Otherwise it'll show the message next
++$ticketnumcheck;
  }
  
  $includes[content].="</div><br>If you want to purchase a ticket, you will need $".$lot_config["ls_price"]." in your balance. 
  <br> You currently have \$
{$money} in your balance. </form>";
  
  
//If the user has enough money...
}
else
{
$ticketnumcheck 1;
while($ticketnumcheck<=100)
{
$result $Db1->query("SELECT * FROM jackpot WHERE ticket_num='{$ticketnumcheck}'");
    //If there is no value there
    if($Db1->num_rows($result) == 0)
    {
    $includes[content].="<input type='submit' name='nr' class='lottobutton' value='{$ticketnumcheck}' onMouseOver='goLite(this.form.name,this.name)' onMouseOut='goDim(this.form.name,this.name)'>"
    }
    else
    { 
    //Checking everything (This is the same as before)
       $name=$result['username'];
    $sqlquerycheck "SELECT * FROM jackpot WHERE ticket_num='{$ticketnumcheck}'";
    $resultquerycheck $Db1->query($sqlquerycheck);        
    $checker $Db1->fetch_array($resultquerycheck);

    if($thismemberinfo[username]!=$checker['username'])
    {
        $includes[content].="<input type='button' class='lottobutton2' value='{$ticketnumcheck}'>";
    }
    else
    {
        $includes[content].="<input type='button' class='lottobutton3' value='{$ticketnumcheck}'>";
        }
        }
++$ticketnumcheck;
}
$money=abs($money);
$includes[content].="</div>You currently have \${$money} in your balance.</form><br><br>";
}

$includes[content].="<div style='margin-left: 10px; float:left'>
<table style='font-size: 11px;' width='300px;' border='0'>
  <tr>
    <td style='margin: 2px 2px 2px 2px;'width='50%'>
<p align='left'>
<br><br>
<b>First prize:</b> 
${$lot_config[ls_prize1]}<br>
<b>Second prize:</b> 
${$lot_config[ls_prize2]}<br>
<b>Third prize:</b> 
${$lot_config[ls_prize3]}<br>
<b>Fourth prize:</b> 
${$lot_config[ls_prize4]}<br>
<p>

</td>
    <td width='50%'><strong>Price per ticket:</strong><br> 
${$lot_config[ls_price]}</td>
    
  </tr>
</table>
<p align='left'>Instructions:<br>
-A Green box means the ticket is still available.<br>
-A Gray box means the ticket is unavailable.<br>
-A Yellow box means you bought that ticket.</p>
<br class='clearfloat'>"
;

$includes[content].="<br><br>Last drawings winners: <br>
<table>
<tr>
<th><center>Round</center></th>
<th><center>1st #</center></th>
<th><center>2nd #</center></th>
<th><center>3rd #</center></th>
<th><center>4th #</center></th>
</tr>"
;
$result $Db1->query("SELECT * FROM lottowinners ORDER BY id DESC limit 5");
while(
$checker $Db1->fetch_array($result))
{
$includes[content].="<tr>
<td><center>
{$checker['id']}</center></td>
<td><center>
{$checker[ticket_num1]}</center></td>
<td><center>
{$checker[ticket_num2]}</center></td>
<td><center>
{$checker[ticket_num3]}</center></td>
<td><center>
{$checker[ticket_num4]}</center></td>
</tr>"
;
}
$includes[content].="</table></div>";
}
else {
echo 
"Lottery is not enabled in this site";
}
?>


admin2/settings/lottery.php
Code: [Select]
<?
$includes[title]="Lottery Settings";
//**S**//
if(($action == "save") && ($working == 1))
{
$enabled = $lot_enabled;
    $price = $ls_price;
    $l1st = $ls_prize1;
    $l2nd = $ls_prize2;
    $l3rd = $ls_prize3;
    $l4th = $ls_prize4;

    $Db1->query("UPDATE ls_config SET
    ls_loton='".$enabled."',
    ls_price='".$price."',
    ls_prize1='".$l1st."',
    ls_prize2='".$l2nd."',
    ls_prize3='".$l3rd."',
    ls_prize4='".$l4th."'
    WHERE ls_id='1' LIMIT 1");

    $Db1->sql_close();
    header("Location: admin.php?view=admin&ac=settings&type=lottery&saved=1&".$url_variables."");
}
$lsconf=$Db1->query("SELECT * FROM ls_config WHERE ls_id='1' LIMIT 1");
$lot_config=$Db1->fetch_array($lsconf);

$includes[content]="
".iif($saved==1,"<font color=\"darkgreen\">The settings have been saved</font>")."
<form action=\"admin.php?view=admin&ac=settings&action=save&type=lottery&".$url_variables."\" method=\"post\" name=\"form\">
<input type=\"hidden\" name=\"working\" value=\"1\">
<table width=\"100%\">

<tr>
<td width=\"250\"><b>Lottery Enabled?: </b></td>
<td><input type=\"checkbox\" name=\"lot_enabled\" value=\"1\"".iif($lot_config[ls_loton] == 1," checked=\"checked\"")."></td>
</tr>
<tr>
<td width=\"250\"><b>Lottery Ticket Price: </b></td>
<td><input type=\"text\" name=\"ls_price\" value=\"$lot_config[ls_price]\">( How much a member needs to pay for a number)</td>
</tr>
<tr>
<td width=\"250\"><b>How much win 1st Winner: </b></td>
<td><input type=\"text\" name=\"ls_prize1\" value=\"$lot_config[ls_prize1]\"> (Winning amount for 1st ticket draw)</td>
</tr>

<tr>
<td width=\"250\"><b>How much win 2nd Winner: </b></td>
<td><input type=\"text\" name=\"ls_prize2\" value=\"$lot_config[ls_prize2]\"> </td>
</tr>

<tr>
<td width=\"250\"><b>How much win the 3rd Winner?: </b></td>
<td><input type=\"text\" name=\"ls_prize3\" value=\"$lot_config[ls_prize3]\"> </td>
</tr>
<tr>
<td width=\"250\"><b>How much win the 4th Winner?: </b></td>
<td><input type=\"text\" name=\"ls_prize4\" value=\"$lot_config[ls_prize4]\"> </td>
</tr>
<tr>
<td colspan=2 align=\"right\"><input type=\"submit\" value=\"Save\"></td>
</tr>

</table>
<div align=\"right\"></div>
</form>";
?>

Open includes/modules.php
Find
Code: [Select]
$module['account'] = array("Account","members/account.php",1);Under it add
Code: [Select]
$module['lottery'] = array("Lottery","members/lottery.php",1);
Upload lottery.php to members directory
SQL Queries to Run
Code: [Select]
CREATE TABLE IF NOT EXISTS `ls_config` (
`ls_id` INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`ls_loton` TINYINT( 1 ) NOT NULL ,
`ls_price` DECIMAL( 12, 5 ) NOT NULL ,
`ls_prize1` DECIMAL( 12, 5 ) NOT NULL ,
`ls_prize2` DECIMAL( 12, 5 ) NOT NULL ,
`ls_prize3` DECIMAL( 12, 5 ) NOT NULL ,
`ls_prize4` DECIMAL( 12, 5 ) NOT NULL
) ENGINE = MYISAM ;

INSERT INTO `ls_config` (`ls_id`, `ls_loton`, `ls_price`, `ls_prize1`, `ls_prize2`, `ls_prize3`, `ls_prize4`) VALUES (NULL, '1', '0.50', '0.80', '0.70', '0.60', '0.50');

CREATE TABLE IF NOT EXISTS `jackpot` (
  `username` varchar(100) NOT NULL,
  `ticket_num` varchar(100) NOT NULL,
  UNIQUE KEY `ticket_num` (`ticket_num`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

CREATE TABLE IF NOT EXISTS `lottowinners` (
  `id` int(11) NOT NULL auto_increment,
  `username1` varchar(100) NOT NULL,
  `ticket_num1` varchar(100) NOT NULL,
  `username2` varchar(100) NOT NULL,
  `ticket_num2` varchar(100) NOT NULL,
  `username3` varchar(100) NOT NULL,
  `ticket_num3` varchar(100) NOT NULL,
  `username4` varchar(100) NOT NULL,
  `ticket_num4` varchar(100) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
Title: Re: My Gift To Everyone - [FREE Aurora Mod] - Lotto/Jackpot Mod
Post by: xingmarts on March 15, 2010, 09:47:43 AM
Thanks for sharing
Title: Re: My Gift To Everyone - [FREE Aurora Mod] - Lotto/Jackpot Mod
Post by: kampai on March 15, 2010, 02:39:16 PM
thanks, i will use this mod after i bought my script from mederite.
Title: Re: My Gift To Everyone - [FREE Aurora Mod] - Lotto/Jackpot Mod
Post by: nitinkumar on March 15, 2010, 07:54:24 PM
error in query part

Quote
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IF NOT EXISTS `lottowinners` ( `id` int(11) NOT NULL AUTO_INCREMENT, `user' at line 1
Title: Re: My Gift To Everyone - [FREE Aurora Mod] - Lotto/Jackpot Mod
Post by: Omega C. on March 22, 2010, 01:11:36 AM
error in query part

Quote
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IF NOT EXISTS `lottowinners` ( `id` int(11) NOT NULL AUTO_INCREMENT, `user' at line 1
looks like an error on your part
Code: [Select]
CREATE TABLE IF NOT EXISTS `lottowinners` (
  `id` int(11) NOT NULL auto_increment,
  `username1` varchar(100) NOT NULL,
  `ticket_num1` varchar(100) NOT NULL,
  `username2` varchar(100) NOT NULL,
  `ticket_num2` varchar(100) NOT NULL,
  `username3` varchar(100) NOT NULL,
  `ticket_num3` varchar(100) NOT NULL,
  `username4` varchar(100) NOT NULL,
  `ticket_num4` varchar(100) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

same as top post
Title: Re: My Gift To Everyone - [FREE Aurora Mod] - Lotto/Jackpot Mod
Post by: nitinkumar on March 22, 2010, 07:11:00 AM
Its working but only problem.

(http://x-mails.biz/lottery.JPG)

You can check problem yourself.
Title: Re: My Gift To Everyone - [FREE Aurora Mod] - Lotto/Jackpot Mod
Post by: Omega C. on March 22, 2010, 03:38:52 PM
Its working but only problem.

(http://x-mails.biz/lottery.JPG)

You can check problem yourself.
i will post fix in a few hours busy updating my forum mod at the moment
Title: Re: My Gift To Everyone - [FREE Aurora Mod] - Lotto/Jackpot Mod
Post by: lordmick on June 04, 2010, 05:48:01 AM
put a \ before the prices variable... in members/lottery.php  line 235-242

like this..
Code: [Select]
<b>First prize:</b> \${$lot_config[ls_prize1]}<br>
<b>Second prize:</b> \${$lot_config[ls_prize2]}<br>
<b>Third prize:</b> \${$lot_config[ls_prize3]}<br>
<b>Fourth prize:</b> \${$lot_config[ls_prize4]}<br>
<p>

</td>
    <td width='50%'><strong>Price per ticket:</strong><br> \${$lot_config[ls_price]}</td>

it works for me...! :)
Title: Re: My Gift To Everyone - [FREE Aurora Mod] - Lotto/Jackpot Mod
Post by: Omega C. on June 11, 2010, 04:19:48 AM
if you change that to
Code: [Select]
b>First prize:</b> $".$lot_config[ls_prize1]."<br>
<b>Second prize:</b> $".$lot_config[ls_prize2]."<br>
<b>Third prize:</b> $".$lot_config[ls_prize3]."<br>
<b>Fourth prize:</b> $".$lot_config[ls_prize4]."<br>
<p>

</td>
    <td width='50%'><strong>Price per ticket:</strong><br> $".$lot_config[ls_price]."</td>
it will parse faster.
Title: Re: My Gift To Everyone - [FREE Aurora Mod] - Lotto/Jackpot Mod
Post by: eecash on June 28, 2010, 03:53:00 AM
Why didn't you use one of those script encoders to keep your script private?
Title: Re: My Gift To Everyone - [FREE Aurora Mod] - Lotto/Jackpot Mod
Post by: Omega C. on June 29, 2010, 02:19:20 AM
because i wasn't thinking about it and i didn't have the $1,000 needed to get the highly secured version of ioncube.
Title: Re: My Gift To Everyone - [FREE Aurora Mod] - Lotto/Jackpot Mod
Post by: eecash on June 29, 2010, 05:55:04 AM
because i wasn't thinking about it and i didn't have the $1,000 needed to get the highly secured version of ioncube.

Then what good are you?    :P

Just Kidding
Title: Re: My Gift To Everyone - [FREE Aurora Mod] - Lotto/Jackpot Mod
Post by: Omega C. on June 30, 2010, 12:40:01 AM
good to make crap for ppl.