Lottery script doesn´t seem to work...

Results 1 to 3 of 3
  1. #1
    Apprentice helpme2 is offline
    MemberRank
    May 2013 Join Date
    The NetherlandsLocation
    18Posts

    ! Lottery script doesn´t seem to work...

    Hello guys (and maybe girls),

    I thought, it´s almost new year, and in The Netherlands they then do a ´special´ lottery. So I thought, let me do it too.

    No I have found the script on RageZone by Googling, but when I press the button, the link goes to http://myhotel.nl/me?succesfull so it says it´s succesfull, but when I lookup in the database..

    There aren´t any users that have chosen a number? I thought: maybe it´s because of you´re using Navicat, and you need to refresh, but still the same problem.

    Please help me..

    Kind regards,

    Musa.


  2. #2
    R.I.P Millercent FatalLulz is offline
    MemberRank
    Nov 2012 Join Date
    AustraliaLocation
    2,248Posts

    Re: Lottery script doesn´t seem to work...

    Paste the file here and make sure to use PHP tags to keep it in-line

  3. #3
    Apprentice helpme2 is offline
    MemberRank
    May 2013 Join Date
    The NetherlandsLocation
    18Posts

    Re: Lottery script doesn´t seem to work...

    This is lottery2.php it´s located in my default htdocs folder so NOT in the skin.

    PHP Code:
    <?php  ##->Inserting values in database 
    $cost '5000'// How much each lottery ticket will cost 
        // Grabbing the POST'ed figures     $Figure_1 = mysql_real_escape_string($_POST["Figure_1"]);     $Figure_2 = mysql_real_escape_string($_POST["Figure_2"]);     $Figure_3 = mysql_real_escape_string($_POST["Figure_3"]);     $userCoins = "" . $_SESSION['user']['credits'] . ""; 
        // If users coins are below the lottery cost, we'll send the header as an error     if($userCoins < $cost)         {             Header("Location: me?Error?=Balance");         }         else {                  // Taking away the cost of lottery to the users account         $coins = mysql_query("UPDATE `users` SET `credits` = credits - ". $cost ." WHERE username = '" . $_SESSION['user']['username'] . "'"); 
            // Inserting the values into database, we'll send the header as successful          $sql = mysql_query("INSERT INTO `lottery` (Username, Figure_1, Figure_2, Figure_3) VALUES ('". $_SESSION['user']['username'] ."', '". $Figure_1 . "', '". $Figure_2 . "', '". $Figure_3 .")");                      Header("Location: me?successful"); 
                
    }              ?><?php // MySQL connection $host = "localhost"; $user = "root"; $pass = "secret"; $data = "hidden"; 
    $connection mysql_connect($host,$user,$pass)      or die("Could not connect: ".mysql_error()); mysql_select_db($data,$connection)  or die("Error in selecting the database:".mysql_error()); 
    $prize "500"// Prize 
    $Query1 mysql_Query("SELECT * FROM lottery ORDER BY RAND() LIMIT 1");          IF($profile mysql_fetch_array($Query1)){         $username mysql_real_escape_string($profile['Username']);         $Figure_1 mysql_real_escape_string($profile['Figure_1']);         $Figure_2 mysql_real_escape_string($profile['Figure_2']);         $Figure_3 mysql_real_escape_string($profile['Figure_3']); 

        
    $sql1 mysql_Query("UPDATE `users` SET `credits` = credits + ".$prize." WHERE username = '".$username."'");         echo "<div style='padding:10px;background-color:green;border-radius:3px;font-family:arial;font-size:12px;color:#FFF;text-align:center;'><b>" $username "</b>  &nbsp;" $Figure_1 " - " $Figure_2 " - " $Figure_3 " Has been awarded "$prize " coins!</div>"$empty mysql_query ("truncate table `lottery`"); // Emptying the table      } 
    else { 
    echo 
    "<div style='padding:10px;background-color:green;border-radius:3px;font-family:arial;font-size:12px;color:#FFF;text-align:center;'>Error no entry in database!</div>";     } ?>
    This is the PHP-code for the lottery. I putted in a box.

    <div class="box"> <div class="heading orange"> <div class="title">Loterij</div> <div class="clear"></div> </div><?php $Query = mysql_query("SELECT * FROM lottery WHERE username = '". $_SESSION['user']['username'] ."'"); IF($profile = mysql_fetch_array($Query)){ $Figure_1 = mysql_real_escape_string($profile['Figure_1']); $Figure_2 = mysql_real_escape_string($profile['Figure_2']); $Figure_3 = mysql_real_escape_string($profile['Figure_3']); ?> <p>You have already entered!</p> <select> <option><?php echo $Figure_1; ?></option> </select> <select> <option><?php echo $Figure_2; ?></option> </select> <select> <option><?php echo $Figure_3; ?></option> </select> <?php } else { ?> <form action="/lottery2" method="post"><div style="color:#D8000C; background-color:#FFBABA; border:1px solid #000000; padding:2px;"/>NOTE: This will cost you <u>5000</u> coins</div><br> <select id="Figure_1" name="Figure_1"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> </select> <select id="Figure_2" name="Figure_2"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> </select> <select id="Figure_3" name="Figure_3"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> </select><br><br> <input type="submit" id="submit" value="Submit" /> </form> <?php } ?> </div> </div>



Advertisement