Powered by Invision Power Board


Pages: (7) 1 [2] 3 4 ... Last » ( Go to first unread post ) Reply to this topicStart new topicStart Poll

> [MOD] Casino, play 2 games and win or lose upload
misterb
Posted: Apr 30 2005, 07:03 AM
Quote Post


Power User
***

Group: Power Users
Posts: 75
Member No.: 1,444
Joined: 17-December 04



QUOTE (macosbrain @ Apr 30 2005, 02:55 PM)
@misterb
get_user_class() of cause.
but why get_user_class works on my system (winxp and xampp) ???

it compares the string "get_user_class" with "UC_...", first 2 lettres are different, and letter "g" < "U" (hexvalue or whatever, i don't know), so it lets you play...


--------------------
Your bunny wrote...
PMEmail Poster
Top
Haselocke26
Posted: Apr 30 2005, 07:09 AM
Quote Post


Member
**

Group: Members
Posts: 16
Member No.: 4,314
Joined: 7-April 05



QUOTE (misterb @ Apr 30 2005, 06:40 AM)
CODE
CREATE TABLE `casino` (
`userid` int(10) NOT NULL default '0',
`win` bigint(20) default NULL,
`lost` bigint(20) default NULL,
`trys` int(11) NOT NULL default '0',
`date` datetime NOT NULL default '0000-00-00 00:00:00',
`enableplay` enum('yes','no') NOT NULL default 'yes',
PRIMARY KEY  (`userid`)
) ENGINE=MyISAM


this should work

Error

SQL-Befehl :

CREATE TABLE `casino` (
`userid` int( 10 ) NOT NULL default '0',
`win` bigint( 20 ) default NULL ,
`lost` bigint( 20 ) default NULL ,
`trys` int( 11 ) NOT NULL default '0',
`date` datetime NOT NULL default '0000-00-00 00:00:00',
`enableplay` enum( 'yes', 'no' ) NOT NULL default 'yes',
PRIMARY KEY ( `userid` )
)ENGINE = MYISAM

MySQL meldet:

#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 'ENGINE = MYISAM' at line 7

Sorry,i am from Germany.
PMEmail Poster
Top
knoten
Posted: Apr 30 2005, 07:09 AM
Quote Post


Power User
***

Group: Power Users
Posts: 302
Member No.: 2,591
Joined: 25-January 05



Hey guys a List for the Staff is very useful i think


With the word list i mean a List where u can see who won mb/gb

oir something like this


Please code it muahah^^



bY S4NE
PMEmail PosterUsers Website
Top
macosbrain
Posted: Apr 30 2005, 07:09 AM
Quote Post


Power User
***

Group: Power Users
Posts: 45
Member No.: 3,966
Joined: 27-March 05



here is the code:

CODE


<?php
//ob_start("ob_gzhandler");
require_once("include/bittorrent.php");
dbconn(false);
loggedinorreturn();
parked();

//////////////////////////////////config
//////who is able to play just
//$player = UC_PEASANT;
//$player = UC_USER;
$player = UC_POWER_USER;
//$player = UC_VIP;
//$player = UC_UPLOADER;
//$player = UC_MODERATOR;
//$player = UC_ADMINISTRATOR;
//$player = UC_SYSOP;
$mb_basic=1024*1024;
$max_download_user = $mb_basic*1024*25; //// 25 GB
$max_download_global = $mb_basic*$mb_basic*2.5; //// 2.5 TB :-)
$required_ratio = 0.4; ///i think you know this
$max_trys = 50; ///50 games and no more

//////////////////this is the funny part
$user_everytimewin_mb = $mb_basic * 70; ////// means users that wins under 70 mb get a cheat_value of 0 -> win every time
$cheat_value = 1; // higher value -> less winner
$cheat_breakpoint = 2; ////very important value -> if (win MB > max_download_global/cheat_breakpoint)
$cheat_value_max = 5; ////// then cheat_value = cheat_value_max -->> i hope you know what i mean. ps: must be higher as cheat_value.
$cheat_ratio_user = 0.4; ///if casino_ratio_user > cheat_ratio_user -> $cheat_value = rand($cheat_value,$cheat_value_max)
$cheat_ratio_global = 0.4; /// same as user just global
$win_amount = 3; // how much do the player win in the first game eg. bet 300, win_amount=3 ---->>> 300*3= 900 win
$win_amount_on_number = 6; // same as win_amount for the number game
$show_real_chance = false; ///shows the user the real chance true or false
$bet_value1 = $mb_basic * 20; ///this is in MB but you can also choose gb or tb :-)
$bet_value2 = $mb_basic * 50;
$bet_value3 = $mb_basic * 100;
$bet_value4 = $mb_basic * 250;
$bet_value5 = $mb_basic * 500;
$bet_value6 = $mb_basic * 1024;
$bet_value7 = $mb_basic * 2048;

//////////////////////////////////config end

if (get_user_class() <= $player)
 stderr("Sorry ".$CURUSER["username"], "The MODERATOR do not allow your class to play casino");

$query ="select * from casino where userid = '".$CURUSER["id"]."'";
$result = mysql_query($query) or die (mysql_error());
if(mysql_affected_rows()!=1)
{
 mysql_query("INSERT INTO casino (userid, win, lost, trys, date) VALUES(" . $CURUSER["id"] . ",0,0,0, '" . get_date_time() . "')") or mysql_error();
 //stderr("Hi ".$CURUSER["username"], "This is the first time you try to play at the Casino please refresh the site");
 $result = mysql_query($query); ///query another time to get the new user, if the stderr is uncomment
}

$row = mysql_fetch_array($result);
 $user_win = $row["win"];
 $user_lost = $row["lost"];
 $user_trys = $row["trys"];
 $user_date = $row["date"];
 $user_enableplay = $row["enableplay"];

if($user_enableplay=="no")
 stderr("Sorry ".$CURUSER["username"],"your banned from casino");

if($user_trys > $max_trys)
 stderr("Sorry ".$CURUSER["username"],"your playtime is over");
 
if(($user_win - $user_lost) > $max_download_user)
 stderr("Sorry ".$CURUSER["username"],"you have reached the max download for a single user");

 if ($CURUSER["downloaded"] > 0)
   $ratio = number_format($CURUSER["uploaded"] / $CURUSER["downloaded"], 2);
 else
   if ($CURUSER["uploaded"] > 0)
     $ratio = 999;
   else
     $ratio = 0;
 if($ratio < $required_ratio)
  stderr("Sorry ".$CURUSER["username"],"your ratio is under ".$required_ratio);  

 $global_down2 = mysql_query(" select (sum(win)-sum(lost)) as globaldown, sum(win) as win, sum(lost) as lost from casino") or die (mysql_error());
 $row = mysql_fetch_array($global_down2);
 $global_down = $row["globaldown"];
 $global_win = $row["win"];
 $global_lost = $row["lost"];
 
 if ($user_win > 0)
   $casino_ratio_user = number_format($user_lost / $user_win, 2);
 else
   if ($user_lost > 0)
     $casino_ratio_user = 999;
   else
     $casino_ratio_user = 0;
     
 if ($global_win > 0)
   $casino_ratio_global = number_format($global_lost / $global_win, 2);
 else
   if ($global_lost > 0)
     $casino_ratio_global = 999;
   else
     $casino_ratio_global = 0;
 
 //get users that bet the first time or win very less :-)
 if($user_win < $user_everytimewin_mb)
  $cheat_value = 0;
 else
 {
  //i think this is a god idea GLOBAL
  if($global_down > ($max_download_global / $cheat_breakpoint))
   $cheat_value = $cheat_value_max;
  if($casino_ratio_global < $cheat_ratio_global)
   $cheat_value = rand($cheat_value,$cheat_value_max);
 
  //i think this is a god idea for EACH USER
  if(($user_win - $user_lost) > ($max_download_user / $cheat_breakpoint))
   $cheat_value = $cheat_value_max;
  if($casino_ratio_user < $cheat_ratio_user)
   $cheat_value = rand($cheat_value,$cheat_value_max);
 }
 
if($global_down > $max_download_global)
 stderr("Sorry ".$CURUSER["username"],"but global max win is above ".mksize($max_download_global));


////////////////////////////////////////////////////////////////////////////////////////////////

if((($_POST["color"]=="red"||$_POST["color"]=="black")||($_POST["number"]=="1"||$_POST["number"]=="2"||$_POST["number"]=="3"||$_POST["number"]=="4"||$_POST["number"]=="5"||
$_POST["number"]=="6"))&&($_POST["betmb"]==$bet_value1||$_POST["betmb"]==$bet_value2||$_POST["betmb"]==$bet_value3||$_POST["betmb"]==$bet_value4||$_POST["betmb"]==$bet_value5||
$_POST["betmb"]==$bet_value6||$_POST["betmb"]==$bet_value7))  
{
if($_POST["number"])
{
 $win_amount = $win_amount_on_number;
 $cheat_value = $cheat_value+5;
 $winner_was = $_POST["number"];
}
else
 $winner_was = $_POST["color"];

$win = $win_amount*$betmb;

if($CURUSER["uploaded"] < $betmb)
 stderr("Sorry ".$CURUSER["username"],"but you have not uploaded ".mksize($betmb));

stdhead();
 

if(rand(0,$cheat_value)==$cheat_value)
{
 stdmsg("Yes ".$CURUSER["username"],"you got it and win ".mksize($win)." because ".$winner_was." is the winner");
 mysql_query("UPDATE users SET uploaded = uploaded + ".$win." WHERE id=".$CURUSER["id"]) or sqlerr();
 mysql_query("UPDATE casino SET date = '".get_date_time()."', trys = trys + 1, win = win + ".$win." WHERE userid=".$CURUSER["id"]) or sqlerr();
}
else
{
 if($_POST["number"])
 {
  do
  {
   $fake_winner = rand(1,6);
  }
  while($_POST["number"]==$fake_winner);
 }
 else
 {
  if($_POST["color"]=="black")
   $fake_winner= "red";
  else
   $fake_winner= "black";
 }
 
 
 stdmsg("Sorry ".$CURUSER["username"],"you lost ".mksize($betmb)." because ".$fake_winner." and not ".$winner_was." was the winner");
 mysql_query("UPDATE users SET uploaded = uploaded - ".$betmb." WHERE id=".$CURUSER["id"]) or sqlerr();
 mysql_query("UPDATE casino SET date = '".get_date_time()."', trys = trys + 1 ,lost = lost + ".$betmb." WHERE userid=".$CURUSER["id"]) or sqlerr();
}
 
}
else
{

stdhead();
print("<h1>Welcome, <a href=userdetails.php?id=$CURUSER[id]>$CURUSER[username]</a>!</h1>\n");

print("<table  cellspacing=0 cellpadding=3 width=400>\n");
print("<tr><td colspan=2 cellspacing=0 cellpadding=5>");
echo("<h1>game 1:</h1>");

print("<form name=casino method=post action=$phpself>");
 print("<table class=message width=100% cellspacing=0 cellpadding=5>\n");
  tr("bet on color:","<input type=submit value='Do it!' >",1);
  tr("black",'<input name="color" type="radio" checked value="black">',1);
  tr("red",'<input name="color" type="radio" value="red">',1);
  tr("how much",'
  <select name="betmb">
  <option value="'.$bet_value1.'">'.mksize($bet_value1).'</option>
<option value="'.$bet_value2.'">'.mksize($bet_value2).'</option>
<option value="'.$bet_value3.'">'.mksize($bet_value3).'</option>
<option value="'.$bet_value4.'">'.mksize($bet_value4).'</option>
<option value="'.$bet_value5.'">'.mksize($bet_value5).'</option>
<option value="'.$bet_value6.'">'.mksize($bet_value6).'</option>
<option value="'.$bet_value7.'">'.mksize($bet_value7).'</option>
  </select>',1);
 
 if($show_real_chance)
  $real_chance=$cheat_value+1;
 else
  $real_chance=2;
 tr("your chance","1 : ".$real_chance,1);
 tr("you can win",$win_amount." * stake",1);
 echo('</table><br>');
 print("</form>");

 echo("<h1>game 2:</h1>");
 print("<form name=casino2 method=post action=$phpself>");
 print("<table class=message width=100% cellspacing=0 cellpadding=5>\n");
  tr("bet on number:","<input type=submit value='Do it!' >",1);
  tr("number",'<input name="number" type="radio" checked value="1">1&nbsp;&nbsp;<input name="number" type="radio" value="2">2&nbsp;&nbsp;<input name="number" type="radio" value="3">3',1);
  tr("",'<input name="number" type="radio" value="4">4&nbsp;&nbsp;<input name="number" type="radio" value="5">5&nbsp;&nbsp;<input name="number" type="radio" value="6">6',1);
  tr("how much",'
  <select name="betmb">
  <option value="'.$bet_value1.'">'.mksize($bet_value1).'</option>
<option value="'.$bet_value2.'">'.mksize($bet_value2).'</option>
<option value="'.$bet_value3.'">'.mksize($bet_value3).'</option>
<option value="'.$bet_value4.'">'.mksize($bet_value4).'</option>
<option value="'.$bet_value5.'">'.mksize($bet_value5).'</option>
<option value="'.$bet_value6.'">'.mksize($bet_value6).'</option>
<option value="'.$bet_value7.'">'.mksize($bet_value7).'</option>
  </select>',1);
 
 if($show_real_chance)
  $real_chance=$cheat_value+5;
 else
  $real_chance=6;
 tr("your chance","1 : ".$real_chance,1);
 tr("you can win",$win_amount_on_number." * stake",1);
 echo('</table><br>');
 print("</form>");
print("</td></tr></table><br>");

print("<table  cellspacing=0 cellpadding=3>\n");
print("<tr><td>");
 print("<h1>user stats</h1>\n");
 print("<table class=message  cellspacing=0 cellpadding=5>\n");
  tr("you can win",mksize($max_download_user),1);
  tr("won",mksize($user_win),1);
  tr("lost",mksize($user_lost),1);
  tr("ratio",$casino_ratio_user,1);
 echo('</table>');
print("</td><td>");
 print("<h1>global stats</h1>\n");
 print("<table class=message  cellspacing=0 cellpadding=5>\n");
  tr("users can win",mksize($max_download_global),1);
  tr("won",mksize($global_win),1);
  tr("lost",mksize($global_lost),1);
  tr("ratio",$casino_ratio_global,1);
 echo('</table>');
print("</td></tr>");
echo('</table>');



}
stdfoot();
?>





edit: very fast answers here :-)

@knoten: i think about an "admin" site for the casino but at first i would see the response for the mod.

@Haselocke26 wie lädst du die tabelle in mysql rein ???? mit phpmyadmin müsste das funktionieren einfach deine bs datenbank anklicken SQL auswählen die tabellenstruktur eingeben und abschicken.



This post has been edited by macosbrain on Apr 30 2005, 07:15 AM


--------------------
macosbrain.com is my site
PMEmail Poster
Top
knoten
Posted: Apr 30 2005, 07:17 AM
Quote Post


Power User
***

Group: Power Users
Posts: 302
Member No.: 2,591
Joined: 25-January 05



Hmm okay man


Hab hasenlocke geholfen is schon okay smile.gif



Now back to english



bY S4NE
PMEmail PosterUsers Website
Top
macosbrain
Posted: Apr 30 2005, 07:28 AM
Quote Post


Power User
***

Group: Power Users
Posts: 45
Member No.: 3,966
Joined: 27-March 05



knoten what do you think should the admin part for the casino contain???


--------------------
macosbrain.com is my site
PMEmail Poster
Top
Ascii
Posted: Apr 30 2005, 07:28 AM
Quote Post


Power User
***

Group: Power Users
Posts: 59
Member No.: 4,145
Joined: 1-April 05



it should contain
who played and how much he/she lost won
PMEmail PosterUsers Website
Top
Traasje
Posted: Apr 30 2005, 07:31 AM
Quote Post


Power User
***

Group: Power Users
Posts: 139
Member No.: 1,392
Joined: 14-December 04



even whit the code on this page i don't win anything sad.gif nor lose smile.gif
and the admin must contain how much somebody haved played game 1 and game 2 the number of wins/loses and number gb lost/won...
:-)

ps: i think the admin page would be very emty at my page tongue.gif
PMEmail Poster
Top
macosbrain
Posted: Apr 30 2005, 07:45 AM
Quote Post


Power User
***

Group: Power Users
Posts: 45
Member No.: 3,966
Joined: 27-March 05



ok how much the user win and lost is no problem.
to count each game the sql table must be slightly different.


what do you think about edit users ????
eg. win, lost, trys, and disable the user.


--------------------
macosbrain.com is my site
PMEmail Poster
Top
knoten
Posted: Apr 30 2005, 07:50 AM
Quote Post


Power User
***

Group: Power Users
Posts: 302
Member No.: 2,591
Joined: 25-January 05



Nice idea man and now u must do this sh*t smile.gif



I´m to newbie i´m sorry




bY S4NE

This post has been edited by knoten on Apr 30 2005, 07:52 AM
PMEmail PosterUsers Website
Top
macosbrain
Posted: Apr 30 2005, 07:58 AM
Quote Post


Power User
***

Group: Power Users
Posts: 45
Member No.: 3,966
Joined: 27-March 05



ok i do this sh*t, how knoten it calls.
for me it is just fun :-) but now it is weekend (and nice weather here in germany) and so all have 2 wait a bit for MY sollution of the casino_admin.


--------------------
macosbrain.com is my site
PMEmail Poster
Top
Traasje
Posted: Apr 30 2005, 08:01 AM
Quote Post


Power User
***

Group: Power Users
Posts: 139
Member No.: 1,392
Joined: 14-December 04



very good script, i can't wait to see the results smile.gif
PMEmail Poster
Top
knoten
Posted: Apr 30 2005, 08:02 AM
Quote Post


Power User
***

Group: Power Users
Posts: 302
Member No.: 2,591
Joined: 25-January 05



me2 m8 thanks anyway und viel Spass draussen smile.gif



bY S4NE
PMEmail PosterUsers Website
Top
nejx
Posted: Apr 30 2005, 08:25 AM
Quote Post


Power User
***

Group: Power Users
Posts: 252
Member No.: 2,942
Joined: 10-February 05



WHERE'S MY SCREENSHOT!!!??? nobody don't have it?


--------------------
----------------------------------------------------------------------------
PMEmail Poster
Top
Masters
Posted: Apr 30 2005, 08:30 AM
Quote Post


Power User
***

Group: Power Users
Posts: 60
Member No.: 2,627
Joined: 27-January 05



Thx for this Games work fine
user posted image

This post has been edited by Masters on Apr 30 2005, 08:34 AM
PMEmail Poster
Top
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

Topic OptionsPages: (7) 1 [2] 3 4 ... Last » Reply to this topicStart new topicStart Poll

 



[ Script Execution time: 0.0635 ]   [ 12 queries used ]   [ GZIP Enabled ]