Location: PHPKode > projects > Bingo Call System > bingo_bin_win_mac_v090/bingo.php
<?php
/*
flash server send these four var
	$var_row
	$var_col
	$var_typ
	$passwd

 
*/



include 'mysql.php';
include 'slideshow.php';


$var_row = $row;
$var_col = $col;
$var_typ = $typ;

$mode = $_GET['mode'];
$passwd = $_GET['passwd'];

$var_row = $_GET['row'];
$var_col = $_GET['col'];
$var_typ = $_GET['typ'];
$function = $_GET['function'];
$now = $_GET['now'];
$last = $_GET['last'];


//echo $mode . "<br>";
//print_r($var_B);
function mode_server($var_row, $var_col, $var_typ, $passwd, $function, $now, $last)
  {
  strtolower($var_row);
  if ($var_row == "R"){
     	  $sql = "UPDATE `function`  
	  SET `function` = '".$function."', `now` = '".$now."', `last` = '".$last."' 
	  WHERE passwd = '" . strtolower($passwd) . "';";
  runsql($sql);

  echo "&err=Row = R<br>";
  	if ($var_col == "B") {
  	  $sql = "UPDATE `b` SET `16` = '0', `17` = '0', `18` = '0', `19` = '0', `20` = '0' WHERE passwd = '" . strtolower($passwd) . "';";
  runsql($sql);
  	  $sql = "UPDATE `i` SET `16` = '0', `17` = '0', `18` = '0', `19` = '0', `20` = '0' WHERE passwd = '" . strtolower($passwd) . "';";
  runsql($sql);
  	  $sql = "UPDATE `n` SET `16` = '0', `17` = '0', `18` = '0', `19` = '0', `20` = '0' WHERE passwd = '" . strtolower($passwd) . "';";
  runsql($sql);
  	  $sql = "UPDATE `g` SET `16` = '0', `17` = '0', `18` = '0', `19` = '0', `20` = '0' WHERE passwd = '" . strtolower($passwd) . "';";
  runsql($sql);
  	  $sql = "UPDATE `o` SET `16` = '0', `17` = '0', `18` = '0', `19` = '0', `20` = '0' WHERE passwd = '" . strtolower($passwd) . "';";
  runsql($sql);
  
	  echo "&err=play bingo reset";	  

	}
	if ($var_col == "M") {
	  
  	  $sql = "UPDATE `b` SET `1` = '0', `2` = '0', `3` = '0', `4` = '0', `5` = '0', `6` = '0', `7` = '0', `8` = '0', `9` = '0', `10` = '0', `11` = '0', `12` = '0', `13` = '0', `14` = '0', `15` = '0' WHERE passwd = '" . strtolower($passwd) . "';";
  runsql($sql);
  	  $sql = "UPDATE `i` SET `1` = '0', `2` = '0', `3` = '0', `4` = '0', `5` = '0', `6` = '0', `7` = '0', `8` = '0', `9` = '0', `10` = '0', `11` = '0', `12` = '0', `13` = '0', `14` = '0', `15` = '0' WHERE passwd = '" . strtolower($passwd) . "';";
  runsql($sql);
  	  $sql = "UPDATE `n` SET `1` = '0', `2` = '0', `3` = '0', `4` = '0', `5` = '0', `6` = '0', `7` = '0', `8` = '0', `9` = '0', `10` = '0', `11` = '0', `12` = '0', `13` = '0', `14` = '0', `15` = '0' WHERE passwd = '" . strtolower($passwd) . "';";
  runsql($sql);
  	  $sql = "UPDATE `g` SET `1` = '0', `2` = '0', `3` = '0', `4` = '0', `5` = '0', `6` = '0', `7` = '0', `8` = '0', `9` = '0', `10` = '0', `11` = '0', `12` = '0', `13` = '0', `14` = '0', `15` = '0' WHERE passwd = '" . strtolower($passwd) . "';";
  runsql($sql);
  	  $sql = "UPDATE `o` SET `1` = '0', `2` = '0', `3` = '0', `4` = '0', `5` = '0', `6` = '0', `7` = '0', `8` = '0', `9` = '0', `10` = '0', `11` = '0', `12` = '0', `13` = '0', `14` = '0', `15` = '0' WHERE passwd = '" . strtolower($passwd) . "';";
  runsql($sql);
	  echo "&err=main bingo reset";	  
  
  
	 // echo "$err=main bingo reset";
	}
  die();
  }

  echo "&err=some stuff  ".$var_row.$var_col." ".$var_typ;
$sql= "UPDATE `" . strtolower($var_row) . "` SET `" . strtolower($var_col) . "` = '" . strtolower($var_typ) . "' WHERE passwd = '" . strtolower($passwd) . "';";
// echo $sql . "<br>";
  runsql($sql);
  
 
   	  $sql = "UPDATE `function`  
	  SET `function` = '".$function."', `now` = '".$now."', `last` = '".$last."' 
	  WHERE passwd = '" . strtolower($passwd) . "';";
  runsql($sql);

 
  
  die();
  }
function mode_client($passwd)
  {
  $sql = "SELECT * FROM b WHERE passwd = '" . strtolower($passwd) . "';";
  $var_call = "b";
$result = runsql($sql);
//echo $result;
while($row2 = mysql_fetch_array($result))
 {
 echo "&var_".$var_call."1=" . $row2['1'].
 	  "&var_".$var_call."2=" . $row2['2'].
	  "&var_".$var_call."3=" . $row2['3'].
	  "&var_".$var_call."4=" . $row2['4'].
	  "&var_".$var_call."5=" . $row2['5'].
	  "&var_".$var_call."6=" . $row2['6'].
	  "&var_".$var_call."7=" . $row2['7'].
	  "&var_".$var_call."8=" . $row2['8'].
	  "&var_".$var_call."9=" . $row2['9'].
	  "&var_".$var_call."10=" . $row2['10'].
	  "&var_".$var_call."11=" . $row2['11'].
	  "&var_".$var_call."12=" . $row2['12'].
	  "&var_".$var_call."13=" . $row2['13'].
	  "&var_".$var_call."14=" . $row2['14'].
	  "&var_".$var_call."15=" . $row2['15'].
	  "&var_".$var_call."16=" . $row2['16'].
	  "&var_".$var_call."17=" . $row2['17'].
	  "&var_".$var_call."18=" . $row2['18'].
	  "&var_".$var_call."19=" . $row2['19'].
	  "&var_".$var_call."20=" . $row2['20'];
 }
  $sql = "SELECT * FROM i WHERE passwd = '" . strtolower($passwd) . "';";
  $var_call = "i";
$result = runsql($sql);
while($row2 = mysql_fetch_array($result))
 {
 echo "&var_".$var_call."1=" . $row2['1'].
 	  "&var_".$var_call."2=" . $row2['2'].
	  "&var_".$var_call."3=" . $row2['3'].
	  "&var_".$var_call."4=" . $row2['4'].
	  "&var_".$var_call."5=" . $row2['5'].
	  "&var_".$var_call."6=" . $row2['6'].
	  "&var_".$var_call."7=" . $row2['7'].
	  "&var_".$var_call."8=" . $row2['8'].
	  "&var_".$var_call."9=" . $row2['9'].
	  "&var_".$var_call."10=" . $row2['10'].
	  "&var_".$var_call."11=" . $row2['11'].
	  "&var_".$var_call."12=" . $row2['12'].
	  "&var_".$var_call."13=" . $row2['13'].
	  "&var_".$var_call."14=" . $row2['14'].
	  "&var_".$var_call."15=" . $row2['15'].
	  "&var_".$var_call."16=" . $row2['16'].
	  "&var_".$var_call."17=" . $row2['17'].
	  "&var_".$var_call."18=" . $row2['18'].
	  "&var_".$var_call."19=" . $row2['19'].
	  "&var_".$var_call."20=" . $row2['20'];
	  
 }
  $sql = "SELECT * FROM n WHERE passwd = '" . strtolower($passwd) . "';";
  $var_call = "n";
$result = runsql($sql);
while($row2 = mysql_fetch_array($result))
 {
 echo "&var_".$var_call."1=" . $row2['1'].
 	  "&var_".$var_call."2=" . $row2['2'].
	  "&var_".$var_call."3=" . $row2['3'].
	  "&var_".$var_call."4=" . $row2['4'].
	  "&var_".$var_call."5=" . $row2['5'].
	  "&var_".$var_call."6=" . $row2['6'].
	  "&var_".$var_call."7=" . $row2['7'].
	  "&var_".$var_call."8=" . $row2['8'].
	  "&var_".$var_call."9=" . $row2['9'].
	  "&var_".$var_call."10=" . $row2['10'].
	  "&var_".$var_call."11=" . $row2['11'].
	  "&var_".$var_call."12=" . $row2['12'].
	  "&var_".$var_call."13=" . $row2['13'].
	  "&var_".$var_call."14=" . $row2['14'].
	  "&var_".$var_call."15=" . $row2['15'].
	  "&var_".$var_call."16=" . $row2['16'].
	  "&var_".$var_call."17=" . $row2['17'].
	  "&var_".$var_call."18=" . $row2['18'].
	  "&var_".$var_call."19=" . $row2['19'].
	  "&var_".$var_call."20=" . $row2['20'];
	  
 }
  $sql = "SELECT * FROM g WHERE passwd = '" . strtolower($passwd) . "';";
  $var_call = "g";
$result = runsql($sql);
while($row2 = mysql_fetch_array($result))
 {
 echo "&var_".$var_call."1=" . $row2['1'].
 	  "&var_".$var_call."2=" . $row2['2'].
	  "&var_".$var_call."3=" . $row2['3'].
	  "&var_".$var_call."4=" . $row2['4'].
	  "&var_".$var_call."5=" . $row2['5'].
	  "&var_".$var_call."6=" . $row2['6'].
	  "&var_".$var_call."7=" . $row2['7'].
	  "&var_".$var_call."8=" . $row2['8'].
	  "&var_".$var_call."9=" . $row2['9'].
	  "&var_".$var_call."10=" . $row2['10'].
	  "&var_".$var_call."11=" . $row2['11'].
	  "&var_".$var_call."12=" . $row2['12'].
	  "&var_".$var_call."13=" . $row2['13'].
	  "&var_".$var_call."14=" . $row2['14'].
	  "&var_".$var_call."15=" . $row2['15'].
	  "&var_".$var_call."16=" . $row2['16'].
	  "&var_".$var_call."17=" . $row2['17'].
	  "&var_".$var_call."18=" . $row2['18'].
	  "&var_".$var_call."19=" . $row2['19'].
	  "&var_".$var_call."20=" . $row2['20'];
	  
 }
  $sql = "SELECT * FROM o WHERE passwd = '" . strtolower($passwd) . "';";
  $var_call = "o";
$result = runsql($sql);
while($row2 = mysql_fetch_array($result))
 {
 echo "&var_".$var_call."1=" . $row2['1'].
 	  "&var_".$var_call."2=" . $row2['2'].
	  "&var_".$var_call."3=" . $row2['3'].
	  "&var_".$var_call."4=" . $row2['4'].
	  "&var_".$var_call."5=" . $row2['5'].
	  "&var_".$var_call."6=" . $row2['6'].
	  "&var_".$var_call."7=" . $row2['7'].
	  "&var_".$var_call."8=" . $row2['8'].
	  "&var_".$var_call."9=" . $row2['9'].
	  "&var_".$var_call."10=" . $row2['10'].
	  "&var_".$var_call."11=" . $row2['11'].
	  "&var_".$var_call."12=" . $row2['12'].
	  "&var_".$var_call."13=" . $row2['13'].
	  "&var_".$var_call."14=" . $row2['14'].
	  "&var_".$var_call."15=" . $row2['15'].
	  "&var_".$var_call."16=" . $row2['16'].
	  "&var_".$var_call."17=" . $row2['17'].
	  "&var_".$var_call."18=" . $row2['18'].
	  "&var_".$var_call."19=" . $row2['19'].
	  "&var_".$var_call."20=" . $row2['20'];
	  
 }
    $sql = "SELECT * FROM function WHERE passwd = '" . strtolower($passwd) . "';";
$result = runsql($sql);
while($row2 = mysql_fetch_array($result))
 {
 echo "&var_function=" . $row2['function'];
  echo "&now=" . $row2['now'];
   echo "&lastcalled=" . $row2['last'];
}

 //echo "&err=Err test";
  die();
}
//http://127.0.0.1/bingo/bingo.php?mode=server&passwd=RHPB&col=5&row=G&typ=1&now=G50&last= &function=board_full


switch ($mode) {
case "server":
	mode_server($var_row, $var_col, $var_typ, $passwd, $function, $now, $last);
    break;
case "client":
	mode_client($passwd);	
    break;
case "slide_show":
	mode_slideshow($passwd);
    break;
}




/*	if($mode=="server"){
	mode_server($var_row, $var_col, $var_typ, $passwd, $function, $now, $last);
	}
	if($mode=="client"){
	mode_client($passwd);	
	}
	if($mode=="slideshow")
	{
	mode_slideshow($passwd);
}*/
die("&err=  Go Away");

?>
Return current item: Bingo Call System