Главная | Топ серверов | Скины | Регистрация | Вход | English Version Приветствую Вас Гость | Показать правый блок
[ Обновленные темы · Новые сообщения · Участники · Правила форума · Поиск · RSS ]
  • Страница 1 из 1
  • 1
[help] Convert
diablo21Дата: Пятница, 04.04.2014, 02:30 | Сообщение # 1
Лейтенант
Группа: Проверенные
Сообщений: 35
Репутация: 2
Статус: Оффлайн
Can someone make a lottery module system
i have a simply maded lottery but need to be builded better this is not working cause its not finished, can someone help here to finish it

Код

<link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Tangerine">

<div style="font-family: 'Tangerine', serif;  font-size: 48px; text-shadow: 2px 2px 2px #666688;">Lottery</div>

<?
################################################
#                    #
#          Lottery made by Nexus               #
#                    #
#                    #
#                    #
#                            #
#                    #
################################################
?>
<?php

if(!defined('DEW_Engine')) {
   Exit;
  }

  if ($Module['Lottery'] == 1) {
  if ($_SESSION['DEW_UserName'] == true) {

// Set credits ammount (change 1000 to your ammount u want)
  $bid = '500';
  $tax = '10'    ; //TAX PERCENT
    
  $check  = $DB->FetchRow($DB->Query("SELECT memb___id FROM loterija WHERE memb___id = '".$username."'"));
  $tickets    = $DB->FetchRow($DB->Query("SELECT memb___id,tickets FROM lottery_tickets WHERE memb___id = '".$username."'"));
  $sum  = $DB->FetchRow($DB->Query("SELECT SUM(credits) FROM loterija"));
  $summa  = $sum[0];
  $lucky  = $DB->FetchRow($DB->Query("SELECT TOP 1 memb___id FROM loterija ORDER BY NEWID() "));
  $laimigais    = $DB->FetchRow($DB->Query("SELECT memb___id,credits FROM laimigais"));
  $userfuck_ = $DB->Query("select memb___id, memb_name from MEMB_INFO WHERE memb___id = '$laimigais[0]'");
  $userfuck = $DB->FetchRow($userfuck_);
  $account = $userfuck[0];
  $name = $userfuck[1];  
  $allusers    = $DB->FetchRow($DB->Query("SELECT count (*) from loterija"));
  $countuser    = $DB->FetchRow($DB->Query("SELECT count (*) from loterija where memb___id = '".$username."' "));
  $font = 'Tangerine';
  $chance = 100;
  $taxbid = $bid-($bid/$tax);
  $nickname = $DB->FetchRow($DB->Query("SELECT memb_name FROM memb_info WHERE memb___id='$username'"));
  echo '<div class="li"><b>Lottery is a great way to get a lot of credits. If big count of users are playing - bigger amount of credits you can get!<br></b></div>';  
  echo "<center><div style='width:90%; text-align:justify; padding:5px 10px 5px 10px; border:1px dashed #40576a;' class='text_default'>One Tickets value is: 500 Credits<br><font size=1>For example: If 10 users are playing - fund will be 5000 Credits and chance to win will be 10%</font></div></center><br>";  
      
   
echo '<div style="font-family: '.$font.', serif;  font-size: 28px; text-shadow: 1px 1px 1px #666688;">';  

  $d=date("D");

if ($d=="Mon") {
   echo "Lottery after 2 days!";
    }
if ($d=="Tue")
   {
   echo "Lottery today at 00:00";
   }
if ($d=="Wed") {
   echo "Lottery after 4 days";
    }
    if ($d=="Thu")
   {
   echo "Lottery after 3 days";
   }
if ($d=="Fri") {
   echo "Lottery after 2 days";
    }
  if ($d=="Sat")
   {
   echo "Lottery today at 00:00";
   }
if ($d=="Sun") {
   echo "Lottery after 3 days";
    }
   
echo '</font></div><br><br>';
   
   
   
   
   
   
   
  if ($tickets[1] <= 0) {
  echo '<img src="Images/Misc/tickets.png"  height="22" width="32" />You have <b>0</b> Tickets'; } else {  
  echo '<img src="Images/Misc/tickets.png"  height="22" width="32" />You have <b>'.$tickets[1].'</b> Tickets';
    } ?>  
    <a href=<?=$URL_class->DEW_Crypt('BuyTicket');?>>(Buy more)</a><br><br>
     
    <?
     
     
     
if (($tickets[1] <= 0) ) {
  echo    DEW_Message('notice','You dont have any ticket');
}

else
  {

if(isset($_POST['submit'])) {
$DB->Query("UPDATE lottery_tickets set tickets = tickets - '1' where memb___id='$username' ");
$DB->Query("INSERT INTO loterija (memb___id,credits) VALUES ('$username','$bid');");
$global_message=msgsend($config['globalmsg']['jsip'], $config['globalmsg']['jsport'],"$nickname[0] joined to Lottery");
echo DEW_Message('ok','Success! Please wait...');
echo '<META HTTP-EQUIV=Refresh CONTENT="1; URL=http://192.168.16.103/NzAxZjA5MzRiMGM4MmY=.DEW">'; // It worked.

}
?>
<?

    
   echo "
    <form action='' method='post'>  
    <table class='sort-table' align='center' border='0' cellpadding='0' cellspacing='0'>
   
      <tr>
       <td colspan='2' align='center'><input name='submit' title='Place more tickets to get better chances' type='submit' value=' Insert a ticket '></td>
      </tr>
    </table>
    </form><br>
   ";
   }

$query = mssql_query('SELECT memb___id FROM loterija');
   
$userlist = array();
   
while( $row = mssql_fetch_array( $query ) )
{
  $userlist[] = $row['memb___id'];
}
   
$userlist = array_unique( $userlist );

if ($sum[0] < 1) {
echo '<img src="Images/Misc/fund.png"  height="26" width="36" />Fund: <b>0 Credits</b><br>';
echo '<img src="Images/Misc/users.png"  height="22" width="22" />No one is playing now<br>';
echo '<img src="Images/Misc/percent.png"  height="19" width="19" /> Your chances to win would be: 100% (1:1)<br><br>'; }
elseif ($check[0] != $username) {
echo '<img src="Images/Misc/fund.png"  height="26" width="36" />Fund: <b>'.$summa.'</b> Credits <font size=1>+ your ' .$bid. ' Credits</font><br>';  
echo '<img src="Images/Misc/users.png"  height="22" width="22" />Playing users:<b> '.count( $userlist ).'</b><br>';
echo '<img src="Images/Misc/tickets.png"  height="22" width="32" />Tickets in lottery:<b> '.$allusers[0].'</b><br>';
echo '<img src="Images/Misc/percent.png"  height="19" width="19" /> Your chances to win would be: <b>'.number_format($chance/($allusers[0] + 1), 2, '.', '').'%</b> (1:'.($allusers[0]+1).')<font size=1> With 1 ticket</font><br><br>'; }

else{
echo '<img src="Images/Misc/fund.png"  height="26" width="36" />Fund: <b>'.$summa.'</b> Credits<br>';  
echo '<img src="Images/Misc/users.png"  height="22" width="22" />Playing users:<b> '.count( $userlist ).'</b><br>';
echo '<img src="Images/Misc/tickets.png"  height="18" width="28" />Tickets in lottery:<b> '.$allusers[0].'</b><br>';
echo '<img src="Images/Misc/percent.png"  height="19" width="19" /> Your chances to win: <b>'.number_format(($chance/$allusers[0])* $countuser[0], 2, '.', '').'%</b> ('.$countuser[0].':'.$allusers[0].')<br><br>'; }

echo '<br><font color=yellow>Winner of this week gets GOLDEN FENRIR + ALL FUND</font><br>';
echo '<hr><img src="Images/Misc/winner.png"  height="19" width="19" /><font size=1>Latest winner is <b>'.$name.'</b>! He got <b>'. $laimigais[1]. '</b> Credits</font>';

?>

<br><br><font color=red>*</font><font size=1>Lottery happens every wednesday and sunday</font><br>
<font color=red>*</font><font size=1>More tickets you will use - more chances you will have<br></font><br><br>
<a href=<?=$URL_class->DEW_Crypt('BuyTicket');?>>Buy Tickets</a>

<?

if ($_SESSION['DEW_UserName'] == 'zerox112') {

if(isset($_POST['random'])) {
$DB->Query("DELETE FROM laimigais");
$DB->Query("UPDATE MEMB_CREDITS set credits = credits + '$summa' where memb___id='$lucky[0]' ");

$DB->Query("INSERT INTO laimigais (memb___id,credits) VALUES ('$lucky[0]','$summa');");
$DB->Query("DELETE FROM loterija");
  $niks_ = $DB->Query("select memb___id, memb_name from MEMB_INFO WHERE memb___id = '$lucky[0]'");
  $niks = $DB->FetchRow($niks_);
  $account = $niks[0];
  $nick = $niks[1];    
$DB->Query("INSERT INTO DEW_mail ( timeof, fromwho, fromwho_char, towho, towho_char, title, text, Readed ) VALUES ( '$Current_Time', '$username', 'Acid', '$lucky[0]', '$nick', 'Lottery System', 'You win in lottery and got $summa Credits! ', '0' )");
$msg = $lucky[0].' wins '.$summa.' Credits';
$global_message=msgsend($config['globalmsg']['jsip'], $config['globalmsg']['jsport'],"$nick won in Lottery and got $summa Credits");
echo DEW_Message('ok',$msg);
}
echo "<br><br><br><hr />ADMIN PANEL
    <form action='' method='post'>  
    <table class='sort-table' align='center' border='0' cellpadding='0' cellspacing='0'>
   
      <tr>
       <td colspan='2' align='center'><input name='random' type='submit' value=' Submit Lucky '></td>
      </tr>
    </table>
    </form><br>
    ";

}

  }

  else {
   echo    DEW_Message('error',phrase_please_login_first);
  }

  }
  else {
   echo    DEW_Message('notice',"Sorry, this module is temporarily disabled!");
  }

  /*    Made by Nexus    */

?>


Реклама
 
mudubumДата: Пятница, 04.04.2014, 22:26 | Сообщение # 2
Сержант
Группа: Пользователи
Сообщений: 12
Репутация: 0
Статус: Оффлайн
This is DEW Engine, not MMW so i dont think that someone will help you sad
 
  • Страница 1 из 1
  • 1
Поиск:

This page is designed to be viewed best with Chrome. Home Page MyMuWeb By Vaflan. Хостинг от uCoz.